C# Класс 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.
Показать файл Открыть проект

Открытые методы

Метод Описание
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).

Описание методов

ActiveGamemode() публичный статический Метод

Returns the name of the currently running gamemode.
public static ActiveGamemode ( LuaState luaState ) : string
luaState LuaState Pointer to lua_State struct.
Результат string

CloseServer() публичный статический Метод

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.
Результат void

GetDemoPlaybackStartTick() публичный статический Метод

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.
Результат double

GetDemoPlaybackTick() публичный статический Метод

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.
Результат double

GetDemoPlaybackTimeScale() публичный статический Метод

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.
Результат double

GetDemoPlaybackTotalTicks() публичный статический Метод

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.
Результат double

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.
public static IsPlayingDemo ( LuaState luaState ) : bool
luaState LuaState Pointer to lua_State struct.
Результат bool

IsRecordingDemo() публичный статический Метод

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.
Результат bool

LightStyle() публичный статический Метод

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". ///
Результат void

OpenDupe() публичный статический Метод

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".
Результат string

TickInterval() публичный статический Метод

Returns the number of seconds between each gametick.
public static TickInterval ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
Результат double

WriteDupe() публичный статический Метод

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 .
Результат void

WriteSave() публичный статический Метод

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.
Результат void