C# Class GarrysModLuaShared.game

The game library provides functions to access various features in the game's engine, most of it's functions are related to controlling the map.
Afficher le fichier Open project: OmegaExtern/gmod-csharp-binary-module

Méthodes publiques

Méthode Description
AddDecal ( LuaState luaState, string decalName, string materialName ) : void

Registers a new decal.

AddParticles ( LuaState luaState, string particleFileName ) : void

Loads a particle file.

ConsoleCommand ( LuaState luaState, string stringCommand ) : void

Runs a console command. Make sure to add a newline ("\n") at the end of the command.

GetAmmoID ( LuaState luaState, string name ) : double

Returns the ammo type ID for given ammo type name. See GetAmmoName for reverse.

GetAmmoMax ( LuaState luaState, double id ) : double

Returns the real maximum amount of ammo of the given ammo ID. Note: Currently all ammo types have overridden maximum value of reserve ammo set to 9999.

GetAmmoName ( LuaState luaState, double id ) : string

Returns the ammo name for given ammo type ID. See GetAmmoID for reverse.

GetMap ( LuaState luaState ) : string

Returns the name of the current map, without a file extension.

GetMapNext ( LuaState luaState ) : string

Returns the next map that would be loaded according to the file that is set by the mapcyclefile convar.

GetMapVersion ( LuaState luaState ) : double

Returns the VBSP version of the current map.

GetSkillLevel ( LuaState luaState ) : double

Returns the difficulty level of the game. TIP: You can use this function in your scripted NPCs or Nextbots to make them harder, however, it is a good idea to lock powerful attacks behind the highest difficulty instead of just increasing the health.

GetTimeScale ( LuaState luaState ) : double

Returns the timescale of the game.

IsDedicated ( LuaState luaState ) : bool

Returns whenever the server or the server we are connected to is a dedicated server.

LoadNextMap ( LuaState luaState ) : void

Loads the next map according to the file that is set by the mapcyclefile convar.

MapLoadType ( LuaState luaState ) : string

Returns the map load type of the current map.

MaxPlayers ( LuaState luaState ) : double

Returns the maximum number of players for this server.

RemoveRagdolls ( LuaState luaState ) : void

Removes all the clientside ragdolls.

SetSkillLevel ( LuaState luaState, double level ) : void

Sets the difficulty level of the game, can be retrieved with game.GetSkillLevel. This will automatically change whenever the "skill" convar is modified serverside.

SetTimeScale ( LuaState luaState, double timeScale ) : void

Sets the time scale of the game. This function is supposed to remove the need of using the host_timescale convar, which is cheat protected. To slow down or speed up the movement of a specific player, use Player.SetLaggedMovementValue instead. NOTE: Like host_timescale, this method does not affect sounds, if you wish to change that, look into EntityEmitSound hook.

SinglePlayer ( LuaState luaState ) : bool

Returns whenever the current session is a single player game.

Method Details

AddDecal() public static méthode

Registers a new decal.
public static AddDecal ( LuaState luaState, string decalName, string materialName ) : void
luaState LuaState Pointer to lua_State struct.
decalName string The name of the decal.
materialName string /// The material to be used for the decal. May also be a list of material names, in which case a /// random material from that list will be chosen every time the decal is placed. ///
Résultat void

AddParticles() public static méthode

Loads a particle file.
public static AddParticles ( LuaState luaState, string particleFileName ) : void
luaState LuaState Pointer to lua_State struct.
particleFileName string The path of the file to add. Must be (file).pcf.
Résultat void

ConsoleCommand() public static méthode

Runs a console command. Make sure to add a newline ("\n") at the end of the command.
public static ConsoleCommand ( LuaState luaState, string stringCommand ) : void
luaState LuaState Pointer to lua_State struct.
stringCommand string String containing the command and arguments to be ran.
Résultat void

GetAmmoID() public static méthode

