internal BaseGamemodeSthv(Shared.Gamemode GamemodeId, uint gameLengthInSeconds, int minimumNumberOfPlayers, int numberOfTeams) { this.GameLengthInSeconds = gameLengthInSeconds; this.GamemodeId = GamemodeId; Debug.WriteLine("^1Message from BaseGamemodeSthv. Triggered by " + GamemodeId + "."); sthvLobbyManager.setAllActiveToWaiting(); }
async Task FirstTick() // res from mapmanager_cliend.lua line 47, stores name of map resource { Tick -= FirstTick; _thisPed = Game.PlayerPed; API.SetManualShutdownLoadingScreenNui(true); Debug.WriteLine("STHV First Tick"); TriggerServerEvent("sth:NeedLicense"); //asks server for serverid, runnerid, and discord validation. Shared.PlayerJoinInfo res = await sthvFetch.Get <Shared.PlayerJoinInfo>("PlayerJoinInfo"); SpawnNuiController.IsAllowedHostMenu = res.isAllowedHostMenu; Debug.WriteLine("host menu allowed: " + res.isAllowedHostMenu); RunnerHandleUpdate(res.runnerServerId); client.GamemodeId = res.gamemodeId; Debug.WriteLine($"^2 serverid recieved, mine: {MyServerId} runner: {RunnerServerId} gamemode: {GamemodeId}^7"); }
public BaseGamemode(Shared.Gamemode id) { gamemodeid = id; }
void setGamemodeIdHandler(int id_int) { //cleanup previous gamemode //TODO: cleanup should happen on server event // maybe also when gamemode starts as a backup? if (gamemode != null) { foreach (var cpevent in gamemode.GetEventHandlers()) { EventHandlers[cpevent.Name] -= cpevent.Handler; } foreach (var act in gamemode.GetTicks()) { Tick -= act; } gamemode.GamemodeFinalizer(); } var id = (Shared.Gamemode)id_int; client.GamemodeId = id; Debug.WriteLine("^2------------Gamemode set to " + id); gamemode = null; switch (id) { case Shared.Gamemode.None: break; case Shared.Gamemode.ClassicHunt: gamemode = new Gamemodes.ClassicHunt(); break; case Shared.Gamemode.CheckpointHunt: { //create checkpoint gamemode gamemode = new Gamemodes.CheckpointHunt(); } break; case Shared.Gamemode.TerrorTag: { gamemode = new Gamemodes.TerrorTag(); break; } case Shared.Gamemode.InverseTag: { gamemode = new Gamemodes.InverseTag(); break; } default: break; } if (gamemode == null) { return; } //gamemode is probably ClassicHunt, which is the "default gamemode" //classic doesn't have a gamemode object because it was the original //gamemode and it's code is scattered throughout the client files. Debug.WriteLine($"Gamemode {gamemode.GetType()} initialized with {gamemode.GetTicks().Count()} ticks."); foreach (var cpevent in gamemode.GetEventHandlers()) { EventHandlers[cpevent.Name] += cpevent.Handler; } foreach (var act in gamemode.GetTicks()) { Tick += act; } }