public void Damaged(Actor self, AttackInfo e) { // only track last hit against our base if (!self.HasTrait <Harvester>()) { return; } // don't track self-damage if (e.Attacker != null && e.Attacker.Owner == self.Owner) { return; } if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25) { Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", "HarvesterAttack", self.Owner.Country.Race); if (radarPings != null) { radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); } } lastAttackTime = self.World.WorldTick; }
public void ResolveOrder(Actor self, Order order) { if (order.OrderString != "PlaceBeacon") { return; } var pos = order.TargetLocation.CenterPosition; self.World.AddFrameEndTask(w => { if (playerBeacon != null) { self.World.Remove(playerBeacon); } playerBeacon = new Beacon(self.Owner, pos, info.Duration, info.PalettePrefix); self.World.Add(playerBeacon); if (self.Owner.IsAlliedWith(self.World.RenderPlayer)) { Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification, self.World.RenderPlayer != null ? self.World.RenderPlayer.Country.Race : null); } if (radarPings != null) { if (playerRadarPing != null) { radarPings.Remove(playerRadarPing); } playerRadarPing = radarPings.Add( () => self.Owner.IsAlliedWith(self.World.RenderPlayer), pos, self.Owner.Color.RGB, info.Duration); } }); }
public void Damaged(Actor self, AttackInfo e) { // only track last hit against our base if (!self.HasTrait <Building>()) { return; } if (e.Attacker == null) { return; } if (e.Attacker.Owner == self.Owner) { return; } if (e.Attacker == self.World.WorldActor) { return; } if (e.Attacker.Owner.IsAlliedWith(self.Owner) && e.Damage <= 0) { return; } if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25) { Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Country.Race); if (radarPings != null) { radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); } } lastAttackTime = self.World.WorldTick; }