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
+29
View File
@@ -283,6 +283,10 @@ func temporarily_change_floor(center: Vector2i, radius: int, new_id: int, durati
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):
var cell_3d = Vector3i(pos.x, 0, pos.y)
var original = enhanced_gridmap.get_cell_item(cell_3d)
@@ -355,6 +359,10 @@ func spawn_tiles_around(count: int = 4):
# Maybe avoid center.
if x == 0 and y == 0: continue
# PHYSICS CHECK: Block spawning on Static Stands
if _is_position_blocked_by_stand(pos):
continue
if enhanced_gridmap.is_position_valid(pos):
# 50% chance to spawn something
if rng.randf() > 0.5: continue
@@ -425,3 +433,24 @@ func play_animation(anim_name: String):
print_tree_pretty()
else:
print("[Tekton] Animation '%s' NOT FOUND in AnimationPlayer!" % anim_name)
func _is_position_blocked_by_stand(target_pos: Vector2i) -> bool:
# Raycast check for Static Tekton Stand (Layer 1, Body)
# 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
# We perform a vertical raycast through the potential stand volume
var query = PhysicsRayQueryParameters3D.create(from, to)
query.collide_with_areas = false
query.collide_with_bodies = true
var space_state = get_world_3d().direct_space_state
var result = space_state.intersect_ray(query)
if result:
# If we hit something not ourselves/player, assume it's a stand/blocker
if result.collider != self:
return true
return false