feat: Implement core player entity with multiplayer state synchronization, character selection, movement, and manager-based input.

This commit is contained in:
Yogi Wiguna
2026-02-26 16:55:36 +08:00
parent 3a902aa3d7
commit 8e0aa322de
3 changed files with 41 additions and 22 deletions
+11 -6
View File
@@ -13,6 +13,7 @@ var powerup_manager
var score: int = 0
signal position_changed
signal tekton_carried_changed(is_carrying)
# Display name (synced across network)
var _display_name: String = ""
@@ -46,6 +47,7 @@ var is_carrying_tekton: bool:
get: return is_carried_tekton
set(value):
is_carried_tekton = value
emit_signal("tekton_carried_changed", value)
# Visual/Logic side effects if any
var is_carried_tekton: bool = false
@@ -2126,20 +2128,19 @@ func update_active_player_indicator():
sync_modulate(color) # Apply locally if offline/not ready
func knock_tekton():
# ... legacy or helper function ...
pass
if not is_multiplayer_authority() or is_frozen or is_stop_frozen:
return
# Requirement: Full Powerup Bar
if not powerup_manager or not powerup_manager.can_use_special():
# Requirement: Full Powerup Bar (or we are already in knock mode)
if not is_knock_mode and (not powerup_manager or not powerup_manager.can_use_special()):
NotificationManager.send_message(self , "Need Full Boost to Knock!", NotificationManager.MessageType.WARNING)
return
var tekton = _find_nearby_tekton()
if tekton:
# Consume Boost
powerup_manager.consume_boost(100.0)
# Consume Boost if we haven't already (or just consume it now if we are in mode)
if powerup_manager:
powerup_manager.consume_boost(100.0)
if is_multiplayer_authority():
rpc("sync_knock_tekton", tekton.get_path())
@@ -2148,6 +2149,10 @@ func knock_tekton():
is_knock_mode = false
NotificationManager.send_message(self, "Knock Successful!", NotificationManager.MessageType.POWERUP)
update_active_player_indicator()
else:
# If we called knock_tekton but nothing was nearby, maybe we just enter the mode?
# But usually this is called by movement_manager which knows something is there.
pass
@rpc("any_peer", "call_local", "reliable")
func sync_knock_tekton(tekton_path: NodePath):