feat: Introduce Tekton roaming NPC with grid movement, player interaction, tile spawning, and visual effects.

This commit is contained in:
Yogi Wiguna
2026-03-13 10:07:17 +08:00
parent 74a81425c5
commit 200e198428
4 changed files with 48 additions and 31 deletions
+28 -18
View File
@@ -298,9 +298,8 @@ func temporarily_change_floor(center: Vector2i, radius: int, new_id: int, durati
var cell_3d = Vector3i(pos.x, 0, pos.y)
var original = enhanced_gridmap.get_cell_item(cell_3d)
# Only change if not already the new ID (avoid redundant updates or overriding existing freeze)
# PROTECTED FLOOR CHECK: avoid overwriting Start (1), Safe (2), Finish (3), or Wall (4)
if original != new_id and not original in [1, 2, 3, 4]:
# PROTECTED FLOOR CHECK: avoid overwriting Start (1), Safe (2), Finish (3), Wall (4), or PowerUp Stand (15)
if original != new_id and not original in [1, 2, 3, 4, 15]:
# PRE-FIX: If we capture a "Hole" (Void or Pickup 7-14) here, we must record it as Floor (0)
# so that we restore a valid floor later.
if original == -1 or (original >= 7 and original <= 14):
@@ -371,24 +370,35 @@ func spawn_tiles_around(count: int = 4):
if _is_position_blocked_by_stand(pos):
continue
# EXTRA CHECK: Do not spawn tiles on walls (ID 4) or empty void (ID -1) on Floor 0
# Note: We allow spawning on Safe Zones, Start, and Finish as it's on Layer 1.
var floor_0_item = enhanced_gridmap.get_cell_item(Vector3i(pos.x, 0, pos.y))
if floor_0_item in [4, -1]:
continue
# 50% chance to spawn something
if rng.randf() > 0.5: continue
# EXTRA CHECK: Do not spawn tiles on walls (ID 4), empty void (ID -1), or static powerup spawns (ID 15)
var floor_0_item = enhanced_gridmap.get_cell_item(Vector3i(pos.x, 0, pos.y))
# Stop n Go: Don't overwrite static powerup spawns
if LobbyManager and LobbyManager.game_mode == "Stop n Go" and floor_0_item == 15:
continue
# Determine Type
var item_id: int
var roll = rng.randf()
if floor_0_item in [4, -1]:
continue
if roll < 0.6:
# 60% Normal Tile (7-10)
item_id = rng.randi_range(7, 10)
# 50% chance to spawn something
if rng.randf() > 0.5: continue
# Determine Type
var item_id: int
var roll = rng.randf()
if roll < 0.6 or (LobbyManager and LobbyManager.game_mode == "Stop n Go"):
# 60% Normal Tile (7-10) OR 100% if Stop n Go (User Request)
item_id = rng.randi_range(7, 10)
else:
# 40% PowerUp (11-14)
var mode = GameMode.Mode.FREEMODE
if LobbyManager:
mode = LobbyManager.get_game_mode()
if mode == GameMode.Mode.TEKTON_DOORS:
item_id = [11, 14].pick_random()
else:
# 40% PowerUp (11-14)
item_id = rng.randi_range(11, 14)
if item_id != -1: