Add cobble and loose cobble for pick usage.

Loose cobble now requires a mallet to repack into cobble.
This commit is contained in:
Aaron Suen 2019-01-06 17:09:34 -05:00
parent c743199364
commit 714e2d40ac
6 changed files with 57 additions and 24 deletions

View File

@ -1,6 +1,6 @@
-- LUALOCALS < ---------------------------------------------------------
local minetest, nodecore, pairs, type
= minetest, nodecore, pairs, type
= minetest, nodecore, pairs, type
-- LUALOCALS > ---------------------------------------------------------
--[[
@ -21,16 +21,19 @@ end
local looseimg = "^nc_api_loose.png"
local function can_repack(pos, node, stats)
local wield = stats.puncher:get_wielded_item()
if not wield then return end
local dg = wield:get_tool_capabilities().damage_groups
return dg and dg.slappy
local function can_repack(level)
return function(pos, node, stats)
local wield = stats.puncher:get_wielded_item()
if not wield then return end
local dg = wield:get_tool_capabilities().groupcaps
return dg and dg.thumpy and dg.thumpy
and dg.thumpy.times[level]
end
end
function nodecore.pummel_repack_node(duration, replace)
local function pummel_repack_node(mult, replace)
if type(replace) ~= "table" then replace = {name = replace} end
return function (pos, node, stats)
if stats.duration < duration then return end
if stats.duration < (mult * stats.check) then return end
minetest.set_node(pos, replace)
return true
end
@ -61,9 +64,10 @@ nodecore.register_on_register_node(function(name, def)
loose.groups.falling_node = 1
if loose.groups.crumbly and not loose.no_repack then
loose.can_pummel = loose.can_pummel
or can_repack(loose.repack_level or 3)
loose.on_pummel = loose.on_pummel
or nodecore.pummel_repack_node(3, name)
loose.can_pummel = loose.can_pummel or can_repack
or pummel_repack_node(loose.repack_time or 1, name)
end
loose.alternate_loose = nil

View File

@ -12,8 +12,8 @@ minetest.register_item(":", {
max_drop_level = 0,
groupcaps = {
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
snappy = {times={[2]=2.00, [3]=0.40}, uses=0, maxlevel=1}
},
damage_groups = {slappy = 1},
snappy = {times={[2]=2.00, [3]=0.40}, uses=0, maxlevel=1},
thumpy = {times={[3]=3.00}, uses=0, maxlevel=1},
}
}
})

View File

@ -1,6 +1,6 @@
-- LUALOCALS < ---------------------------------------------------------
local ipairs, minetest, pairs
= ipairs, minetest, pairs
= ipairs, minetest, pairs
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
@ -53,9 +53,18 @@ regterrain({
"stone_with_iron",
"desert_stone",
"sandstone",
"mese",
},
groups = {
cracky = 3
},
drop_in_place = modname .. ":cobble",
})
regterrain({
description = "Cobble",
mapgen = {
"sandstonebrick",
"stair_sandstone_block",
"mese",
"cobble",
"stair_cobble",
"stair_desert_stone",
@ -64,6 +73,13 @@ regterrain({
groups = {
cracky = 3
},
alternate_loose = {
repack_level = 2,
groups = {
crumbly = 2,
falling_repose = 3
}
},
})
for _, v in ipairs({

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

After

Width:  |  Height:  |  Size: 340 B

View File

@ -1,11 +1,12 @@
-- LUALOCALS < ---------------------------------------------------------
local ItemStack, minetest, nodecore
= ItemStack, minetest, nodecore
= ItemStack, minetest, nodecore
-- LUALOCALS > ---------------------------------------------------------
local modname = minetest.get_current_modname()
local function toolhead(name, from, group, sticks)
local function toolhead(name, from, group, sticks, times)
slow = slow or 1
local n
if name then
n = modname .. ":toolhead_" .. name:lower()
@ -32,10 +33,11 @@ local function toolhead(name, from, group, sticks)
tool_capabilities = {
groupcaps = {
[group] = {
times = {
times = times or {
[1] = 4.00,
[2] = 1.00,
[3] = 0.50},
[3] = 0.50
},
uses = 20
},
},
@ -69,8 +71,19 @@ local function toolhead(name, from, group, sticks)
end)
end
toolhead("Mallet", modname .. ":plank", "thumpy", 2)
toolhead("Spade", modname .. ":toolhead_mallet", "crumbly", 1)
toolhead("Hatchet", modname .. ":toolhead_spade", "choppy", 1)
toolhead("Pick", modname .. ":toolhead_hatchet", "cracky", 2)
toolhead(nil, modname.. ":toolhead_pick", nil, 2)
toolhead("Mallet", modname .. ":plank",
"thumpy", 2, {
[2] = 5.00,
[3] = 2.00
})
toolhead("Spade", modname .. ":toolhead_mallet",
"crumbly", 1)
toolhead("Hatchet", modname .. ":toolhead_spade",
"choppy", 1)
toolhead("Pick", modname .. ":toolhead_hatchet",
"cracky", 2, {
[2] = 20.00,
[3] = 10.00
})
toolhead(nil, modname.. ":toolhead_pick",
nil, 2)