Hello /vm/, /agdg/ here, I've embedded the lua interpreter for modding, and I'd like some feedback about the way I'm currently doing things.
All client side mods are located in Client/lua/<modnamehere>/
Inside this folder is where a mod should store all it's assets/code. Two files on the client are the entry point for the mod. First, bootstrap.lua this file is run immediately when the game starts (Before any graphical display even) and should be used to expose a mod's api to other mods. The second is client.lua, this is run when the player connects to a server. Neither file is required, and mods can have one without the other. To wrestle api's into the right order, there is a modorder.dat in Client/lua/ that is just a text file that lists what order mods' bootstrap.lua should be loaded in.
The server side mods are located in Server/lua/<modnamehere>/, servermods also have a bootstrap.lua, and a modorder.dat for api's. only difference is that servers run server.lua immediately after running all bootstrap files, and do not run client.lua
In order to add functionality through lua, you must register hooks with the game.
function greet(ply)
print ply:name() .. " has joined the game, everyone say hello!"
end
Hook.OnInitialSpawn(greet)
In order to extend the game, I have a simple "gameobject" which can have modifiers added
local someobject = Util.gameobject()
//these are all set to nil by default
someobject.position = Util.vector3(0,0,0)//Set this item's position to the origin
someobject.graphical = Util.loadmodel("assets/general.obj")//I'm useing irrlicht, so this can be any supported 3d type
someobject.material = Util.loadmaterial("assets/general.mat")//My own special texture format that holds all the things irrlicht needs for materials
someobject.collision = Util.loadmodel("assets/charactercollision.obj")//This can be different from the graphical, esp. for detailed models that on
Post too long. Click here to view the full text.