aboutsummaryrefslogtreecommitdiffstats
path: root/data/materials.lua
diff options
context:
space:
mode:
Diffstat (limited to 'data/materials.lua')
-rw-r--r--data/materials.lua62
1 files changed, 62 insertions, 0 deletions
diff --git a/data/materials.lua b/data/materials.lua
new file mode 100644
index 0000000..a2f876c
--- /dev/null
+++ b/data/materials.lua
@@ -0,0 +1,62 @@
+-- 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",
+ },
+ {
+ 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",
+ },
+ {
+ 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.15, 0.12, 0.10, 1.0 },
+ },
+}
+
+-- 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