update
This commit is contained in:
@@ -66,10 +66,10 @@ func initialize(p_player: Node3D, p_gridmap: Node):
|
||||
# =============================================================================
|
||||
func get_effect_from_item(item_id: int) -> int:
|
||||
match item_id:
|
||||
7: return SpecialEffect.BLOCK_FLOOR # Heart
|
||||
8: return SpecialEffect.FREEZE_PLAYER # Diamond
|
||||
9: return SpecialEffect.INVISIBLE_MODE # Star
|
||||
10: return SpecialEffect.BURN_TILES # Coin (Handles Burn or Spawn)
|
||||
7: return SpecialEffect.BLOCK_FLOOR # Heart
|
||||
8: return SpecialEffect.FREEZE_PLAYER # Diamond
|
||||
9: return SpecialEffect.INVISIBLE_MODE # Star
|
||||
10: return SpecialEffect.BURN_TILES # Coin (Handles Burn or Spawn)
|
||||
_: return -1
|
||||
|
||||
func add_powerup_from_item(item_id: int):
|
||||
@@ -120,7 +120,7 @@ func activate_effect(effect: int, target_player: Node3D = null):
|
||||
_execute_burn_tiles(target_player)
|
||||
else:
|
||||
# Spawn tiles around SELF (as per user request "around activating player")
|
||||
_execute_spawn_tiles(player)
|
||||
_execute_spawn_tiles(player)
|
||||
|
||||
SpecialEffect.BLOCK_FLOOR:
|
||||
if target_player:
|
||||
@@ -189,7 +189,7 @@ func _execute_burn_tiles(target: Node3D):
|
||||
board_indices.append(i)
|
||||
|
||||
if board_indices.is_empty():
|
||||
return
|
||||
return
|
||||
|
||||
var burn_count = rng.randi_range(3, 6)
|
||||
board_indices.shuffle()
|
||||
@@ -208,7 +208,7 @@ func _execute_burn_tiles(target: Node3D):
|
||||
if main:
|
||||
main.rpc("sync_playerboard", target.name.to_int(), target.playerboard)
|
||||
|
||||
target.rpc("display_message", "Burned by %s!" % player.display_name, 3)
|
||||
NotificationManager.send_message(target, NotificationManager.MESSAGES.BURNED_BY % player.display_name, NotificationManager.MessageType.WARNING)
|
||||
|
||||
|
||||
func _execute_spawn_tiles(target: Node3D):
|
||||
@@ -220,7 +220,7 @@ func _execute_spawn_tiles(target: Node3D):
|
||||
# So random number tiles (7-10 are powerups, 1-6 are normal? No, 7-10 are patterns in this game).
|
||||
# "Spawn 3x3 pattern tiles" -> Tiles with ID 7,8,9,10 are the goal tiles.
|
||||
|
||||
target.rpc("display_message", "Tiles Spawned!", 2)
|
||||
NotificationManager.send_message(target, NotificationManager.MESSAGES.TILES_SPAWNED, NotificationManager.MessageType.POWERUP)
|
||||
|
||||
func _execute_freeze_player(target: Node3D):
|
||||
if not target:
|
||||
@@ -233,7 +233,7 @@ func _execute_freeze_player(target: Node3D):
|
||||
target.set("is_frozen", true)
|
||||
_create_unfreeze_timer(target, FREEZE_DURATION)
|
||||
|
||||
target.rpc("display_message", "Frozen by %s!" % player.display_name, 3)
|
||||
NotificationManager.send_message(target, NotificationManager.MESSAGES.FROZEN_BY % player.display_name, NotificationManager.MessageType.WARNING)
|
||||
|
||||
func _execute_block_floor(target: Node3D):
|
||||
# Make nearby tile non-walkable for 9 seconds
|
||||
@@ -262,14 +262,14 @@ func _execute_block_floor(target: Node3D):
|
||||
"timer": BLOCK_DURATION
|
||||
})
|
||||
|
||||
target.rpc("display_message", "Floor Blocked!", 3)
|
||||
NotificationManager.send_message(target, NotificationManager.MESSAGES.FLOOR_BLOCKED, NotificationManager.MessageType.WARNING)
|
||||
|
||||
func _execute_invisible_mode(target: Node3D):
|
||||
target.is_invisible = true
|
||||
# Auto-disable after duration handled in Player._process or here?
|
||||
# SpecialTilesManager seems to handle effect timers.
|
||||
invisible_timer = INVISIBLE_DURATION
|
||||
target.rpc("display_message", "Invisible!", 2)
|
||||
NotificationManager.send_message(target, NotificationManager.MESSAGES.INVISIBLE, NotificationManager.MessageType.POWERUP)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
@@ -279,7 +279,6 @@ func _execute_invisible_mode(target: Node3D):
|
||||
func spawn_powerups_around(center: Vector2i, force_powerups: bool = true):
|
||||
# "spawn / replace your nearby tiles into power up ( special tiles )"
|
||||
# PowerUp Tiles are 7, 8, 9, 10 (Heart, Diamond, Star, Coin)
|
||||
|
||||
var radius = 2
|
||||
for x in range(-radius, radius + 1):
|
||||
for y in range(-radius, radius + 1):
|
||||
@@ -308,7 +307,7 @@ func _update_invisible_timer(delta: float):
|
||||
invisible_timer = 0
|
||||
if is_instance_valid(player):
|
||||
player.is_invisible = false
|
||||
player.rpc("display_message", "Invisibility Ended")
|
||||
NotificationManager.send_message(player, NotificationManager.MESSAGES.INVISIBILITY_ENDED, NotificationManager.MessageType.NORMAL)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
@@ -366,7 +365,7 @@ func check_shield_and_cancel_effect() -> bool:
|
||||
invisible_timer = 0 # Cancel timer
|
||||
if player.get("original_movement_range"):
|
||||
player.movement_range = player.original_movement_range
|
||||
player.rpc("display_message", "Shield blocked an attack!")
|
||||
NotificationManager.send_message(player, NotificationManager.MESSAGES.SHIELD_BLOCKED, NotificationManager.MessageType.POWERUP)
|
||||
return true
|
||||
return false
|
||||
|
||||
@@ -377,4 +376,4 @@ func _create_unfreeze_timer(target_player: Node3D, duration: float):
|
||||
# Reset visuals
|
||||
if target_player.has_method("sync_modulate"):
|
||||
target_player.rpc("sync_modulate", Color.WHITE)
|
||||
target_player.rpc("display_message", "Unfrozen!")
|
||||
NotificationManager.send_message(target_player, NotificationManager.MESSAGES.UNFROZEN, NotificationManager.MessageType.NORMAL)
|
||||
|
||||
Reference in New Issue
Block a user