public void CmdRespawnPlayer() { if (AdminCommandsManager.IsAdmin(connectionToClient, out _, false) || GameManager.Instance.RespawnCurrentlyAllowed) { ServerRespawnPlayer(); } }
public void CmdGetAdminOverlayFullUpdate() { if (AdminCommandsManager.IsAdmin(connectionToClient, out var player)) { AdminOverlay.RequestFullUpdate(player); } }
public void CmdAGhost() { if (AdminCommandsManager.IsAdmin(connectionToClient, out _)) { ServerAGhost(); } }
public void TriggerSpecificEvent(int eventIndex, InGameEventType eventType, bool isFake = false, string adminName = null, bool announceEvent = true, string serializedEventParameters = null) { List <EventScriptBase> list; if (eventType == InGameEventType.Random) { list = GetRandomEventList(); } else { list = GetListFromEnum(eventType); } if (list == null) { Logger.LogError("Event List was null shouldn't happen unless new type wasn't added to switch", Category.Event); return; } if (eventIndex == 0) { StartRandomEvent(list, true, isFake, false, adminName, announceEvent); } else { var eventChosen = list[eventIndex - 1]; eventChosen.FakeEvent = isFake; eventChosen.AnnounceEvent = announceEvent; eventChosen.TriggerEvent(serializedEventParameters); AdminCommandsManager.LogAdminAction($"{adminName}: triggered the event: {eventChosen.EventName}. Is fake: {isFake}. Announce: {announceEvent}"); } }
public void CmdVetoRestartVote() { if (AdminCommandsManager.IsAdmin(connectionToClient, out var player)) { if (VotingManager.Instance == null) { return; } VotingManager.Instance.VetoVote(player.ClientId); } }
public void StartRandomEvent(List <EventScriptBase> eventList, bool anEventMustHappen = false, bool isFake = false, bool serverTriggered = false, string adminName = null, bool announceEvent = true, int stackOverFlowProtection = 0) { if (eventList.Count == 0) { return; } foreach (var eventInList in eventList.Shuffle()) { //If there's not enough players try to trigger a different one if (eventInList.MinPlayersToTrigger > PlayerList.Instance.InGamePlayers.Count) { continue; } var chanceToHappen = UnityEngine.Random.Range(0f, 100f); if (chanceToHappen < eventInList.ChanceToHappen) { eventInList.FakeEvent = isFake; eventInList.AnnounceEvent = announceEvent; eventInList.TriggerEvent(); if (serverTriggered) { AdminCommandsManager.LogAdminAction($"A random event, {eventInList.EventName} has been triggered by the server. Is fake: {isFake}. Announce: {announceEvent}", "[Server]"); return; } AdminCommandsManager.LogAdminAction($"{adminName}: triggered a random event, {eventInList.EventName} was chosen. Is fake: {isFake}. Announce: {announceEvent}"); return; } } stackOverFlowProtection++; if (stackOverFlowProtection > 100) { AdminCommandsManager.LogAdminAction("A random event has failed to be triggered by the server due to overflow protection.", "[Server]"); return; } if (anEventMustHappen) { StartRandomEvent(eventList, true, isFake, serverTriggered, adminName, announceEvent, stackOverFlowProtection); } }
public void CmdAdminSmash(GameObject toSmash) { if (AdminCommandsManager.IsAdmin(connectionToClient, out _) == false) { return; } if (toSmash == null) { return; } var integrity = toSmash.GetComponent <Integrity>(); if (integrity == null) { return; } integrity.ApplyDamage(float.MaxValue, AttackType.Melee, DamageType.Brute); }
public void CmdAdminMakeHotspot(GameObject onObject) { if (AdminCommandsManager.IsAdmin(connectionToClient, out _) == false) { return; } if (onObject == null) { return; } var reactionManager = onObject.GetComponentInParent <ReactionManager>(); if (reactionManager == null) { return; } reactionManager.ExposeHotspotWorldPosition(onObject.TileWorldPosition(), 1000, true); reactionManager.ExposeHotspotWorldPosition(onObject.TileWorldPosition() + Vector2Int.down, 1000, true); reactionManager.ExposeHotspotWorldPosition(onObject.TileWorldPosition() + Vector2Int.left, 1000, true); reactionManager.ExposeHotspotWorldPosition(onObject.TileWorldPosition() + Vector2Int.up, 1000, true); reactionManager.ExposeHotspotWorldPosition(onObject.TileWorldPosition() + Vector2Int.right, 1000, true); }