Fix raking sand/gravel by machine
This commit is contained in:
parent
e803155cbc
commit
eea39a773f
@ -64,7 +64,6 @@ minetest.node_dig = function(pos, node, user, ...)
|
||||
laststack = nodecore.stack_get(pos)
|
||||
local wield = nodecore.machine_digging and nodecore.machine_digging.tool
|
||||
or user and user:is_player() and user:get_wielded_item()
|
||||
print(wield and wield:to_string() or "nada")
|
||||
lastraking = wield and (wield:get_definition() or {}).on_rake
|
||||
if lastraking then return deferfall(old_node_dig, pos, node, user, ...) end
|
||||
return old_node_dig(pos, node, user, ...)
|
||||
|
@ -58,6 +58,7 @@ local function checktarget(data, stack)
|
||||
nodedef = def,
|
||||
duration = 3600,
|
||||
presstoolpos = data.pointed.under,
|
||||
wield = stack,
|
||||
toolgroupcaps = caps.groups
|
||||
}
|
||||
return nodecore.craft_search(target, node, pumdata)
|
||||
|
@ -49,7 +49,10 @@ nodecore.register_lode("rake", {
|
||||
})
|
||||
d.on_rake = mkonrake(d.tool_capabilities)
|
||||
end,
|
||||
groups = {rakey = 2},
|
||||
groups = {
|
||||
rakey = 2,
|
||||
nc_doors_pummel_first = 1
|
||||
},
|
||||
tool_wears_to = modname .. ":prill_# 10"
|
||||
})
|
||||
|
||||
|
@ -18,7 +18,11 @@ minetest.register_tool(modname .. ":rake", {
|
||||
snappy = 1,
|
||||
uses = 10
|
||||
}),
|
||||
groups = {flammable = 1, rakey = 1},
|
||||
groups = {
|
||||
flammable = 1,
|
||||
rakey = 1,
|
||||
nc_doors_pummel_first = 1
|
||||
},
|
||||
sounds = nodecore.sounds("nc_tree_sticky"),
|
||||
on_rake = function() return rakevol, raketest end
|
||||
})
|
||||
|
@ -67,32 +67,33 @@ function nodecore.register_raked(basename, desc, opacity, recipematch, recipeidx
|
||||
indexkeys = recipeidx,
|
||||
nodes = {{match = recipematch}},
|
||||
after = function(pos, data)
|
||||
if not (data.crafter and data.crafter.getpos
|
||||
and data.crafter.get_look_horizontal) then return end
|
||||
local newnode = {
|
||||
name = nexusname,
|
||||
param2 = 0
|
||||
}
|
||||
|
||||
local newnode
|
||||
local ppos = data.crafter:get_pos()
|
||||
ppos.y = pos.y
|
||||
if vector.distance(pos, ppos) < 0.4 then
|
||||
newnode = {
|
||||
name = nexusname,
|
||||
param2 = 0
|
||||
}
|
||||
else
|
||||
local dir = data.crafter:get_look_horizontal()
|
||||
while dir >= math_pi * 3/4 do dir = dir - math_pi end
|
||||
dir = minetest.yaw_to_dir(dir + math_pi / 4)
|
||||
newnode = {
|
||||
name = linearname,
|
||||
param2 = minetest.dir_to_facedir(dir)
|
||||
}
|
||||
if data.crafter and data.crafter.getpos
|
||||
and data.crafter.get_look_horizontal then
|
||||
local ppos = data.crafter:get_pos()
|
||||
ppos.y = pos.y
|
||||
if vector.distance(pos, ppos) >= 0.4 then
|
||||
local dir = data.crafter:get_look_horizontal()
|
||||
while dir >= math_pi * 3/4 do dir = dir - math_pi end
|
||||
dir = minetest.yaw_to_dir(dir + math_pi / 4)
|
||||
newnode = {
|
||||
name = linearname,
|
||||
param2 = minetest.dir_to_facedir(dir)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local node = data.node or minetest.get_node(pos)
|
||||
if node.name == newnode.name and node.param2 == newnode.param2 then
|
||||
newnode = {name = basename}
|
||||
end
|
||||
nodecore.wear_wield(data.crafter, {snappy = 1}, 1)
|
||||
if data.crafter then
|
||||
nodecore.wear_wield(data.crafter, {snappy = 1}, 1)
|
||||
end
|
||||
nodecore.set_loud(pos, newnode)
|
||||
return nodecore.fallcheck(pos)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user