mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 01:21:05 +01:00
Merge pull request 'Hoppers pulling from chest minecart' (#2954) from anarquimico/MineClone2:hoppers_mc_chest into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2954 Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me> Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
5a9d428151
1 changed files with 12 additions and 8 deletions
|
@ -338,8 +338,8 @@ minetest.register_node("mcl_hoppers:hopper_side_disabled", def_hopper_side_disab
|
||||||
|
|
||||||
--[[ END OF NODE DEFINITIONS ]]
|
--[[ END OF NODE DEFINITIONS ]]
|
||||||
|
|
||||||
local function hopper_pull_from_mc (mc_ent, dest_pos)
|
local function hopper_pull_from_mc (mc_ent, dest_pos, inv_size)
|
||||||
local inv = mcl_entity_invs.load_inv(mc_ent,5)
|
local inv = mcl_entity_invs.load_inv(mc_ent, inv_size)
|
||||||
if not inv then
|
if not inv then
|
||||||
mcl_log("No inv")
|
mcl_log("No inv")
|
||||||
return false
|
return false
|
||||||
|
@ -382,7 +382,7 @@ end
|
||||||
--[[ BEGIN OF ABM DEFINITONS ]]
|
--[[ BEGIN OF ABM DEFINITONS ]]
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Hoppers pull from minecart hoppers",
|
label = "Hoppers pull from minecart",
|
||||||
nodenames = {"mcl_hoppers:hopper","mcl_hoppers:hopper_side"},
|
nodenames = {"mcl_hoppers:hopper","mcl_hoppers:hopper_side"},
|
||||||
interval = 0.5,
|
interval = 0.5,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
|
@ -396,9 +396,9 @@ minetest.register_abm({
|
||||||
if entity and entity.name then
|
if entity and entity.name then
|
||||||
--mcl_log("Name of object near: " .. tostring(entity.name))
|
--mcl_log("Name of object near: " .. tostring(entity.name))
|
||||||
|
|
||||||
if entity.name == "mcl_minecarts:hopper_minecart" then
|
if entity.name == "mcl_minecarts:hopper_minecart" or entity.name == "mcl_minecarts:chest_minecart"then
|
||||||
local hm_pos = entity.object:get_pos()
|
local hm_pos = entity.object:get_pos()
|
||||||
mcl_log("We have a hopper minecart close: ".. minetest.pos_to_string(hm_pos))
|
mcl_log("We have a minecart with inventory close: ".. minetest.pos_to_string(hm_pos))
|
||||||
|
|
||||||
--if hm_pos.y == pos.y + 1 then mcl_log("y is correct") end
|
--if hm_pos.y == pos.y + 1 then mcl_log("y is correct") end
|
||||||
--if (hm_pos.x >= pos.x - DIST_FROM_MC and hm_pos.x <= pos.x + DIST_FROM_MC) then mcl_log("x is within range") end
|
--if (hm_pos.x >= pos.x - DIST_FROM_MC and hm_pos.x <= pos.x + DIST_FROM_MC) then mcl_log("x is within range") end
|
||||||
|
@ -409,7 +409,11 @@ minetest.register_abm({
|
||||||
and (hm_pos.x >= pos.x - DIST_FROM_MC and hm_pos.x <= pos.x + DIST_FROM_MC)
|
and (hm_pos.x >= pos.x - DIST_FROM_MC and hm_pos.x <= pos.x + DIST_FROM_MC)
|
||||||
and (hm_pos.z >= pos.z - DIST_FROM_MC and hm_pos.z <= pos.z + DIST_FROM_MC) then
|
and (hm_pos.z >= pos.z - DIST_FROM_MC and hm_pos.z <= pos.z + DIST_FROM_MC) then
|
||||||
mcl_log("Minecart close enough")
|
mcl_log("Minecart close enough")
|
||||||
hopper_pull_from_mc (entity, pos)
|
if entity.name == "mcl_minecarts:hopper_minecart" then
|
||||||
|
hopper_pull_from_mc(entity, pos, 5)
|
||||||
|
elseif entity.name == "mcl_minecarts:chest_minecart" then
|
||||||
|
hopper_pull_from_mc(entity, pos, 27)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue