-
Notifications
You must be signed in to change notification settings - Fork 1
Home
acuifex edited this page Dec 2, 2022
·
5 revisions
command | description |
---|---|
lua_runstring <lua> | runs a lua string inside <lua> |
lua_run <filename> | runs a .lua file from JBMod/jbmod/lua/<filename>.lua |
lua_debugcallback <value> | calls callback called "test" with value <value> |
hook.set(string hookName, function callback) // sets a hook for hookName. currently doesn't support multiple hooks
https://www.lua.org/manual/5.4/manual.html#6
-
base
TODO: remove dangerous functions like dofile
-
string
-
table
-
math
TODO for some hooks: pass classes to callbacks
- LevelInit(string MapName)
- GameFrame(boolean simulating)
- LevelShutdown
- ClientActive
- ClientDisconnect
- ClientCommand(string cmd)
function | description |
---|---|
CBaseEntity CreateEntityByName(String name) | creates an entity by name. for example physics_prop |
DispatchSpawn(CBaseEntity entity) | spawns an entity |
CBaseEntity GetBaseEntityByEntIndex(int index) | gets a CBaseEntity by index |
RemoveEntity(CBaseEntity entity) | removes entity |
CBaseEntity FirstEntity() | get first entity |
CBaseEntity NextEntity(CBaseEntity entity) | get next entity // TODO: this probably returns null on last entity. HANDLE THIS!!! |
CBaseEntity FindEntityByHammerID(int index) | get entity by hammer id // TODO: same as above |
TODO: USING CUSTOM TYPES AFTER THEIR DELITION WILL CRASH YOUR GAME OR LEAD TO UNDEFINED BEHAVIOUR
method | desctiption |
---|---|
KeyValue(string key, string value) | sets different values. see: https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/game/server/props.cpp#L5927-L5944 https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/game/shared/baseentity_shared.cpp#L330-L445 there's most likely more. i didn't bother searching |
Precache() | this has something to do with preloading models. i didn't dig deeper |
Activate() | not sure. |
bool IsMoving() | returns true if entity is moving/not in physics sleep |
SetModel(string model) | sets model by path to .mdl |
string GetClassname() | get class name of the entity (i.e. prop_physics) |
create a bunch of cabinets in the middle of the map
for i=1572,1672,5 do
local w = IServerTools.CreateEntityByName('physics_prop')
w:KeyValue('origin', tostring(i)..' -7880 290')
w:KeyValue('model', 'models/props_wasteland/controlroom_filecabinet001a.mdl')
w:Precache()
IServerTools.DispatchSpawn(w)
w:Activate()
end