st to stead.state, arg to xref
This commit is contained in:
parent
7b5d618831
commit
41b6025f28
|
@ -1,7 +1,7 @@
|
||||||
game.hinting = true;
|
game.hinting = true;
|
||||||
game.showlast = true;
|
game.showlast = true;
|
||||||
|
|
||||||
iface.xref = function(self, str, obj)
|
iface.xref = function(self, str, obj, ...)
|
||||||
local o = ref(obj);
|
local o = ref(obj);
|
||||||
local cmd=''
|
local cmd=''
|
||||||
|
|
||||||
|
@ -16,7 +16,12 @@ iface.xref = function(self, str, obj)
|
||||||
elseif isSceneUse(o) then
|
elseif isSceneUse(o) then
|
||||||
cmd = 'use ';
|
cmd = 'use ';
|
||||||
end
|
end
|
||||||
return stead.cat('<a:'..cmd..'0'..tostring(o.id)..'>',str,'</a>');
|
local a = ''
|
||||||
|
local i
|
||||||
|
for i = 1, stead.table.maxn(arg) do
|
||||||
|
a = a..','..arg[i]
|
||||||
|
end
|
||||||
|
return stead.cat('<a:'..cmd..'0'..tostring(o.id)..a..'>',str,'</a>');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
iface.enum = function(self, n, str)
|
iface.enum = function(self, n, str)
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
para_mod = obj {
|
para_mod = {
|
||||||
nam = 'para',
|
|
||||||
ini = function(s)
|
|
||||||
s.time = stead.time()
|
|
||||||
end,
|
|
||||||
space = ' ',
|
space = ' ',
|
||||||
}
|
}
|
||||||
|
|
||||||
stead.fmt = stead.hook(stead.fmt, function(f, ...)
|
stead.fmt = stead.hook(stead.fmt, function(f, ...)
|
||||||
local r = f(unpack(arg))
|
local r = f(unpack(arg))
|
||||||
if type(r) == 'string' and stead.time() > para_mod.time then
|
if type(r) == 'string' and stead.state then
|
||||||
para_mod.time = stead.time()
|
|
||||||
r = r:gsub('\n([^\n])', '<¶>%1'):gsub('<¶>[ \t]*', '\n'..txtnb(para_mod.space));
|
r = r:gsub('\n([^\n])', '<¶>%1'):gsub('<¶>[ \t]*', '\n'..txtnb(para_mod.space));
|
||||||
r = r:gsub('^',txtnb(para_mod.space))
|
r = r:gsub('^',txtnb(para_mod.space))
|
||||||
end
|
end
|
||||||
|
|
|
@ -1713,7 +1713,7 @@ iface = {
|
||||||
cmd = function(self, inp)
|
cmd = function(self, inp)
|
||||||
local r, v;
|
local r, v;
|
||||||
v = false
|
v = false
|
||||||
local st = false; -- changed state (main screen)
|
stead.state = false; -- changed state (main screen)
|
||||||
local a = { };
|
local a = { };
|
||||||
local cmd;
|
local cmd;
|
||||||
RAW_TEXT = nil
|
RAW_TEXT = nil
|
||||||
|
@ -1725,7 +1725,6 @@ iface = {
|
||||||
|
|
||||||
if cmd == 'look' then
|
if cmd == 'look' then
|
||||||
r,v = me():look();
|
r,v = me():look();
|
||||||
st = true;
|
|
||||||
elseif cmd == 'obj' then
|
elseif cmd == 'obj' then
|
||||||
r,v = me():objs();
|
r,v = me():objs();
|
||||||
elseif cmd == 'inv' then
|
elseif cmd == 'inv' then
|
||||||
|
@ -1736,17 +1735,17 @@ iface = {
|
||||||
r = stead.par('^^', me():objs(), me():inv(), me():ways());
|
r = stead.par('^^', me():objs(), me():inv(), me():ways());
|
||||||
v = nil;
|
v = nil;
|
||||||
elseif cmd == 'go' then
|
elseif cmd == 'go' then
|
||||||
|
stead.state = true
|
||||||
r,v = me():go(unpack(a));
|
r,v = me():go(unpack(a));
|
||||||
st = true;
|
|
||||||
elseif cmd == 'back' then
|
elseif cmd == 'back' then
|
||||||
|
stead.state = true
|
||||||
r,v = me():go(from());
|
r,v = me():go(from());
|
||||||
st = true;
|
|
||||||
elseif cmd == 'act' then
|
elseif cmd == 'act' then
|
||||||
|
stead.state = true
|
||||||
r,v = me():action(unpack(a));
|
r,v = me():action(unpack(a));
|
||||||
st = true;
|
|
||||||
elseif cmd == 'use' then
|
elseif cmd == 'use' then
|
||||||
|
stead.state = true
|
||||||
r,v = me():use(unpack(a));
|
r,v = me():use(unpack(a));
|
||||||
st = true;
|
|
||||||
elseif cmd == 'save' then
|
elseif cmd == 'save' then
|
||||||
r, v = game:save(unpack(a));
|
r, v = game:save(unpack(a));
|
||||||
elseif cmd == 'load' then
|
elseif cmd == 'load' then
|
||||||
|
@ -1757,14 +1756,14 @@ iface = {
|
||||||
elseif cmd == 'nop' then
|
elseif cmd == 'nop' then
|
||||||
v = true;
|
v = true;
|
||||||
r = nil;
|
r = nil;
|
||||||
st = true;
|
stead.state = true
|
||||||
else
|
else
|
||||||
|
stead.state = true
|
||||||
r,v = me():action(cmd, unpack(a));
|
r,v = me():action(cmd, unpack(a));
|
||||||
st = true;
|
|
||||||
end
|
end
|
||||||
-- here r is action result, v - ret code value
|
-- here r is action result, v - ret code value
|
||||||
-- st -- game state changed
|
-- state -- game state changed
|
||||||
if st and r == nil and v == true then -- we do nothing
|
if stead.state and r == nil and v == true then -- we do nothing
|
||||||
return nil;
|
return nil;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1781,16 +1780,16 @@ iface = {
|
||||||
local av, pv -- av -- active lifes, pv -- background
|
local av, pv -- av -- active lifes, pv -- background
|
||||||
local vv
|
local vv
|
||||||
|
|
||||||
if st then
|
if stead.state then
|
||||||
pv,av = game:step();
|
pv,av = game:step();
|
||||||
me():tag();
|
me():tag();
|
||||||
vv = here():look();
|
vv = here():look();
|
||||||
end
|
end
|
||||||
|
|
||||||
vv = self:fmt(cmd, st, (oldloc ~= here()) or PLAYER_MOVED,
|
vv = self:fmt(cmd, stead.state, (oldloc ~= here()) or PLAYER_MOVED,
|
||||||
ACTION_TEXT, av, vv, pv);
|
ACTION_TEXT, av, vv, pv);
|
||||||
|
|
||||||
if st then
|
if stead.state then
|
||||||
game._lastdisp = vv
|
game._lastdisp = vv
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1862,9 +1861,9 @@ function ways(w)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function xref(str, obj)
|
function xref(str, obj, ...)
|
||||||
if type(str) ~= 'string' then return nil; end;
|
if type(str) ~= 'string' then return nil; end;
|
||||||
return iface:xref(str, obj);
|
return iface:xref(str, obj, unpack(arg));
|
||||||
end
|
end
|
||||||
|
|
||||||
function pon(...)
|
function pon(...)
|
||||||
|
|
Reference in a new issue