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 ';
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

View file

@ -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 '';