Example #1
0
        protected override void OnEnterComplete(Actor self, Actor targetActor)
        {
            // Master got killed :(
            if (master.IsDead)
            {
                return;
            }

            // Load this thingy.
            // Issue attack move to the rally point.
            self.World.AddFrameEndTask(w =>
            {
                if (self.IsDead || master.IsDead)
                {
                    return;
                }

                spawnerMaster.PickupSlave(master, self);
                w.Remove(self);

                // Insta repair.
                if (spawnerMaster.Info.InstaRepair)
                {
                    var health = self.Trait <Health>();
                    self.InflictDamage(self, new Damage(-health.MaxHP));
                }
            });
        }
Example #2
0
        protected override void OnInside(Actor self)
        {
            // Master got killed :(
            if (master.IsDead)
            {
                return;
            }

            Done(self);             // Stop slaves from exiting.

            // Load this thingy.
            // Issue attack move to the rally point.
            self.World.AddFrameEndTask(w =>
            {
                if (self.IsDead || master.IsDead)
                {
                    return;
                }

                spawnerMaster.PickupSlave(master, self);
                w.Remove(self);

                // Insta repair.
                if (spawnerMaster.Info.InstaRepair)
                {
                    var health = self.Trait <Health>();
                    self.InflictDamage(self, new Damage(-health.MaxHP));
                }

                // Insta re-arm. (Delayed launching is handled at spawner.)
                var ammoPools = self.TraitsImplementing <AmmoPool>().ToArray();
                if (ammoPools != null)
                {
                    foreach (var pool in ammoPools)
                    {
                        while (pool.GiveAmmo(self, 1))
                        {
                            ;                                                   // fill 'er up.
                        }
                    }
                }
            });
        }
        protected override void OnEnterComplete(Actor self, Actor targetActor)
        {
            if (master.IsDead)
            {
                return;
            }

            self.World.AddFrameEndTask(w =>
            {
                if (self.IsDead || master.IsDead)
                {
                    return;
                }

                spawnerMaster.PickupSlave(master, self);
                w.Remove(self);

                if (spawnerMaster.CarrierMasterInfo.InstantRepair)
                {
                    var health = self.Trait <Health>();
                    self.InflictDamage(self, new Damage(-health.MaxHP));
                }

                // Delayed launching is handled at spawner.
                var ammoPools = self.TraitsImplementing <AmmoPool>().ToArray();
                if (ammoPools != null)
                {
                    foreach (var pool in ammoPools)
                    {
                        while (pool.GiveAmmo(self, 1))
                        {
                        }
                    }
                }
            });
        }