示例#1
0
        public void HandleShotEnd(ServerPlayer sender, MsgShotEnd shotMessage)
        {
            ShotInfo shot = FindShot(shotMessage.PlayerID, shotMessage.ShotID);

            if (shot == null)
            {
                return;
            }

            bool valid = false;

            if (sender.Info.ShotImmunities > 0)
            {
                sender.Info.ShotImmunities--;
                valid = true;
            }

            if (shot.ShotType == ShotTypes.ThiefShot || shot.ShotType == ShotTypes.GuidedShot)
            {
                valid = true;
            }

            if (!valid)     // don't penalize them for sending this, they just always send it
            {
                return;     // we know that all other cases must be followed by a death to be valid, so just remove the shot then.
            }
            Flags.HandlePlayerTakeHit(sender, shot.Owner, shot);

            ShotHit?.Invoke(this, shot);
            EndShot(shot, shotMessage.Exploded);
        }
示例#2
0
        private static void HandleShotEnd(NetworkMessage msg)
        {
            MsgShotEnd se = msg as MsgShotEnd;

            WriteLine("MsgShotEnd " + se.PlayerID.ToString());
            WriteLine("\tShotID " + se.ShotID.ToString());
            WriteLine("\tExploded " + se.Exploded.ToString());
        }
示例#3
0
        public void EndShot(ShotInfo shot, bool exploded)
        {
            lock (ShotList)
                ShotList.Remove(shot);

            ShotDied?.Invoke(this, shot);

            MsgShotEnd endShot = new MsgShotEnd();

            endShot.Exploded = exploded;
            endShot.PlayerID = shot.Owner.PlayerID;
            endShot.ShotID   = shot.PlayerShotID;

            Players.SendToAll(endShot, false);
        }
示例#4
0
        public void HandleShotEnd(NetworkMessage msg)
        {
            MsgShotEnd se = msg as MsgShotEnd;

            Shot s = GetShotByBZFSID(BuildBZFSShotID(se.PlayerID, se.ShotID));

            if (s == null)
            {
                return;
            }

            RemoveShotByGID(s.GlobalID);

            if (ExplosionCreated != null)
            {
                ExplosionEventArgs args = new ExplosionEventArgs();
                args.Position     = s.Position;
                args.LastVelocity = s.Velocity;
                args.Reson        = se.Exploded ? ExplosionEventArgs.Reasons.ImpactEnd : ExplosionEventArgs.Reasons.LifetimeEnd;

                ExplosionCreated.Invoke(this, args);
            }
        }