The engine library provides functions to access various features in the game's engine, most are related to the demo and save systems.
Returns the name of the currently running gamemode. This will return the incorrect gamemode name on the client if used too early.
Closes the server and completely exits. This is only functional when running in server test mode (launch option -systemtest). Server test mode is used internally at Facepunch as part of the build process to make sure that the dedicated servers aren't crashing on startup.
Returns a list of addons the player have subscribed to on the workshop. This list will also include "Floating" .gma addons that are mounted by the game, but not the folder addons.
When starting playing a demo, engine.GetDemoPlaybackTick will be reset and its old value will be added to this functions return value.
Current tick of currently loaded demo. If not playing a demo, it will return amount of ticks since last demo playback.
Returns time scale of demo playback. If not during demo playback, returns 1.
Returns total amount of ticks of currently loaded demo. If not playing a demo, returns 0 or the value of last played demo.
Returns an array of tables corresponding to all games from which Garry's Mod supports mounting content.
We advise against using this. It may be changed or removed in a future update. Used internally for in-game menus, may be merged in the future into engine.GetAddons. Returns the UGC (demos, saves and dupes) the player have subscribed to on the workshop.
Returns true if we're currently playing a demo. You will notice that there's no server-side version of this. That's because there is no server when playing a demo. Demos are both recorded and played back purely clientside.
Returns true if the game is currently recording a demo file (.dem) using gm_demo
engine.LightStyle( number lightstyle, string pattern )
This is a direct binding to the function “engine->LightStyle”. This function allows you to change the default light style of the map - so you can make lighting lighter or darker. You’ll need to call render.RedownloadAllLightmaps clientside to refresh the lightmaps to this new color. Calling this function with arguments 0 and "a" will cause dynamic lights such as those produced by the Light tool to stop working.
number, number engine.ServerFrameTime()
Returns an estimate of the server's performance. Equivalent to calling FrameTime from the server, according to source code.
engine.SetMounted( string depotID, boolean doMount )
Sets the mounting options for mountable content.
Returns video recording settings set by video.Record. Used by Demo-To-Video feature.