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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
-- Base building materials for the clone.
--
-- The engine reads the global `Materials` array (in order). Build modes 1-4
-- map to entries 1-4. Mods under data/mods/ run AFTER this file and may use
-- FindMaterial(name) to tweak these, or table.insert(Materials, ...) to add new
-- ones. (angle_threshold is in DEGREES; the engine converts to radians.)
Materials =
{
{
name = "wood",
stiffness = 600, damping = 12, mass = 0.25,
max_compression = 0.90, max_expansion = 1.10, -- snaps past +/-10% length
angle_threshold = 30, tension_only = false, -- snaps if a loose strut rotates >30deg
min_length = 0.4, max_length = 3.0, max_link_length = 6.0, -- single-strut size limits
hit_points = 150,
flammable = true, burn_rate = 15, spread_time = 2.0, -- wood: slow burn/spread
blocks_projectiles = true, blocks_beam = true, -- solid: stops shells & beams
half_width = 0.15,
cost_metal = 5, cost_energy = 25, -- Forts wood 0.1 / 0.5
color = { 1.0, 1.0, 1.0, 1.0 }, -- white = show texture untinted
texture = "data/textures/wood.png",
texture_forts = "forts:materials/wood_panel.tga",
},
{
name = "bgbrace", -- background bracing
stiffness = 600, damping = 12, mass = 0.25,
max_compression = 0.92, max_expansion = 1.08,
angle_threshold = 30, tension_only = false,
min_length = 0.4, max_length = 3.0, max_link_length = 6.0,
hit_points = 100,
flammable = true, burn_rate = 22, spread_time = 0.7, -- burns ~3x faster than wood
blocks_projectiles = false, blocks_beam = false, -- shells AND beams pass through (beam still burns it)
half_width = 0.15,
cost_metal = 5, cost_energy = 25,
color = { 1.0, 1.0, 1.0, 0.45 }, -- translucent
texture = "data/textures/bgbrace.png",
texture_forts = "forts:materials/bracing-bg.tga",
},
{
name = "rope",
stiffness = 150, damping = 8, mass = 0.05,
max_compression = 0.0, max_expansion = 1.50, -- slack in compression, snaps at +50%
angle_threshold = 360, tension_only = true, -- never snaps on angle
min_length = 0.8, max_length = 1.5, max_link_length = 20.0, -- subdivides into many segments -> drapes
hit_points = 50,
flammable = true, burn_rate = 25, spread_time = 1.0, -- burns through fast
blocks_projectiles = false, blocks_beam = false, -- shells AND beams pass through
half_width = 0.04,
cost_metal = 5, cost_energy = 25,
color = { 0.72, 0.66, 0.55, 1.0 }, -- tan: tints the cable art, and is
-- the visible rope when it is absent
texture_forts = "forts:materials/cable.tga",
},
-- Appended LAST on purpose: build modes map to this array by index, so a new
-- material goes on the end (key 4) rather than shifting bg-brace and rope.
{
name = "armour", -- the kinetic tank
-- Forts armor: 25% stiffer than wood, 2x the mass, HP 400, and it does
-- NOT catch fire (its Fire deg/s is n/a). 3 wood (450 HP) still beats
-- 1 armour (400 HP), so armour buys durability per strut, not per metal.
stiffness = 750, damping = 12, mass = 0.5,
max_compression = 0.90, max_expansion = 1.10, -- same +/-10% as wood
angle_threshold = 30, tension_only = false,
min_length = 0.4, max_length = 3.0, max_link_length = 6.0,
hit_points = 400,
flammable = false, burn_rate = 0, spread_time = 0, -- metal: never burns
blocks_projectiles = true, blocks_beam = true, -- solid
half_width = 0.18, -- reads chunkier than wood
cost_metal = 90, cost_energy = 75, -- Forts 1.8 / 1.5, i.e.
-- 18x wood metal, 3x energy
color = { 0.62, 0.66, 0.70, 1.0 }, -- steel (also the fallback)
texture_forts = "forts:materials/armor.tga",
},
}
-- Helpers mods can use (mirrors the Forts modding API shape).
function IndexOfMaterial(name)
for i, m in ipairs(Materials) do
if m.name == name then return i end
end
return nil
end
function FindMaterial(name)
local i = IndexOfMaterial(name)
if i then return Materials[i] end
return nil
end
|