2 if (minetest
.get_modpath("intllib")) then
5 S
= function ( s
) return s
end
9 pedology
.wetnames
= {[0] = "dry", "wet", "watery", "sludgy", "muddy", "slurry" }
11 dofile(minetest
.get_modpath("pedology").."/settings.lua")
13 if pedology
.USE_DRIPS
== 1 then
14 dofile(minetest
.get_modpath("pedology").."/drip.lua")
19 function pedology
.ooze(pos
, node
, active_object_count
, active_object_wider
)
20 local wet
= minetest
.get_item_group(node
.name
, "wet")
21 if wet
== 0 then return end
23 --[[ This table contain the nodes which are either neighbors
24 of node or which touch the node at an edge or corner and which are
25 not on a heigher y-level than
29 { -- neighbor directly below
30 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
},
34 { -- touching the lower sides
35 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
-1},
36 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
+1},
37 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
},
38 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
},
41 { -- touching the lower corners
42 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
-1},
43 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
+1},
44 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
-1},
45 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
+1},
46 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
+1},
49 { -- sides on the same level
50 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
}, -- left
51 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
}, -- right
52 {x
=pos
.x
, y
=pos
.y
, z
=pos
.z
-1}, -- before
53 {x
=pos
.x
, y
=pos
.y
, z
=pos
.z
+1}, -- behind
56 { -- touching at the side on the same level
57 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
-1},
58 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
+1},
59 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
-1},
60 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
+1},
66 for j
=1,#neighbors
[i
] do
67 local node
= minetest
.get_node(neighbors
[i
][j
])
68 local name
= node
.name
69 local destwet
= minetest
.get_item_group(name
, "wet")
72 (minetest
.get_item_group(name
, "sucky") >= 1)) and
73 (neighbors
[i
].minwet
<= (wet
- destwet
)) then
74 pedology
.wetten(neighbors
[i
][j
])
82 --[[ This is an ABM action which wettens the node iff many water nodes
83 are neighbors of it or touching it at an edge or corner.]]
84 function pedology
.suck(pos
, node
, active_object_count
, active_object_wider
)
85 local wet
= minetest
.get_item_group(node
.name
, "wet")
89 -- These three tables contain the positions of all nodes around node
92 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
}, -- below
93 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
}, -- left
94 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
}, -- right
95 {x
=pos
.x
, y
=pos
.y
+1, z
=pos
.z
}, -- above
96 {x
=pos
.x
, y
=pos
.y
, z
=pos
.z
-1}, -- before
97 {x
=pos
.x
, y
=pos
.y
, z
=pos
.z
+1}, -- behind
101 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
-1},
102 {x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
+1},
103 {x
=pos
.x
, y
=pos
.y
+1, z
=pos
.z
-1},
104 {x
=pos
.x
, y
=pos
.y
+1, z
=pos
.z
+1},
105 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
-1},
106 {x
=pos
.x
-1, y
=pos
.y
, z
=pos
.z
+1},
107 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
-1},
108 {x
=pos
.x
+1, y
=pos
.y
, z
=pos
.z
+1},
109 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
},
110 {x
=pos
.x
-1, y
=pos
.y
+1, z
=pos
.z
},
111 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
},
112 {x
=pos
.x
+1, y
=pos
.y
+1, z
=pos
.z
},
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},
118 {x
=pos
.x
-1, y
=pos
.y
+1, z
=pos
.z
-1},
119 {x
=pos
.x
-1, y
=pos
.y
+1, z
=pos
.z
+1},
120 {x
=pos
.x
-1, y
=pos
.y
-1, z
=pos
.z
-1},
121 {x
=pos
.x
+1, y
=pos
.y
+1, z
=pos
.z
+1},
122 {x
=pos
.x
+1, y
=pos
.y
+1, z
=pos
.z
-1},
123 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
+1},
124 {x
=pos
.x
+1, y
=pos
.y
-1, z
=pos
.z
+1},
129 for i
=1,#neighbors
do
130 for j
=1,#neighbors
[i
] do
131 local neighbor
= minetest
.get_node(neighbors
[i
][j
])
132 local name
= neighbor
.name
133 local water
= minetest
.get_item_group(name
, "water")
135 score
= score
+ neighbors
[i
].rating
141 if(wet
== 0 and score
>= 1) then
143 elseif(wet
== 1 and score
>= 2) then
145 elseif(wet
== 2 and score
>= 3) then
147 elseif(wet
== 3 and score
>= 5) then
149 elseif(wet
== 4 and score
>= 8) then
151 elseif(wet
== 5 and score
>= 11) then
152 -- erosion: turn node into water
153 -- TODO: Also drop the drops
154 minetest
.set_node(pos
, {name
="pedology:water_fresh_source"})
158 if(wetten
==true) then
163 --[[ ABM action which dries out a node when it is in direct sunlight ]]
164 function pedology
.sun_dry(pos
, node
, active_object_count
, active_object_wider
)
165 if(minetest
.get_item_group(node
.name
, "wet") < 6) then
166 -- don’t dry off if there is water nearby
167 if(not minetest
.find_node_near(pos
, 1, {"group:water"})) then
168 local light
= minetest
.get_node_light(pos
, minetest
.get_timeofday())
169 if light
>= pedology
.DRY_LIGHT
then
179 function pedology
.register_liquid(basename
, description
, alpha
, viscosity
, drowning
, damage_per_second
, post_effect_color
, additional_groups
)
180 local flowing_groups
= {wet
=6,liquid
=1,not_in_creative_inventory
=1}
181 local source_groups
= {wet
=6,liquid
=1}
182 for k
,v
in pairs(additional_groups
) do
183 flowing_groups
[k
] = v
187 local tile
= "pedology_"..basename
..".png"
188 local nodedef_source
= {
189 description
= S(description
.." source"),
190 inventory_image
= minetest
.inventorycube(tile
),
192 special_tiles
= {{name
=tile
, backface_culling
=false}},
200 liquid_alternative_flowing
= "pedology:"..basename
.."_flowing",
201 liquid_alternative_source
= "pedology:"..basename
.."_source",
202 liquid_viscosity
= viscosity
,
203 post_effect_color
= post_effect_color
,
205 damage_per_second
= damage_per_second
,
208 liquidtype
= "source",
209 groups
= source_groups
,
211 minetest
.register_node("pedology:"..basename
.."_source", nodedef_source
)
213 local nodedef_flowing
= {
214 description
= S("flowing "..description
),
215 inventory_image
= minetest
.inventorycube(tile
),
217 special_tiles
= {{name
=tile
, backface_culling
=false}, {name
=tile
, backface_culling
=true}},
225 liquid_alternative_flowing
= "pedology:"..basename
.."_flowing",
226 liquid_alternative_source
= "pedology:"..basename
.."_source",
227 liquid_viscosity
= viscosity
,
228 post_effect_color
= post_effect_color
,
230 damage_per_second
= damage_per_second
,
232 drawtype
= "flowingliquid",
233 liquidtype
= "flowing",
234 groups
= flowing_groups
,
235 paramtype2
= "flowingliquid",
238 minetest
.register_node("pedology:"..basename
.."_flowing", nodedef_flowing
)
242 pedology
.register_liquid("water_fresh", "freshwater", 100, 1, 2, 0, {a
=60, r
=100, b
=200, g
=100}, {water
=1})
243 --pedology.register_liquid("water_salt", "salt water", 180, 2, 4, 0, {a=80, r=120, b=200, g=120}, {water=1})
244 pedology
.register_liquid("water_ponding", "ponding water", 234, 4, 3, 0, {a
=128, r
=85, g
=85, g
=60}, {water
=1})
246 --[[ Water drip function ]]
247 function pedology
.drip_particle(pos
, wet
)
248 local below1
= minetest
.get_node({x
=pos
.x
, y
=pos
.y
-1, z
=pos
.z
})
249 local below2
= minetest
.get_node({x
=pos
.x
, y
=pos
.y
-2, z
=pos
.z
})
250 if(below1
.name
== "air" and below2
.name
== "air") then
251 return minetest
.add_particlespawner(
254 { x
=pos
.x
-(45/100), y
=pos
.y
- 0.5, z
=pos
.z
-(45/100) }, -- minpos
255 { x
=pos
.x
+(45/100), y
=pos
.y
- 0.5, z
=pos
.z
+(45/100) }, -- maxpos
256 { x
=0, y
=0, z
=0 }, { x
=0, y
=0, z
=0 }, -- minvel, maxvel
257 { x
=0, y
=-9.82, z
=0 }, { x
=0, y
=-9.80, z
=0 }, -- minacc, maxacc
258 1, 3, -- minexptime, maxexptime
259 1, 1, -- minsize, maxsize
260 false, -- collisiondetection
261 "pedology_water_fresh.png" -- texture
263 --[[ For future Lua API
267 minpos = { pos.x -(45/100), pos.y - 0.5, pos.z -(45/100) },
268 maxpos = { pos.x +(45/100), pos.y - 0.5, pos.z +(45/100) },
269 minvel = { 0, -9.81, 0 },
270 maxvel = { 0, 0, 0 },
273 collisiondetection = true,
275 texture = "pedology_water_fresh.png",
283 --[[ register a sucky/oozing node to this mod ]]
284 function pedology
.register_sucky(basename
, description
, wetness
, oozing
, sucky
, melting_point
, drop
, sounds
, additional_groups
)
285 local wetname
= basename
.."_"..tostring(wetness
)
287 local groups
= { sucky
=sucky
, oozing
=oozing
, wet
=wetness
, melting_point
=melting_point
, not_in_creative_inventory
= noncreative
, [basename
]=1 }
288 if additional_groups
~= nil then
289 for k
,v
in pairs(additional_groups
) do
294 local name
= "pedology:"..wetname
297 -- If the node is not dry, do not add it into the creative inventory
298 if wetness
== 0 then noncreative
= 0 else noncreative
= 1 end
299 local on_construct
, on_destruct
300 if pedology
.USE_DRIPS
== 2 then
301 on_construct
= function(pos
)
302 local dripper
= pedology
.drip_particle(pos
, wetness
)
303 if(dripper
~= nil) then
304 local meta
= minetest
.get_meta(pos
)
305 meta
:set_int("dripper", dripper
)
308 on_destruct
= function(pos
)
309 local meta
= minetest
.get_meta(pos
)
310 local dripper
= meta
:get_int("dripper")
311 if(dripper
~= nil) then
312 minetest
.delete_particlespawner(dripper
)
316 on_construct
, on_destruct
= nil
319 description
= S(description
),
320 inventory_image
= minetest
.inventorycube("pedology_"..wetname
..".png"),
321 tiles
= {"pedology_"..wetname
..".png"},
326 is_ground_content
= true,
327 on_construct
= on_construct
,
328 on_destruct
= on_destruct
,
330 minetest
.register_node(name
, nodedef
)
338 This function registers a couple of sucky/oozing nodes, including all their “wet” variants.
339 It also registers an ABM.
342 basename: The internal name piece from which the concrete basenames will be build. The wetness level will be appended.
343 basedescription. The description of the nodes. A proper wetness adjective (“dry”, “wet”, …) will be prepended.
344 lumpdescription. The description component of the “lump” of the node. If nil, no lump is used
345 maxwet: The maximum wetness level of this node group (minimum: 0, maximum: 5)
346 maxlump: The maximum wetness level of lumps of this node group (minimum: 0, recommended maximum: 3)
347 oozeinterval: The interval in seconds in which it the node may ooze. the Minimal value: 1
348 oozechance: The inverted chance (1/x) to ooze
349 melttable: Table of melting_point values for each wetness level
350 dropcount: How many lumps nodes of this group drop. If 0, the nodes simply drop themselves (not recommended!)
351 sounds: Sound specification for all nodes
352 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).
354 function pedology
.register_sucky_group(basename
, basedescription
, lumpbasedescription
, maxwet
, maxlump
, oozeinterval
, oozechance
, melttable
, dropcount
, sounds
, additional_groups
)
355 local sucky
, oozing
, dripinterval
356 local m
-- melting_point
357 local lumpdescription
359 local nestedgroups
= false
360 if(type(additional_groups
) == "table") then
361 if(type(additional_groups
[0]) == "table") then
367 if(w
==0) then oozing
=0 else oozing
=1 end
368 if (w
==maxwet
and w
~= 5) then sucky
=0 else sucky
=1 end
369 if melttable
== nil then m
= 0 else m
= melttable
[w
] end
370 if( lumpbasedescription
~= nil) then
371 lumpdescription
= S((pedology
.wetnames
[w
]).." "..lumpbasedescription
)
373 lumpdescription
= nil
376 local itemname
, drop
, itemdef
377 if( maxlump
== -1) then
379 elseif( w
> maxlump
) then
380 itemname
= "pedology:lump_"..basename
.."_"..tostring(maxlump
)
381 drop
= itemname
.. " " .. tostring(dropcount
)
383 itemname
= "pedology:lump_"..basename
.."_"..tostring(w
)
384 drop
= itemname
.. " " .. tostring(dropcount
)
386 description
= S(lumpdescription
),
387 inventory_image
= "pedology_lump_inv_"..basename
.."_"..tostring(w
)..".png",
388 wield_image
= "pedology_lump_"..basename
.."_"..tostring(w
)..".png"
390 minetest
.register_craftitem("pedology:lump_"..basename
.."_"..tostring(w
), itemdef
)
392 if(nestedgroups
) then
393 groups
= additional_groups
[w
]
395 groups
= additional_groups
398 groups
["disable_jump"] = 1
400 pedology
.register_sucky(basename
, S((pedology
.wetnames
[w
]).." "..basedescription
), w
, oozing
, sucky
, m
, drop
, sounds
, groups
)
402 if(w
>0 and pedology
.USE_DRIPS
== 1) then
403 minetest
.register_abm({
404 nodenames
= {"pedology:"..basename
.."_"..tostring(w
)},
406 interval
= math
.max(oozeinterval
/4,2),
407 chance
= math
.max(oozechance
,22),
408 action
= pedology
.create_drip
,
413 minetest
.register_abm({
414 nodenames
= {"group:"..basename
},
415 neighbors
= {"group:sucky"},
416 interval
= oozeinterval
,
418 action
= pedology
.ooze
,
426 local sound_clay
= {footstep
= {name
="pedology_clay_footstep", gain
=0.5}}
427 local sound_silt_fine
= {footstep
= {name
="pedology_silt_footstep", gain
=0.3}}
428 local sound_silt_medium
= {footstep
= {name
="pedology_silt_footstep", gain
=0.35}}
429 local sound_silt_coarse
= {footstep
= {name
="pedology_silt_footstep", gain
=0.4}}
430 local sound_sand_fine
= {footstep
= {name
="pedology_sand_footstep", gain
=0.2}}
431 local sound_sand_medium
= {footstep
= {name
="pedology_sand_footstep", gain
=0.25}}
432 local sound_sand_coarse
= {footstep
= {name
="pedology_sand_footstep", gain
=0.3}}
433 local sound_gravel_fine
= {footstep
= {name
="pedology_gravel_footstep", gain
=1}}
434 local sound_gravel_medium
= {footstep
= {name
="pedology_gravel_footstep", gain
=1}}
435 local sound_gravel_coarse
= {footstep
= {name
="pedology_gravel_footstep", gain
=1}}
436 local sound_turf_sapric
= {footstep
= {name
="pedology_turf_footstep", gain
=0.2}}
437 local sound_turf_hemic
= {footstep
= {name
="pedology_turf_footstep", gain
=0.24}}
438 local sound_turf_fibric
= {footstep
= {name
="pedology_turf_footstep", gain
=0.28}}
440 --[[ register sucky and oozing nodes ]]
442 pedology
.register_sucky_group("clay", "clay", "clay lump",
443 3, 3, 60, 1.25, {3000, 3100, 3200, 3500, 3550, 3600}, 4, sound_clay
, { crumbly
= 3, sun_dry
= 1})
444 pedology
.register_sucky_group("silt_fine", "fine silt", "fine silt lump",
445 3, 3, 45, 1.25, {2800, 2900, 3000, 3100, 3200, 3300}, 4, sound_silt_fine
, { crumbly
= 3, sun_dry
= 1 })
446 pedology
.register_sucky_group("silt_medium", "medium silt", "medium silt lump",
447 3, 3, 30, 1.25, {2600, 2800, 3200, 3800, 4200}, 4, sound_silt_medium
, { crumbly
= 3, sun_dry
= 1 })
448 pedology
.register_sucky_group("silt_coarse", "coarse silt", "coarse silt lump",
449 3, 3, 20, 1.25, {2000, 2200, 2400, 2800}, 2, sound_silt_coarse
, { crumbly
= 3, sun_dry
= 1 })
450 pedology
.register_sucky_group("sand_fine", "fine sand", "fine sand pile",
451 2, 0, 10, 1.111111, {1100, 1200, 1300}, 2, sound_sand_fine
, { crumbly
= 3, sand
= 1, sun_dry
= 1 })
452 pedology
.register_sucky_group("sand_medium", "medium sand", "medium sand pile",
453 1, 0, 5, 1.111111, {990, 1100}, 2, sound_sand_medium
, { crumbly
= 3, sand
= 1, sun_dry
= 1 })
454 pedology
.register_sucky_group("sand_coarse", "coarse sand", "coarse sand pile",
455 0, 0, nil, nil, {900}, 1, sound_sand_coarse
, { crumbly
= 3, sand
= 1, sun_dry
= 1 })
456 pedology
.register_sucky_group("gravel_fine", "fine gravel", "pebble",
457 1, 0, 2, 1, {670, 770}, 9, sound_gravel_fine
, { crumbly
= 2, sun_dry
= 1 })
458 pedology
.register_sucky_group("gravel_medium", "medium gravel", "medium stone",
459 2, 0, 1.5, 1, {600, 800, 1250}, 3, sound_gravel_medium
, { crumbly
= 2, sun_dry
= 1})
460 pedology
.register_sucky_group("gravel_coarse", "coarse gravel", "big stone",
461 2, 0, 1, 1, {500, 750, 1000}, 1, sound_gravel_coarse
, { crumbly
= 1, sun_dry
= 1 })
464 minetest
.register_craftitem("pedology:lump_snow", {
465 description
= S("snow ball"),
466 wield_image
= "pedology_lump_snow.png",
467 inventory_image
= "pedology_lump_snow.png",
470 minetest
.register_craftitem("pedology:lump_ice_pure", {
471 description
= S("small pure ice cube"),
472 wield_image
= "pedology_lump_ice_pure.png",
473 inventory_image
= "pedology_lump_ice_pure.png",
476 minetest
.register_craftitem("pedology:lump_ice_white", {
477 description
= S("small white ice cube"),
478 wield_image
= "pedology_lump_ice_white.png",
479 inventory_image
= "pedology_lump_ice_white.png",
482 -- TODO: slushy snow is very instable snow; it should be destroyed when touched
483 minetest
.register_node("pedology:snow_slush", {
484 description
= S("slushy snow"),
485 tiles
= { "pedology_snow_slush.png" },
486 sounds
= { footstep
= { name
= "pedology_snow_soft_footstep", gain
= 1 } },
487 is_ground_content
= true,
488 groups
= { crumbly
= 1, level
= 1, melts
= 1, falling_node
= 1},
490 freezemelt
= "pedology:water_fresh_source",
493 minetest
.register_node("pedology:snow_soft", {
494 description
= S("soft snow"),
495 tiles
= { "pedology_snow_soft.png" },
496 sounds
= { footstep
= { name
= "pedology_snow_soft_footstep", gain
= 1 } },
497 is_ground_content
= true,
498 groups
= { crumbly
= 2, level
= 2, melts
= 1, falling_node
= 1 },
499 drop
= "pedology:lump_snow 1",
500 freezemelt
= "pedology:water_fresh_source",
503 minetest
.register_node("pedology:snow", {
504 description
= S("snow"),
505 tiles
= { "pedology_snow.png" },
506 sounds
= { footstep
= { name
= "pedology_snow_footstep", gain
= 0.9 } },
507 is_ground_content
= true,
508 groups
= { crumbly
= 3, level
= 3, melts
= 1, falling_node
= 1 },
509 drop
= "pedology:lump_snow 2",
510 freezemelt
= "pedology:water_fresh_source",
513 minetest
.register_node("pedology:snow_packing", {
514 description
= S("packing snow"),
515 tiles
= { "pedology_snow_packing.png" },
516 sounds
= { footstep
= { name
= "pedology_snow_footstep", gain
= 1 } },
517 is_ground_content
= true,
518 groups
= { crumbly
= 3, level
= 3, melts
= 1 },
519 drop
= "pedology:lump_snow 3",
520 freezemelt
= "pedology:water_fresh_source",
523 minetest
.register_node("pedology:snow_firn", {
524 description
= S("firn"),
525 tiles
= { "pedology_snow_firn.png" },
526 sounds
= { footstep
= { name
= "pedology_ice_white_footstep", gain
= 0.7 } },
527 is_ground_content
= true,
528 groups
= { crumbly
= 2, cracky
= 2, level
= 4, melts
= 1 },
529 drop
= "pedology:lump_snow 4",
530 freezemelt
= "pedology:water_fresh_source",
533 minetest
.register_node("pedology:ice_white", {
534 description
= S("white ice"),
535 tiles
= { "pedology_ice_white.png" },
536 sounds
= { footstep
= { name
= "pedology_ice_white_footstep", gain
= 0.8 } },
537 is_ground_content
= true,
538 groups
= { cracky
= 3, level
= 1, melts
= 1 },
539 drop
= "pedology:lump_ice_white 4",
540 freezemelt
= "pedology:water_fresh_source",
543 minetest
.register_node("pedology:ice_pure", {
544 description
= S("pure ice"),
545 drawtype
= "glasslike",
547 tiles
= { "pedology_ice_pure.png" },
548 inventory_image
= minetest
.inventorycube( "pedology_ice_pure.png" ),
549 sounds
= { footstep
= { name
= "pedology_ice_pure_footstep", gain
= 0.8 } },
550 is_ground_content
= true,
551 groups
= { cracky
= 3, level
= 2, melts
= 1 },
552 drop
= "pedology:lump_ice_pure 4",
553 freezemelt
= "pedology:water_fresh_source",
556 --[[ mud and slurry ]]
557 pedology
.register_liquid("clay_4", "clay mud", 240, 6, 5, 0, {a
=240, r
=123, g
=57, b
=6}, {sucky
=1, oozing
=1, wet
=4})
558 pedology
.register_liquid("clay_5", "clay slurry", 176, 4, 5, 0, {a
=176, r
=146, g
=85, b
=73}, {oozing
=1, wet
=5})
560 pedology
.register_liquid("silt_fine_4", "fine silt mud", 230, 6, 5, 0, {a
=230, r
=137, g
=82, b
=0}, {sucky
=1, oozing
=1, wet
=4})
561 pedology
.register_liquid("silt_fine_5", "fine silt slurry", 166, 4, 5, 0, {a
=166, r
=179, g
=117, b
=59}, {oozing
=1, wet
=5})
563 pedology
.register_liquid("silt_medium_4", "medium silt mud", 220, 6, 5, 0, {a
=220, r
=165, g
=131, b
=0}, {oozing
=1, wet
=4})
566 pedology
.register_sucky_group("turf_fibric", "fibric turf", "fibric turf cutting",
567 2, 2, 120, 1.25, {1000, 1100, 1200}, 4, sound_turf_fibric
, { [0] = { crumbly
= 3, flammable
= 1 }, { crumbly
= 3 }, {crumbly
= 3} } )
568 pedology
.register_sucky_group("turf_hemic", "hemic turf", "hemic turf cutting",
569 2, 2, 180, 1.225, {1100, 1200, 1300}, 3, sound_turf_hemic
, { [0] = { crumbly
= 3, flammable
= 1 }, { crumbly
= 3 }, { crumbly
= 3 } } )
570 pedology
.register_sucky_group("turf_sapric", "sapric turf", "sapric turf cutting",
571 2, 2, 240, 1.2, {1200, 1300, 1400}, 2, sound_turf_sapric
, { [0] = { crumbly
= 3, flammable
= 1 }, { crumbly
= 3 }, { crumbly
= 3 } } )
573 minetest
.register_craft({
575 recipe
= "pedology:turf_fibric_0",
578 minetest
.register_craft({
580 recipe
= "pedology:turf_hemic_0",
583 minetest
.register_craft({
585 recipe
= "pedology:turf_sapric_0",
589 minetest
.register_craft({
591 recipe
= "pedology:lump_turf_fibric_0",
594 minetest
.register_craft({
596 recipe
= "pedology:lump_turf_hemic_0",
599 minetest
.register_craft({
601 recipe
= "pedology:lump_turf_sapric_0",
609 pedology
.maxwet
.clay
= 5
610 pedology
.maxwet
.silt_fine
= 5
611 pedology
.maxwet
.silt_medium
= 4
612 pedology
.maxwet
.silt_coarse
= 3
613 pedology
.maxwet
.sand_fine
= 2
614 pedology
.maxwet
.sand_medium
= 1
615 pedology
.maxwet
.sand_coarse
= 0
616 pedology
.maxwet
.gravel_fine
= 1
617 pedology
.maxwet
.gravel_medium
= 2
618 pedology
.maxwet
.gravel_coarse
= 2
620 pedology
.maxwet
.turf_fibric
= 2
621 pedology
.maxwet
.turf_hemic
= 2
622 pedology
.maxwet
.turf_sapric
= 2
624 --[[ “API” functions ]]
625 --[[ Replace the node at <pos> with a node with a “drier” version of it, if available ]]
626 function pedology
.dry(pos
)
627 local node
= minetest
.get_node(pos
)
628 local wet
= minetest
.get_item_group(node
.name
, "wet")
629 local dried
= tostring(wet
- 1)
633 local newbasename
= string.sub(node
.name
,1,#node
.name
-1)
634 newbasename
= newbasename
.. dried
635 minetest
.set_node(pos
, {name
=newbasename
, param1
=0, param2
=0})
638 --[[ Replace the node at <pos> with a “wetter” version of it, if available ]]
639 function pedology
.wetten(pos
)
640 local node
= minetest
.get_node(pos
)
641 local wet
= minetest
.get_item_group(node
.name
, "wet")
642 local cutbasename
= string.sub(node
.name
,10,#node
.name
-2)
643 if pedology
.maxwet
[cutbasename
] == nil then
645 elseif wet
> pedology
.maxwet
[cutbasename
] then
649 local newbasename
= string.sub(node
.name
,1,#node
.name
-1) .. tostring(wet
+1)
650 minetest
.set_node(pos
, {name
=newbasename
, param1
=0, param2
=0})
653 --[[ register ABMs ]]
654 minetest
.register_abm({
655 nodenames
= {"group:sun_dry"},
659 action
= pedology
.sun_dry
,
662 minetest
.register_abm({
663 nodenames
= {"group:sucky"},
664 neighbors
= {"group:water"},
667 action
= pedology
.suck
,
670 minetest
.register_abm({
671 nodenames
= {"group:melting_point"},
672 neighbors
= {"group:hot"},
675 action
= function(pos
,node
,...)
676 minetest
.set_node(pos
,node
)