forked from mtcontrib/pipeworks
Return early from on_step (#33)
This commit is contained in:
parent
3b31b6f9c0
commit
1349ff8dd8
@ -311,8 +311,6 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
|||||||
self:set_pos(pos)
|
self:set_pos(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local stack = ItemStack(self.itemstring)
|
|
||||||
|
|
||||||
local velocity = self:get_velocity()
|
local velocity = self:get_velocity()
|
||||||
|
|
||||||
local moved = false
|
local moved = false
|
||||||
@ -329,9 +327,15 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
|||||||
moved = true
|
moved = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not moved then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local stack = ItemStack(self.itemstring)
|
||||||
|
|
||||||
pipeworks.load_position(self.start_pos)
|
pipeworks.load_position(self.start_pos)
|
||||||
local node = minetest.get_node(self.start_pos)
|
local node = minetest.get_node(self.start_pos)
|
||||||
if moved and minetest.get_item_group(node.name, "tubedevice_receiver") == 1 then
|
if minetest.get_item_group(node.name, "tubedevice_receiver") == 1 then
|
||||||
local leftover
|
local leftover
|
||||||
if minetest.registered_nodes[node.name].tube and minetest.registered_nodes[node.name].tube.insert_object then
|
if minetest.registered_nodes[node.name].tube and minetest.registered_nodes[node.name].tube.insert_object then
|
||||||
leftover = minetest.registered_nodes[node.name].tube.insert_object(self.start_pos, node, stack, vel, self.owner)
|
leftover = minetest.registered_nodes[node.name].tube.insert_object(self.start_pos, node, stack, vel, self.owner)
|
||||||
@ -349,7 +353,6 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if moved then
|
|
||||||
local found_next, new_velocity, multimode = go_next(self.start_pos, velocity, stack, self.owner) -- todo: color
|
local found_next, new_velocity, multimode = go_next(self.start_pos, velocity, stack, self.owner) -- todo: color
|
||||||
local rev_vel = vector.multiply(velocity, -1)
|
local rev_vel = vector.multiply(velocity, -1)
|
||||||
local rev_dir = vector.direction(self.start_pos,vector.add(self.start_pos,rev_vel))
|
local rev_dir = vector.direction(self.start_pos,vector.add(self.start_pos,rev_vel))
|
||||||
@ -389,7 +392,6 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
|||||||
self:set_velocity(new_velocity)
|
self:set_velocity(new_velocity)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.get_modpath("mesecons_mvps") then
|
if minetest.get_modpath("mesecons_mvps") then
|
||||||
|
Loading…
Reference in New Issue
Block a user