2 pedology
.wetnames
= {[0] = "dry", "wet", "watery", "sludgy", "muddy", "slurry" }
4 dofile(minetest
.get_modpath("pedology").."/settings.lua")
6 if pedology
.USE_DRIPS
== 1 then
7 dofile(minetest
.get_modpath("pedology").."/drip.lua")
12 function pedology
.ooze(pos
, node
, active_object_count
, active_object_wider
)
13 local wet
= minetest
.get_item_group(node
.name
, "wet")
14 if wet
== 0 then return end
16 --[[ This table contain the nodes which are either neighbors
17 of node or which touch the node at an edge or corner and which are
18 not on a heigher y-level than
22 { -- neighbor directly below
23 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
},
27 { -- touching the lower sides
28 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
-1},
29 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
+1},
30 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
},
31 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
},
34 { -- touching the lower corners
35 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
-1},
36 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
+1},
37 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
-1},
38 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
+1},
39 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
+1},
42 { -- sides on the same level
43 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
}, -- left
44 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
}, -- right
45 {x
=pos
.x
, y
=pos
.y
, z
=pos
.z
-1}, -- before
46 {x
=pos
.x
, y
=pos
.y
, z
=pos
.z
+1}, -- behind
49 { -- touching at the side on the same level
50 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
-1},
51 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
+1},
52 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
-1},
53 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
+1},
59 for j
=1,#neighbors
[i
] do
60 local node
= minetest
.get_node(neighbors
[i
][j
])
61 local name
= node
.name
62 local destwet
= minetest
.get_item_group(name
, "wet")
65 (minetest
.get_item_group(name
, "sucky") >= 1)) and
66 (neighbors
[i
].minwet
<= (wet
- destwet
)) then
67 pedology
.wetten(neighbors
[i
][j
])
75 --[[ This is an ABM action which wettens the node iff many water nodes
76 are neighbors of it or touching it at an edge or corner.]]
77 function pedology
.suck(pos
, node
, active_object_count
, active_object_wider
)
78 local wet
= minetest
.get_item_group(node
.name
, "wet")
82 -- These three tables contain the positions of all nodes around node
85 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
}, -- below
86 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
}, -- left
87 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
}, -- right
88 {x
=pos
.x
, y
=pos
.y
+1, z
=pos
.z
}, -- above
89 {x
=pos
.x
, y
=pos
.y
, z
=pos
.z
-1}, -- before
90 {x
=pos
.x
, y
=pos
.y
, z
=pos
.z
+1}, -- behind
94 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
-1},
95 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
+1},
96 {x
=pos
.x
, y
=pos
.y
+1, z
=pos
.z
-1},
97 {x
=pos
.x
, y
=pos
.y
+1, z
=pos
.z
+1},
98 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
-1},
99 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
+1},
100 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
-1},
101 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
+1},
102 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
},
103 {x
=pos
.x
-1, y
=pos
.y
+1, z
=pos
.z
},
104 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
},
105 {x
=pos
.x
+1, y
=pos
.y
+1, z
=pos
.z
},
109 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
-1},
110 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
+1},
111 {x
=pos
.x
-1, y
=pos
.y
+1, z
=pos
.z
-1},
112 {x
=pos
.x
-1, y
=pos
.y
+1, z
=pos
.z
+1},
113 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
-1},
114 {x
=pos
.x
+1, y
=pos
.y
+1, z
=pos
.z
+1},
115 {x
=pos
.x
+1, y
=pos
.y
+1, z
=pos
.z
-1},
116 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
+1},
117 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
+1},
122 for i
=1,#neighbors
do
123 for j
=1,#neighbors
[i
] do
124 local neighbor
= minetest
.get_node(neighbors
[i
][j
])
125 local name
= neighbor
.name
126 local water
= minetest
.get_item_group(name
, "water")
128 score
= score
+ neighbors
[i
].rating
134 if(wet
== 0 and score
>= 1) then
136 elseif(wet
== 1 and score
>= 2) then
138 elseif(wet
== 2 and score
>= 3) then
140 elseif(wet
== 3 and score
>= 5) then
142 elseif(wet
== 4 and score
>= 8) then
144 elseif(wet
== 5 and score
>= 11) then
145 -- erosion: turn node into water
146 -- TODO: Also drop the drops
147 minetest
.set_node(pos
, {name
="pedology:water_fresh_source"})
151 if(wetten
==true) then
156 --[[ ABM action which dries out a node when it is in direct sunlight ]]
157 function pedology
.sun_dry(pos
, node
, active_object_count
, active_object_wider
)
158 if(minetest
.get_item_group(node
.name
, "wet") < 6) then
159 -- don’t dry off if there is water nearby
160 if(not minetest
.find_node_near(pos
, 1, {"group:water"})) then
161 local light
= minetest
.get_node_light(pos
, minetest
.get_timeofday())
162 if light
>= pedology
.DRY_LIGHT
then
172 function pedology
.register_liquid(basename
, description
, alpha
, viscosity
, drowning
, damage_per_second
, post_effect_color
, additional_groups
)
173 flowing_groups
= {wet
=6,not_in_creative_inventory
=1}
174 source_groups
= {wet
=6}
175 for k
,v
in pairs(additional_groups
) do
176 flowing_groups
[k
] = v
180 local tile
= "pedology_"..basename
..".png"
181 local nodedef_source
= {
182 description
= description
.." source",
183 inventory_image
= minetest
.inventorycube(tile
),
192 liquid_alternative_flowing
= "pedology:"..basename
.."_flowing",
193 liquid_alternative_source
= "pedology:"..basename
.."_source",
194 liquid_viscosity
= viscosity
,
195 post_effect_color
= post_effect_color
,
197 damage_per_second
= damage_per_second
,
200 liquidtype
= "source",
201 groups
= source_groups
,
203 minetest
.register_node("pedology:"..basename
.."_source", nodedef_source
)
205 local nodedef_flowing
= {
206 description
= description
.." flowing",
207 inventory_image
= minetest
.inventorycube(tile
),
216 liquid_alternative_flowing
= "pedology:"..basename
.."_flowing",
217 liquid_alternative_source
= "pedology:"..basename
.."_source",
218 liquid_viscosity
= viscosity
,
219 post_effect_color
= post_effect_color
,
221 damage_per_second
= damage_per_second
,
223 drawtype
= "flowingliquid",
224 liquidtype
= "flowing",
225 groups
= flowing_groups
,
226 paramtype2
= "flowingliquid",
229 minetest
.register_node("pedology:"..basename
.."_flowing", nodedef_flowing
)
233 pedology
.register_liquid("water_fresh", "freshwater", 100, 1, 2, 0, {a
=60, r
=100, b
=200, g
=100}, {water
=1})
234 --pedology.register_liquid("water_salt", "salt water", 180, 2, 4, 0, {a=80, r=120, b=200, g=120}, {water=1})
235 pedology
.register_liquid("water_ponding", "ponding water", 234, 4, 3, 0, {a
=128, r
=85, g
=85, g
=60}, {water
=1})
238 TODO: Decide wheather to keep or to remove lava
239 pedology.register_liquid("lava_1", "very hot lava", 230, 2, 10, 8, {a=230, r=255, g=0, b=0}, {hot=6000, lava=1})
240 pedology.register_liquid("lava_2", "hot lava", 230, 3, 9, 7, {a=230, r=255, g=0, b=0}, {hot=5000, lava=1})
241 pedology.register_liquid("lava_3", "lava", 230, 4, 8, 6, {a=230, r=255, g=0, b=0}, {hot=4000, lava=1})
242 pedology.register_liquid("lava_4", "cold lava", 230, 5, 7, 6, {a=230, r=255, g=0, b=0}, {hot=3000, lava=1})
245 --[[ Water drip function ]]
246 function pedology
.drip_particle(pos
, wet
)
247 local below1
= minetest
.get_node({x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
})
248 local below2
= minetest
.get_node({x
=pos
.x
, y
=pos
.y
-2, z
=pos
.z
})
249 if(below1
.name
== "air" and below2
.name
== "air") then
250 return minetest
.add_particlespawner(
253 { x
=pos
.x
-(45/100), y
=pos
.y
- 0.5, z
=pos
.z
-(45/100) }, -- minpos
254 { x
=pos
.x
+(45/100), y
=pos
.y
- 0.5, z
=pos
.z
+(45/100) }, -- maxpos
255 { x
=0, y
=-9.80, z
=0 }, { x
=0, y
=0, z
=0 }, -- minvel, maxvel
256 { x
=0, y
=-9.82, z
=0 }, { x
=0, y
=0, z
=0 }, -- minacc, maxacc
257 1, 3, -- minexptime, maxexptime
258 1, 1, -- minsize, maxsize
259 false, -- collisiondetection
260 "pedology_water_fresh.png" -- texture
262 --[[ For future Lua API
266 minpos = { pos.x -(45/100), pos.y - 0.5, pos.z -(45/100) },
267 maxpos = { pos.x +(45/100), pos.y - 0.5, pos.z +(45/100) },
268 minvel = { 0, -9.81, 0 },
269 maxvel = { 0, 0, 0 },
272 collisiondetection = true,
274 texture = "pedology_water_fresh.png",
282 --[[ register a sucky/oozing node to this mod ]]
283 function pedology
.register_sucky(basename
, description
, wetness
, oozing
, sucky
, melting_point
, drop
, sounds
, additional_groups
)
284 local wetname
= basename
.."_"..tostring(wetness
)
286 local groups
= { sucky
=sucky
, oozing
=oozing
, wet
=wetness
, melting_point
=melting_point
, not_in_creative_inventory
= noncreative
, [basename
]=1 }
287 if additional_groups
~= nil then
288 for k
,v
in pairs(additional_groups
) do
293 local name
= "pedology:"..wetname
296 -- If the node is not dry, do not add it into the creative inventory
297 if wetness
== 0 then noncreative
= 0 else noncreative
= 1 end
298 if pedology
.USE_DRIPS
== 2 then
299 on_construct
= function(pos
)
300 local dripper
= pedology
.drip_particle(pos
, wetness
)
301 if(dripper
~= nil) then
302 local meta
= minetest
.get_meta(pos
)
303 meta
:set_int("dripper", dripper
)
306 on_destruct
= function(pos
)
307 local meta
= minetest
.get_meta(pos
)
308 local dripper
= meta
:get_int("dripper")
309 if(dripper
~= nil) then
310 minetest
.delete_particlespawner(dripper
)
314 on_construct
, after_destruct
= nil
317 description
= description
,
318 inventory_image
= minetest
.inventorycube("pedology_"..wetname
..".png"),
319 tiles
= {"pedology_"..wetname
..".png"},
324 is_ground_content
= true,
325 on_construct
= on_construct
,
326 on_destruct
= on_destruct
,
328 minetest
.register_node(name
, nodedef
)
336 This function registers a couple of sucky/oozing nodes, including all their “wet” variants.
337 It also registers an ABM.
340 basename: The internal name piece from which the concrete basenames will be build. The wetness level will be appended.
341 basedescription. The description of the nodes. A proper wetness adjective (“dry”, “wet”, …) will be prepended.
342 lumpdescription. The description component of the “lump” of the node. If nil, no lump is used
343 maxwet: The maximum wetness level of this node group (minimum: 0, maximum: 5)
344 maxlump: The maximum wetness level of lumps of this node group (minimum: 0, recommended maximum: 3)
345 oozeinterval: The interval in seconds in which it the node may ooze. the Minimal value: 1
346 oozechance: The inverted chance (1/x) to ooze
347 melttable: Table of melting_point values for each wetness level
348 dropcount: How many lumps nodes of this group drop. If 0, the nodes simply drop themselves (not recommended!)
349 sounds: Sound specification for all nodes
350 additional_groups: Either a table of tables of strings, a table of strings or nil. If it is nil, no additional groups will be added to all nodes. If it is a table, the strings are interpreted as group names which will be added to each node. If it is a table of tables strings, you can specify the groups tables for each wetness level (start with index number 0 for dry).
352 function pedology
.register_sucky_group(basename
, basedescription
, lumpbasedescription
, maxwet
, maxlump
, oozeinterval
, oozechance
, melttable
, dropcount
, sounds
, additional_groups
)
353 local oozing
, dripinterval
354 local m
-- melting_point
355 local lumpdescription
357 local nestedgroups
= false
358 if(type(additional_groups
) == "table") then
359 if(type(additional_groups
[0]) == "table") then
365 if(w
==0) then oozing
=0 else oozing
=1 end
366 if (w
==maxwet
and w
~= 5) then sucky
=0 else sucky
=1 end
367 if melttable
== nil then m
= 0 else m
= melttable
[w
] end
368 if( lumpbasedescription
~= nil) then
369 lumpdescription
= (pedology
.wetnames
[w
]).." "..lumpbasedescription
371 lumpdescription
= nil
374 local itemname
, drop
, itemdef
375 if( maxlump
== -1) then
377 elseif( w
> maxlump
) then
378 itemname
= "pedology:lump_"..basename
.."_"..tostring(maxlump
)
379 drop
= itemname
.. " " .. tostring(dropcount
)
381 itemname
= "pedology:lump_"..basename
.."_"..tostring(w
)
382 drop
= itemname
.. " " .. tostring(dropcount
)
384 description
= lumpdescription
,
385 inventory_image
= "pedology_lump_inv_"..basename
.."_"..tostring(w
)..".png",
386 wield_image
= "pedology_lump_"..basename
.."_"..tostring(w
)..".png"
388 minetest
.register_craftitem("pedology:lump_"..basename
.."_"..tostring(w
), itemdef
)
390 if(nestedgroups
) then
391 groups
= additional_groups
[w
]
393 groups
= additional_groups
395 pedology
.register_sucky(basename
, (pedology
.wetnames
[w
]).." "..basedescription
, w
, oozing
, sucky
, m
, drop
, sounds
, groups
)
397 if(w
>0 and pedology
.USE_DRIPS
== 1) then
398 minetest
.register_abm({
399 nodenames
= {"pedology:"..basename
.."_"..tostring(w
)},
401 interval
= math
.max(oozeinterval
/4,2),
402 chance
= math
.max(oozechance
,22),
403 action
= pedology
.create_drip
,
408 minetest
.register_abm({
409 nodenames
= {"group:"..basename
},
410 neighbors
= {"group:sucky"},
411 interval
= oozeinterval
,
413 action
= pedology
.ooze
,
421 local sound_clay
= {footstep
= {name
="pedology_clay_footstep", gain
=0.5}}
422 local sound_silt_fine
= {footstep
= {name
="pedology_silt_footstep", gain
=0.3}}
423 local sound_silt_medium
= {footstep
= {name
="pedology_silt_footstep", gain
=0.35}}
424 local sound_silt_coarse
= {footstep
= {name
="pedology_silt_footstep", gain
=0.4}}
425 local sound_sand_fine
= {footstep
= {name
="pedology_sand_footstep", gain
=0.2}}
426 local sound_sand_medium
= {footstep
= {name
="pedology_sand_footstep", gain
=0.25}}
427 local sound_sand_coarse
= {footstep
= {name
="pedology_sand_footstep", gain
=0.3}}
428 local sound_gravel_fine
= {footstep
= {name
="pedology_gravel_footstep", gain
=1}}
429 local sound_gravel_medium
= {footstep
= {name
="pedology_gravel_footstep", gain
=1}}
430 local sound_gravel_coarse
= {footstep
= {name
="pedology_gravel_footstep", gain
=1}}
432 --[[ register sucky and oozing nodes ]]
434 pedology
.register_sucky_group("clay", "clay", "clay lump",
435 5, 3, 60, 1.25, {3000, 3100, 3200, 3500, 3550, 3600}, 4, sound_clay
, { crumbly
= 3, sun_dry
= 1})
436 pedology
.register_sucky_group("silt_fine", "fine silt", "fine silt lump",
437 5, 3, 45, 1.25, {2800, 2900, 3000, 3100, 3200, 3300}, 4, sound_silt_fine
, { crumbly
= 3, sun_dry
= 1 })
438 pedology
.register_sucky_group("silt_medium", "medium silt", "medium silt lump",
439 4, 3, 30, 1.25, {2600, 2800, 3200, 3800, 4200}, 4, sound_silt_medium
, { crumbly
= 3, sun_dry
= 1 })
440 pedology
.register_sucky_group("silt_coarse", "coarse silt", "coarse silt lump",
441 3, 3, 20, 1.25, {2000, 2200, 2400, 2800}, 2, sound_silt_coarse
, { crumbly
= 3, sun_dry
= 1 })
442 pedology
.register_sucky_group("sand_fine", "fine sand", "fine sand pile",
443 2, 0, 10, 1.111111, {1100, 1200, 1300}, 2, sound_sand_fine
, { crumbly
= 3, sand
= 1, sun_dry
= 1 })
444 pedology
.register_sucky_group("sand_medium", "medium sand", "medium sand pile",
445 1, 0, 5, 1.111111, {990, 1100}, 2, sound_sand_medium
, { crumbly
= 3, sand
= 1, sun_dry
= 1 })
446 pedology
.register_sucky_group("sand_coarse", "coarse sand", "coarse sand pile",
447 0, 0, nil, nil, {900}, 1, sound_sand_coarse
, { crumbly
= 3, sand
= 1, sun_dry
= 1 })
448 pedology
.register_sucky_group("gravel_fine", "fine gravel", "pebble",
449 1, 0, 2, 1, {670, 770}, 9, sound_gravel_fine
, { crumbly
= 2, sun_dry
= 1 })
450 pedology
.register_sucky_group("gravel_medium", "medium gravel", "medium stone",
451 2, 0, 1.5, 1, {600, 800, 1250}, 3, sound_gravel_medium
, { crumbly
= 2, sun_dry
= 1})
452 pedology
.register_sucky_group("gravel_coarse", "coarse gravel", "big stone",
453 2, 0, 1, 1, {500, 750, 1000}, 1, sound_gravel_coarse
, { crumbly
= 1, sun_dry
= 1 })
457 -- TODO: slushy snow is very instable snow; it should be destroyed when touched
458 minetest
.register_node("pedology:snow_slush", {
459 description
= "slushy snow",
460 tiles
= { "pedology_snow_slush.png" },
461 sounds
= { footstep
= { name
= "pedology_snow_soft_footstep", gain
= 1 } },
462 is_ground_content
= true,
463 groups
= { crumbly
= 1, level
= 1, melts
= 1, falling_node
= 1},
464 freezemelt
= "pedology:water_fresh_source",
467 minetest
.register_node("pedology:snow_soft", {
468 description
= "soft snow",
469 tiles
= { "pedology_snow_soft.png" },
470 sounds
= { footstep
= { name
= "pedology_snow_soft_footstep", gain
= 1 } },
471 is_ground_content
= true,
472 groups
= { crumbly
= 2, level
= 2, melts
= 1, falling_node
= 1 },
473 freezemelt
= "pedology:water_fresh_source",
476 minetest
.register_node("pedology:snow", {
477 description
= "snow",
478 tiles
= { "pedology_snow.png" },
479 sounds
= { footstep
= { name
= "pedology_snow_footstep", gain
= 0.9 } },
480 is_ground_content
= true,
481 groups
= { crumbly
= 3, level
= 3, melts
= 1, falling_node
= 1 },
482 freezemelt
= "pedology:water_fresh_source",
485 minetest
.register_node("pedology:snow_packing", {
486 description
= "packing snow",
487 tiles
= { "pedology_snow_packing.png" },
488 sounds
= { footstep
= { name
= "pedology_snow_footstep", gain
= 1 } },
489 is_ground_content
= true,
490 groups
= { crumbly
= 3, level
= 3, melts
= 1 },
491 freezemelt
= "pedology:water_fresh_source",
494 minetest
.register_node("pedology:snow_firn", {
495 description
= "firn",
496 tiles
= { "pedology_snow_firn.png" },
497 sounds
= { footstep
= { name
= "pedology_ice_white_footstep", gain
= 0.7 } },
498 is_ground_content
= true,
499 groups
= { crumbly
= 2, cracky
= 2, level
= 4, melts
= 1 },
500 freezemelt
= "pedology:water_fresh_source",
503 minetest
.register_node("pedology:ice_white", {
504 description
= "white ice",
505 tiles
= { "pedology_ice_white.png" },
506 sounds
= { footstep
= { name
= "pedology_ice_white_footstep", gain
= 0.8 } },
507 is_ground_content
= true,
508 groups
= { cracky
= 3, level
= 1, melts
= 1 },
509 freezemelt
= "pedology:water_fresh_source",
512 minetest
.register_node("pedology:ice_pure", {
513 description
= "pure ice",
514 drawtype
= "glasslike",
516 tiles
= { "pedology_ice_pure.png" },
517 inventory_image
= minetest
.inventorycube( "pedology_ice_pure.png" ),
518 sounds
= { footstep
= { name
= "pedology_ice_pure_footstep", gain
= 0.8 } },
519 is_ground_content
= true,
520 groups
= { cracky
= 3, level
= 2, melts
= 1 },
521 freezemelt
= "pedology:water_fresh_source",
525 pedology.register_liquid("clay_3", "sludgy clay", 192, 6, 5, 0, {a=192, r=104, g=23, b=0}, {oozing=1})
526 pedology.register_liquid("clay_4", "muddy clay", 156, 4, 5, 0, {a=156, r=123, g=57, b=6}, {oozing=1})
527 pedology.register_liquid("clay_5", "slurry clay", 128, 2, 5, 0, {a=128, r=146, g=85, b=73}, {oozing=1})
531 pedology
.register_sucky_group("turf_fibric", "fibric turf", "fibric turf cutting",
532 2, 2, 120, 1.25, {1000, 1100, 1200}, 4, sound_silt_coarse
, { [0] = { crumbly
= 3, flammable
= 1 }, { crumbly
= 3 }, {crumbly
= 3} } )
533 pedology
.register_sucky_group("turf_hemic", "hemic turf", "hemic turf cutting",
534 2, 2, 180, 1.225, {1100, 1200, 1300}, 3, sound_silt_coarse
, { [0] = { crumbly
= 3, flammable
= 1 }, { crumbly
= 3 }, { crumbly
= 3 } } )
535 pedology
.register_sucky_group("turf_sapric", "sapric turf", "sapric turf cutting",
536 2, 2, 240, 1.2, {1200, 1300, 1400}, 2, sound_silt_coarse
, { [0] = { crumbly
= 3, flammable
= 1 }, { crumbly
= 3 }, { crumbly
= 3 } } )
538 minetest
.register_craft({
540 recipe
= "pedology:turf_fibric_0",
543 minetest
.register_craft({
545 recipe
= "pedology:turf_hemic_0",
548 minetest
.register_craft({
550 recipe
= "pedology:turf_sapric_0",
554 minetest
.register_craft({
556 recipe
= "pedology:lump_turf_fibric_0",
559 minetest
.register_craft({
561 recipe
= "pedology:lump_turf_hemic_0",
564 minetest
.register_craft({
566 recipe
= "pedology:lump_turf_sapric_0",
574 pedology
.maxwet
.clay
= 5
575 pedology
.maxwet
.silt_fine
= 5
576 pedology
.maxwet
.silt_medium
= 4
577 pedology
.maxwet
.silt_coarse
= 3
578 pedology
.maxwet
.sand_fine
= 2
579 pedology
.maxwet
.sand_medium
= 1
580 pedology
.maxwet
.sand_coarse
= 0
581 pedology
.maxwet
.gravel_fine
= 1
582 pedology
.maxwet
.gravel_medium
= 2
583 pedology
.maxwet
.gravel_coarse
= 2
585 pedology
.maxwet
.turf_fibric
= 2
586 pedology
.maxwet
.turf_hemic
= 2
587 pedology
.maxwet
.turf_sapric
= 2
589 --[[ “API” functions ]]
590 --[[ Replace the node at <pos> with a node with a “drier” version of it, if available ]]
591 function pedology
.dry(pos
)
592 local node
= minetest
.get_node(pos
)
593 local wet
= minetest
.get_item_group(node
.name
, "wet")
594 local dried
= tostring(wet
- 1)
598 local newbasename
= string.sub(node
.name
,1,#node
.name
-1)
599 newbasename
= newbasename
.. dried
600 minetest
.set_node(pos
, {name
=newbasename
, param1
=0, param2
=0})
603 --[[ Replace the node at <pos> with a “wetter” version of it, if available ]]
604 function pedology
.wetten(pos
)
605 local node
= minetest
.get_node(pos
)
606 local wet
= minetest
.get_item_group(node
.name
, "wet")
607 local cutbasename
= string.sub(node
.name
,10,#node
.name
-2)
608 if pedology
.maxwet
[cutbasename
] == nil then
610 elseif wet
> pedology
.maxwet
[cutbasename
] then
614 local newbasename
= string.sub(node
.name
,1,#node
.name
-1) .. tostring(wet
+1)
615 minetest
.set_node(pos
, {name
=newbasename
, param1
=0, param2
=0})
618 --[[ register ABMs ]]
619 minetest
.register_abm({
620 nodenames
= {"group:sun_dry"},
624 action
= pedology
.sun_dry
,
627 minetest
.register_abm({
628 nodenames
= {"group:sucky"},
629 neighbors
= {"group:water"},
632 action
= pedology
.suck
,
635 minetest
.register_abm({
636 nodenames
= {"group:melting_point"},
637 neighbors
= {"group:hot"},
640 action
= function(pos
,node
,...)
641 minetest
.set_node(pos
,node
)