Download CommonLua/Classes/Player.lua from sirnii/myspace: direct link, hf CLI and curl.
- Browser
- Download file 922 Bytes
-
https://huggingface.co/spaces/sirnii/myspace/resolve/main/CommonLua/Classes/Player.lua
- Command line
-
hf download hf://spaces/sirnii/myspace/CommonLua/Classes/Player.lua
-
curl -L -o Player.lua https://huggingface.co/spaces/sirnii/myspace/resolve/main/CommonLua/Classes/Player.lua
922 Bytes
| MapVar("Players", false) | |
| MapVar("UIPlayer", false) | |
| ----- Player | |
| DefineClass.Player = { | |
| __parents = { "CooldownObj", "LabelContainer" }, | |
| player = false, | |
| } | |
| function Player:Init() | |
| self.player = self | |
| end | |
| ----- PlayerObject | |
| DefineClass.PlayerObject = { | |
| __parents = { "Object" }, | |
| properties = { | |
| { id = "player", editor = "object", default = false, read_only = true, }, | |
| }, | |
| } | |
| function PlayerObject:Done() | |
| self.player = nil | |
| end | |
| function PlayerObject:PostLoad() | |
| if IsEditorActive() then | |
| self.player = UIPlayer | |
| end | |
| end | |
| ----- | |
| function CreatePlayerObjects() | |
| return { Player:new{ handle = 1 } } | |
| end | |
| function OnMsg.NewMap() | |
| if not mapdata.GameLogic then return end | |
| SetPlayers(CreatePlayerObjects()) | |
| end | |
| function SetPlayers(players, ui_player) | |
| Players = players or {} | |
| UIPlayer = ui_player or players and players[1] or false | |
| for _, player in ipairs(players) do | |
| Msg("PlayerObjectCreated", player) | |
| end | |
| end |