aboutsummaryrefslogtreecommitdiffstats
path: root/data/weapons.lua
diff options
context:
space:
mode:
authorVaino Kauppila <vaino@vke.fi>2026-07-02 22:58:25 +0300
committerVaino Kauppila <vaino@vke.fi>2026-07-02 23:47:07 +0300
commitcd0c08dc7ce754473178ad3f32f7740a1dddc1eb (patch)
tree589c676b41d6f3d322ea5ce339ddb0811f29ec31 /data/weapons.lua
downloadforts_clone-cd0c08dc7ce754473178ad3f32f7740a1dddc1eb.tar.gz
forts_clone-cd0c08dc7ce754473178ad3f32f7740a1dddc1eb.zip
Initial import: LibreForts (M0-M5 in progress)
Open-source Forts clone: custom C++20 engine + data-driven (Lua) 2D physics artillery RTS. - Building: node/strut graph on a stiff mass-spring solver (canon Forts model), triangulation rigidity, axial + 30-degree angle-stress breaking, cascading collapse, fire (DoT + spread), ground destroys debris. - Weapons (M4): cannon (ballistic) + laser (beam/ignite) with select-and-aim-in- arc UX; splash / beam damage; bg-brace passthrough. - Devices + economy (M5): reactors + win/loss + restart, mines/turbines/battery, metal deposits, storage caps, per-shot energy cost. - Data-driven via Lua/sol2 with a layered mod loader; enemy-fort scenario mod. - Renderer: SDL3 + textures + ImGui dev UI. stb_image + ImGui vendored. - Assets: CC0 placeholders only; real game art loaded at runtime from the user's own install via forts: paths (bring-your-own; nothing copyrighted committed). See README.md / CLAUDE.md and research/ + requirements/ for detail.
Diffstat (limited to 'data/weapons.lua')
-rw-r--r--data/weapons.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/data/weapons.lua b/data/weapons.lua
new file mode 100644
index 0000000..8fd2a6b
--- /dev/null
+++ b/data/weapons.lua
@@ -0,0 +1,47 @@
+-- Weapon definitions (values scaled from Forts' data to our world units).
+-- Build modes / firing read the global `Weapons` array; mods may FindWeapon().
+
+Weapons =
+{
+ {
+ name = "cannon", -- ballistic artillery (arcs under gravity)
+ muzzle_speed = 38, -- launch speed (units/s); Forts MuzzleSpeed 6000 cm/s
+ reload = 2.0, -- seconds between shots
+ splash_damage = 200, -- Forts StructureSplashDamage 200
+ splash_radius = 3.0, -- Forts 150 cm ~= 3 units
+ knockback = 55, -- Forts KickbackMean 40 (impulse)
+ projectile_radius = 0.18,
+ fire_chance = 0.25, -- Forts cannon is incendiary (~25%)
+ min_fire_angle = -20, -- firing arc (degrees, rel. to mount) — Forts MinFireAngle
+ max_fire_angle = 30, -- Forts MaxFireAngle
+ energy_cost = 120, -- energy per shot (Forts EnergyFireCost)
+ texture = "data/textures/weapon_turret.png",
+ projectile_texture = "data/textures/projectile_laser.png",
+ },
+ {
+ name = "laser", -- line-of-sight beam; ignites what it hits
+ is_beam = true,
+ reload = 3.0, -- seconds between beams (Forts ReloadTime)
+ beam_range = 70, -- max beam length (units)
+ beam_dps = 90, -- HP/s to the struck strut
+ beam_duration = 1.5, -- Forts BeamDuration 1.5
+ fire_chance = 1.0, -- laser ALWAYS ignites (its whole point)
+ min_fire_angle = -20, -- Forts laser MinFireAngle -20
+ max_fire_angle = 45, -- Forts laser MaxFireAngle 45
+ energy_cost = 200, -- beam is energy-hungry
+ texture = "data/textures/weapon_turret.png",
+ },
+}
+
+function IndexOfWeapon(name)
+ for i, w in ipairs(Weapons) do
+ if w.name == name then return i end
+ end
+ return nil
+end
+
+function FindWeapon(name)
+ local i = IndexOfWeapon(name)
+ if i then return Weapons[i] end
+ return nil
+end