From 430770e5bfe1eb4cec569adb81c25901f29df705 Mon Sep 17 00:00:00 2001 From: VinPropane Date: Sun, 5 Apr 2026 01:57:33 -0400 Subject: [PATCH] NS-23: Rename bump helpers; WALK_BUMP_STEP_GROUP for scene group Remove ticket-style names from collider/footprint APIs (_collider_in_bump_step_group, _departing_bump_step_to_lower_floor, touches_bump_step). Editor group string stays ns19_bump in one const until main.tscn renames the group. --- client/scripts/player.gd | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/client/scripts/player.gd b/client/scripts/player.gd index af0e337..e319ba0 100644 --- a/client/scripts/player.gd +++ b/client/scripts/player.gd @@ -3,7 +3,7 @@ extends CharacterBody3D ## NS-23: Follow server move target on walkable geometry. ## ## Horizontal velocity toward nav waypoint or goal; `velocity.y` stays 0 except a short **step-off** -## nudge (see `_use_direct_step_down_steering`) so NS-19 bumps can drop without full gravity. +## nudge (see `_use_direct_step_down_steering`) so stepped bumps can drop without full gravity. ## Move **legality** is server MoveCommand only — not reimplemented here. ## ## Nav for detours; short local step-down (feet vs goal Y, not body origin) may bypass waypoints. @@ -14,10 +14,10 @@ const VERT_ARRIVE_EPS: float = 0.055 const DIRECT_APPROACH_RADIUS: float = 0.85 const FLOOR_PROBE_DOWN: float = 4.0 const STEP_OFF_FLOOR_MARGIN: float = 0.04 -## Only NS-19-sized step downs (not cliffs); allows a wider horiz cap without bee-lining big drops. +## Only small step-downs (not cliffs); allows a wider horiz cap without bee-lining big drops. const STEP_OFF_MIN_DROP: float = 0.055 const STEP_OFF_MAX_DROP: float = 0.24 -## Past this, only direct step-down when footprint still touches `ns19_bump` (nav rim paths). +## Past this, only direct step-down when footprint still touches a bump-step collider (nav rim). const STEP_OFF_CLOSE_HORIZ: float = 8.0 ## Match server `MovementValidation.MaxHorizontalStep` default; no bee-line past this. const STEP_OFF_MAX_HORIZ_AUTH: float = 18.0 @@ -33,6 +33,8 @@ const BUMP_RIM_GOAL_BOOST: float = 1.15 const BUMP_RIM_MAX_HORIZ_MULT: float = 1.38 ## If next waypoint is within this xz of us, steer to goal (rim / underfoot waypoints). const NEXT_WAYPOINT_MIN_HORIZ_SQ: float = 0.01 +## Editor group on stepped bump colliders; value must match `main.tscn`. +const WALK_BUMP_STEP_GROUP: StringName = &"ns19_bump" var _has_walk_goal: bool = false var _auth_walk_goal: Vector3 = Vector3.ZERO @@ -84,10 +86,10 @@ func _ray_floor_y_at(from: Vector3) -> float: return from.y -func _collider_in_ns19_bump(collider: Variant) -> bool: +func _collider_in_bump_step_group(collider: Variant) -> bool: var n: Node = collider as Node while n: - if n.is_in_group("ns19_bump"): + if n.is_in_group(WALK_BUMP_STEP_GROUP): return true n = n.get_parent() return false @@ -100,7 +102,7 @@ func _floor_y_under_body() -> float: return maxf(y_center, y_lower) -## One ray pass: max floor Y under footprint + whether any hit is an NS-19 bump (`ns19_bump` group). +## One ray pass: max floor Y under footprint + whether any hit uses `WALK_BUMP_STEP_GROUP`. func _compute_footprint_step_down_state() -> Dictionary: var p: Vector3 = global_position var h: float = STEP_FOOTPRINT_HALF @@ -127,7 +129,7 @@ func _compute_footprint_step_down_state() -> Dictionary: got = true else: best_y = maxf(best_y, yc) - if not on_bump and _collider_in_ns19_bump(hit_c.get("collider")): + if not on_bump and _collider_in_bump_step_group(hit_c.get("collider")): on_bump = true for d: Vector3 in oxz: for yoff2: float in [0.0, FLOOR_PROBE_BODY_Y_OFFSET]: @@ -140,11 +142,11 @@ func _compute_footprint_step_down_state() -> Dictionary: got = true else: best_y = maxf(best_y, yo) - if not on_bump and _collider_in_ns19_bump(hit_o.get("collider")): + if not on_bump and _collider_in_bump_step_group(hit_o.get("collider")): on_bump = true if not got: best_y = _floor_y_under_body() - return {"max_y": best_y, "touches_ns19_bump": on_bump} + return {"max_y": best_y, "touches_bump_step": on_bump} func _footprint_step_down_state() -> Dictionary: @@ -170,7 +172,7 @@ func _destination_footing_y() -> float: func _use_direct_step_down_steering() -> bool: var st: Dictionary = _footprint_step_down_state() var floor_y: float = float(st["max_y"]) - var on_bump: bool = bool(st["touches_ns19_bump"]) + var on_bump: bool = bool(st["touches_bump_step"]) var dest_floor_y: float = _destination_footing_y() if dest_floor_y >= floor_y - STEP_OFF_FLOOR_MARGIN: return false @@ -196,9 +198,9 @@ func _set_horizontal_velocity_toward(point: Vector3) -> void: velocity.y = 0.0 -func _departing_ns19_bump_to_lower_floor() -> bool: +func _departing_bump_step_to_lower_floor() -> bool: var fp: Dictionary = _footprint_step_down_state() - if not bool(fp["touches_ns19_bump"]): + if not bool(fp["touches_bump_step"]): return false var max_y: float = float(fp["max_y"]) var dest_y: float = _destination_footing_y() @@ -207,7 +209,7 @@ func _departing_ns19_bump_to_lower_floor() -> bool: ## Frustum walls turn “toward goal” into tangential rim slide; nudge out + along goal, capped. func _apply_bump_rim_wall_unstick() -> void: - if not _departing_ns19_bump_to_lower_floor(): + if not _departing_bump_step_to_lower_floor(): return var pos: Vector3 = global_position var to_g: Vector3 = Vector3(_auth_walk_goal.x - pos.x, 0.0, _auth_walk_goal.z - pos.z)