extends Node

# Ship movement
var ship_thrust: float = 250.0
var ship_max_speed: float = 300.0
var ship_rotation_speed: float = 1.0
# Continuing to hold left/right past this many seconds ramps to
# ship_rotation_speed_held (double the tap rate) — a quick tap stays precise,
# a held turn goes faster. See ship_movement.gd's _simulate_step().
var ship_rotation_ramp_delay: float = 0.15
var ship_rotation_speed_held: float = 2.0

# Shooting — damage/energy cost/bullet count all scale per-role (Fighter/
# Gunner/Tank, see menu/team_select.gd's RACES "role" field); Gunner and Tank
# fire their bullets in a side-by-side pair instead of Fighter's single shot
# (see ship_movement.gd's _server_process_shoot()).
var ship_fire_rate: float = 0.15
var bullet_speed: float = 750.0
var ship_bullet_damage_by_role: Dictionary = {"Fighter": 100, "Gunner": 25, "Tank": 50}
var ship_bullet_count_by_role: Dictionary = {"Fighter": 1, "Gunner": 2, "Tank": 2}
var bullet_side_spacing: float = 14.0
var bullet_max_range: float = 1500.0

# Per-shot sound effect (menu/team_select.gd's RACES "sound_path" field, one
# shared clip per faction) — max_distance is in world/pixel units, same as
# AudioStreamPlayer2D expects, so only ships within this radius of the shot
# actually hear it (see world.gd's _play_shoot_sound()).
var ship_shoot_sound_max_distance: float = 500.0

# Health & respawn
var ship_max_health: int = 100
var ship_respawn_delay: float = 3.0
var ship_invincibility_time: float = 2.0

# Energy (see ships/ship_movement.gd) — max energy scales by ship role
# (Fighter/Gunner/Tank, see menu/team_select.gd's RACES ship "role" field);
# regen is a flat rate regardless of role, so bigger ships take longer to
# top off from empty than smaller ones.
var ship_max_energy_by_role: Dictionary = {"Fighter": 100.0, "Gunner": 150.0, "Tank": 250.0}
var ship_bullet_energy_cost_by_role: Dictionary = {"Fighter": 75.0, "Gunner": 25.0, "Tank": 50.0}
var ship_energy_regen_rate: float = 100.0 / 2.5  # 100 energy per 2.5s

# Environment collision (asteroids only) — bounce-back and impact damage scale with impact speed
var ship_bounce_restitution: float = 0.45
var ship_collision_damage_scale: float = 0.064

# One shared knob to resize every ship's in-world sprite at once, applied on
# top of each ship's own per-role "scale" in team_select.gd's RACES (see
# ship_movement.gd's _init_player()) — doesn't touch those individually
# balanced per-role values, just scales the end result uniformly.
var ship_scale_factor: float = 0.75

# How much of the sprite's own texture bounds its collision capsule covers
# (see ship_movement.gd's _update_collision_shape()) — under 1.0 to stay
# inside the hull's soft/anti-aliased edge instead of the full texture rect.
var ship_hitbox_scale: float = 0.85

# Explosion VFX (effects/explosion.gd) — one shared knob to resize every
# explosion in the game at once; explosion_fps controls playback speed of the
# 12-frame animation (see assets/images/effects/explosion/). Each frame is
# held for 5 ticks (explosion.tscn's SpriteFrames "duration": 5.0 per frame,
# so mostly-transparent/dark frames like the opening spark and the frame 6
# ember cloud have time to register instead of reading as a flicker-to-black
# gap between the brighter frames) — total time is (12 * 5) / explosion_fps.
var explosion_scale: float = 0.75
var explosion_fps: float = 24.0  # 60 ticks / 24.0 fps = 2.5s total

# Damage-number VFX (effects/damage_number.gd) — floating "(amount)" combat
# text shown only to the attacker when their shot lands, not broadcast to
# every peer like the kill feed (see ship_movement.gd's
# _notify_damage_dealt()/_show_damage_number()).
var damage_number_rise_distance: float = 36.0
var damage_number_duration: float = 1.4
var damage_number_font_size: int = 34
var damage_number_color: Color = Color(0.95, 0.15, 0.15)

