From d065df3d2f52930490370121e4f0eaa21596071d Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Wed, 23 Jun 2010 13:02:36 +0000
Subject: [PATCH] para module full automatic
---
stead/para.lua | 5 +++--
stead/stead.lua | 7 +++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/stead/para.lua b/stead/para.lua
index d40698d..6aa0e37 100644
--- a/stead/para.lua
+++ b/stead/para.lua
@@ -1,7 +1,8 @@
stead.fmt = stead.hook(stead.fmt, function(f, ...)
local r = f(unpack(arg))
- if type(r) == 'string' then
- r = r:gsub('~[ \t]*([^ \t]+)', txtnb(' %1'));
+ if type(r) == 'string' and stead.tick then
+ r = r:gsub('\n([^\n])', '<¶>%1'):gsub('<¶>', '\n'..txtnb(' '));
+ r = r:gsub('^',txtnb(' '))
end
return r;
end)
diff --git a/stead/stead.lua b/stead/stead.lua
index 68ed680..446e32e 100644
--- a/stead/stead.lua
+++ b/stead/stead.lua
@@ -1698,7 +1698,7 @@ iface = {
fmt = function(self, cmd, st, moved, r, av, objs, pv) -- st -- changed state (main win), move -- loc changed
local l
if st and not moved then
- if cmd ~= 'look' and cmd ~= '' then
+ if cmd ~= 'look' then
av = txtem(av);
pv = txtem(pv);
r = txtem(r);
@@ -1719,10 +1719,11 @@ iface = {
RAW_TEXT = nil
PLAYER_MOVED = nil
cmd,a = stead.getcmd(inp);
+ if cmd == '' then cmd = 'look' end
-- me():tag();
local oldloc = here();
- if cmd == 'look' or cmd == '' then
+ if cmd == 'look' then
r,v = me():look();
st = true;
elseif cmd == 'obj' then
@@ -1761,6 +1762,7 @@ iface = {
r,v = me():action(cmd, unpack(a));
st = true;
end
+ stead.tick = st
-- here r is action result, v - ret code value
-- st -- game state changed
if st and r == nil and v == true then -- we do nothing
@@ -1839,6 +1841,7 @@ end
function time()
return game._time;
end
+stead.time = time
function inv()
return me().obj;