Bug fixes, tidier craft excess handling.

This commit is contained in:
Aaron Suen 2019-04-03 08:10:03 -04:00
parent 4b1488ed3f
commit 3614068263
8 changed files with 23 additions and 20 deletions

View File

@ -9,6 +9,8 @@ ISSUES: Bugs, Cleanup and Refinements
# # # # # # # # # # # #
#### # #### # ###### ###### # # ####
- Allow lode cube cooking/cooling in placed form.
- First-class support for stack "pez dispensers".
- Upon digging a stack node, try to shift all inventories from
stack nodes above downward.

View File

@ -1,8 +1,6 @@
-- LUALOCALS < ---------------------------------------------------------
local ItemStack, ipairs, math, minetest, nodecore, pairs, type
= ItemStack, ipairs, math, minetest, nodecore, pairs, type
local math_ceil
= math.ceil
local ItemStack, ipairs, minetest, nodecore, pairs, type
= ItemStack, ipairs, minetest, nodecore, pairs, type
-- LUALOCALS > ---------------------------------------------------------
local function addgroups(sum, pos)
@ -93,13 +91,11 @@ local function craftcheck(recipe, pos, node, data, xx, xz, zx, zz)
if v.match.excess then
local s = nodecore.stack_get(p)
local x = s:get_count() - (v.match.count or 1)
local n = math_ceil(x / 4)
while x > 0 do
if n > x then n = x end
x = x - n
s:set_count(n)
nodecore.item_eject(p, s, 5)
if x > 0 then
s:set_count(x)
nodecore.item_eject(p, s, 0.001)
end
nodecore.stack_set(p, ItemStack(""))
end
if r then
minetest.set_node(p, r)

View File

@ -158,14 +158,12 @@ addhint("put a stone tip onto a tool",
------------------------------------------------------------------------
-- LODE
local lodestratum = {true, "nc_lode:stone", "nc_lode:ore"}
addhint("found a lode stratum",
lodestratum)
"group:lodey")
addhint("found lode ore",
"nc_lode:ore",
lodestratum)
"group:lodey")
addhint("dug up lode ore",
"nc_lode:cobble_loose",
@ -210,6 +208,11 @@ addhint("tempered a lode tool head",
},
"anvil making lode toolhead_mallet")
addhint("welded a lode pick and spade together",
"assemble lode mattock head",
"anvil making lode toolhead_pick")
------------------------------------------------------------------------
-- TOTE

View File

@ -129,8 +129,7 @@ local falling = {
and meta and meta.inventory and meta.inventory.solo then
local stack = ItemStack(meta.inventory.solo[1] or "")
if not stack:is_empty() then
nodecore.item_eject(self.object:getpos(), stack,
nil, nil, {x = 0, y = 0.01, z = 0})
nodecore.item_eject(self.object:getpos(), stack, 0.001)
return self.object:remove()
end
end

View File

@ -61,7 +61,7 @@ function nodecore.register_lode(shape, rawdef)
end
end
if def.bytemper then def.bytemper(temper.name, def) end
if def.bytemper then def.bytemper(temper, def) end
minetest.register_item(modname .. ":" .. def.name, def)
end

View File

@ -12,7 +12,7 @@ local function reg(suff, def)
description = "Lode " .. suff,
name = suff:lower(),
is_ground_content = true,
groups = { cracky = 2 },
groups = { cracky = 2, lodey = 1 },
sounds = nodecore.sounds("nc_terrain_stony")
})
def.fullname = modname .. ":" .. def.name
@ -50,6 +50,7 @@ for i = 1, nodecore.hard_stone_strata do
and (":stone_" .. (i - 1)) or ":stone"),
strata = stratstone,
groups = {
lodey = 1,
cracky = i + 2,
hard_stone = i
}
@ -61,6 +62,7 @@ for i = 1, nodecore.hard_stone_strata do
drop_in_place = modname .. ":cobble",
strata = stratore,
groups = {
lodey = 1,
cracky = i + 2,
hard_stone = i
}
@ -72,6 +74,7 @@ reg("Cobble", {
alternate_loose = {
repack_level = 2,
groups = {
lodey = 1,
cracky = 0,
crumbly = 2,
falling_repose = 3

View File

@ -32,7 +32,7 @@ local function toolhead(name, groups, prills)
stack_max = 1,
tool_capabilities = toolcap(4),
bytemper = function(t, d)
if t == "Tempered" then
if t.name == "tempered" then
d.tool_capabilities = toolcap(5)
end
end,

View File

@ -29,7 +29,7 @@ nodecore.extend_item(chip, function(copy, orig)
itemstack:set_count(itemstack:get_count() - 1)
if placer then
nodecore.player_stat_add(1, placer, "craft",
"assemble " .. itemstack:get_name())
"assemble " .. v.to)
end
return itemstack
end