diff --git a/stead/gui.lua b/stead/gui.lua index 2f9b334..6ceeabf 100644 --- a/stead/gui.lua +++ b/stead/gui.lua @@ -17,7 +17,7 @@ iface.xref = function(self, str, obj) cmd = 'go '; elseif isMenu(o) then cmd = 'act '; - elseif isSceneuse(o) then + elseif isSceneUse(o) then cmd = 'use '; end @@ -135,3 +135,7 @@ function isMenu(v) end return false end + +function isSceneUse(v) + return call_bool(v, 'scene_use'); +end diff --git a/stead/stead.lua b/stead/stead.lua index 5a30d42..43de348 100644 --- a/stead/stead.lua +++ b/stead/stead.lua @@ -911,18 +911,25 @@ end function player_use(self, what, onwhat) local obj, obj2, v, vv, r; + local use_mode obj = self:srch(what); if not obj then - obj = ref(self.where):srch(what); - if obj and not isSceneuse(obj) then - obj = nil; + if call_bool(game, 'scene_use') then + use_mode = true + obj = ref(self.where):srch(what); + if not obj then + return + end + else + return game.err, false; end end - if not obj then - return game.err, false; - end if onwhat == nil then - v, r = call(ref(obj),'inv'); + if use_mode then + return player_action(self, what); + else + v, r = call(ref(obj),'inv'); + end if not v and r ~= true then v, r = call(game, 'inv', obj); end @@ -1394,16 +1401,6 @@ function isForcedsc(v) return g and r ~= false end -function isSceneuse(v) - local o,g - o = call_bool(v, 'scene_use'); - if o then - return true - end - g = call_bool(game, 'scene_use'); - return g and o ~= false -end - iface = { img = function(self, str) return '';