public Add ( Func |
||
isVisible | Func |
|
position | WPos | |
color | Color | |
duration | int | |
return |
void INotifyDamage.Damaged(Actor self, AttackInfo e) { // Don't track self-damage if (e.Attacker != null && e.Attacker.Owner == self.Owner) { return; } // Only track last hit against our harvesters if (!self.Info.HasTraitInfo <HarvesterInfo>()) { return; } if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25) { Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName); if (radarPings != null) { radarPings.Add(() => self.Owner.IsAlliedWith(self.World.RenderPlayer), self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); } } lastAttackTime = self.World.WorldTick; }
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", 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; }
public void Damaged(Actor self, AttackInfo e) { if (e.Attacker == null) { return; } if (e.Attacker.Owner == self.Owner) { return; } if (e.Attacker == self.World.WorldActor) { return; } // Only track last hit against our base if (!self.Info.HasTraitInfo <BuildingInfo>()) { return; } if (e.Attacker.Owner.IsAlliedWith(self.Owner) && e.Damage <= 0) { return; } if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25) { var rules = self.World.Map.Rules; Game.Sound.PlayNotification(rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName); if (info.AllyNotification != null) { foreach (Player p in self.World.Players) { if (p != self.Owner && p.IsAlliedWith(self.Owner) && p != e.Attacker.Owner) { Game.Sound.PlayNotification(rules, p, "Speech", info.AllyNotification, p.Faction.InternalName); } } } if (radarPings != null) { radarPings.Add(() => self.Owner.IsAlliedWith(self.World.RenderPlayer), self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); } } lastAttackTime = self.World.WorldTick; }
public void ResolveOrder(Actor self, Order order) { if (order.OrderString != "PlaceBeacon") { return; } var pos = self.World.Map.CenterOfCell(order.TargetLocation); self.World.AddFrameEndTask(w => { if (playerBeacon != null) { self.World.Remove(playerBeacon); } playerBeacon = new Beacon(self.Owner, pos, info.Duration, info.Palette, info.IsPlayerPalette, info.BeaconImage, info.ArrowSequence, info.CircleSequence); self.World.Add(playerBeacon); if (self.Owner.IsAlliedWith(self.World.RenderPlayer)) { Game.Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification, self.World.RenderPlayer != null ? self.World.RenderPlayer.Faction.InternalName : 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.Faction.InternalName); if (radarPings != null) { radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration); } } lastAttackTime = self.World.WorldTick; }