Skip to main content

Below is a template for a GameClass script, which controls the game.

Game = class()
-- Constants-- https://scrapmechanictools.com/lua/Game-Script-Environment/Constants#gameclass
Game.defaultInventorySize = 40Game.enableAggro = trueGame.enableAmmoConsumption = falseGame.enableFuelConsumption = falseGame.enableLimitedInventory = falseGame.enableRestrictions = falseGame.enableUpgrade = false
-- Serverside Callbacks
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#oncreatefunction Game.server_onCreate( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onrefreshfunction Game.server_onRefresh( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onfixedupdatefunction Game.server_onFixedUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#onplayerjoinedfunction Game.server_onPlayerJoined( self, player, newPlayer )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#onplayerleftfunction Game.server_onPlayerLeft( self, player )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#onresetfunction Game.server_onReset( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#onrestartfunction Game.server_onRestart( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#onsavelevelfunction Game.server_onSaveLevel( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#ontestlevelfunction Game.server_onTestLevel( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#onstoptestfunction Game.server_onStopTest( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#ondestroyfunction Game.server_onDestroy( self )
end


-- Clientside Callbacks
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#oncreatefunction Game.client_onCreate( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onrefreshfunction Game.client_onRefresh( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onfixedupdatefunction Game.client_onFixedUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onupdatefunction Game.client_onUpdate( self, dt )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#onloadingscreenliftedfunction Game.client_onLoadingScreenLifted( self )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/GameClass#onlanguagechangefunction Game.client_onLanguageChange( self, language )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#onclientdataupdatefunction Game.client_onClientDataUpdate( self, data, channel )
end
-- https://scrapmechanictools.com/lua/Game-Script-Environment/Classes/CommonCallbacks#ondestroyfunction Game.client_onDestroy( self )
end