C# Class GarrysModLuaShared.engine

The engine library provides functions to access various features in the game's engine, most are related to the demo and save systems.
ファイルを表示 Open project: OmegaExtern/gmod-csharp-binary-module

Public Methods

Method Description
ActiveGamemode ( LuaState luaState ) : string

Returns the name of the currently running gamemode.

CloseServer ( LuaState luaState ) : void

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.

GetDemoPlaybackStartTick ( LuaState luaState ) : double

When starting playing a demo, GetDemoPlaybackTick will be reset and its old value will be added to this functions return value.

GetDemoPlaybackTick ( LuaState luaState ) : double

Current tick of currently loaded demo. If not playing a demo, it will return amount of ticks since last demo playback.

GetDemoPlaybackTimeScale ( LuaState luaState ) : double

Returns time scale of demo playback. If not during demo playback, returns 1.

GetDemoPlaybackTotalTicks ( LuaState luaState ) : double

Returns total amount of ticks of currently loaded demo. If not playing a demo, returns 0 or the value of last played demo.

IsPlayingDemo ( LuaState luaState ) : bool

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.

IsRecordingDemo ( LuaState luaState ) : bool

Returns true if the game is currently recording a demo file (.dem) using gm_demo console variable.

LightStyle ( LuaState luaState, double lightstyle, string pattern ) : void

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.

OpenDupe ( LuaState luaState, string dupeName ) : string

Loads a duplication from the local filesystem.

TickInterval ( LuaState luaState ) : double

Returns the number of seconds between each gametick.

WriteDupe ( LuaState luaState, string dupe, string jpeg ) : void

Saves a duplication as a file.

WriteSave ( LuaState luaState, string saveData, string name, double time, string map ) : void

Stores savedata into the game (can be loaded using the LoadGame menu).

Method Details

ActiveGamemode() public static method

Returns the name of the currently running gamemode.
public static ActiveGamemode ( LuaState luaState ) : string
luaState LuaState Pointer to lua_State struct.
return string

CloseServer() public static method

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.
public static CloseServer ( LuaState luaState ) : void
luaState LuaState Pointer to lua_State struct.
return void

GetDemoPlaybackStartTick() public static method

When starting playing a demo, GetDemoPlaybackTick will be reset and its old value will be added to this functions return value.
public static GetDemoPlaybackStartTick ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
return double

GetDemoPlaybackTick() public static method

Current tick of currently loaded demo. If not playing a demo, it will return amount of ticks since last demo playback.
public static GetDemoPlaybackTick ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
return double

GetDemoPlaybackTimeScale() public static method

Returns time scale of demo playback. If not during demo playback, returns 1.
public static GetDemoPlaybackTimeScale ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
return double

GetDemoPlaybackTotalTicks() public static method

Returns total amount of ticks of currently loaded demo. If not playing a demo, returns 0 or the value of last played demo.
public static GetDemoPlaybackTotalTicks ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
return double

IsPlayingDemo() public static method

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.
public static IsPlayingDemo ( LuaState luaState ) : bool
luaState LuaState Pointer to lua_State struct.
return bool

IsRecordingDemo() public static method

Returns true if the game is currently recording a demo file (.dem) using gm_demo console variable.
public static IsRecordingDemo ( LuaState luaState ) : bool
luaState LuaState Pointer to lua_State struct.
return bool

LightStyle() public static method

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.
public static LightStyle ( LuaState luaState, double lightstyle, string pattern ) : void
luaState LuaState Pointer to lua_State struct.
lightstyle double The lightstyle to edit. 0 to 63. If you want to edit map lighting, you want to set this to 0.
pattern string /// The pattern to change the lightstyle to. "a" is the darkest, "z" is the brightest. You can use /// stuff like "abcxyz" to make flashing patterns. The normal brightness for a map is "m". ///
return void

OpenDupe() public static method

Loads a duplication from the local filesystem.
public static OpenDupe ( LuaState luaState, string dupeName ) : string
luaState LuaState Pointer to lua_State struct.
dupeName string Name of the file. e.g "dupes/8b809dd7a1a9a375e75be01cdc12e61f.dupe".
return string

TickInterval() public static method

Returns the number of seconds between each gametick.
public static TickInterval ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
return double

WriteDupe() public static method

Saves a duplication as a file.
public static WriteDupe ( LuaState luaState, string dupe, string jpeg ) : void
luaState LuaState Pointer to lua_State struct.
dupe string /// Dupe table, encoded by and compressed by /// . ///
jpeg string The dupe icon, created by .
return void

WriteSave() public static method

Stores savedata into the game (can be loaded using the LoadGame menu).
public static WriteSave ( LuaState luaState, string saveData, string name, double time, string map ) : void
luaState LuaState Pointer to lua_State struct.
saveData string Data generated by .
name string Name the save will have.
time double When the save was saved during the game (use here)
map string The map the save is used for.
return void