From cd0c08dc7ce754473178ad3f32f7740a1dddc1eb Mon Sep 17 00:00:00 2001 From: Vaino Kauppila Date: Thu, 2 Jul 2026 22:58:25 +0300 Subject: 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. --- data/weapons.lua | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 data/weapons.lua (limited to 'data/weapons.lua') 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 -- cgit v1.3