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
|
-- Base building materials for the clone.
--
-- The engine reads the global `Materials` array (in order). Build modes 1/2/3
-- map to entries 1/2/3. 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,
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,
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,
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",
},
}
-- 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
|