Exemple #1
0
 public override void OnClientPredictedInput(int clientId, SnapObj_PlayerInput input)
 {
     if (!World.IsPaused)
     {
         Players[clientId].OnPredictedInput(input);
     }
 }
Exemple #2
0
 public override void OnClientDirectInput(int clientId, SnapObj_PlayerInput input)
 {
     if (!World.IsPaused)
     {
         Players[clientId].OnDirectInput(input);
     }
 }
Exemple #3
0
        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;
            }
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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;
            }
        }
Exemple #6
0
        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);
        }
Exemple #7
0
        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);
        }
Exemple #8
0
 public CharacterCore()
 {
     QuantizeCore = new SnapObj_Character();
     Input        = new SnapObj_PlayerInput();
 }
Exemple #9
0
 public abstract void OnClientDirectInput(int clientId, SnapObj_PlayerInput input);
Exemple #10
0
 public abstract void OnClientPredictedInput(int clientId, SnapObj_PlayerInput input);
Exemple #11
0
 public abstract void OnDirectInput(SnapObj_PlayerInput input);
Exemple #12
0
 public abstract void OnPredictedInput(SnapObj_PlayerInput input);