M7 B2
Bug fixes and other fixes. Migration to Godot 4.3 (RC3)
This commit is contained in:
parent
6b6b539e81
commit
f3350a462a
50 changed files with 578 additions and 478 deletions
|
@ -17,7 +17,7 @@ func _ready():
|
|||
|
||||
func join_game():
|
||||
var peer = ENetMultiplayerPeer.new()
|
||||
peer.create_client(Game.ip, Game.port)
|
||||
peer.create_client(Game.settings["ip"], Game.settings["port"])
|
||||
multiplayer.multiplayer_peer = peer
|
||||
|
||||
func is_valid(sender_id, must_be_from_owner):
|
||||
|
@ -50,10 +50,10 @@ func _on_player_disconnected(id):
|
|||
Game.players = 0
|
||||
else:
|
||||
Game.players -= 1
|
||||
print("found")
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
current_character.free()
|
||||
print("freed")
|
||||
if current_character.captured_by != null:
|
||||
current_character.captured_by.lost_one()
|
||||
x += 1
|
||||
Game.player_list.erase(id)
|
||||
|
||||
|
@ -98,4 +98,3 @@ func sync_computers(node_name, current):
|
|||
func sync_beast(player):
|
||||
if is_valid(multiplayer.get_remote_sender_id(), true):
|
||||
Game.sync_beast(player)
|
||||
|
||||
|
|
|
@ -55,4 +55,3 @@ func _on_connected_ok():
|
|||
$player_customization/join.disabled = true
|
||||
$player_customization/name.editable = false
|
||||
$player_customization/ip.editable = false
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
extends Node
|
||||
|
||||
var settings = {"save_version" = 2, "fps_counter" = 1, "port" = 35000, "ip" = "127.0.0.1"}
|
||||
var settings = {"save_version" = 3, "fps_counter" = 1, "port" = 35000, "ip" = "127.0.0.1"}
|
||||
var computers = 0
|
||||
var players = 0
|
||||
var map_name = "mansion"
|
||||
|
@ -21,8 +21,6 @@ var player_escaped = false
|
|||
var is_beast = false
|
||||
var character = preload("res://objects/player.tscn")
|
||||
# Server Variables
|
||||
var port = 35000
|
||||
var ip = "127.0.0.1"
|
||||
var player_name
|
||||
var room_name
|
||||
var is_server = false
|
||||
|
|
|
@ -15,4 +15,3 @@ func _on_button_pressed():
|
|||
Game.reset()
|
||||
get_tree().change_scene_to_file("res://menus/main_menu.tscn")
|
||||
queue_free()
|
||||
|
||||
|
|
|
@ -29,7 +29,11 @@ func create_game():
|
|||
multiplayer.multiplayer_peer = peer
|
||||
|
||||
func _on_player_disconnected(id):
|
||||
if multiplayer.is_server():
|
||||
while multiplayer.is_server():
|
||||
for i in range(5000):
|
||||
if id in multiplayer.get_peers():
|
||||
break
|
||||
await get_tree().create_timer(0.001).timeout
|
||||
var room_name = player_associations[id]
|
||||
var player_list = create_player_list(room_name)
|
||||
if game_rooms.has(room_name) and game_rooms[room_name] == id:
|
||||
|
@ -41,6 +45,7 @@ func _on_player_disconnected(id):
|
|||
Client.rpc_id(p,"_on_player_disconnected",id)
|
||||
player_associations.erase(id)
|
||||
name_associations.erase(id)
|
||||
break
|
||||
|
||||
func _on_player_connected(id):
|
||||
if multiplayer.is_server():
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
|
||||
var jump_velocity = 12
|
||||
var jump_velocity = 4.5
|
||||
var speed = 7
|
||||
var zoom = 0
|
||||
var player_no
|
||||
|
@ -47,6 +47,12 @@ func _ready():
|
|||
func _physics_process(delta):
|
||||
if enabled:
|
||||
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor() and $jump_timeout.is_stopped():
|
||||
if beast:
|
||||
speed -= 5
|
||||
$jump_timeout.start()
|
||||
velocity.y = jump_velocity
|
||||
|
||||
if not is_on_floor():
|
||||
velocity.y -= gravity * delta
|
||||
|
||||
|
@ -62,11 +68,11 @@ func _physics_process(delta):
|
|||
$cam_y.position.y = 0.5
|
||||
position.y += 1
|
||||
|
||||
if Input.is_action_pressed("click") and $hammer.rotation_degrees.x > -90:
|
||||
if Input.is_action_pressed("click") and $hammer.rotation_degrees.x > 0:
|
||||
$hammer.rotation_degrees.x -= 5
|
||||
for id in Game.player_list:
|
||||
Client.rpc_id(id,"sync_hammer",name, $hammer.rotation)
|
||||
elif $hammer.rotation_degrees.x < 0 and !Input.is_action_pressed("click"):
|
||||
elif $hammer.rotation_degrees.x < 90 and !Input.is_action_pressed("click"):
|
||||
$hammer.rotation_degrees.x += 5
|
||||
for id in Game.player_list:
|
||||
Client.rpc_id(id,"sync_hammer",name, $hammer.rotation)
|
||||
|
@ -79,16 +85,7 @@ func _physics_process(delta):
|
|||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, speed)
|
||||
velocity.z = move_toward(velocity.z, 0, speed)
|
||||
|
||||
if Input.is_action_just_pressed("jump") and is_on_floor() and $jump_timeout.is_stopped():
|
||||
if beast:
|
||||
speed -= 5
|
||||
$jump_timeout.start()
|
||||
if velocity.x == 0 or velocity.y == 0:
|
||||
velocity.y = jump_velocity
|
||||
else:
|
||||
velocity.y = jump_velocity/2
|
||||
|
||||
|
||||
move_and_slide()
|
||||
|
||||
if !npc:
|
||||
|
@ -132,9 +129,9 @@ func beast_init():
|
|||
beast = true
|
||||
speed += 2
|
||||
position.y += 10
|
||||
$hammer/hammer2/CSGBox3D/detect_hit.monitoring = true
|
||||
$hammer/hammer2/CSGBox3D/detect_hit.monitorable = true
|
||||
$hammer/hammer2/CSGBox3D/detect_hit/CollisionShape3D.disabled = false
|
||||
$hammer/CSGBox3D/detect_hit.monitoring = true
|
||||
$hammer/CSGBox3D/detect_hit.monitorable = true
|
||||
$hammer/CSGBox3D/detect_hit/CollisionShape3D.disabled = false
|
||||
$hammer.show()
|
||||
$bag.show()
|
||||
|
||||
|
@ -183,6 +180,7 @@ func _on_time_in_bag_timeout():
|
|||
enabled = true
|
||||
caught = false
|
||||
captured_by.lost_one()
|
||||
captured_by = null
|
||||
position = position_pre
|
||||
$in_bag.visible = false
|
||||
|
||||
|
|
7
scripts/settings_text.gd
Normal file
7
scripts/settings_text.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends TextEdit
|
||||
|
||||
func _ready():
|
||||
text = Game.settings[get_parent().name]
|
||||
|
||||
func _on_text_changed():
|
||||
Game.save_setting(get_parent().name, text)
|
Loading…
Add table
Add a link
Reference in a new issue