engine
The engine library provides functions to access various features in the game's engine, most are related to the demo and save systems.
Methods
number engine.AbsoluteFrameTime()
Returns non paused FrameTime.
string engine.ActiveGamemode()
Returns the name of the currently running gamemode.
engine.CloseServer()
Closes the server and completely exits.
To enable this function for use on your server, add -allowquit to your commandline, which will make this function run quit keep_players when executed, this also does not forcibly disconnect players.
This is also available 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.
number engine.GetDemoPlaybackStartTick()
When starting playing a demo, engine. GetDemoPlaybackTick will be reset and its old value will be added to this functions return value.
number engine.GetDemoPlaybackTick()
Current tick of currently loaded demo.
If not playing a demo, it will return amount of ticks since last demo playback.
number engine.GetDemoPlaybackTimeScale()
Returns time scale of demo playback.
If not during demo playback, returns 1.
number engine.GetDemoPlaybackTotalTicks()
Returns total amount of ticks of currently loaded demo.
If not playing a demo, returns 0 or the value of last played demo.
table engine.GetGamemodes()
Returns a table containing info for all installed gamemodes
Returns an array of tables corresponding to all games from which Garry's Mod supports mounting content.
table engine.GetUserContent()
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.
boolean engine.IsPlayingDemo()
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.
boolean engine.IsRecordingDemo()
Returns true if the game is currently recording a demo file (. dem) using gm_demo
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. Issue Tracker: 3626
Returns an estimate of the server's performance. Equivalent to calling FrameTime from the server, according to source code.
Sets the mounting options for mountable content.
number engine.TickInterval()
Returns the number of seconds between each gametick.
table engine.VideoSettings()
This is used internally - although you're able to use it you probably shouldn't.
Returns video recording settings set by video. Record. Used by Demo-To-Video feature.
This is used internally - although you're able to use it you probably shouldn't.
Do not use.
Saves a duplication as a file.