Files
tactical-shooter/scripts/network/player_net_input.gd.netfox-wip
T
shawn e7299b17e9 Phase 7: netfox + godot-jolt stack upgrade
Stack installed:
- netfox v1.35.3 (core + extras + noray + internals)
- godot-jolt v0.16.0-stable

Architecture:
- Server: ENet transport (works headless, no netfox deps)
- Client/Editor: netfox rollback (RollbackSynchronizer, TickInterpolator)

New/modified:
- docs/migration-netfox-plan.md — migration architecture
- scripts/network/network_manager.gd — netfox-aware ENet fallback
- scripts/network/player.gd — clean base player
- client/characters/player_netfox.gd — rollback player w/ WeaponManager
- client/characters/input/player_net_input.gd — BaseNetInput subclass
- client/characters/character/fps_character_controller.gd — netfox input feed
- client/weapons/ — weapon data, registry, TacticalWeaponHitscan, WeaponManager
- client/scripts/round_replicator.gd — client-side round state bridge
- server/scripts/round_manager.gd — improved state machine
- server/scripts/plugin_api/plugin_manager.gd — refined plugin system
- config: enemy_tag, ally_tag for meatball targeting

Removed: old C++ SimulationServer GDExtension (replaced by netfox rollback)
2026-07-02 17:39:22 -04:00

77 lines
2.6 KiB
Plaintext

## PlayerNetInput — netfox BaseNetInput subclass for tactical-shooter.
##
## This node lives under the Player scene and gathers input each network
## tick. RollbackSynchronizer references its properties in `input_properties`.
##
## Usage:
## Place as a child of the Player (CharacterBody3D or Node3D).
## The RollbackSynchronizer on the player's parent node will call
## _gather() before each tick, reading these exported properties.
extends BaseNetInput
class_name PlayerNetInput
# ---------------------------------------------------------------------------
# Input state — read by RollbackSynchronizer as input_properties
# These are set in _gather() on the authority peer before every tick.
# ---------------------------------------------------------------------------
## Movement direction in local space (normalized, or zero).
@export var move_direction: Vector3 = Vector3.ZERO
## Mouse look: yaw (horizontal, radians).
@export var look_yaw: float = 0.0
## Mouse look: pitch (vertical, radians).
@export var look_pitch: float = 0.0
## Jump pressed this tick.
@export var jump: bool = false
## Sprint toggle active.
@export var sprint: bool = false
## Crouch toggle active.
@export var crouch: bool = false
## Shoot pressed this tick.
@export var shoot: bool = false
## Aim-down-sights pressed.
@export var aim: bool = false
# ---------------------------------------------------------------------------
# Input gathering (called before each tick on the authority peer)
# ---------------------------------------------------------------------------
func _gather() -> void:
# Movement direction
var dir := Vector3.ZERO
if Input.is_action_pressed(&"move_forward") or Input.is_action_pressed(&"move_up"):
dir.z -= 1.0
if Input.is_action_pressed(&"move_backward") or Input.is_action_pressed(&"move_down"):
dir.z += 1.0
if Input.is_action_pressed(&"move_left"):
dir.x -= 1.0
if Input.is_action_pressed(&"move_right"):
dir.x += 1.0
if dir.length_squared() > 0.0:
dir = dir.normalized()
move_direction = dir
# Mouse look is handled in fps_character_controller.gd _input()
# and synced here via the character controller's current yaw/pitch.
# If this node has a FPSCharacterController sibling, read from it.
var parent := get_parent()
if parent and parent.has_method(&"get_current_yaw"):
look_yaw = parent.get_current_yaw()
if parent and parent.has_method(&"get_current_pitch"):
look_pitch = parent.get_current_pitch()
# Action inputs
jump = Input.is_action_just_pressed(&"jump")
sprint = Input.is_action_pressed(&"sprint")
crouch = Input.is_action_pressed(&"crouch")
shoot = Input.is_action_pressed(&"shoot")
aim = Input.is_action_pressed(&"aim")