# Shared white/teammate vs. red/enemy color scheme -- used by both the
# top-left roster (hud/player_list.gd) and in-world ship nameplates
# (ships/ship_movement.gd) so the two always agree. Was a yellow enemy_color
# that read too close to white/teammate at a glance; red is unambiguous.
var team_color: Color = Color(0.92, 0.95, 1.0)
var enemy_color: Color = Color(0.95, 0.25, 0.25)

# In-world ship nameplate (ships/ship_movement.gd) -- offset from ship center
# so it sits at the bottom-right of the sprite rather than directly under it
# (keeps it clear of the engine flame and doesn't read as a health-bar-like
# element stacked straight below).
var ship_nameplate_offset: Vector2 = Vector2(26, 24)
var ship_nameplate_font_size: int = 18

# One shared knob for the local player's view distance -- Camera2D.zoom below
# 1.0 shows more world per screen pixel (zoomed out), above 1.0 shows less
# (zoomed in). Applied once in ship_movement.gd's _ready() to the owner's own
# Camera2D only; doesn't affect any other peer's view.
var camera_zoom: float = 0.85

# Locally-remembered callsign, pre-fills the name field on the menu.
# Race/ship/speed are per-peer now — see PlayerRegistry.
var player_name: String = ""

# Current map's play area, in world coordinates. Set by world.gd on load.
var world_bounds: Rect2 = Rect2(0, 0, 1152, 648)

# Random offset applied around a chosen team_a_spawn/team_b_spawn marker
# (see ship_movement.gd's _get_spawn_position()) so multiple ships spawning
# off the same single marker -- e.g. a 7-bot casual-fill team -- don't stack
# exactly on top of each other.
var spawn_scatter_radius: float = 150.0

# True while the chat input box has keyboard focus — gates ship movement/fire
# input so typing (e.g. the letter "w") doesn't also move the ship.
var chat_focused: bool = false

# True while TeamSelect is reopened mid-match (pause menu "SELECT TEAM") —
# same purpose as chat_focused, so clicking ship rows doesn't also fly the
# ship underneath. Not needed for the initial pre-spawn pick since the ship
# has no physics processing yet at that point.
var team_select_focused: bool = false

# Bots (casual fill) — see bots/bot_manager.gd and overview/bots.md
var bot_min_team_size: int = 7  # mirrors matchmaking-api's CASUAL_TEAM_SIZE default
var bot_engage_range: float = 500.0

# Personality trait ranges (bots/bot_personality.gd) — each bot rolls all 5
# traits 0..1 independently once at spawn; these ranges convert that roll
# into the concrete numbers BotAI actually flies with.
var bot_stop_distance_min: float = 70.0     # aggression 1: dogfights up close
var bot_stop_distance_max: float = 260.0    # aggression 0: hangs back at range
var bot_retreat_health_frac_min: float = 0.10  # caution 0: fights to the death
var bot_retreat_health_frac_max: float = 0.65  # caution 1: breaks off early
var bot_aim_tolerance_best_deg: float = 3.0   # accuracy 1: pinpoint gate
var bot_aim_tolerance_worst_deg: float = 14.0 # accuracy 0: sloppy gate
var bot_aim_jitter_max_px: float = 220.0      # accuracy 0: aims this far off the real spot
var bot_reaction_update_best_sec: float = 0.05  # reaction 1: re-aims almost every tick
var bot_reaction_update_worst_sec: float = 0.6  # reaction 0: laggy, stale tracking
var bot_awareness_range_min: float = 900.0    # awareness 0: near-sighted
var bot_awareness_range_max: float = 16000.0  # awareness 1: sees across the whole map
# map_01 spawns the two teams ~10608 units apart (see world/maps/map_01.tscn),
# on a ~14016x6000 map (diagonal ~15247) — the max must clear that or every
# bot spawns permanently unable to detect the enemy team and never advances.
