Differences From
Artifact [830720f731]:
89 89 end
90 90
91 91 world.ecology.biomes.foreach('starlit:biome-gen', {}, function(id, b)
92 92 b.def.name = id
93 93 minetest.register_biome(b.def)
94 94 end)
95 95
96 -world.ecology.biomes.link('starlit:steppe', {
97 - nightTempDelta = -30;
98 - waterTempDelta = 0;
99 - -- W Sp Su Au W
100 - seasonalTemp = {-50, -10, 5, 5, -20, -50};
101 - def = {
102 - node_top = 'starlit:greengraze', depth_top = 1;
103 - node_filler = 'starlit:soil', depth_filler = 4;
104 - node_riverbed = 'starlit:sand', depth_riverbed = 4;
105 - y_min = 0;
106 - y_max = 512;
107 - heat_point = 10;
108 - humidity_point = 30;
109 - };
110 -})
111 -
112 -world.ecology.biomes.link('starlit:ocean', {
113 - nightTempDelta = -35;
114 - waterTempDelta = 5;
115 - seasonalTemp = {0}; -- no seasonal variance
116 - def = {
117 - y_max = 3;
118 - y_min = -512;
119 - heat_point = 15;
120 - humidity_point = 50;
121 - node_top = 'starlit:sand', depth_top = 1;
122 - node_filler = 'starlit:sand', depth_filler = 3;
123 - };
124 -})
96 +world.ecology.plants.foreach('starlit:plant-gen', {}, function(id, b)
97 + local stageCt = #b.stages
98 + local function stageID(n)
99 + if n == stageCt then return id end
100 + return id .. string.format('_stage_%s', n)
101 + end
102 + b.stageNodes = {}
103 + local function regStage(n, st)
104 + local base = {
105 + description = b.name;
106 + drawtype = "plantlike";
107 + tiles = { tostring(st.tex) };
108 + paramtype = "light";
109 + paramtype2 = "meshoptions";
110 + walkable = false;
111 + buildable_to = true;
112 + groups = {
113 + plant = 1;
114 + plant_grow = stageCt ~= n and 1 or 0;
115 + };
116 + drop = st.drop;
117 + _starlit = {
118 + plant = {
119 + id = id, stage = n;
120 + };
121 + };
122 + }
123 + if st.swap then
124 + base.node_dig_prediction = stageID(st.swap)
125 + function base.on_dig(pos, node, digger)
126 + node.name = stageID(st.swap)
127 + minetest.swap_node(pos, node)
128 + return true
129 + end
130 + end
131 + return base
132 + end
133 + for i, v in ipairs(b.stages) do
134 + local n = regStage(i, v)
135 + b.stageNodes[i] = n
136 + minetest.register_node(stageID(i), n)
137 + end
138 + b.fullyGrown = stageID(stageCt)
139 +
140 + local dec = {
141 + deco_type = 'simple';
142 + decoration = b.fullyGrown;
143 + height = 1;
144 + param2 = 0;
145 + }
146 + for k,v in pairs(b.decoration) do dec[k] = v end
147 + b.decoration = minetest.register_decoration(dec)
148 +end)
125 149
126 150 local toward = lib.math.toward
127 151 local hfinterval = 1.5
128 152 starlit.startJob('starlit:heatflow', hfinterval, function(delta)
129 153
130 154 -- our base thermal conductivity (κ) is measured in °C/°C/s. say the
131 155 -- player is in -30°C weather, and has an internal temperature of