para module full automatic

This commit is contained in:
p.kosyh 2010-06-23 13:02:36 +00:00
parent 24b7692d75
commit d065df3d2f
2 changed files with 8 additions and 4 deletions

View file

@ -1,7 +1,8 @@
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' then if type(r) == 'string' and stead.tick then
r = r:gsub('~[ \t]*([^ \t]+)', txtnb(' %1')); r = r:gsub('\n([^\n])', '<&para;>%1'):gsub('<&para;>', '\n'..txtnb(' '));
r = r:gsub('^',txtnb(' '))
end end
return r; return r;
end) end)

View file

@ -1698,7 +1698,7 @@ iface = {
fmt = function(self, cmd, st, moved, r, av, objs, pv) -- st -- changed state (main win), move -- loc changed fmt = function(self, cmd, st, moved, r, av, objs, pv) -- st -- changed state (main win), move -- loc changed
local l local l
if st and not moved then if st and not moved then
if cmd ~= 'look' and cmd ~= '' then if cmd ~= 'look' then
av = txtem(av); av = txtem(av);
pv = txtem(pv); pv = txtem(pv);
r = txtem(r); r = txtem(r);
@ -1719,10 +1719,11 @@ iface = {
RAW_TEXT = nil RAW_TEXT = nil
PLAYER_MOVED = nil PLAYER_MOVED = nil
cmd,a = stead.getcmd(inp); cmd,a = stead.getcmd(inp);
if cmd == '' then cmd = 'look' end
-- me():tag(); -- me():tag();
local oldloc = here(); local oldloc = here();
if cmd == 'look' or cmd == '' then if cmd == 'look' then
r,v = me():look(); r,v = me():look();
st = true; st = true;
elseif cmd == 'obj' then elseif cmd == 'obj' then
@ -1761,6 +1762,7 @@ iface = {
r,v = me():action(cmd, unpack(a)); r,v = me():action(cmd, unpack(a));
st = true; st = true;
end end
stead.tick = st
-- here r is action result, v - ret code value -- here r is action result, v - ret code value
-- st -- game state changed -- st -- game state changed
if st and r == nil and v == true then -- we do nothing if st and r == nil and v == true then -- we do nothing
@ -1839,6 +1841,7 @@ end
function time() function time()
return game._time; return game._time;
end end
stead.time = time
function inv() function inv()
return me().obj; return me().obj;