sm.game
Used to check and control the state of the game.
Functions
bindChatCommand
sm.game.bindChatCommand( command, params, callback, help )
Binds a chat command to a callback function.
The callback function receives an array of parameters.
The first object in it is the name of the command itself,
the others are the extra parameters defined when registering the command.
command
[ string ]: The name of the command. Must start with a/
.params
[ table ]: The array with extra command parameters. See table structure below.callback
[ string ]: The name of the callback function.help
[ string ]: Text to be displayed when using /help on the command.
{
--First parameter
{
"int", --The parameter type. Can be "bool", "int", "number" and "string"
"firstCommand", --The command name shown when using /help on the command. Defaults to automatic naming ("p1", "p2", ...)
false --Whether the parameter is optional or not. Defaults to false (is optional).
},
--Second parameter
{
"number",
"secondCommand",
true
}
--etc.
}
getCurrentTick
sm.game.getCurrentTick()
Returns the current game tick.
Returns:- [ int ]: The tick.
getDifficulty
sm.game.getDifficulty()
Returns the current game difficulty level.
Returns:- [ int ]: The difficulty.
getEnableAggro
sm.game.getEnableAggro()
Returns whether aggro is enabled.
Returns:- [ bool ]: The aggro state (true = enabled, false = disabled).
getEnableAmmoConsumption
sm.game.getEnableAmmoConsumption()
Returns whether ammo consumption is enabled.
Returns:- [ bool ]: The ammo consumption state (true = enabled, false = disabled).
getEnableFuelConsumption
sm.game.getEnableFuelConsumption()
Returns whether fuel consumption is enabled.
Returns:- [ bool ]: The fuel consumption state (true = enabled, false = disabled).
getEnableRestrictions
sm.game.getEnableRestrictions()
Returns whether restrictions are enabled.
Returns:- [ bool ]: The restriction state (true = enabled, false = disabled).
getEnableUpgrade
sm.game.getEnableUpgrade()
Returns whether upgrading is enabled.
Returns:- [ bool ]: The upgrading state (true = enabled, false = disabled).
getLimitedInventory
sm.game.getLimitedInventory()
Returns whether limited inventory is enabled.
Returns:- [ bool ]: The inventory state (true = limited, false = unlimited).
getServerTick
sm.game.getServerTick()
Returns the estimated game tick on the server.
Returns:- [ int ]: The tick.
getTimeOfDay
sm.game.getTimeOfDay()
Return the fraction value of how far the current day has progressed
Returns:- [ number ]: The fraction of the day cycle.
setEnableAggro
sm.game.setEnableAggro( state )
Server-Only
Sets the aggro state. If true, players will be detected as targets by enemies.
Arguments:state
[ bool ]: The aggro state.
setEnableAmmoConsumption
sm.game.setEnableAmmoConsumption( state )
Server-Only
Sets the ammo consumption state. If true, guns require ammo to shoot.
Arguments:state
[ bool ]: The ammo consumption state.
setEnableFuelConsumption
sm.game.setEnableFuelConsumption( state )
Server-Only
Sets the fuel consumption state. If true, engines require fuel to shoot.
Arguments:state
[ bool ]: The fuel consumption state.
setEnableRestrictions
sm.game.setEnableRestrictions( state )
Server-Only
Sets the restriction state. If true, restrictions will apply to the world.
Arguments:state
[ bool ]: The restriction state.
setEnableUpgrade
sm.game.setEnableUpgrade( state )
Server-Only
Sets the upgrading state. If true, interactables can be upgraded using component kits.
Arguments:state
[ bool ]: The upgrading state.
setLimitedInventory
sm.game.setLimitedInventory( state )
Server-Only
Sets the inventory state. If true, the inventory is limited.
Arguments:state
[ bool ]: The inventory state.
setTimeOfDay
sm.game.setTimeOfDay( time )
Client-Only
Sets the fraction value of how far the current day has progressed.
Arguments:time
[ number ]: The fraction of the day cycle.