feat: Create player input and powerup managers to handle player interactions, movement, actions, targeting, and boost meter mechanics.
This commit is contained in:
@@ -125,8 +125,9 @@ func handle_unhandled_input(event):
|
||||
if player.powerup_manager.has_method("spawn_boost_reward"):
|
||||
player.powerup_manager.spawn_boost_reward()
|
||||
KEY_G:
|
||||
if not player.is_carrying_tekton:
|
||||
player.grab_tekton()
|
||||
if not player.is_carrying_tekton and player.powerup_manager:
|
||||
if player.powerup_manager.can_use_special():
|
||||
player.grab_tekton()
|
||||
|
||||
# Handle spawn point selection if not yet selected
|
||||
|
||||
|
||||
@@ -156,6 +156,11 @@ func use_special_effect() -> bool:
|
||||
if not can_use_special():
|
||||
return false
|
||||
|
||||
# Restriction: Cannot use attack mode while carrying a Tekton
|
||||
if player.is_carrying_tekton:
|
||||
NotificationManager.send_message(player, "Cannot enter Attack Mode while carrying a Tekton!", NotificationManager.MessageType.WARNING)
|
||||
return false
|
||||
|
||||
# Enable Attack Mode explicitly
|
||||
player.is_attack_mode = true
|
||||
# Do NOT consume boost here. Boost acts as "fuel" for the attacks.
|
||||
@@ -183,14 +188,15 @@ func spawn_boost_reward() -> bool:
|
||||
return false
|
||||
|
||||
if player.special_tiles_manager and player.special_tiles_manager.has_method("spawn_powerups_around"):
|
||||
# Spawn only common tiles (7-10) with 100% density
|
||||
player.special_tiles_manager.spawn_powerups_around(player.current_position, true, true, true)
|
||||
# Spawn tiles (Stop N Go gets only common, Free Mode gets 60/40 ratio)
|
||||
player.special_tiles_manager.spawn_powerups_around(player.current_position, true, false, true)
|
||||
|
||||
# Drop the Tekton after spawning
|
||||
if player.has_method("drop_tekton"):
|
||||
player.drop_tekton()
|
||||
|
||||
print("[PowerUp] %s used Tekton to SPAWN TILES (100%% Density Common)." % player.name)
|
||||
reset_boost()
|
||||
print("[PowerUp] %s used Tekton to SPAWN TILES and consumed Boost." % player.name)
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
@@ -441,14 +441,14 @@ func spawn_powerups_around(center: Vector2i, force_powerups: bool = true, only_c
|
||||
var mode = LobbyManager.get_game_mode()
|
||||
|
||||
if only_common or LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO):
|
||||
# Spawn ONLY goals (7-10) for Stop n Go or if forced
|
||||
# Spawn ONLY common tiles (7-10) for Stop n Go or if forced
|
||||
item_id = rng.randi_range(7, 10)
|
||||
else:
|
||||
# Free mode: 60% Chance for Normal Tile (7-10), 40% for PowerUp
|
||||
# Free mode: 60% Chance for Common Tile (7-10), 40% for PowerUp
|
||||
if rng.randf() < 0.6:
|
||||
item_id = rng.randi_range(7, 10)
|
||||
else:
|
||||
# 30% Chance for PowerUp (Speed 11, Freeze 12, Ghost 14 - Exclude Wall 13 in restricted modes)
|
||||
# 40% Chance for PowerUp
|
||||
var is_restricted = GameMode.is_restricted(mode)
|
||||
if is_restricted:
|
||||
item_id = [11, 14].pick_random()
|
||||
|
||||
@@ -524,13 +524,17 @@ func _on_boost_points_changed(current_points: int, max_points: int):
|
||||
# User Request: Disable Special & SpawnBoost if < 100%
|
||||
var is_full = current_points >= (max_points - 1) # Tolerance
|
||||
|
||||
_update_boost_button_state(attack_mode_button, is_full)
|
||||
# Attack Mode (⚡) is only enabled if full AND not carrying a Tekton
|
||||
var can_attack = is_full and not (local_player and local_player.is_carrying_tekton)
|
||||
_update_boost_button_state(attack_mode_button, can_attack)
|
||||
|
||||
# SpawnBoost depends on carrying a Tekton, not boost points
|
||||
var can_spawn = local_player and local_player.is_carrying_tekton
|
||||
_update_boost_button_state(spawn_boost_button, can_spawn)
|
||||
|
||||
_update_boost_button_state(tekton_grab_button, true) # Always enabled (logic handles grab-ability)
|
||||
# Tekton Grab (👋) is only enabled if full AND not already carrying one
|
||||
var can_grab = is_full and not (local_player and local_player.is_carrying_tekton)
|
||||
_update_boost_button_state(tekton_grab_button, can_grab)
|
||||
|
||||
func _on_tekton_carried_changed(_is_carrying: bool):
|
||||
# Refresh button states when player grabs/throws a tekton
|
||||
|
||||
Reference in New Issue
Block a user