Add new pumice material

- Flowing lava quenches to pumice
- Pumice can spontaneously melt back to flowing
  lava, when touching lava, and sometimes even
  when still quenched.
- Pumice cannot be harvested or moved, it's
  utterly destroyed by digging.
This commit is contained in:
Aaron Suen 2020-06-06 08:23:29 -04:00
parent f70c34cf8e
commit 3493e8222b
4 changed files with 67 additions and 2 deletions

View File

@ -67,12 +67,13 @@ local gains_base = {
place_failed = 0.2,
fall = 0.1
}
function nodecore.sounds(name, gains)
function nodecore.sounds(name, gains, pitch)
local t = {}
for k, v in pairs(gains_base) do
t[k] = {
name = name,
gain = (gains and gains[k] or 1) * v
gain = (gains and gains[k] or 1) * v,
pitch = pitch
}
end
return t

View File

@ -6,3 +6,4 @@ local include, nodecore
nodecore.amcoremod()
include('amalgam')
include('pumice')

View File

@ -0,0 +1,63 @@
-- LUALOCALS < ---------------------------------------------------------
local math, minetest, nodecore
= math, minetest, nodecore
local math_random
= math.random
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local pumname = modname .. ":pumice"
local pumdef
pumdef = {
description = "Pumice",
tiles = {"nc_igneous_pumice.png"},
groups = {
cracky = 2,
stack_as_node = 1
},
drop = "",
silktouch = false,
after_dig_node = function(pos)
nodecore.digparticles(pumdef, {
time = 0.05,
amount = 100,
minpos = {x = pos.x - 0.5, y = pos.y - 0.5, z = pos.z - 0.5},
maxpos = {x = pos.x + 0.5, y = pos.y + 0.5, z = pos.z + 0.5},
minvel = {x = -2, y = -2, z = -2},
maxvel = {x = 2, y = 2, z = 2},
minacc = {x = 0, y = -4, z = 0},
maxacc = {x = 0, y = -4, z = 0},
minexptime = 0.25,
maxexptime = 0.5,
minsize = 1,
maxsize = 8
})
end,
sounds = nodecore.sounds("nc_optics_glassy", nil, 0.8),
}
minetest.register_node(pumname, pumdef)
nodecore.register_limited_abm({
label = "Quench Lava to Pumice",
interval = 1,
chance = 2,
nodenames = {"nc_terrain:lava_flowing"},
neighbors = {"group:coolant"},
action = function(pos)
return nodecore.set_loud(pos, {name = pumname})
end
})
nodecore.register_limited_abm({
label = "Melt Pumice",
interval = 1,
chance = 2,
nodenames = {pumname},
neighbors = {"group:lava"},
action = function(pos)
if math_random() < 0.95 and nodecore.quenched(pos) then return end
return nodecore.set_loud(pos, {name = "nc_terrain:lava_flowing", param2 = 7})
end
})

View File

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 858 B