From 166db4b5e58936bf54d855065083d49f854f763f Mon Sep 17 00:00:00 2001 From: sys4-fr Date: Sun, 25 Mar 2018 15:46:58 +0200 Subject: [PATCH] Fix crash --- actions/actions.lua | 4 ++-- actions/places.lua | 1 + npc.lua | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/actions/actions.lua b/actions/actions.lua index 4bd735d..b1b689b 100644 --- a/actions/actions.lua +++ b/actions/actions.lua @@ -649,7 +649,7 @@ function npc.actions.use_openable(self, args) local node = minetest.get_node(pos) local state = npc.actions.get_openable_node_state(node, pos, dir) - local clicker = self.object + local clicker = self.object.npc_name if action ~= state then minetest.registered_nodes[node.name].on_rightclick(pos, node, clicker, nil, nil) end @@ -1192,4 +1192,4 @@ function npc.actions.walk_to_pos(self, args) self.object:moveto({x=end_pos.x, y=end_pos.y+1, z=end_pos.z}) end end -end \ No newline at end of file +end diff --git a/actions/places.lua b/actions/places.lua index 3403914..3f821d8 100644 --- a/actions/places.lua +++ b/actions/places.lua @@ -259,6 +259,7 @@ function npc.places.find_unused_place(self, place_category, place_type, original return alternative_places[i] end end + --result = original_place else result = original_place end diff --git a/npc.lua b/npc.lua index 91a6f48..52652fc 100755 --- a/npc.lua +++ b/npc.lua @@ -1311,7 +1311,8 @@ function npc.after_activate(self) if self.yaw_before_interaction then self.object:setyaw(self.yaw_before_interaction) end - else + else + if not self.actions then self.actions = {} end -- Temporary code - adds the new state variables self.actions.move_state = { is_sitting = false,