feat: implement water shader and environment for free mode arena

This commit is contained in:
Yogi Wiguna
2026-03-31 15:59:00 +08:00
parent 3454710f2c
commit 1e6da89fff
16 changed files with 337 additions and 116 deletions
+21 -16
View File
@@ -123,19 +123,11 @@ func _apply_arena_background():
"Stop N Go Arena":
texture_path = "res://assets/graphics/level_bg/placeholder_stop_n_go.jpg"
_instantiate_3d_arena("res://scenes/arena/stop_n_go.scn")
# Make normal, non-walkable, and Tekton floors invisible
# by shrinking their scale to 0. This hides them visually while
# avoiding "Parameter 'mesh' is null" or material override errors.
var em = $EnhancedGridMap
if em and em.mesh_library:
var ml = em.mesh_library.duplicate()
for id in [0, 4, 6]:
# Scale to 0 to hide it without triggering invalid mesh errors
ml.set_item_mesh_transform(id, Transform3D().scaled(Vector3.ZERO))
em.mesh_library = ml
print("[Main] Hide tiles 0, 4, 6 via zero-scale transform.")
_hide_ground_tiles()
"Freemode Arena":
texture_path = "res://assets/graphics/level_bg/placeholder_classic.jpg" # Fallback texture
_instantiate_3d_arena("res://scenes/arena/freemode.tscn")
_hide_ground_tiles()
"Tekton Doors Arena":
texture_path = "res://assets/graphics/level_bg/placeholder_tekton_doors.jpg"
"Classic", _:
@@ -159,6 +151,20 @@ func _instantiate_3d_arena(scene_path: String):
move_child(arena_instance, 0)
print("Instantiated 3D Arena: ", scene_path)
func _hide_ground_tiles():
# Make normal, non-walkable, and Tekton floors invisible
# by shrinking their scale to 0. This hides them visually while
# avoiding "Parameter 'mesh' is null" or material override errors.
var em = $EnhancedGridMap
if em and em.mesh_library:
var ml = em.mesh_library.duplicate()
for id in [0, 4, 6]:
# Scale to 0 to hide it without triggering invalid mesh errors
ml.set_item_mesh_transform(id, Transform3D().scaled(Vector3.ZERO))
em.mesh_library = ml
print("[Main] Hide tiles 0, 4, 6 via zero-scale transform.")
@rpc("any_peer", "call_local", "reliable")
func sync_portal_configs(configs: Array):
if portal_mode_manager:
@@ -849,11 +855,10 @@ func _assign_random_spawn_positions():
var pos = Vector2i(x, z)
# SAFETY CHECK: Is this reserved for a Static Tekton Stand?
# Stand clears 3x3, we use a strictly >= 1 check (so abs <= 1 is EXACTLY the 3x3 stand)
# Let's use a 3x3 check (1 radius) to avoid strictly the stand itself, plus 1 buffer = radius 2.
# Stand clears exactly 3x3 area
var is_safe = true
for reserved in reserved_static_positions:
if abs(x - reserved.x) <= 2 and abs(z - reserved.y) <= 2:
if abs(x - reserved.x) <= 1 and abs(z - reserved.y) <= 1:
is_safe = false
break