feat: Introduce special tile power-up system, managing inventory, levels, cooldowns, and targeted effects like area freeze and block floor.

This commit is contained in:
Yogi Wiguna
2026-02-13 13:26:22 +08:00
parent ad16f5942b
commit 6472e47edf
3 changed files with 64 additions and 1 deletions
+30 -1
View File
@@ -380,6 +380,11 @@ func _execute_block_floor(target_pos: Vector2i):
for n in neighbors:
var pos = n.position
# PHYSICS CHECK
if _is_position_blocked_by_stand(pos):
continue
var block_pos = Vector3i(pos.x, 0, pos.y)
# Check current item first
@@ -437,6 +442,10 @@ func spawn_powerups_around(center: Vector2i, force_powerups: bool = true):
for x in range(-radius, radius + 1):
for y in range(-radius, radius + 1):
var pos = center + Vector2i(x, y)
if _is_position_blocked_by_stand(pos):
continue
if enhanced_gridmap.is_position_valid(pos):
# Random chance to spawn ANYTHING at this spot (keep density reasonable)
if rng.randf() > 0.5: continue
@@ -640,4 +649,24 @@ 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)
NotificationManager.send_message(target_player, NotificationManager.MESSAGES.UNFROZEN, NotificationManager.MessageType.NORMAL)
NotificationManager.send_message(target_player, "You are no longer frozen!", NotificationManager.MessageType.NORMAL)
func _is_position_blocked_by_stand(target_pos: Vector2i) -> bool:
if not player: return false
# Raycast check for Static Tekton Stand
# Check CENTER of tile (x+0.5) at LOW height (0.3)
var from = Vector3(target_pos.x + 0.5, 0.3, target_pos.y + 0.5) + Vector3.UP * 2.0
var to = Vector3(target_pos.x + 0.5, 0.3, target_pos.y + 0.5) + Vector3.DOWN * 2.0
var query = PhysicsRayQueryParameters3D.create(from, to)
query.collide_with_areas = false
query.collide_with_bodies = true
var space_state = player.get_world_3d().direct_space_state
var result = space_state.intersect_ray(query)
if result:
if result.collider != player:
return true
return false