fix: Godot 4.2.1 compat and map builder fixes

- Fix tab character in _build_elevated_walkways() call (line 63)
- Fix untyped 'pos' variable in grapple pillar loop (line 376)
- Remove fog_sky_affinity (Godot 4.3+ only property)
- Replace preload() with load() for runtime script loading
- Replace 'is DoubleBarrelShotgun' type check with duck-typing
- Fix 'is not OfflineMultiplayerPeer' syntax in grenade spawn
- Replace absf() with abs() in state_machine, state_air, state_ground
- Update test_level.tscn to remove stale UID reference

All fixes verified: PARSE OK and scene runs without script errors
on Godot 4.2.1 headless.
This commit is contained in:
2026-06-21 01:24:42 -04:00
parent f164afecd8
commit 462d12bee5
6 changed files with 15 additions and 16 deletions
+3 -3
View File
@@ -226,7 +226,7 @@ func detect_wall_horizontal() -> Vector3:
continue
var n: Vector3 = hit.get("normal", Vector3.ZERO)
# Wall must be roughly vertical (normal mostly horizontal)
if absf(n.y) < 0.3 and n.length_squared() > 0.0:
if abs(n.y) < 0.3 and n.length_squared() > 0.0:
wall_normal = n.normalized()
wall_side = side_data["side"]
return wall_normal
@@ -246,7 +246,7 @@ func detect_wall_horizontal() -> Vector3:
if collider is PlayerMovementController or collider is CharacterBody3D or collider.has_method("take_damage"):
continue
var n: Vector3 = hit.get("normal", Vector3.ZERO)
if absf(n.y) < 0.3 and n.length_squared() > 0.0:
if abs(n.y) < 0.3 and n.length_squared() > 0.0:
wall_normal = n.normalized()
wall_side = side_data["side"]
return wall_normal
@@ -294,7 +294,7 @@ func detect_wall_forward() -> Dictionary:
return {"hit": false, "normal": Vector3.ZERO, "is_short": false}
var normal: Vector3 = best_hit.get("normal", Vector3.ZERO)
if absf(normal.y) >= 0.3:
if abs(normal.y) >= 0.3:
return {"hit": false, "normal": Vector3.ZERO, "is_short": false} # Not a vertical wall
# Check if wall is short (ledge check) using a top ray
+1 -1
View File
@@ -1112,7 +1112,7 @@ func _throw_grenade() -> void:
var throw_vel = camera.global_transform.basis.z * -throw_speed + Vector3.UP * throw_up_speed + velocity
var spawn_pos = camera.global_position + camera.global_transform.basis.z * -0.5
if multiplayer.has_multiplayer_peer() and multiplayer.multiplayer_peer is not OfflineMultiplayerPeer:
if multiplayer.has_multiplayer_peer() and not (multiplayer.multiplayer_peer is OfflineMultiplayerPeer):
server_spawn_grenade.rpc_id(1, spawn_pos, throw_vel)
else:
_spawn_grenade_local(spawn_pos, throw_vel, 1)
+1 -1
View File
@@ -145,7 +145,7 @@ func update(delta: float) -> void:
# Require looking mostly along the wall (angle > 41 degrees from normal)
# and inputting mostly along the wall (angle > 31 degrees from normal, allows W+A/D diagonally into wall)
if absf(h_look.dot(wall_n)) < 0.75 and absf(wish_dir.dot(wall_n)) < 0.85:
if abs(h_look.dot(wall_n)) < 0.75 and abs(wish_dir.dot(wall_n)) < 0.85:
machine.switch_to("wall_run")
return
+2 -2
View File
@@ -96,7 +96,7 @@ func update(delta: float) -> void:
if wish_dir.length_squared() > 0.01 and not machine.input_crouch:
for i in range(player.get_slide_collision_count()):
var col = player.get_slide_collision(i)
if absf(col.get_normal().y) < 0.3: # Hit a wall
if abs(col.get_normal().y) < 0.3: # Hit a wall
var max_step_height = 0.95
var space_state = player.get_world_3d().direct_space_state
var feet_y = player.global_position.y - (machine.original_capsule_height / 2.0)
@@ -209,7 +209,7 @@ func update(delta: float) -> void:
# Require looking mostly along the wall (angle > 41 degrees from normal)
# and inputting mostly along the wall (angle > 31 degrees from normal, allows W+A/D diagonally into wall)
if absf(h_look.dot(wall_n)) < 0.75 and absf(wish_dir.dot(wall_n)) < 0.85:
if abs(h_look.dot(wall_n)) < 0.75 and abs(wish_dir.dot(wall_n)) < 0.85:
machine.switch_to("wall_run")
return