1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
-- Device catalog (reactor / mine / turbine / battery). Values scaled from Forts'
-- devices/*.lua. `texture_forts` is a "forts:REL" path that loads real art from
-- your own Forts install at runtime (nothing copyrighted is stored in the repo);
-- it falls back to `texture` (a CC0 placeholder), then to the flat `color`.
DeviceDefs =
{
{
name = "reactor", is_core = true, -- the core: lose it and the round ends
hp = 100, -- Forts reactor HP 100 (fragile)
energy_rate = 100, metal_rate = 5, -- also the base generator
half_w = 0.7, half_h = 0.9,
texture_forts = "forts:devices/reactor/reactor_core01.tga",
color = { 0.3, 1.0, 0.5 },
},
{
name = "turbine", wind = true, -- energy scales with height above ground
hp = 60, wind_max_rate = 16, wind_max_height = 22,
half_w = 0.5, half_h = 1.3,
cost_metal = 30, cost_energy = 50,
texture_forts = "forts:devices/windturbine/base.tga",
color = { 0.6, 0.8, 1.0 },
},
{
name = "mine", needs_deposit = true, -- only produces on a metal deposit
hp = 80, energy_rate = -5, metal_rate = 4, -- Forts mine: -5 e, +4 metal
half_w = 0.6, half_h = 0.5,
cost_metal = 0, cost_energy = 100,
texture_forts = "forts:devices/mine/base.png",
color = { 0.75, 0.55, 0.2 },
},
{
name = "battery", -- energy storage
hp = 100, energy_storage = 2000, -- Forts battery cap 2000
half_w = 0.6, half_h = 0.6,
cost_metal = 20, cost_energy = 100,
texture_forts = "forts:devices/battery/base.tga",
color = { 0.9, 0.85, 0.3 },
},
}
function IndexOfDevice(name)
for i, d in ipairs(DeviceDefs) do if d.name == name then return i end end
return nil
end
function FindDevice(name)
local i = IndexOfDevice(name); if i then return DeviceDefs[i] end; return nil
end
|