eXperemental object module

This commit is contained in:
p.kosyh 2010-06-20 15:47:49 +00:00
parent 805e3f2ea8
commit 7971622f82
3 changed files with 38 additions and 0 deletions

View file

@ -16,6 +16,7 @@ install:
$(INSTALL) vars.lua $(STEADPATH)/vars.lua
$(INSTALL) prefs.lua $(STEADPATH)/prefs.lua
$(INSTALL) snapshot.lua $(STEADPATH)/snapshot.lua
$(INSTALL) object.lua $(STEADPATH)/object.lua
uninstall:
$(RM) $(STEADPATH)/stead.lua

View file

@ -13,3 +13,4 @@ install:
copy vars.lua ..\bin\stead
copy prefs.lua ..\bin\stead
copy snapshot.lua ..\bin\stead
copy object.lua ..\bin\stead

36
stead/object.lua Normal file
View file

@ -0,0 +1,36 @@
obj = inherit(obj, function(v)
if v.use then
v.use = hook(v.use, function(f, s, on, ...)
return f(s, ref(on), unpack(arg))
end)
end
if v.used then
v.used = hook(v.used, function(f, s, by, ...)
return f(s, ref(by), unpack(arg))
end)
end
return v
end)
room = inherit(room, function(v)
if v._enter then
v.enter = hook(v.enter, function(f, s, from, ...)
return f(s, ref(from), unpack(arg))
end)
end
if v.entered then
v.entered = hook(v.enter, function(f, s, from, ...)
return f(s, ref(from), unpack(arg))
end)
end
if v.exit then
v.exit = hook(v.exit, function(f, s, to, ...)
return f(s, ref(to), unpack(arg))
end)
end
if v.left then
v.left = hook(v.left, function(f, s, to, ...)
return f(s, ref(to), unpack(arg))
end)
end
end)