void OnDeployStarted() { foreach (var up in info.UndeployedUpgrades) { manager.RevokeUpgrade(self, up, this); } deployState = DeployState.Deploying; }
void OnAirborneAltitudeLeft() { if (!airborne) { return; } airborne = false; if (um != null) { foreach (var u in Info.AirborneUpgrades) { um.RevokeUpgrade(self, u, this); } } }
public void ResolveOrder(Actor self, Order order) { if (order.OrderString != "DeployToUpgrade") { return; } if (!OnValidTerrain()) { return; } if (isUpgraded) { foreach (var up in info.Upgrades) { manager.RevokeUpgrade(self, up, this); } } else { foreach (var up in info.Upgrades) { manager.GrantUpgrade(self, up, this); } } isUpgraded = !isUpgraded; }
void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e) { if (um == null) { return; } var rand = Game.CosmeticRandom; if (!granted && info.ValidDamageStates.HasFlag(e.DamageState) && !info.ValidDamageStates.HasFlag(e.PreviousDamageState)) { granted = true; var sound = info.EnabledSounds.RandomOrDefault(rand); Game.Sound.Play(sound, self.CenterPosition); foreach (var u in info.Upgrades) { um.GrantUpgrade(self, u, this); } } else if (granted && !info.ValidDamageStates.HasFlag(e.DamageState) && info.ValidDamageStates.HasFlag(e.PreviousDamageState)) { granted = false; var sound = info.DisabledSounds.RandomOrDefault(rand); Game.Sound.Play(sound, self.CenterPosition); foreach (var u in info.Upgrades) { um.RevokeUpgrade(self, u, this); } } }
public void Tick(Actor self) { var currentTerrain = self.World.Map.GetTerrainInfo(self.Location).Type; var wantsGranted = info.TerrainTypes.Contains(currentTerrain); if (currentTerrain != previousTerrain) { if (wantsGranted && !granted) { foreach (var up in info.Upgrades) { manager.GrantUpgrade(self, up, this); } granted = true; } else if (!wantsGranted && granted) { foreach (var up in info.Upgrades) { manager.RevokeUpgrade(self, up, this); } granted = false; } } previousTerrain = currentTerrain; }
internal void UnreserveSpace(Actor a) { if (!reserves.Contains(a)) { return; } reservedWeight -= GetWeight(a); reserves.Remove(a); if (reserves.Count == 0) { foreach (var u in Info.LoadingUpgrades) { upgradeManager.RevokeUpgrade(self, u, this); } } }
void RevokeUpgrades(Actor self) { if (upgradeManager != null) { foreach (var u in Info.WhileCloakedUpgrades) { upgradeManager.RevokeUpgrade(self, u, this); } } }
public void DisablePlug(Actor self, string type) { if (type != active) { return; } foreach (var u in Info.Upgrades[type]) { upgradeManager.RevokeUpgrade(self, u, this); } }
// This gets called by carrier after we touched down public virtual void Detached(Actor self) { if (!attached) { return; } attached = false; foreach (var u in info.CarryableUpgrades) { upgradeManager.RevokeUpgrade(self, u, this); } }
void Unlock() { if (!locked) { return; } locked = false; foreach (var u in info.CarryableUpgrades) { upgradeManager.RevokeUpgrade(self, u, this); } }
public void Uncloak(int time) { if (Cloaked) { Game.Sound.Play(Info.UncloakSound, self.CenterPosition); if (upgradeManager != null) { foreach (var u in Info.WhileCloakedUpgrades) { upgradeManager.RevokeUpgrade(self, u, this); } } } remainingTime = Math.Max(remainingTime, time); }
public void SetPrimaryProducer(Actor self, bool state) { if (state == false) { IsPrimary = false; foreach (var up in info.Upgrades) { manager.RevokeUpgrade(self, up, this); } return; } // TODO: THIS IS SHIT // Cancel existing primaries foreach (var p in self.Info.TraitInfo <ProductionInfo>().Produces) { var productionType = p; // benign closure hazard foreach (var b in self.World .ActorsWithTrait <PrimaryBuilding>() .Where(a => a.Actor.Owner == self.Owner && a.Trait.IsPrimary && a.Actor.Info.TraitInfo <ProductionInfo>().Produces.Contains(productionType))) { b.Trait.SetPrimaryProducer(b.Actor, false); } } IsPrimary = true; foreach (var up in info.Upgrades) { manager.GrantUpgrade(self, up, this); } Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.SelectionNotification, self.Owner.Faction.InternalName); }
public void PrerequisitesUpdated(Actor self, bool available) { if (available == wasAvailable) { return; } if (available) { foreach (var u in info.Upgrades) { manager.GrantUpgrade(self, u, this); } } else { foreach (var u in info.Upgrades) { manager.RevokeUpgrade(self, u, this); } } wasAvailable = available; }