mirror of
https://repo.or.cz/minetest_pedology.git
synced 2024-12-29 11:20:17 +01:00
Add silt, clay and turf lumps (actual node drops)
This commit is contained in:
parent
b0c32458cc
commit
052198d1c2
@ -103,15 +103,17 @@ Increases the `wet`ness level of the node at `pos` by `1`, if possible. This is
|
|||||||
####Return value
|
####Return value
|
||||||
`nil`
|
`nil`
|
||||||
|
|
||||||
###`pedology.register_sucky_group(basename, basedescription, maxwet, oozeinterval, oozechance, melttable, sounds, additional_groups)
|
###`pedology.register_sucky_group(basename, basedescription, lumpdescription, maxwet, oozeinterval, oozechance, melttable, dropcount, sounds, additional_groups)
|
||||||
Registers a bunch of `sucky` and `oozing` nodes to Pedology . This function assumes that textures are ready for the node, one texture for each `wet`ness level (up to `maxwet`). They have to be named according to the pattern `pedology_<basename>_<wetness>.png` and must reside in the `textures` folder. Example name: `pedology_clay_0.png` is the texture for dry clay, `pedology_clay_1.png` is texture for wet clay, and so on.
|
Registers a bunch of `sucky` and `oozing` nodes to Pedology . This function assumes that textures are ready for the node, one texture for each `wet`ness level (up to `maxwet`). They have to be named according to the pattern `pedology_<basename>_<wetness>.png` and must reside in the `textures` folder. Example name: `pedology_clay_0.png` is the texture for dry clay, `pedology_clay_1.png` is texture for wet clay, and so on.
|
||||||
####Parameters
|
####Parameters
|
||||||
* `basename`: A part of the internal itemstring of all the nodes to be registered. The full itemstring for a node would be “`pedology:<basename>_<wetness>`, where “`<basename>`” is replaced with the given `basename` and “`<wetness`>” is replaced with the wetness level (a single digit). This parameter is also used to find the textures.
|
* `basename`: A part of the internal itemstring of all the nodes to be registered. The full itemstring for a node would be “`pedology:<basename>_<wetness>`, where “`<basename>`” is replaced with the given `basename` and “`<wetness`>” is replaced with the wetness level (a single digit). This parameter is also used to find the textures.
|
||||||
* `basedescription`: A part of the user-visible description for each node. The full description is built from the template “`<wetnessstring> <basedescription>`. `<wetnessstring>` would be “dry”, “wet”, “watery”, “sludgy”, “muddy” or “slurry”.
|
* `basedescription`: A part of the user-visible description for each node. The full description is built from the template “`<wetnessstring> <basedescription>`. `<wetnessstring>` would be “dry”, “wet”, “watery”, “sludgy”, “muddy” or “slurry”.
|
||||||
|
* `lumpdescription`: The full description of the “lump” version of the block (if any)
|
||||||
* `maxwet`: The maximum `wet`ness level of the nodes. Must be at least 0 and at most 5.
|
* `maxwet`: The maximum `wet`ness level of the nodes. Must be at least 0 and at most 5.
|
||||||
* `oozeinterval`: The interval in seconds in which the node may ooze its wetness to other nodes (Minimum: 1)
|
* `oozeinterval`: The interval in seconds in which the node may ooze its wetness to other nodes (Minimum: 1)
|
||||||
* `oozechance`: The interted chance (`1/oozechance`) to ooze each time the `oozeinterval` has passed.
|
* `oozechance`: The interted chance (`1/oozechance`) to ooze each time the `oozeinterval` has passed.
|
||||||
* `melttable`: Table of `melting_point` values for each `wet`ness level. The table length must equal `maxwet+1`. This parameter may alternatively be nil (all nodes are indestructible by heat then). Note that lava and melting points are not implemented yet.
|
* `melttable`: Table of `melting_point` values for each `wet`ness level. The table length must equal `maxwet+1`. This parameter may alternatively be nil (all nodes are indestructible by heat then). Note that lava and melting points are not implemented yet.
|
||||||
|
* `dropcount`: How many lumps nodes of this group drop, when mined. If 0, they simply drop themselves (NOT recommended)
|
||||||
* `sounds`: Sound specification for every node (Definition is the same as for `minetest.register_node`).
|
* `sounds`: Sound specification for every node (Definition is the same as for `minetest.register_node`).
|
||||||
* `additional_groups`: Table of additional groups for every node. May also be empty or nil, meaning no additional groups will be added.
|
* `additional_groups`: Table of additional groups for every node. May also be empty or nil, meaning no additional groups will be added.
|
||||||
|
|
||||||
|
103
init.lua
103
init.lua
@ -289,7 +289,7 @@ pedology.register_liquid("lava_4", "cold lava", 230, 5, 7, 6, {a=230, r=255, g
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
--[[ register a sucky/oozing node to this mod ]]
|
--[[ register a sucky/oozing node to this mod ]]
|
||||||
function pedology.register_sucky(basename, description, wetness, oozing, sucky, melting_point, sounds, additional_groups)
|
function pedology.register_sucky(basename, description, wetness, oozing, sucky, melting_point, dropcount, sounds, additional_groups)
|
||||||
local wetname = basename.."_"..tostring(wetness)
|
local wetname = basename.."_"..tostring(wetness)
|
||||||
local noncreative
|
local noncreative
|
||||||
local groups = { sucky=sucky, oozing=oozing, wet=wetness, melting_point=melting_point, not_in_creative_inventory = noncreative, [basename]=1 }
|
local groups = { sucky=sucky, oozing=oozing, wet=wetness, melting_point=melting_point, not_in_creative_inventory = noncreative, [basename]=1 }
|
||||||
@ -298,6 +298,16 @@ function pedology.register_sucky(basename, description, wetness, oozing, sucky,
|
|||||||
groups[k] = v
|
groups[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local name = "pedology:"..wetname
|
||||||
|
local itemname
|
||||||
|
if(dropcount > 0) then
|
||||||
|
itemname = "pedology:"..basename.."_lump"
|
||||||
|
drop = itemname .. " " .. tostring(dropcount)
|
||||||
|
else
|
||||||
|
drop = nil
|
||||||
|
end
|
||||||
|
|
||||||
-- If the node is not dry, do not add it into the creative inventory
|
-- If the node is not dry, do not add it into the creative inventory
|
||||||
if wetness == 0 then noncreative = 0 else noncreative = 1 end
|
if wetness == 0 then noncreative = 0 else noncreative = 1 end
|
||||||
local nodedef = {
|
local nodedef = {
|
||||||
@ -305,12 +315,10 @@ function pedology.register_sucky(basename, description, wetness, oozing, sucky,
|
|||||||
inventory_image = minetest.inventorycube("pedology_"..wetname..".png"),
|
inventory_image = minetest.inventorycube("pedology_"..wetname..".png"),
|
||||||
tiles = {"pedology_"..wetname..".png"},
|
tiles = {"pedology_"..wetname..".png"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
-- drop = "pedology:"..basename.."_lump 4",
|
drop = drop,
|
||||||
groups = groups,
|
groups = groups,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
}
|
}
|
||||||
local name = "pedology:"..wetname
|
|
||||||
|
|
||||||
minetest.register_node(name, nodedef)
|
minetest.register_node(name, nodedef)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -322,21 +330,33 @@ end
|
|||||||
parameters:
|
parameters:
|
||||||
basename: The internal name piece from which the concrete basenames will be build. The wetness level will be appended.
|
basename: The internal name piece from which the concrete basenames will be build. The wetness level will be appended.
|
||||||
basedescription. The description of the nodes. A proper wetness adjective (“dry”, “wet”, …) will be prepended.
|
basedescription. The description of the nodes. A proper wetness adjective (“dry”, “wet”, …) will be prepended.
|
||||||
|
lumpdescription. The description component of the “lump” of the node. If nil, no lump is used
|
||||||
maxwet: The maximum wetness level of this node group (minimum: 0, maximum: 5)
|
maxwet: The maximum wetness level of this node group (minimum: 0, maximum: 5)
|
||||||
oozeinterval: The interval in seconds in which it the node may ooze. the Minimal value: 1
|
oozeinterval: The interval in seconds in which it the node may ooze. the Minimal value: 1
|
||||||
oozechance: The inverted chance (1/x) to ooze
|
oozechance: The inverted chance (1/x) to ooze
|
||||||
melttable: Table of melting_point values for each wetness level
|
melttable: Table of melting_point values for each wetness level
|
||||||
|
dropcount: How many lumps nodes of this group drop. If 0, the nodes simply drop themselves (not recommended!)
|
||||||
sounds: Sound specification for all nodes
|
sounds: Sound specification for all nodes
|
||||||
additional_groups: table of additional groups of all the nodes. May be empty or nil (meaning no additional groups).
|
additional_groups: table of additional groups of all the nodes. May be empty or nil (meaning no additional groups).
|
||||||
]]
|
]]
|
||||||
function pedology.register_sucky_group(basename, basedescription, maxwet, oozeinterval, oozechance, melttable, sounds, additional_groups)
|
function pedology.register_sucky_group(basename, basedescription, lumpdescription, maxwet, oozeinterval, oozechance, melttable, dropcount, sounds, additional_groups)
|
||||||
local oozing, dripinterval
|
local oozing, dripinterval
|
||||||
local m -- melting_point
|
local m -- melting_point
|
||||||
|
|
||||||
|
-- Register drops (if available)
|
||||||
|
if(dropcount > 0) then
|
||||||
|
local itemdef = {
|
||||||
|
description = lumpdescription,
|
||||||
|
inventory_image = "pedology_lump_"..basename..".png"
|
||||||
|
}
|
||||||
|
minetest.register_craftitem("pedology:"..basename.."_lump", itemdef)
|
||||||
|
end
|
||||||
|
|
||||||
for w=0, maxwet do
|
for w=0, maxwet do
|
||||||
if(w==0) then oozing=0 else oozing=1 end
|
if(w==0) then oozing=0 else oozing=1 end
|
||||||
if (w==maxwet and w ~= 5) then sucky=0 else sucky=1 end
|
if (w==maxwet and w ~= 5) then sucky=0 else sucky=1 end
|
||||||
if melttable == nil then m = 0 else m = melttable[w] end
|
if melttable == nil then m = 0 else m = melttable[w] end
|
||||||
pedology.register_sucky(basename, (pedology.wetnames[w]).." "..basedescription, w, oozing, sucky, m, sounds, additional_groups)
|
pedology.register_sucky(basename, (pedology.wetnames[w]).." "..basedescription, w, oozing, sucky, m, dropcount, sounds, additional_groups)
|
||||||
-- register dripping
|
-- register dripping
|
||||||
if(w>0 and pedology.USE_DRIPS == true) then
|
if(w>0 and pedology.USE_DRIPS == true) then
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
@ -375,26 +395,26 @@ local sound_gravel_coarse = {footstep = {name="pedology_gravel_footstep", gain=1
|
|||||||
|
|
||||||
--[[ register sucky and oozing nodes ]]
|
--[[ register sucky and oozing nodes ]]
|
||||||
--[[ ground nodes ]]
|
--[[ ground nodes ]]
|
||||||
pedology.register_sucky_group("clay", "clay",
|
pedology.register_sucky_group("clay", "clay", "clay lump",
|
||||||
5, 60, 1.25, {3000, 3100, 3200, 3500, 3550, 3600}, sound_clay, { crumbly = 3, sun_dry = 1})
|
5, 60, 1.25, {3000, 3100, 3200, 3500, 3550, 3600}, 4, sound_clay, { crumbly = 3, sun_dry = 1})
|
||||||
pedology.register_sucky_group("silt_fine", "fine silt",
|
pedology.register_sucky_group("silt_fine", "fine silt", "fine silt lump",
|
||||||
5, 45, 1.25, {2800, 2900, 3000, 3100, 3200, 3300}, sound_silt_fine, { crumbly = 3, sun_dry = 1 })
|
5, 45, 1.25, {2800, 2900, 3000, 3100, 3200, 3300}, 4, sound_silt_fine, { crumbly = 3, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("silt_medium", "medium silt",
|
pedology.register_sucky_group("silt_medium", "medium silt", "medium silt lump",
|
||||||
4, 30, 1.25, {2600, 2800, 3200, 3800, 4200}, sound_silt_medium, { crumbly = 3, sun_dry = 1 })
|
4, 30, 1.25, {2600, 2800, 3200, 3800, 4200}, 4, sound_silt_medium, { crumbly = 3, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("silt_coarse", "coarse silt",
|
pedology.register_sucky_group("silt_coarse", "coarse silt", "coarse silt lump",
|
||||||
3, 20, 1.25, {2000, 2200, 2400, 2800}, sound_silt_coarse, { crumbly = 3, sun_dry = 1 })
|
3, 20, 1.25, {2000, 2200, 2400, 2800}, 4, sound_silt_coarse, { crumbly = 3, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("sand_fine", "fine sand",
|
pedology.register_sucky_group("sand_fine", "fine sand", nil,
|
||||||
2, 10, 1.111111, {1100, 1200, 1300}, sound_sand_fine, { crumbly = 3, sand = 1, sun_dry = 1 })
|
2, 10, 1.111111, {1100, 1200, 1300}, 0, sound_sand_fine, { crumbly = 3, sand = 1, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("sand_medium", "medium sand",
|
pedology.register_sucky_group("sand_medium", "medium sand", nil,
|
||||||
1, 5, 1.111111, {990, 1100}, sound_sand_medium, { crumbly = 3, sand = 1, sun_dry = 1 })
|
1, 5, 1.111111, {990, 1100}, 0, sound_sand_medium, { crumbly = 3, sand = 1, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("sand_coarse", "coarse sand",
|
pedology.register_sucky_group("sand_coarse", "coarse sand", nil,
|
||||||
0, nil, nil, {900}, sound_sand_coarse, { crumbly = 3, sand = 1, sun_dry = 1 })
|
0, nil, nil, {900}, 0, sound_sand_coarse, { crumbly = 3, sand = 1, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("gravel_fine", "fine gravel",
|
pedology.register_sucky_group("gravel_fine", "fine gravel", "pebble",
|
||||||
1, 2, 1, {670, 770}, sound_gravel_fine, { crumbly = 2, sun_dry = 1 })
|
1, 2, 1, {670, 770}, 9, sound_gravel_fine, { crumbly = 2, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("gravel_medium", "medium gravel",
|
pedology.register_sucky_group("gravel_medium", "medium gravel", "medium stone",
|
||||||
2, 1.5, 1, {600, 800, 1250}, sound_gravel_medium, { crumbly = 2, sun_dry = 1})
|
2, 1.5, 1, {600, 800, 1250}, 3, sound_gravel_medium, { crumbly = 2, sun_dry = 1})
|
||||||
pedology.register_sucky_group("gravel_coarse", "coarse gravel",
|
pedology.register_sucky_group("gravel_coarse", "coarse gravel", "big stone",
|
||||||
2, 1, 1, {500, 750, 1000}, sound_gravel_coarse, { crumbly = 1, sun_dry = 1 })
|
2, 1, 1, {500, 750, 1000}, 1, sound_gravel_coarse, { crumbly = 1, sun_dry = 1 })
|
||||||
|
|
||||||
|
|
||||||
--[[ TODO: clay mud
|
--[[ TODO: clay mud
|
||||||
@ -411,17 +431,18 @@ pedology.register_sucky_group("turf_hemic", "hemic turf",
|
|||||||
pedology.register_sucky_group("turf_sapric", "sapric turf",
|
pedology.register_sucky_group("turf_sapric", "sapric turf",
|
||||||
2, 240, 1.2, {1200, 1300, 1400}, sound_silt_coarse, { crumbly = 3, flammable = 1 } )]]
|
2, 240, 1.2, {1200, 1300, 1400}, sound_silt_coarse, { crumbly = 3, flammable = 1 } )]]
|
||||||
|
|
||||||
pedology.register_sucky("turf_fibric", "dry fibric turf", 0, 0, 1, 1000, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
--[[ TODO (v5.0): Write registration function for turf to condense redundant code. It’s a mess! ]]
|
||||||
pedology.register_sucky("turf_fibric", "wet fibric turf", 1, 1, 1, 1100, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_fibric", "dry fibric turf", 0, 0, 1, 1000, 4, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
||||||
pedology.register_sucky("turf_fibric", "watery fibric turf", 2, 1, 0, 1200, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_fibric", "wet fibric turf", 1, 1, 1, 1100, 4, sound_silt_coarse, { crumbly = 3 } )
|
||||||
|
pedology.register_sucky("turf_fibric", "watery fibric turf", 2, 1, 0, 1200, 4, sound_silt_coarse, { crumbly = 3 } )
|
||||||
|
|
||||||
pedology.register_sucky("turf_hemic", "dry hemic turf", 0, 0, 1, 1100, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
pedology.register_sucky("turf_hemic", "dry hemic turf", 0, 0, 1, 1100, 3, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
||||||
pedology.register_sucky("turf_hemic", "wet hemic turf", 1, 1, 1, 1200, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_hemic", "wet hemic turf", 1, 1, 1, 1200, 3, sound_silt_coarse, { crumbly = 3 } )
|
||||||
pedology.register_sucky("turf_hemic", "watery hemic turf", 2, 1, 0, 1300, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_hemic", "watery hemic turf", 2, 1, 0, 1300, 3, sound_silt_coarse, { crumbly = 3 } )
|
||||||
|
|
||||||
pedology.register_sucky("turf_sapric", "dry sapric turf", 0, 0, 1, 1200, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
pedology.register_sucky("turf_sapric", "dry sapric turf", 0, 0, 1, 1200, 2, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
||||||
pedology.register_sucky("turf_sapric", "wet sapric turf", 1, 1, 1, 1300, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_sapric", "wet sapric turf", 1, 1, 1, 1300, 2, sound_silt_coarse, { crumbly = 3 } )
|
||||||
pedology.register_sucky("turf_sapric", "watery sapric turf", 2, 1, 0, 1400, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_sapric", "watery sapric turf", 2, 1, 0, 1400, 2, sound_silt_coarse, { crumbly = 3 } )
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"group:turf_fibric"}, neighbors = {"group:sucky"}, interval = 120, chance = 1.25, action = pedology.ooze
|
nodenames = {"group:turf_fibric"}, neighbors = {"group:sucky"}, interval = 120, chance = 1.25, action = pedology.ooze
|
||||||
@ -433,6 +454,18 @@ minetest.register_abm({
|
|||||||
nodenames = {"group:turf_sapric"}, neighbors = {"group:sucky"}, interval = 240, chance = 1.5, action = pedology.ooze
|
nodenames = {"group:turf_sapric"}, neighbors = {"group:sucky"}, interval = 240, chance = 1.5, action = pedology.ooze
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("pedology:turf_fibric_lump", {
|
||||||
|
description = "fibric turf lump",
|
||||||
|
inventory_image = "pedology_lump_turf_fibric.png"
|
||||||
|
})
|
||||||
|
minetest.register_craftitem("pedology:turf_hemic_lump", {
|
||||||
|
description = "hemic turf lump",
|
||||||
|
inventory_image = "pedology_lump_turf_hemic.png"
|
||||||
|
})
|
||||||
|
minetest.register_craftitem("pedology:turf_sapric_lump", {
|
||||||
|
description = "sapric turf lump",
|
||||||
|
inventory_image = "pedology_lump_turf_sapric.png"
|
||||||
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
Loading…
Reference in New Issue
Block a user