void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); // Set initial disabled state Tick(self); }
protected virtual void Created(Actor self) { repairableInfo = self.Info.TraitInfoOrDefault <RepairableInfo>(); rearmableInfo = self.Info.TraitInfoOrDefault <RearmableInfo>(); conditionManager = self.TraitOrDefault <ConditionManager>(); speedModifiers = self.TraitsImplementing <ISpeedModifier>().ToArray().Select(sm => sm.GetSpeedModifier()); cachedPosition = self.CenterPosition; }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); if (initialExperience > 0) { GiveExperience(initialExperience, info.SuppressLevelupAnimation); } }
protected override void Created(Actor self) { base.Created(self); conditionManager = self.TraitOrDefault <ConditionManager>(); Update(self); }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); UpdateCondition(self); // HACK: Temporarily needed until Rearm activity is gone for good RemainingTicks = Info.ReloadDelay; }
protected override void Created(Actor self) { conditionManager = self.Trait <ConditionManager>(); mobile = self.TraitOrDefault <Mobile>(); delayPickups = self.TraitsImplementing <IDelayCarryallPickup>().ToArray(); base.Created(self); }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); if (conditionManager != null && self.Owner.IsBot && info.Bots.Contains(self.Owner.BotType)) { conditionToken = conditionManager.GrantCondition(self, info.Condition); } }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); if (!string.IsNullOrEmpty(initialPlug)) { EnablePlug(self, initialPlug); } }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); AutoReloads = self.TraitsImplementing <ReloadAmmoPool>().Any(r => r.Info.AmmoPool == Info.Name && r.Info.RequiresCondition == null); UpdateCondition(self); // HACK: Temporarily needed until Rearm activity is gone for good RemainingTicks = Info.ReloadDelay; }
void INotifyCreated.Created(Actor self) { // Special case handling is required for the Player actor. // Created is called before Player.PlayerActor is assigned, // so we must query other player traits from self, knowing that // it refers to the same actor as self.Owner.PlayerActor var playerActor = self.Info.Name == "player" ? self : self.Owner.PlayerActor; globalManager = playerActor.Trait <GrantConditionOnPrerequisiteManager>(); conditionManager = self.TraitOrDefault <ConditionManager>(); }
void INotifyCreated.Created(Actor self) { // AutoTargetPriority and their Priorities are fixed - so we can safely cache them with ToArray. // IsTraitEnabled can change over time, and so must appear after the ToArray so it gets re-evaluated each time. activeTargetPriorities = self.TraitsImplementing <AutoTargetPriority>() .OrderByDescending(ati => ati.Info.Priority).ToArray() .Where(Exts.IsTraitEnabled).Select(atp => atp.Info); conditionManager = self.TraitOrDefault <ConditionManager>(); ApplyStanceCondition(self); }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); if (Cloaked) { wasCloaked = true; if (conditionManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) { cloakedToken = conditionManager.GrantCondition(self, Info.CloakedCondition); } } }
void INotifyCreated.Created(Actor self) { notifyHarvesterAction = self.TraitsImplementing <INotifyHarvesterAction>().ToArray(); resourceMultipliers = self.TraitsImplementing <HarvesterResourceMultiplier>().ToArray(); conditionManager = self.TraitOrDefault <ConditionManager>(); UpdateCondition(self); // Note: This is queued in a FrameEndTask because otherwise the activity is dropped/overridden while moving out of a factory. if (Info.SearchOnCreation) { self.World.AddFrameEndTask(w => self.QueueActivity(new FindAndDeliverResources(self))); } }
protected override void Created(Actor self) { turret = self.TraitsImplementing <Turreted>().FirstOrDefault(t => t.Name == Info.Turret); coords = self.Trait <BodyOrientation>(); notifyBurstComplete = self.TraitsImplementing <INotifyBurstComplete>().ToArray(); notifyAttacks = self.TraitsImplementing <INotifyAttack>().ToArray(); conditionManager = self.TraitOrDefault <ConditionManager>(); rangeModifiers = self.TraitsImplementing <IRangeModifier>().ToArray().Select(m => m.GetRangeModifier()); reloadModifiers = self.TraitsImplementing <IReloadModifier>().ToArray().Select(m => m.GetReloadModifier()); damageModifiers = self.TraitsImplementing <IFirepowerModifier>().ToArray().Select(m => m.GetFirepowerModifier()); inaccuracyModifiers = self.TraitsImplementing <IInaccuracyModifier>().ToArray().Select(m => m.GetInaccuracyModifier()); base.Created(self); }
void INotifyCreated.Created(Actor self) { // Special case handling is required for the Player actor. // Created is called before Player.IsBot is set, so we // must use a different method to enable this trait if // it's defined on the PlayerActor. self.World.AddFrameEndTask(w => { conditionManager = self.TraitOrDefault <ConditionManager>(); if (conditionManager != null && self.Owner.IsBot && info.Bots.Contains(self.Owner.BotType)) { conditionToken = conditionManager.GrantCondition(self, info.Condition); } }); }
void INotifyCreated.Created(Actor self) { var valued = self.Info.TraitInfoOrDefault <ValuedInfo>(); var requiredExperience = info.ExperienceModifier < 0 ? (valued != null ? valued.Cost : 1) : info.ExperienceModifier; foreach (var kv in info.Conditions) { nextLevel.Add(Pair.New(kv.Key * requiredExperience, kv.Value)); } conditionManager = self.TraitOrDefault <ConditionManager>(); if (initialExperience > 0) { GiveExperience(initialExperience, info.SuppressLevelupAnimation); } }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); move = self.TraitOrDefault <IMove>(); progressWatchers = self.TraitsImplementing <ICaptureProgressWatcher>().ToArray(); enabledCapturable = self.TraitsImplementing <Capturable>() .ToArray() .Where(Exts.IsTraitEnabled); enabledCaptures = self.TraitsImplementing <Captures>() .ToArray() .Where(Exts.IsTraitEnabled); RefreshCaptures(self); RefreshCapturable(self); }
protected override void Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); otherCloaks = self.TraitsImplementing <Cloak>() .Where(c => c != this) .ToArray(); if (Cloaked) { wasCloaked = true; if (conditionManager != null && cloakedToken == ConditionManager.InvalidConditionToken && !string.IsNullOrEmpty(Info.CloakedCondition)) { cloakedToken = conditionManager.GrantCondition(self, Info.CloakedCondition); } } base.Created(self); }
void INotifyCreated.Created(Actor self) { aircraft = self.TraitOrDefault <Aircraft>(); conditionManager = self.TraitOrDefault <ConditionManager>(); if (conditionManager != null && cargo.Any()) { foreach (var c in cargo) { string passengerCondition; if (Info.PassengerConditions.TryGetValue(c.Info.Name, out passengerCondition)) { passengerTokens.GetOrAdd(c.Info.Name).Push(conditionManager.GrantCondition(self, passengerCondition)); } } if (!string.IsNullOrEmpty(Info.LoadedCondition)) { loadedTokens.Push(conditionManager.GrantCondition(self, Info.LoadedCondition)); } } // Defer notifications until we are certain all traits on the transport are initialised self.World.AddFrameEndTask(w => { foreach (var c in cargo) { c.Trait <Passenger>().Transport = self; foreach (var nec in c.TraitsImplementing <INotifyEnteredCargo>()) { nec.OnEnteredCargo(c, self); } foreach (var npe in self.TraitsImplementing <INotifyPassengerEntered>()) { npe.OnPassengerEntered(self, c); } } initialised = true; }); }
protected override void Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); notify = self.TraitsImplementing <INotifyDeployTriggered>().ToArray(); base.Created(self); switch (deployState) { case DeployState.Undeployed: OnUndeployCompleted(); break; case DeployState.Deploying: if (canTurn) { self.Trait <IFacing>().Facing = Info.Facing; } Deploy(true); break; case DeployState.Deployed: if (canTurn) { self.Trait <IFacing>().Facing = Info.Facing; } OnDeployCompleted(); break; case DeployState.Undeploying: if (canTurn) { self.Trait <IFacing>().Facing = Info.Facing; } Undeploy(true); break; } }
void INotifyCreated.Created(Actor self) { aircraft = self.TraitOrDefault <Aircraft>(); conditionManager = self.TraitOrDefault <ConditionManager>(); if (conditionManager != null && cargo.Any()) { foreach (var c in cargo) { string passengerCondition; if (Info.PassengerConditions.TryGetValue(c.Info.Name, out passengerCondition)) { passengerTokens.GetOrAdd(c.Info.Name).Push(conditionManager.GrantCondition(self, passengerCondition)); } } if (!string.IsNullOrEmpty(Info.LoadedCondition)) { loadedTokens.Push(conditionManager.GrantCondition(self, Info.LoadedCondition)); } } }
public void Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); switch (deployState) { case DeployState.Undeployed: OnUndeployCompleted(); break; case DeployState.Deploying: if (canTurn) { self.Trait <IFacing>().Facing = info.Facing; } Deploy(true); break; case DeployState.Deployed: if (canTurn) { self.Trait <IFacing>().Facing = info.Facing; } OnDeployCompleted(); break; case DeployState.Undeploying: if (canTurn) { self.Trait <IFacing>().Facing = info.Facing; } Undeploy(true); break; } }
public ExternalCondition(Actor self, ExternalConditionInfo info) { Info = info; conditionManager = self.Trait <ConditionManager>(); }
void INotifyCreated.Created(Actor self) { conditionManager = self.Trait <ConditionManager>(); GrantConditionOnValidHealth(self, health.HP); }
void INotifyCreated.Created(Actor self) { aircraft = self.TraitOrDefault <Aircraft>(); conditionManager = self.Trait <ConditionManager>(); }
public void Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); speedModifiers = self.TraitsImplementing <ISpeedModifier>().ToArray().Select(sm => sm.GetSpeedModifier()); cachedPosition = self.CenterPosition; }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); GrantConditionOnValidDamageState(self, health.DamageState); }
protected override void Created(Actor self) { conditionManager = self.Trait <ConditionManager>(); base.Created(self); }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); }
void INotifyCreated.Created(Actor self) { conditionManager = self.TraitOrDefault <ConditionManager>(); targetPriorities = self.TraitsImplementing <AutoTargetPriority>().ToArray(); ApplyStanceCondition(self); }