mirror of
https://repo.or.cz/minetest_pedology.git
synced 2024-12-29 11:20:17 +01:00
New lumps are now coded in
… except sand!
This commit is contained in:
parent
85751160ed
commit
3fb97d6471
86
init.lua
86
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, dropcount, sounds, additional_groups)
|
function pedology.register_sucky(basename, description, lumpdescription, wetness, oozing, sucky, melting_point, drop, 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 }
|
||||||
@ -301,12 +301,6 @@ function pedology.register_sucky(basename, description, wetness, oozing, sucky,
|
|||||||
|
|
||||||
local name = "pedology:"..wetname
|
local name = "pedology:"..wetname
|
||||||
local itemname
|
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
|
||||||
@ -320,6 +314,7 @@ function pedology.register_sucky(basename, description, wetness, oozing, sucky,
|
|||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
}
|
}
|
||||||
minetest.register_node(name, nodedef)
|
minetest.register_node(name, nodedef)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -332,6 +327,7 @@ end
|
|||||||
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
|
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)
|
||||||
|
maxlump: The maximum wetness level of lumps of this node group (minimum: 0, recommended maximum: 3)
|
||||||
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
|
||||||
@ -339,24 +335,38 @@ end
|
|||||||
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, lumpdescription, maxwet, oozeinterval, oozechance, melttable, dropcount, sounds, additional_groups)
|
function pedology.register_sucky_group(basename, basedescription, lumpbasedescription, maxwet, maxlump, oozeinterval, oozechance, melttable, dropcount, sounds, additional_groups)
|
||||||
local oozing, dripinterval
|
local oozing, dripinterval
|
||||||
local m -- melting_point
|
local m -- melting_point
|
||||||
|
local lumpdescription
|
||||||
-- 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, dropcount, sounds, additional_groups)
|
if( lumpbasedescription ~= nil) then
|
||||||
|
lumpdescription = (pedology.wetnames[w]).." "..lumpbasedescription
|
||||||
|
else
|
||||||
|
lumpdescription = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local itemname, drop, itemdef
|
||||||
|
if( maxlump == -1) then
|
||||||
|
drop = nil
|
||||||
|
elseif( w > maxlump) then
|
||||||
|
itemname = "pedology:"..basename.."_lump_"..tostring(maxlump)
|
||||||
|
drop = itemname .. " " .. tostring(dropcount)
|
||||||
|
else
|
||||||
|
itemname = "pedology:"..basename.."_lump_"..tostring(w)
|
||||||
|
drop = itemname .. " " .. tostring(dropcount)
|
||||||
|
itemdef = {
|
||||||
|
description = lumpdescription,
|
||||||
|
inventory_image = "pedology_lump_inv_"..basename.."_"..tostring(w)..".png",
|
||||||
|
wield_image = "pedology_lump_"..basename.."_"..tostring(w)..".png"
|
||||||
|
}
|
||||||
|
minetest.register_craftitem("pedology:"..basename.."_lump_"..tostring(w), itemdef)
|
||||||
|
end
|
||||||
|
pedology.register_sucky(basename, (pedology.wetnames[w]).." "..basedescription, lumpdescription, w, oozing, sucky, m, drop, 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({
|
||||||
@ -396,25 +406,25 @@ 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", "clay lump",
|
pedology.register_sucky_group("clay", "clay", "clay lump",
|
||||||
5, 60, 1.25, {3000, 3100, 3200, 3500, 3550, 3600}, 4, sound_clay, { crumbly = 3, sun_dry = 1})
|
5, 3, 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", "fine silt lump",
|
pedology.register_sucky_group("silt_fine", "fine silt", "fine silt lump",
|
||||||
5, 45, 1.25, {2800, 2900, 3000, 3100, 3200, 3300}, 4, sound_silt_fine, { crumbly = 3, sun_dry = 1 })
|
5, 3, 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", "medium silt lump",
|
pedology.register_sucky_group("silt_medium", "medium silt", "medium silt lump",
|
||||||
4, 30, 1.25, {2600, 2800, 3200, 3800, 4200}, 4, sound_silt_medium, { crumbly = 3, sun_dry = 1 })
|
4, 3, 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", "coarse silt lump",
|
pedology.register_sucky_group("silt_coarse", "coarse silt", "coarse silt lump",
|
||||||
3, 20, 1.25, {2000, 2200, 2400, 2800}, 4, sound_silt_coarse, { crumbly = 3, sun_dry = 1 })
|
3, 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", nil,
|
pedology.register_sucky_group("sand_fine", "fine sand", nil,
|
||||||
2, 10, 1.111111, {1100, 1200, 1300}, 0, sound_sand_fine, { crumbly = 3, sand = 1, sun_dry = 1 })
|
2, -1, 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", nil,
|
pedology.register_sucky_group("sand_medium", "medium sand", nil,
|
||||||
1, 5, 1.111111, {990, 1100}, 0, sound_sand_medium, { crumbly = 3, sand = 1, sun_dry = 1 })
|
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", nil,
|
pedology.register_sucky_group("sand_coarse", "coarse sand", nil,
|
||||||
0, nil, nil, {900}, 0, sound_sand_coarse, { crumbly = 3, sand = 1, sun_dry = 1 })
|
0, -1, nil, nil, {900}, 0, sound_sand_coarse, { crumbly = 3, sand = 1, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("gravel_fine", "fine gravel", "pebble",
|
pedology.register_sucky_group("gravel_fine", "fine gravel", "pebble",
|
||||||
1, 2, 1, {670, 770}, 9, sound_gravel_fine, { crumbly = 2, sun_dry = 1 })
|
1, 0, 2, 1, {670, 770}, 9, sound_gravel_fine, { crumbly = 2, sun_dry = 1 })
|
||||||
pedology.register_sucky_group("gravel_medium", "medium gravel", "medium stone",
|
pedology.register_sucky_group("gravel_medium", "medium gravel", "medium stone",
|
||||||
2, 1.5, 1, {600, 800, 1250}, 3, sound_gravel_medium, { crumbly = 2, sun_dry = 1})
|
2, 0, 1.5, 1, {600, 800, 1250}, 3, sound_gravel_medium, { crumbly = 2, sun_dry = 1})
|
||||||
pedology.register_sucky_group("gravel_coarse", "coarse gravel", "big stone",
|
pedology.register_sucky_group("gravel_coarse", "coarse gravel", "big stone",
|
||||||
2, 1, 1, {500, 750, 1000}, 1, sound_gravel_coarse, { crumbly = 1, sun_dry = 1 })
|
2, 0, 1, 1, {500, 750, 1000}, 1, sound_gravel_coarse, { crumbly = 1, sun_dry = 1 })
|
||||||
|
|
||||||
|
|
||||||
--[[ TODO: clay mud
|
--[[ TODO: clay mud
|
||||||
@ -432,17 +442,17 @@ 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 } )]]
|
||||||
|
|
||||||
--[[ TODO (v5.0): Write registration function for turf to condense redundant code. It’s a mess! ]]
|
--[[ TODO (v5.0): Write registration function for turf to condense redundant code. It’s a mess! ]]
|
||||||
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", "dry fibric turf", "dry fibric turf cutting", 0, 0, 1, 1000, 4, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
||||||
pedology.register_sucky("turf_fibric", "wet fibric turf", 1, 1, 1, 1100, 4, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_fibric", "wet fibric turf", "wet fibric turf cutting", 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_fibric", "watery fibric turf", "watery fibric turf cutting", 2, 1, 0, 1200, 4, sound_silt_coarse, { crumbly = 3 } )
|
||||||
|
|
||||||
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", "dry hemic turf", "dry hemic turf cutting", 0, 0, 1, 1100, 3, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
||||||
pedology.register_sucky("turf_hemic", "wet hemic turf", 1, 1, 1, 1200, 3, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_hemic", "wet hemic turf", "wet hemic turf cutting", 1, 1, 1, 1200, 3, 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_hemic", "watery hemic turf", "watery hemic turf cutting", 2, 1, 0, 1300, 3, sound_silt_coarse, { crumbly = 3 } )
|
||||||
|
|
||||||
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", "dry sapric turf", "dry sapric turf cutting", 0, 0, 1, 1200, 2, sound_silt_coarse, { crumbly = 3, flammable = 1 } )
|
||||||
pedology.register_sucky("turf_sapric", "wet sapric turf", 1, 1, 1, 1300, 2, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_sapric", "wet sapric turf", "wet sapric turf cutting", 1, 1, 1, 1300, 2, sound_silt_coarse, { crumbly = 3 } )
|
||||||
pedology.register_sucky("turf_sapric", "watery sapric turf", 2, 1, 0, 1400, 2, sound_silt_coarse, { crumbly = 3 } )
|
pedology.register_sucky("turf_sapric", "watery sapric turf", "watery sapric turf cutting", 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
|
||||||
@ -454,6 +464,7 @@ 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", {
|
minetest.register_craftitem("pedology:turf_fibric_lump", {
|
||||||
description = "fibric turf lump",
|
description = "fibric turf lump",
|
||||||
inventory_image = "pedology_lump_turf_fibric.png"
|
inventory_image = "pedology_lump_turf_fibric.png"
|
||||||
@ -466,6 +477,7 @@ minetest.register_craftitem("pedology:turf_sapric_lump", {
|
|||||||
description = "sapric turf lump",
|
description = "sapric turf lump",
|
||||||
inventory_image = "pedology_lump_turf_sapric.png"
|
inventory_image = "pedology_lump_turf_sapric.png"
|
||||||
})
|
})
|
||||||
|
]]
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user