After couple of weeks of working and testing (in my free) and after last 24 hours working on documentation, I can finally present you my object-oriented LUA framework for Game Guru -
Avram's Game Guru Toolkit
As I have spent whole day working on a project's wiki system, I'm just going to copy description from the wiki:
Avram's Game Guru Toolkit is a LUA OOP framework (set of LUA OOP classes) for easier development of FPS games with Game Guru. Instead of writing spaghetti code and cluttering your global game namespace with custom variables and functions this project tries to encapsulate player and entities in Game Guru into single variables so you can easily interact with entities within the game. Don't expect too much though, as LUA support in Game Guru is still poor at this stage. There are only few things you can do, but with this framework you're going to do them easier than ever!
Features
[*] everywhere accessible
aPlayer object that encapsulates player
[*] encapsulate entities into single variable per entity
[*] fetch entities by their name (or part of the name)
[*] fetch nearest entities, all or by (part of) their name
[*] interact with multiple entities within one entity script function
[*] assign custom global (persistent) attributes to entities and/or player
[*] have custom global (persistent) variables not related to any entities or player
[*] have timed events (
Avram's timer is now part of this framework)
Sample code:
function plant_main(e)
local this = aEntity:new(e) -- get existing or create new timer for this entity
local myTimer = aTimer.for_e(this, 10) -- get/create timer
if aPlayer:distance(this) < 80 then
myTimer:start() -- start timer if the player is near
end
-- if the timer is running (is started, and for the first time) countdown or KABOOOM!
if myTimer:running() and myTimer.cnt == 1 then
if myTimer:expired() then
Prompt("KABOOOM!")
else
Prompt("tick, tick ... " .. myTimer:left())
end
end
-- wait 5 seconds prior to stopping timer (and hiding text)
if (myTimer:passed() > myTimer.countdown+5) then
myTimer:stop()
end
end
Result:
Wiki is not still complete, I need to write documentation for static aMisc class and make couple of more examples. Or someone else might test it and send me the code and youtube video clip for his example
Download and documentation