mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-28 03:40:25 +01:00
Various small fixes
* Save the fakeplayer's wielded item in set_wielded_item * pipeworks.luaentity: Return the found objects in get_objects_inside_radius * Remove the invalid and unused on_blast return values in lua_tube.lua This should avoid a crash when a strong explosion happens next to a Lua Tube. * Do not access a global "nodename" in a BUG message. This avoids a potential crash, in case the message actually appears in practice. * Set the Flow Sensor and Fountain Head mesecons connection rules * pipeworks.luaentity: Use the same function for move_to and set_pos * (no functional change) Do not save the object returned by tube_inject_item into the "item1" local variable in filter-injector.lua
This commit is contained in:
parent
f0ef43823c
commit
a2c0dd1130
@ -223,7 +223,7 @@ function pipeworks.create_fake_player(def, is_dynamic)
|
|||||||
return self._inventory:set_stack(def.wield_list,
|
return self._inventory:set_stack(def.wield_list,
|
||||||
self._wield_index, item)
|
self._wield_index, item)
|
||||||
end
|
end
|
||||||
_wielded_item = ItemStack(item)
|
self._wielded_item = ItemStack(item)
|
||||||
end,
|
end,
|
||||||
get_wielded_item = function(self, item)
|
get_wielded_item = function(self, item)
|
||||||
if self._inventory and def.wield_list then
|
if self._inventory and def.wield_list then
|
||||||
@ -242,17 +242,18 @@ function pipeworks.create_fake_player(def, is_dynamic)
|
|||||||
set_bone_position = delay(),
|
set_bone_position = delay(),
|
||||||
hud_change = delay(),
|
hud_change = delay(),
|
||||||
}
|
}
|
||||||
local _trash
|
|
||||||
-- Getter & setter functions
|
-- Getter & setter functions
|
||||||
p.get_inventory_formspec, p.set_inventory_formspec
|
p.get_inventory_formspec, p.set_inventory_formspec
|
||||||
= get_set_wrap("formspec", is_dynamic)
|
= get_set_wrap("formspec", is_dynamic)
|
||||||
p.get_breath, p.set_breath = get_set_wrap("breath", is_dynamic)
|
p.get_breath, p.set_breath = get_set_wrap("breath", is_dynamic)
|
||||||
p.get_hp, p.set_hp = get_set_wrap("hp", is_dynamic)
|
p.get_hp, p.set_hp = get_set_wrap("hp", is_dynamic)
|
||||||
p.get_pos, p.set_pos = get_set_wrap("pos", is_dynamic)
|
p.get_pos, p.set_pos = get_set_wrap("pos", is_dynamic)
|
||||||
_trash, p.move_to = get_set_wrap("pos", is_dynamic)
|
|
||||||
p.get_wield_index, p.set_wield_index = get_set_wrap("wield_index", true)
|
p.get_wield_index, p.set_wield_index = get_set_wrap("wield_index", true)
|
||||||
p.get_properties, p.set_properties = get_set_wrap("properties", false)
|
p.get_properties, p.set_properties = get_set_wrap("properties", false)
|
||||||
|
|
||||||
|
-- For players, move_to and get_pos do the same
|
||||||
|
p.move_to = p.get_pos
|
||||||
|
|
||||||
-- Backwards compatibilty
|
-- Backwards compatibilty
|
||||||
p.getpos = p.get_pos
|
p.getpos = p.get_pos
|
||||||
p.setpos = p.set_pos
|
p.setpos = p.set_pos
|
||||||
|
@ -465,7 +465,7 @@ minetest.register_node(nodename_sensor_empty, {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if mesecon then
|
if mesecon then
|
||||||
mesecon.receptor_off(pos, rules)
|
mesecon.receptor_off(pos, pipeworks.mesecons_rules)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
@ -504,7 +504,7 @@ minetest.register_node(nodename_sensor_loaded, {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if mesecon then
|
if mesecon then
|
||||||
mesecon.receptor_on(pos, rules)
|
mesecon.receptor_on(pos, pipeworks.mesecons_rules)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
@ -626,7 +626,7 @@ minetest.register_node(nodename_fountain_empty, {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if mesecon then
|
if mesecon then
|
||||||
mesecon.receptor_on(pos, rules)
|
mesecon.receptor_on(pos, pipeworks.mesecons_rules)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
@ -661,7 +661,7 @@ minetest.register_node(nodename_fountain_loaded, {
|
|||||||
end,
|
end,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
if mesecon then
|
if mesecon then
|
||||||
mesecon.receptor_on(pos, rules)
|
mesecon.receptor_on(pos, pipeworks.mesecons_rules)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
selection_box = {
|
selection_box = {
|
||||||
|
@ -322,7 +322,8 @@ local function punch_filter(data, filtpos, filtnode, msg)
|
|||||||
end
|
end
|
||||||
local pos = vector.add(frompos, vector.multiply(dir, 1.4))
|
local pos = vector.add(frompos, vector.multiply(dir, 1.4))
|
||||||
local start_pos = vector.add(frompos, dir)
|
local start_pos = vector.add(frompos, dir)
|
||||||
local item1 = pipeworks.tube_inject_item(pos, start_pos, dir, item, fakePlayer:get_player_name())
|
pipeworks.tube_inject_item(pos, start_pos, dir, item,
|
||||||
|
fakePlayer:get_player_name())
|
||||||
return true -- only fire one item, please
|
return true -- only fire one item, please
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -993,7 +993,7 @@ for white = 0, 1 do
|
|||||||
on_blast = function(pos, intensity)
|
on_blast = function(pos, intensity)
|
||||||
if not intensity or intensity > 1 + 3^0.5 then
|
if not intensity or intensity > 1 + 3^0.5 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
return {string.format("%s_%s", name, dropname)}
|
return
|
||||||
end
|
end
|
||||||
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
@ -1070,7 +1070,7 @@ minetest.register_node(BASENAME .. "_burnt", {
|
|||||||
on_blast = function(pos, intensity)
|
on_blast = function(pos, intensity)
|
||||||
if not intensity or intensity > 1 + 3^0.5 then
|
if not intensity or intensity > 1 + 3^0.5 then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
return {string.format("%s_%s", name, dropname)}
|
return
|
||||||
end
|
end
|
||||||
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
|
@ -324,6 +324,7 @@ function luaentity.get_objects_inside_radius(pos, radius)
|
|||||||
index = index + 1
|
index = index + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
return objects
|
||||||
end
|
end
|
||||||
|
|
||||||
local move_entities_globalstep_part2 = function(dtime)
|
local move_entities_globalstep_part2 = function(dtime)
|
||||||
|
@ -339,7 +339,9 @@ flowlogic.run_transition = function(node, currentpressure)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not found then
|
if not found then
|
||||||
pipeworks.logger("flowlogic.run_transition() BUG no transition definitions found! nodename="..nodename.." currentpressure="..tostring(currentpressure))
|
pipeworks.logger("flowlogic.run_transition() BUG no transition " ..
|
||||||
|
"definitions found! node.name=" .. node.name ..
|
||||||
|
" currentpressure=" .. tostring(currentpressure))
|
||||||
end
|
end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user