public override void OnClientPredictedInput(int clientId, SnapObj_PlayerInput input) { if (!World.IsPaused) { Players[clientId].OnPredictedInput(input); } }
public override void OnClientDirectInput(int clientId, SnapObj_PlayerInput input) { if (!World.IsPaused) { Players[clientId].OnDirectInput(input); } }
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(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 virtual void OnPredictedInput(SnapObj_PlayerInput newInput) { if (!Input.Compare(newInput)) { LastAction = Server.Tick; } Input.FillFrom(newInput); NumInputs++; if (Input.TargetX == 0 && Input.TargetY == 0) { Input.TargetY = -1; } }
public virtual void OnDirectInput(SnapObj_PlayerInput newInput) { LatestPrevInput.FillFrom(LatestInput); LatestInput.FillFrom(newInput); if (LatestInput.TargetX == 0 && LatestInput.TargetY == 0) { LatestInput.TargetY = -1; } if (NumInputs > 2 && Player.Team != Team.SPECTATORS) { HandleWeaponSwitch(); FireWeapon(); } LatestPrevInput.FillFrom(LatestInput); }
public Character(BasePlayer player, Vector2 spawnPos) : base(1) { HitObjects = new List <Entity>(); Weapons = new WeaponStat[(int)Weapon.NUM_WEAPONS]; NinjaStat = new NinjaStat(); ActiveWeapon = Weapon.GUN; LastWeapon = Weapon.HAMMER; QueuedWeapon = (Weapon)(-1); Position = spawnPos; Health = 0; Armor = 0; EmoteStopTick = -1; LastAction = -1; Player = player; IsAlive = true; Input = new SnapObj_PlayerInput(); LatestPrevInput = new SnapObj_PlayerInput(); LatestInput = new SnapObj_PlayerInput(); Core = new CharacterCore(); SendCore = new CharacterCore(); ReckoningCore = new CharacterCore(); Core.Reset(); Core.Init(GameWorld.WorldCore, GameContext.Collision); Core.Position = Position; var worldCore = new WorldCore( GameWorld.WorldCore.CharacterCores.Length, GameWorld.WorldCore.Tuning); ReckoningCore.Init(worldCore, GameContext.Collision); GameWorld.WorldCore.CharacterCores[player.ClientId] = Core; GameContext.GameController.OnCharacterSpawn(this); }
public CharacterCore() { QuantizeCore = new SnapObj_Character(); Input = new SnapObj_PlayerInput(); }
public abstract void OnClientDirectInput(int clientId, SnapObj_PlayerInput input);
public abstract void OnClientPredictedInput(int clientId, SnapObj_PlayerInput input);
public abstract void OnDirectInput(SnapObj_PlayerInput input);
public abstract void OnPredictedInput(SnapObj_PlayerInput input);