1
0
Fork 0
mirror of https://gitlab.com/Oreolek/duel.git synced 2024-06-24 11:00:54 +03:00

Updates WIP

This commit is contained in:
Alexander Yakovlev 2019-03-07 21:43:57 +07:00
parent b5390b66d0
commit d8dc936c3a
Signed by: oreolek
GPG key ID: 1CDC4B7820C93BD3
2 changed files with 44 additions and 30 deletions

View file

@ -1,6 +1,7 @@
--$Author: Alexander Yakolev$
--$Version: 1.2$
--$Name: Инженер$
-- instead_version "3.2.0"
require "fmt"
require "noinv"
declare "isdebug" (false)
@ -10,7 +11,7 @@ require "proxymenu"
if isdebug then
require "dbg"
require "dbg-ru"
include("transcript")
loadmod("transcript")
end
-- Мы не шифруемся, у нас Creative Commons

View file

@ -1,40 +1,53 @@
local std = stead
local filename = "game.log"
local hooked = false
local orig_onwalk
local orig_afteract
function writelog(s)
local function writelog(s)
local filename = "game.log"
local f = io.open(filename, "a")
f:seek("end", 0)
f:write("\n", s, "\n")
return f:flush()
end
game.onwalk = function(f, inwalk)
if inwalk.dsc then
local dsc = std.call(inwalk, 'dsc')
if dsc then
writelog(dsc)
end
std.mod_start(function()
if hooked then
return
end
if inwalk.decor then
local decor = std.call(inwalk, 'decor')
if decor then
writelog(decor)
end
end
return true
end
orig_onwalk = std.rawget(game, 'onwalk');
orig_afteract = std.rawget(game, 'afteract');
game.afteract = function(this, that)
local nam1 = this.decor
local nam2 = that.decor
if that:type('phr') then
nam2 = std.call(that, 'dsc')
else
nam2 = that.nam
end
if nam2 then
writelog("> "..nam2)
end
end
std.hook(game.onwalk, function(f, inwalk)
print(inwalk.nam);
if inwalk.dsc then
local dsc = std.call(inwalk, 'dsc')
if dsc then
writelog(dsc)
end
end
if inwalk.decor then
local decor = std.call(inwalk, 'decor')
if decor then
writelog(decor)
end
end
return true
end)
std.mod_start(function() writelog("--- НАЧАЛО ИГРЫ ---") end)
std.hook(game.afteract, function(this, that)
writelog("> "..this.nam..' @ '..that.nam)
if that:type('phr') then
writelog(std.call(that, 'dsc'))
end
end)
hooked = true
writelog("--- НАЧАЛО ИГРЫ ---")
end)
std.mod_done(function(load)
hooked = false
std.rawset(game, 'onwalk', orig_onwalk);
std.rawset(game, 'afteract', orig_afteract);
end)