Returns the ammo type ID for given ammo type name. See GetAmmoName for reverse.
public static GetAmmoID ( LuaState luaState, string name ) : double
luaState LuaState Pointer to lua_State struct.
name string Name of the ammo type to look up ID of.
Résultat double

GetAmmoMax() public static méthode

Returns the real maximum amount of ammo of the given ammo ID. Note: Currently all ammo types have overridden maximum value of reserve ammo set to 9999.
public static GetAmmoMax ( LuaState luaState, double id ) : double
luaState LuaState Pointer to lua_State struct.
id double Ammo type ID.
Résultat double

GetAmmoName() public static méthode

Returns the ammo name for given ammo type ID. See GetAmmoID for reverse.
public static GetAmmoName ( LuaState luaState, double id ) : string
luaState LuaState Pointer to lua_State struct.
id double Ammo ID to retrieve the name of. Starts from 1.
Résultat string

GetMap() public static méthode

Returns the name of the current map, without a file extension.
public static GetMap ( LuaState luaState ) : string
luaState LuaState Pointer to lua_State struct.
Résultat string

GetMapNext() public static méthode

Returns the next map that would be loaded according to the file that is set by the mapcyclefile convar.
public static GetMapNext ( LuaState luaState ) : string
luaState LuaState Pointer to lua_State struct.
Résultat string

GetMapVersion() public static méthode

Returns the VBSP version of the current map.
public static GetMapVersion ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
Résultat double

GetSkillLevel() public static méthode

Returns the difficulty level of the game. TIP: You can use this function in your scripted NPCs or Nextbots to make them harder, however, it is a good idea to lock powerful attacks behind the highest difficulty instead of just increasing the health.
public static GetSkillLevel ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
Résultat double

GetTimeScale() public static méthode

Returns the timescale of the game.
public static GetTimeScale ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
Résultat double

IsDedicated() public static méthode

Returns whenever the server or the server we are connected to is a dedicated server.
public static IsDedicated ( LuaState luaState ) : bool
luaState LuaState Pointer to lua_State struct.
Résultat bool

LoadNextMap() public static méthode

Loads the next map according to the file that is set by the mapcyclefile convar.
public static LoadNextMap ( LuaState luaState ) : void
luaState LuaState Pointer to lua_State struct.
Résultat void

MapLoadType() public static méthode

Returns the map load type of the current map.
public static MapLoadType ( LuaState luaState ) : string
luaState LuaState Pointer to lua_State struct.
Résultat string

MaxPlayers() public static méthode

Returns the maximum number of players for this server.
public static MaxPlayers ( LuaState luaState ) : double
luaState LuaState Pointer to lua_State struct.
Résultat double

RemoveRagdolls() public static méthode

Removes all the clientside ragdolls.
public static RemoveRagdolls ( LuaState luaState ) : void
luaState LuaState Pointer to lua_State struct.
Résultat void

SetSkillLevel() public static méthode

Sets the difficulty level of the game, can be retrieved with game.GetSkillLevel. This will automatically change whenever the "skill" convar is modified serverside.
public static SetSkillLevel ( LuaState luaState, double level ) : void
luaState LuaState Pointer to lua_State struct.
level double The difficulty level, Easy( 1 ), Normal( 2 ), Hard( 3 ).
Résultat void

SetTimeScale() public static méthode

Sets the time scale of the game. This function is supposed to remove the need of using the host_timescale convar, which is cheat protected. To slow down or speed up the movement of a specific player, use Player.SetLaggedMovementValue instead. NOTE: Like host_timescale, this method does not affect sounds, if you wish to change that, look into EntityEmitSound hook.
public static SetTimeScale ( LuaState luaState, double timeScale ) : void
luaState LuaState Pointer to lua_State struct.
timeScale double The new timescale, minimum value is 0.001 and maximum is 5.
Résultat void

SinglePlayer() public static méthode

Returns whenever the current session is a single player game.
public static SinglePlayer ( LuaState luaState ) : bool
luaState LuaState Pointer to lua_State struct.
Résultat bool