public override void PostTick() { if (PlayerFlags.HasFlag(PlayerFlags.Scoreboard)) { for (var i = 0; i < GameContext.Players.Length; i++) { if (GameContext.Players[i] != null && GameContext.Players[i].Team != Team.Spectators) { ActualLatency[i] = GameContext.Players[i].Latency.Min; } } } if ((Team == Team.Spectators || DeadSpectatorMode) && SpectatorMode != SpectatorMode.FreeView) { if (SpectatorFlag != null) { ViewPos = SpectatorFlag.Position; } else if (GameContext.Players[SpectatorId] != null) { ViewPos = GameContext.Players[SpectatorId].ViewPos; } } }
public void OnTravel(Node to) { if (to == destination && PlayerFlags.HasFlag(hasFlag)) { onTravelTo.Invoke(); } }
public override void OnDirectInput(SnapObj_PlayerInput input) { if (input.PlayerFlags.HasFlag(PlayerFlags.PLAYERFLAG_CHATTING)) { if (PlayerFlags.HasFlag(PlayerFlags.PLAYERFLAG_CHATTING)) { return; } Character?.ResetInput(); PlayerFlags = input.PlayerFlags; return; } PlayerFlags = input.PlayerFlags; Character?.OnDirectInput(input); if (Character == null && Team != Team.SPECTATORS && (input.Fire & 1) != 0) { Spawning = true; } if (input.Direction != 0 || input.Jump || input.Hook || LatestActivity.TargetX != input.TargetX || LatestActivity.TargetY != input.TargetY || (input.Fire & 1) != 0) { LatestActivity.TargetX = input.TargetX; LatestActivity.TargetY = input.TargetY; LastActionTick = Server.Tick; } }
public override void OnPredictedInput(SnapshotPlayerInput input) { // ignore input when player chat open if (PlayerFlags.HasFlag(PlayerFlags.Chatting) && input.PlayerFlags.HasFlag(PlayerFlags.Chatting)) { return; } Character?.OnPredictedInput(input); }
public override void OnPredictedInput(SnapObj_PlayerInput input) { // ignore input when player chat open if (PlayerFlags.HasFlag(PlayerFlags.PLAYERFLAG_CHATTING) && input.PlayerFlags.HasFlag(PlayerFlags.PLAYERFLAG_CHATTING)) { return; } Character?.OnPredictedInput(input); }
public bool CanTravelTo(Node to) { if (to == null) { return(false); } int index = travelNodes.FindIndex(naf => naf.node == to); if (index == -1 || !PlayerFlags.HasFlag(travelNodes[index].flag)) { return(false); } return(true); }
public void BeginSequence() { if (!PlayerFlags.HasFlag(hasFlag) || PlayerFlags.HasAnyFlag(doesntHaveFlag)) { ended = true; return; } ended = false; functionOnStart.Invoke(); if (sequence != null) { (sequence as ISequence).BeginSequence(); StartCoroutine(WaitUntilSeqEndCoroutine()); } else { StartCoroutine(WaitUntilTimeCoroutine()); } }
public override void PostTick() { if (PlayerFlags.HasFlag(PlayerFlags.PLAYERFLAG_SCOREBOARD)) { for (var i = 0; i < GameContext.Players.Length; i++) { if (GameContext.Players[i] != null && GameContext.Players[i].Team != Team.SPECTATORS) { ActLatency[i] = GameContext.Players[i].Latency.Min; } } } if (SpectatorId >= 0 && Team == Team.SPECTATORS && GameContext.Players[SpectatorId] != null) { ViewPos = GameContext.Players[SpectatorId].ViewPos; } }
public override void OnDirectInput(SnapshotPlayerInput input) { if (GameContext.World.Paused) { PlayerFlags = input.PlayerFlags; return; } if (input.PlayerFlags.HasFlag(PlayerFlags.Chatting)) { if (PlayerFlags.HasFlag(PlayerFlags.Chatting)) { return; } Character?.ResetInput(); PlayerFlags = input.PlayerFlags; return; } PlayerFlags = input.PlayerFlags; Character?.OnDirectInput(input); if (Character == null && Team != Team.Spectators && (input.Fire & 1) != 0) { Respawn(); } if (Character == null && Team == Team.Spectators && (input.Fire & 1) != 0) { if (!ActiveSpectatorSwitch) { ActiveSpectatorSwitch = true; if (SpectatorMode == SpectatorMode.FreeView) { var character = BaseCharacter.Entities.Closest(ViewPos, 6 * 32f, null); var flag = Flag.Entities.Closest(ViewPos, 6 * 32f, null); if (character != null || flag != null) { if (character == null || flag != null && character != null && MathHelper.Distance(ViewPos, flag.Position) < MathHelper.Distance(ViewPos, character.Position)) { SpectatorMode = flag.Team == Team.Red ? SpectatorMode.FlagRed : SpectatorMode.FlagBlue; SpectatorFlag = flag; SpectatorId = -1; } else { SpectatorMode = SpectatorMode.Player; SpectatorFlag = null; SpectatorId = character.Player.ClientId; } } } else { SpectatorMode = SpectatorMode.FreeView; SpectatorFlag = null; SpectatorId = -1; } } } else if (ActiveSpectatorSwitch) { ActiveSpectatorSwitch = false; } if (input.Direction != 0 || LatestActivity.TargetX != input.TargetX || LatestActivity.TargetY != input.TargetY || input.IsJump || (input.Fire & 1) != 0 || input.IsHook) { LatestActivity.TargetX = input.TargetX; LatestActivity.TargetY = input.TargetY; LastActionTick = Server.Tick; InactivityTickCounter = 0; } }