scene_use logic

This commit is contained in:
p.kosyh 2009-10-15 07:06:45 +00:00
parent 24fef87d46
commit 834d2af9bd
2 changed files with 19 additions and 18 deletions

View file

@ -17,7 +17,7 @@ iface.xref = function(self, str, obj)
cmd = 'go '; cmd = 'go ';
elseif isMenu(o) then elseif isMenu(o) then
cmd = 'act '; cmd = 'act ';
elseif isSceneuse(o) then elseif isSceneUse(o) then
cmd = 'use '; cmd = 'use ';
end end
@ -135,3 +135,7 @@ function isMenu(v)
end end
return false return false
end end
function isSceneUse(v)
return call_bool(v, 'scene_use');
end

View file

@ -911,18 +911,25 @@ end
function player_use(self, what, onwhat) function player_use(self, what, onwhat)
local obj, obj2, v, vv, r; local obj, obj2, v, vv, r;
local use_mode
obj = self:srch(what); obj = self:srch(what);
if not obj then if not obj then
obj = ref(self.where):srch(what); if call_bool(game, 'scene_use') then
if obj and not isSceneuse(obj) then use_mode = true
obj = nil; obj = ref(self.where):srch(what);
if not obj then
return
end
else
return game.err, false;
end end
end end
if not obj then
return game.err, false;
end
if onwhat == nil then 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 if not v and r ~= true then
v, r = call(game, 'inv', obj); v, r = call(game, 'inv', obj);
end end
@ -1394,16 +1401,6 @@ function isForcedsc(v)
return g and r ~= false return g and r ~= false
end 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 = { iface = {
img = function(self, str) img = function(self, str)
return ''; return '';