v0.1.0-windows: initial Windows release build

- WeaponData: restored class_name, converted static vars to make() factory
- WeaponDefinitions: updated to use make() instead of static var refs
- Windows export: tactical-shooter.exe + godot-jolt_windows-x64.dll
- Build artifact: build/tactical-shooter-windows-x86_64-v0.1.0.zip
This commit is contained in:
2026-07-02 18:09:16 -04:00
parent e70ce76207
commit 969741aa31
2 changed files with 23 additions and 65 deletions
+19 -61
View File
@@ -5,13 +5,11 @@
## via the class-level constants (RIFLE, PISTOL, SHOTGUN, SMG). ## via the class-level constants (RIFLE, PISTOL, SHOTGUN, SMG).
## ##
## Usage: ## Usage:
## var data: WeaponData = WeaponData.RIFLE ## var wd = preload("res://scripts/combat/weapon_data.gd")
## print(data.display_name) # "Assault Rifle" ## var data = wd.make("rifle", "Assault Rifle", 30.0, 10.0, 30, ...)
##
extends Resource extends Resource
# NOTE: no class_name — the client has WeaponData class_name at class_name WeaponData
# client/weapons/data/weapon_data.gd with different field names.
# Server code uses preload() + untyped references to avoid conflicts.
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Properties # Properties
@@ -19,83 +17,43 @@ extends Resource
## Unique identifier string (e.g., "rifle", "pistol"). ## Unique identifier string (e.g., "rifle", "pistol").
@export var weapon_id: String = "" @export var weapon_id: String = ""
## Human-readable weapon name. ## Human-readable weapon name.
@export var display_name: String = "" @export var display_name: String = ""
## Base damage per projectile/pellet. ## Base damage per projectile/pellet.
@export var damage: float = 0.0 @export var damage: float = 0.0
## Rate of fire in rounds per second (Hz). ## Rate of fire in rounds per second (Hz).
@export var fire_rate: float = 0.0 @export var fire_rate: float = 0.0
## Magazine capacity (max ammo per reload). ## Magazine capacity (max ammo per reload).
@export var mag_size: int = 0 @export var mag_size: int = 0
## Reload duration in seconds. ## Reload duration in seconds.
@export var reload_time: float = 0.0 @export var reload_time: float = 0.0
## If true, hold to fire continuously. If false, single-shot per press. ## If true, hold to fire continuously. If false, single-shot per press.
@export var is_automatic: bool = false @export var is_automatic: bool = false
## Base weapon spread in degrees (used for accuracy cone). ## Base weapon spread in degrees (used for accuracy cone).
@export var spread_degrees: float = 0.0 @export var spread_degrees: float = 0.0
## Effective range in Godot units (metres conceptual). ## Effective range in Godot units (metres conceptual).
@export var range: float = 0.0 @export var range: float = 0.0
## Number of pellets/projectiles per shot (1 for most weapons, 8 for shotgun). ## Number of pellets/projectiles per shot (1 for most weapons, 8 for shotgun).
@export var pellets_per_shot: int = 1 @export var pellets_per_shot: int = 1
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Pre-configured weapon instances (class-level static vars) # Factory
# ---------------------------------------------------------------------------
# NOTE: static var initializers CAN call functions (unlike const).
# These run when the script is loaded, which avoids the "not a constant
# expression" error that occurs with const + .new().
## Assault Rifle — 30 dmg, 10 rps, 30 mag, 2.1s reload, automatic, 0.5° spread, 200m range.
static var RIFLE: Resource = pref(
"rifle", "Assault Rifle",
30.0, 10.0, 30, 2.1, true, 0.5, 200.0, 1
)
## Pistol — 25 dmg, 4 rps, 12 mag, 1.5s reload, semi-auto, 0.3° spread, 80m range.
static var PISTOL: Resource = pref(
"pistol", "Pistol",
25.0, 4.0, 12, 1.5, false, 0.3, 80.0, 1
)
## Shotgun — 8 dmg × 8 pellets, 1 rps, 8 mag, 3.0s reload, semi-auto, 3° spread, 30m range.
static var SHOTGUN: Resource = pref(
"shotgun", "Shotgun",
8.0, 1.0, 8, 3.0, false, 3.0, 30.0, 8
)
## SMG — 18 dmg, 12 rps, 25 mag, 1.8s reload, automatic, 1.5° spread, 100m range.
static var SMG: Resource = pref(
"smg", "Submachine Gun",
18.0, 12.0, 25, 1.8, true, 1.5, 100.0, 1
)
# ---------------------------------------------------------------------------
# Factory helper
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
## Internal helper that constructs a WeaponData instance from raw values. ## Construct a WeaponData instance from raw stat values.
## This avoids repeating the constructor boilerplate for every constant. ## Avoids class_name references in return types for headless compatibility.
static func pref( static func make(
_weapon_id: String, _weapon_id: String,
_display_name: String, _display_name: String,
_damage: float, _damage: float,
_fire_rate: float, _fire_rate: float,
_mag_size: int, _mag_size: int,
_reload_time: float, _reload_time: float,
_is_automatic: bool, _is_automatic: bool,
_spread_degrees: float, _spread_degrees: float,
_range: float, _range: float,
_pellets: int = 1 _pellets: int = 1
): # -> WeaponData (untyped for headless compat) ):
var w = WeaponData.new() var w = WeaponData.new()
w.weapon_id = _weapon_id w.weapon_id = _weapon_id
w.display_name = _display_name w.display_name = _display_name
+4 -4
View File
@@ -33,10 +33,10 @@ static func _ensure_init() -> void:
return return
_initialized = true _initialized = true
WEAPONS = { WEAPONS = {
"rifle": _WD.RIFLE, "rifle": _WD.make("rifle", "Assault Rifle", 30.0, 10.0, 30, 2.1, true, 0.5, 200.0, 1),
"pistol": _WD.PISTOL, "pistol": _WD.make("pistol", "Pistol", 25.0, 4.0, 12, 1.5, false, 0.3, 80.0, 1),
"shotgun": _WD.SHOTGUN, "shotgun": _WD.make("shotgun","Shotgun", 8.0, 1.0, 8, 3.0, false, 3.0, 30.0, 8),
"smg": _WD.SMG, "smg": _WD.make("smg", "Submachine Gun", 18.0, 12.0, 25, 1.8, true, 1.5, 100.0, 1),
} }
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------