4a5264c5b0
- Replaced TeamData.Team type hints with int in all scripts - Added explicit preloads for headless mode class resolution - Created stub LagCompensation and DamageProcessor scripts - Fixed PluginManager, SpawnManager, EconomyManager, BuyZone, RoundManager, BuyMenuHandler, BombObjective class_name references - Updated server config to match ServerConfig.gd format Gray screen root cause: server scripts failed to parse in headless mode due to Godot 4 class_name loading order (Resource after Node), leaving server_main.gd non-functional — accepted connections but never spawned players.
28 lines
1.1 KiB
GDScript
28 lines
1.1 KiB
GDScript
## LagCompensation — records player position history for hit-scan rewinding.
|
|
## Minimal stub for server startup compatibility.
|
|
## Full implementation to be built when hitscan system is wired.
|
|
extends Node
|
|
## class_name LagCompensation — commented out for headless compatibility
|
|
|
|
var physics_world = null
|
|
var _history: Dictionary = {} # tick → { entity_id: position }
|
|
|
|
func record_position(tick: int, entity_id: int, position: Vector3) -> void:
|
|
_history[tick] = {entity_id: position}
|
|
# Keep only 128 most recent ticks
|
|
if _history.size() > 128:
|
|
var oldest = _history.keys().min()
|
|
if oldest != null:
|
|
_history.erase(oldest)
|
|
|
|
func rewind_and_raycast(tick: int, origin: Vector3, direction: Vector3, max_range: float, exclude: Array = []) -> Dictionary:
|
|
# Stub: fall back to current-frame raycast
|
|
if physics_world == null:
|
|
return {}
|
|
var space_state = physics_world.direct_space_state
|
|
if space_state == null:
|
|
return {}
|
|
var query = PhysicsRayQueryParameters3D.create(origin, origin + direction * max_range)
|
|
query.exclude = exclude
|
|
return space_state.intersect_ray(query)
|