Fix bug with 'ignore' nodes when some map areas are not fully loaded but NPC try to perform actions on them.
This commit is contained in:
parent
cc56446206
commit
e70888c3e5
@ -604,6 +604,10 @@ function npc.actions.use_bed(self, args)
|
||||
|
||||
if action == npc.actions.const.beds.LAY then
|
||||
-- Get position
|
||||
-- Error here due to ignore. Need to come up with better solution
|
||||
if node.name == "ignore" then
|
||||
return
|
||||
end
|
||||
local bed_pos = npc.actions.nodes.beds[node.name].get_lay_pos(pos, dir)
|
||||
-- Sit down on bed, rotate to correct direction
|
||||
npc.add_action(self, npc.actions.cmd.SIT, {pos=bed_pos, dir=(node.param2 + 2) % 4})
|
||||
@ -611,6 +615,10 @@ function npc.actions.use_bed(self, args)
|
||||
npc.add_action(self, npc.actions.cmd.LAY, {})
|
||||
else
|
||||
-- Calculate position to get up
|
||||
-- Error here due to ignore. Need to come up with better solution
|
||||
if node.name == "ignore" then
|
||||
return
|
||||
end
|
||||
local bed_pos_y = npc.actions.nodes.beds[node.name].get_lay_pos(pos, dir).y
|
||||
local bed_pos = {x = pos.x, y = bed_pos_y, z = pos.z}
|
||||
-- Sit up
|
||||
@ -662,6 +670,10 @@ function npc.actions.use_sittable(self, args)
|
||||
|
||||
if action == npc.actions.const.sittable.SIT then
|
||||
-- Calculate position depending on bench
|
||||
-- Error here due to ignore. Need to come up with better solution
|
||||
if node.name == "ignore" then
|
||||
return
|
||||
end
|
||||
local sit_pos = npc.actions.nodes.sittable[node.name].get_sit_pos(pos, node.param2)
|
||||
-- Sit down on bench/chair/stairs
|
||||
npc.add_action(self, npc.actions.cmd.SIT, {pos=sit_pos, dir=(node.param2 + 2) % 4})
|
||||
|
@ -153,7 +153,11 @@ local function walkable(node, exceptions)
|
||||
if node.name == "cottages:wood_flat" then
|
||||
is_mg_villages_ceiling = true
|
||||
end
|
||||
if node ~= nil and node.name ~= nil and not minetest.registered_nodes[node.name].walkable then
|
||||
if node ~= nil
|
||||
and node.name ~= nil
|
||||
and node.name ~= "ignore"
|
||||
and minetest.registered_nodes[node.name]
|
||||
and not minetest.registered_nodes[node.name].walkable then
|
||||
return false
|
||||
elseif is_openable then
|
||||
return false
|
||||
|
@ -557,6 +557,11 @@ function spawner.replace_mg_villages_plotmarker(pos)
|
||||
local village_id = meta:get_string("village_id")
|
||||
local plot_nr = meta:get_int("plot_nr")
|
||||
local infotext = meta:get_string("infotext")
|
||||
-- Check for nil values above
|
||||
if (not village_id or (village and village == ""))
|
||||
or (not plot_nr or (plot_nr and plot_nr == 0)) then
|
||||
return
|
||||
end
|
||||
-- Following line from mg_villages mod, protection.lua
|
||||
local btype = mg_villages.all_villages[village_id].to_add_data.bpos[plot_nr].btype
|
||||
local building_data = mg_villages.BUILDINGS[btype]
|
||||
|
Loading…
Reference in New Issue
Block a user