Пример #1
0
        bool IPointDefense.Destroy(WPos position, Player attacker, string type)
        {
            if (IsTraitDisabled || armament.IsTraitDisabled || armament.IsTraitPaused || hasFiredThisTick)
            {
                return(false);
            }

            if (!info.ValidRelationships.HasStance(self.Owner.RelationshipWith(attacker)))
            {
                return(false);
            }

            if (armament.IsReloading)
            {
                return(false);
            }

            if (!info.PointDefenseTypes.Contains(type))
            {
                return(false);
            }

            if ((self.CenterPosition - position).HorizontalLengthSquared > armament.MaxRange().LengthSquared)
            {
                return(false);
            }

            hasFiredThisTick = true;
            self.World.AddFrameEndTask(w =>
            {
                if (!self.IsDead)
                {
                    armament.CheckFire(self, null, Target.FromPos(position));
                }
            });
            return(true);
        }