Compare commits

...

3 Commits

3 changed files with 50 additions and 17 deletions

View File

@ -409,14 +409,17 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o
-- Slow down or speed up
local acc = dir.y * -1.8
local friction = 0.4
local speed_mod = minetest.registered_nodes[minetest.get_node(pos).name]._rail_acceleration
acc = acc - friction
if has_fuel then
acc = acc + 0.2
elseif speed_mod and speed_mod ~= 0 then
acc = acc + speed_mod
else
acc = acc - 0.4
acc = acc + 0.6
end
if speed_mod and speed_mod ~= 0 then
acc = acc + speed_mod + friction
end
new_acc = vector.multiply(dir, acc)

View File

@ -253,6 +253,7 @@ local horse = {
-- Put on armor and take armor from player's inventory
local w = clicker:get_wielded_item()
local armor = minetest.get_item_group(iname, "horse_armor")
self._horse_armor = iname
if not minetest.settings:get_bool("creative_mode") then

View File

@ -90,6 +90,39 @@ if not canonical_basename then
canonical_basename = basename
end
local double_chest_add_item = function(top_inv, bottom_inv, listname, stack)
if not stack or stack:is_empty() then
return
end
local name = stack:get_name()
local top_off = function(inv, stack)
for i,chest_stack in ipairs(inv:get_list(listname)) do
if stack:is_empty() then
break
end
if chest_stack:get_name() == name and chest_stack:get_free_space() > 0 then
stack = chest_stack:add_item(stack)
inv:set_stack(listname, i, chest_stack)
end
end
return stack
end
stack = top_off(top_inv, stack)
stack = top_off(bottom_inv, stack)
if not stack:is_empty() then
stack = top_inv:add_item(listname, stack)
if not stack:is_empty() then
bottom_inv:add_item(listname, stack)
end
end
end
minetest.register_node("mcl_chests:"..basename, {
description = desc,
_tt_help = tt_help,
@ -295,12 +328,10 @@ minetest.register_node("mcl_chests:"..basename.."_left", {
-- BEGIN OF LISTRING WORKAROUND
if listname == "input" then
local inv = minetest.get_inventory({type="node", pos=pos})
local leftover = inv:add_item("main", stack)
if not leftover:is_empty() then
local other_pos = mcl_util.get_double_container_neighbor_pos(pos, minetest.get_node(pos).param2, "left")
local other_inv = minetest.get_inventory({type="node", pos=other_pos})
other_inv:add_item("main", leftover)
end
local other_pos = mcl_util.get_double_container_neighbor_pos(pos, minetest.get_node(pos).param2, "left")
local other_inv = minetest.get_inventory({type="node", pos=other_pos})
double_chest_add_item(inv, other_inv, "main", stack)
end
-- END OF LISTRING WORKAROUND
end,
@ -430,11 +461,9 @@ minetest.register_node("mcl_chests:"..basename.."_right", {
if listname == "input" then
local other_pos = mcl_util.get_double_container_neighbor_pos(pos, minetest.get_node(pos).param2, "right")
local other_inv = minetest.get_inventory({type="node", pos=other_pos})
local leftover = other_inv:add_item("main", stack)
if not leftover:is_empty() then
local inv = minetest.get_inventory({type="node", pos=pos})
inv:add_item("main", leftover)
end
local inv = minetest.get_inventory({type="node", pos=pos})
double_chest_add_item(other_inv, inv, "main", stack)
end
-- END OF LISTRING WORKAROUND
end,