feat: implement player character with state management, network synchronization, and manager integration.
This commit is contained in:
+15
-4
@@ -145,11 +145,15 @@ func _flash_damage():
|
||||
t.tween_property(mesh, "scale", base_scale * 1.2, 0.1)
|
||||
t.tween_property(mesh, "scale", base_scale, 0.1)
|
||||
|
||||
var is_recovering: bool = false # True when shrunk/waiting
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func on_thrown_landing(attacker: Node = null):
|
||||
"""Called when Tekton lands after being thrown."""
|
||||
print("[Tekton] Landed! Shrinking and waiting...")
|
||||
|
||||
is_recovering = true
|
||||
|
||||
# Disable movement/interaction logic temporarily
|
||||
var controller = get_node_or_null("TektonController")
|
||||
if controller and controller.get("timer"):
|
||||
@@ -170,8 +174,8 @@ func on_thrown_landing(attacker: Node = null):
|
||||
var t = create_tween()
|
||||
t.tween_property(mesh, "scale", base_scale * 0.5, 0.2).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||
|
||||
# Wait 1 seconds
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
# Wait 3 seconds
|
||||
await get_tree().create_timer(3.0).timeout
|
||||
|
||||
# Grow back
|
||||
for i in range(mesh_cache.size()):
|
||||
@@ -181,6 +185,8 @@ func on_thrown_landing(attacker: Node = null):
|
||||
var t = create_tween()
|
||||
t.tween_property(mesh, "scale", base_scale, 0.2).set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_BACK)
|
||||
|
||||
is_recovering = false
|
||||
|
||||
# Resume AI
|
||||
if controller and controller.has_method("_start_timer"):
|
||||
if is_multiplayer_authority() and not is_carried:
|
||||
@@ -191,9 +197,14 @@ func on_thrown_landing(attacker: Node = null):
|
||||
spawn_tiles_around(8) # Standard amount
|
||||
|
||||
# Floor Freeze (Visual/Instant - Run on all clients locally)
|
||||
_temporarily_change_floor(current_position, 1, 6, 3.0)
|
||||
temporarily_change_floor(current_position, 1, 6, 3.0)
|
||||
|
||||
# Stun nearby players handled by Thrower (Player.gd) or here?
|
||||
# Player.gd handles the stun call because it knows the impact zone context better?
|
||||
# Actually, Player.gd calls this function. Player.gd *also* iterates players to stun them.
|
||||
# That is fine.
|
||||
|
||||
func _temporarily_change_floor(center: Vector2i, radius: int, new_id: int, duration: float):
|
||||
func temporarily_change_floor(center: Vector2i, radius: int, new_id: int, duration: float):
|
||||
if not enhanced_gridmap: return
|
||||
|
||||
# Run locally on all clients to ensure instant feedback without network delay
|
||||
|
||||
Reference in New Issue
Block a user