feat: Implement core player character logic and input handling, including movement, actions, and manager integration.
This commit is contained in:
@@ -828,6 +828,34 @@ func attempt_target_action(target_index: int):
|
||||
st_manager.activate_effect(effect, target_player)
|
||||
inventory_ui.deselect()
|
||||
|
||||
func activate_powerup(effect_id: int):
|
||||
var main = get_tree().get_root().get_node_or_null("Main")
|
||||
if not main or not main.ui_manager:
|
||||
return
|
||||
|
||||
# Try to find the UI button directly if possible, or simulate the click
|
||||
# The goal is to Select it (if it requires targeting) OR Activate it (if instant)
|
||||
|
||||
# Since PowerUpInventoryUI manages selection state, we should route through it if possible
|
||||
# or directly tell SpecialTilesManager to prepare?
|
||||
|
||||
# Let's try to mimic the button press
|
||||
var inventory_ui = main.ui_manager.get_node_or_null("PowerUpInventoryUI") # Or wherever it lives
|
||||
if not inventory_ui:
|
||||
# Fallback: Find it in scene
|
||||
inventory_ui = main.get_node_or_null("PowerUpInventoryUI")
|
||||
|
||||
if inventory_ui:
|
||||
# Inventory UI handles: "activate_effect(effect_id)" on click
|
||||
# Which then calls SpecialTilesManager.activate_effect
|
||||
# This handles both "Instant" effects (Speed) and "Targeting" effects (Wall)
|
||||
inventory_ui._on_btn_pressed(effect_id)
|
||||
else:
|
||||
# Fallback if UI not found
|
||||
var st_manager = get_node_or_null("SpecialTilesManager")
|
||||
if st_manager:
|
||||
st_manager.activate_effect(effect_id)
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if is_multiplayer_authority():
|
||||
|
||||
Reference in New Issue
Block a user