feat: Implement core game systems including settings management, player input, and initial gameplay mechanics with associated UI.
This commit is contained in:
@@ -82,7 +82,7 @@ func _process(delta):
|
||||
player.highlight_cells_if_authorized(area, highlight_id)
|
||||
|
||||
func handle_unhandled_input(event):
|
||||
# Early return if not authorized human playersa
|
||||
# Early return if not authorized human player
|
||||
if not player.is_multiplayer_authority() or player.is_bot or player.is_in_group("Bots"):
|
||||
player.set_process_unhandled_input(false)
|
||||
return
|
||||
@@ -97,66 +97,37 @@ func handle_unhandled_input(event):
|
||||
|
||||
# --- Keyboard Shortcuts (Event-based) ---
|
||||
if event is InputEventKey and event.pressed and not event.echo:
|
||||
var mode = LobbyManager.get_game_mode()
|
||||
var is_sng = mode == GameMode.Mode.STOP_N_GO
|
||||
|
||||
# Safety check for SettingsManager
|
||||
if not SettingsManager:
|
||||
return
|
||||
|
||||
# Get dynamic keybinds
|
||||
var key_p1 = SettingsManager.get_control_keycode("powerup_1")
|
||||
var key_p2 = SettingsManager.get_control_keycode("powerup_2")
|
||||
var key_p3 = SettingsManager.get_control_keycode("powerup_3")
|
||||
var key_p4 = SettingsManager.get_control_keycode("powerup_4")
|
||||
|
||||
var ek = event.keycode
|
||||
|
||||
# Unified check for PowerUp keys
|
||||
if ek == key_p1:
|
||||
# Single Slot Logic: Find whatever powerup is currently set to 'true' and activate it
|
||||
var active_effect = -1
|
||||
if player.special_tiles_manager:
|
||||
for effect_key in player.special_tiles_manager.inventory:
|
||||
if player.special_tiles_manager.inventory[effect_key]:
|
||||
active_effect = effect_key
|
||||
break
|
||||
|
||||
if active_effect != -1:
|
||||
player.activate_powerup(active_effect)
|
||||
else:
|
||||
print("No powerup in slot 1 to activate.")
|
||||
|
||||
# KP Fallback
|
||||
elif ek == KEY_KP_1:
|
||||
var active_effect = -1
|
||||
if player.special_tiles_manager:
|
||||
for effect_key in player.special_tiles_manager.inventory:
|
||||
if player.special_tiles_manager.inventory[effect_key]:
|
||||
active_effect = effect_key
|
||||
break
|
||||
if active_effect != -1:
|
||||
player.activate_powerup(active_effect)
|
||||
|
||||
# Action Buttons (Remappable)
|
||||
elif ek == SettingsManager.get_control_keycode("attack_mode"):
|
||||
# 1. Unified check for POWER-UP Activation
|
||||
if event.is_action_pressed("use_powerup"):
|
||||
player.activate_held_powerup()
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
|
||||
|
||||
# 3. Action Buttons (Remappable via InputMap)
|
||||
if event.is_action_pressed("action_knock_tekton"):
|
||||
if player.powerup_manager:
|
||||
player.powerup_manager.use_special_effect()
|
||||
if player.is_attack_mode and player.has_method("enter_attack_mode"):
|
||||
player.enter_attack_mode()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
elif ek == SettingsManager.get_control_keycode("spawn_boost"):
|
||||
elif event.is_action_pressed("spawn_boost"):
|
||||
if player.is_carrying_tekton and player.powerup_manager:
|
||||
if player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
player.powerup_manager.spawn_boost_reward()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
elif ek == SettingsManager.get_control_keycode("tekton_grab"):
|
||||
elif event.is_action_pressed("action_grab_tekton"):
|
||||
if not player.is_carrying_tekton and player.powerup_manager:
|
||||
if player.powerup_manager.can_use_special():
|
||||
if player.powerup_manager.has_method("can_use_special"): # Corrected method name
|
||||
player.grab_tekton()
|
||||
|
||||
# Handle spawn point selection if not yet selected
|
||||
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
# Handle spawn point selection if not yet selected
|
||||
if not player.spawn_point_selected and player.highlighted_spawn_points.size() > 0:
|
||||
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
|
||||
Reference in New Issue
Block a user