private void AddEntityForRepair(Entity entity, int startingHealth) { HealthViewComponent healthViewComponent = entity.Get <HealthViewComponent>(); if (healthViewComponent == null) { healthViewComponent = new HealthViewComponent(); entity.Add(healthViewComponent); } HealthComponent healthComponent = entity.Get <HealthComponent>(); healthViewComponent.UpdateHealth(startingHealth, healthComponent.MaxHealth, false); healthComponent.Health = startingHealth; if (!this.worldLoadPending) { healthViewComponent.SetupElements(); } Service.Get <EntityController>().GetViewSystem <HealthRenderSystem>().UpdateRubbleStateFromHealthView(healthViewComponent); if (this.entitiesInRepairMap == null) { this.entitiesInRepairMap = new Dictionary <Entity, HealthViewComponent>(); } if (!this.entitiesInRepairMap.ContainsKey(entity)) { this.entitiesInRepairMap.Add(entity, healthViewComponent); } this.StartHealthRepair(healthViewComponent); }
protected virtual void UpdateHitpoints() { if (this.useUpgradeGroup) { return; } int health = this.buildingInfo.Health; int num = health; HealthViewComponent healthViewComp = this.selectedBuilding.HealthViewComp; if (healthViewComp != null && healthViewComp.IsInitialized) { num = healthViewComp.HealthAmount; } UXLabel currentLabel = this.sliders[this.hitpointSliderIndex].CurrentLabel; currentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(num), this.lang.ThousandsSeparated(health) }); UXSlider currentSlider = this.sliders[this.hitpointSliderIndex].CurrentSlider; currentSlider.Value = ((health != 0) ? ((float)num / (float)health) : 0f); }
public void RemoveExistingRepair(Entity entity) { HealthViewComponent healthView = null; if (this.entitiesInRepairMap.TryGetValue(entity, out healthView)) { this.CleanupEntityAfterRepair(entity, healthView); this.entitiesInRepairMap.Remove(entity); } }
public EatResponse OnEvent(EventId id, object cookie) { switch (id) { case EventId.MapDataProcessingStart: this.worldLoadPending = true; this.canRepair = this.CheckIfCanRepair(); return(EatResponse.NotEaten); case EventId.MapDataProcessingEnd: { IL_15: if (id == EventId.BuildingViewReady) { if (this.canRepair) { EntityViewParams entityViewParams = (EntityViewParams)cookie; this.OnEntityLoaded(entityViewParams.Entity); } return(EatResponse.NotEaten); } if (id == EventId.GameStateAboutToChange) { this.UpdateEntityRepairs(cookie as IState); return(EatResponse.NotEaten); } if (id != EventId.EntityHealthViewRegenerated) { return(EatResponse.NotEaten); } HealthViewComponent healthViewComponent = (HealthViewComponent)cookie; if (healthViewComponent.Entity != null) { this.entitiesInRepairMap.Remove(healthViewComponent.Entity); this.OnHeathRepairStopped(healthViewComponent); this.CleanupEntityAfterRepair(healthViewComponent.Entity, healthViewComponent); } return(EatResponse.NotEaten); } case EventId.WorldLoadComplete: { this.worldLoadPending = false; IState currentState = Service.GameStateMachine.CurrentState; this.UpdateEntityRepairs(currentState); return(EatResponse.NotEaten); } } goto IL_15; }
public void StopHealthRepairs() { if (this.entitiesInRepairMap != null) { foreach (KeyValuePair <Entity, HealthViewComponent> current in this.entitiesInRepairMap) { Entity key = current.get_Key(); HealthViewComponent value = current.get_Value(); value.AutoRegenerating = false; this.OnHeathRepairStopped(value); this.CleanupEntityAfterRepair(key, value); } this.entitiesInRepairMap.Clear(); } this.repairing = false; }
private void OnHeathRepairStopped(HealthViewComponent healthView) { healthView.TeardownElements(); Entity entity = healthView.Entity; this.eventManager.SendEvent(EventId.EntityPostBattleRepairFinished, entity); if (this.entitiesInRepairMap == null || this.entitiesInRepairMap.Count == 0) { this.eventManager.SendEvent(EventId.AllPostBattleRepairFinished, null); } Service.Get <BuildingTooltipController>().EnsureBuildingTooltip((SmartEntity)entity); if (Service.Get <BuildingController>().SelectedBuilding == entity) { Service.Get <UXController>().HUD.ShowContextButtons(entity); } }
public void StashBuilding(SmartEntity buildingEntity, bool allowRevert) { BuildingComponent buildingComponent = buildingEntity.Get <BuildingComponent>(); if (buildingComponent.BuildingType.Type == BuildingType.Clearable) { Service.Logger.Warn("BLT: Can't stash clearable: " + buildingComponent.BuildingTO.Key + ":" + buildingComponent.BuildingTO.Uid); return; } string uid = buildingComponent.BuildingTO.Uid; if (this.stashedBuildingMap == null) { this.stashedBuildingMap = new Dictionary <string, List <SmartEntity> >(); } if (!this.stashedBuildingMap.ContainsKey(uid)) { this.stashedBuildingMap.Add(uid, new List <SmartEntity>()); } List <SmartEntity> list = this.stashedBuildingMap[uid]; if (!list.Contains(buildingEntity)) { list.Add(buildingEntity); } GameObjectViewComponent gameObjectViewComp = buildingEntity.GameObjectViewComp; if (gameObjectViewComp != null) { TransformComponent transformComp = buildingEntity.TransformComp; gameObjectViewComp.SetXYZ(Units.BoardToWorldX(transformComp.CenterX()), -1000f, Units.BoardToWorldZ(transformComp.CenterZ())); } if (buildingEntity.HealthViewComp != null) { HealthViewComponent healthViewComponent = buildingEntity.Get <HealthViewComponent>(); healthViewComponent.TeardownElements(); } Service.EventManager.SendEvent(EventId.UserStashedBuilding, buildingEntity); Service.BoardController.RemoveEntity(buildingEntity, true); Service.EventManager.SendEvent(EventId.EntityDestroyed, buildingEntity.ID); Service.EventManager.SendEvent(EventId.BuildingMovedOnBoard, buildingEntity); Service.BuildingController.DisableUnstashStampingState(); if (allowRevert) { this.ShouldRevertMap = true; } }
private bool ShowHealthView(Entity entity, IHealthComponent health, GameObjectViewComponent viewToAttachTo, bool hasPrimary, bool hasSecondary, bool showAtFullHealth, bool isUpdatingPrimary) { SmartEntity smartEntity = (SmartEntity)entity; if (smartEntity.TrapComp != null) { return(false); } bool flag = health != null && health.Health >= health.MaxHealth; if (health == null || (!showAtFullHealth && flag)) { if (smartEntity.HealthViewComp != null) { smartEntity.HealthViewComp.TeardownElements(); } return(false); } if (viewToAttachTo == null) { if (smartEntity.HealthViewComp != null) { smartEntity.HealthViewComp.TeardownElements(); } return(false); } HealthViewComponent healthViewComponent = smartEntity.HealthViewComp; if (healthViewComponent == null) { healthViewComponent = new HealthViewComponent(); entity.Add(healthViewComponent); } if (!healthViewComponent.IsInitialized) { healthViewComponent.SetupElements(viewToAttachTo, hasPrimary, hasSecondary); } healthViewComponent.UpdateHealth(health.Health, health.MaxHealth, !isUpdatingPrimary); if (!flag || !healthViewComponent.WillFadeOnTimer()) { healthViewComponent.GoAwayIn(4f); } return(true); }
public void UpdateRubbleStateFromHealthView(HealthViewComponent healthView) { float num = (healthView.MaxHealthAmount != 0) ? ((float)healthView.HealthAmount / (float)healthView.MaxHealthAmount) : 0f; bool flag = num < 0.2f; if (healthView.HasRubble) { if (!flag) { Service.FXManager.RemoveAttachedRubbleFromEntity(healthView.Entity); healthView.HasRubble = false; } } else if (flag) { Service.FXManager.CreateAndAttachRubbleToEntity(healthView.Entity); healthView.HasRubble = true; } }
protected override void Update(float dt) { if (Service.BuildingTooltipController != null) { Service.BuildingTooltipController.ResetTooltipSlots(); } for (HealthViewNode healthViewNode = this.nodeList.Head; healthViewNode != null; healthViewNode = healthViewNode.Next) { HealthViewComponent healthView = healthViewNode.HealthView; if (healthView != null) { healthView.UpdateLocation(); if (healthView.AutoRegenerating) { this.UpdateAutoRegeneration(healthView, dt); } } } }
private void CleanupEntityAfterRepair(Entity entity, HealthViewComponent healthView) { if (entity == null) { return; } BuildingComponent buildingComponent = entity.Get <BuildingComponent>(); if (buildingComponent == null) { return; } float num = (healthView.MaxHealthAmount == 0) ? 0f : ((float)healthView.HealthAmount / (float)healthView.MaxHealthAmount); if (num > 0.2f) { Service.Get <FXManager>().RemoveAttachedRubbleFromEntity(entity); } Service.Get <StorageEffects>().UpdateFillState(entity, buildingComponent.BuildingType); this.UpdateDamagePercentageFromHealth(entity, Mathf.FloorToInt(num * 100f)); }
private void UpdateAutoRegeneration(HealthViewComponent healthView, float dt) { this.timeSinceRegenerationUpdate += dt; if (this.timeSinceRegenerationUpdate >= 0.1f) { this.timeSinceRegenerationUpdate = 0f; int num = healthView.HealthAmount + 80; int maxHealthAmount = healthView.MaxHealthAmount; if (num > maxHealthAmount) { num = maxHealthAmount; } healthView.UpdateHealth(num, maxHealthAmount, false); if (num == maxHealthAmount) { healthView.AutoRegenerating = false; healthView.TeardownElements(); Service.ViewTimerManager.CreateViewTimer(1f, false, new TimerDelegate(this.NotifyAutoRegenerationFinished), healthView); } this.UpdateRubbleStateFromHealthView(healthView); } }
private void StartHealthRepair(HealthViewComponent healthView) { this.repairing = true; healthView.AutoRegenerating = true; Entity entity = healthView.Entity; this.eventManager.SendEvent(EventId.EntityPostBattleRepairStarted, entity); SupportViewComponent supportViewComponent = entity.Get <SupportViewComponent>(); if (supportViewComponent != null) { supportViewComponent.TeardownElements(); } GeneratorViewComponent generatorViewComponent = entity.Get <GeneratorViewComponent>(); if (generatorViewComponent != null) { generatorViewComponent.SetEnabled(false); } BuildingComponent buildingComponent = entity.Get <BuildingComponent>(); Service.Get <StorageEffects>().UpdateFillState(entity, buildingComponent.BuildingType); }
public override object Remove(Type compCls) { if (compCls == typeof(AreaTriggerComponent)) { this.AreaTriggerComp = null; } else if (compCls == typeof(ArmoryComponent)) { this.ArmoryComp = null; } else if (compCls == typeof(AssetComponent)) { this.AssetComp = null; } else if (compCls == typeof(AttackerComponent)) { this.AttackerComp = null; } else if (compCls == typeof(BarracksComponent)) { this.BarracksComp = null; } else if (compCls == typeof(BoardItemComponent)) { this.BoardItemComp = null; } else if (compCls == typeof(BuildingAnimationComponent)) { this.BuildingAnimationComp = null; } else if (compCls == typeof(BuildingComponent)) { this.BuildingComp = null; } else if (compCls == typeof(CantinaComponent)) { this.CantinaComp = null; } else if (compCls == typeof(ChampionComponent)) { this.ChampionComp = null; } else if (compCls == typeof(CivilianComponent)) { this.CivilianComp = null; } else if (compCls == typeof(ClearableComponent)) { this.ClearableComp = null; } else if (compCls == typeof(DamageableComponent)) { this.DamageableComp = null; } else if (compCls == typeof(DefenderComponent)) { this.DefenderComp = null; } else if (compCls == typeof(DefenseLabComponent)) { this.DefenseLabComp = null; } else if (compCls == typeof(DroidComponent)) { this.DroidComp = null; } else if (compCls == typeof(DroidHutComponent)) { this.DroidHutComp = null; } else if (compCls == typeof(SquadBuildingComponent)) { this.SquadBuildingComp = null; } else if (compCls == typeof(NavigationCenterComponent)) { this.NavigationCenterComp = null; } else if (compCls == typeof(FactoryComponent)) { this.FactoryComp = null; } else if (compCls == typeof(FleetCommandComponent)) { this.FleetCommandComp = null; } else if (compCls == typeof(FollowerComponent)) { this.FollowerComp = null; } else if (compCls == typeof(GameObjectViewComponent)) { this.GameObjectViewComp = null; } else if (compCls == typeof(GeneratorComponent)) { this.GeneratorComp = null; } else if (compCls == typeof(GeneratorViewComponent)) { this.GeneratorViewComp = null; } else if (compCls == typeof(HealerComponent)) { this.HealerComp = null; } else if (compCls == typeof(HealthComponent)) { this.HealthComp = null; } else if (compCls == typeof(TroopShieldComponent)) { this.TroopShieldComp = null; } else if (compCls == typeof(TroopShieldViewComponent)) { this.TroopShieldViewComp = null; } else if (compCls == typeof(TroopShieldHealthComponent)) { this.TroopShieldHealthComp = null; } else if (compCls == typeof(HealthViewComponent)) { this.HealthViewComp = null; } else if (compCls == typeof(HQComponent)) { this.HQComp = null; } else if (compCls == typeof(KillerComponent)) { this.KillerComp = null; } else if (compCls == typeof(LootComponent)) { this.LootComp = null; } else if (compCls == typeof(MeterShaderComponent)) { this.MeterShaderComp = null; } else if (compCls == typeof(OffenseLabComponent)) { this.OffenseLabComp = null; } else if (compCls == typeof(PathingComponent)) { this.PathingComp = null; } else if (compCls == typeof(SecondaryTargetsComponent)) { this.SecondaryTargetsComp = null; } else if (compCls == typeof(ShieldBorderComponent)) { this.ShieldBorderComp = null; } else if (compCls == typeof(ShieldGeneratorComponent)) { this.ShieldGeneratorComp = null; } else if (compCls == typeof(SizeComponent)) { this.SizeComp = null; } else if (compCls == typeof(ShooterComponent)) { this.ShooterComp = null; } else if (compCls == typeof(StarportComponent)) { this.StarportComp = null; } else if (compCls == typeof(StateComponent)) { this.StateComp = null; } else if (compCls == typeof(StorageComponent)) { this.StorageComp = null; } else if (compCls == typeof(SupportComponent)) { this.SupportComp = null; } else if (compCls == typeof(SupportViewComponent)) { this.SupportViewComp = null; } else if (compCls == typeof(TacticalCommandComponent)) { this.TacticalCommandComp = null; } else if (compCls == typeof(ChampionPlatformComponent)) { this.ChampionPlatformComp = null; } else if (compCls == typeof(TeamComponent)) { this.TeamComp = null; } else if (compCls == typeof(TrackingComponent)) { this.TrackingComp = null; } else if (compCls == typeof(TrackingGameObjectViewComponent)) { this.TrackingGameObjectViewComp = null; } else if (compCls == typeof(TransformComponent)) { this.TransformComp = null; } else if (compCls == typeof(TransportComponent)) { this.TransportComp = null; } else if (compCls == typeof(TroopComponent)) { this.TroopComp = null; } else if (compCls == typeof(TurretBuildingComponent)) { this.TurretBuildingComp = null; } else if (compCls == typeof(TurretShooterComponent)) { this.TurretShooterComp = null; } else if (compCls == typeof(WalkerComponent)) { this.WalkerComp = null; } else if (compCls == typeof(WallComponent)) { this.WallComp = null; } else if (compCls == typeof(BuffComponent)) { this.BuffComp = null; } else if (compCls == typeof(TrapComponent)) { this.TrapComp = null; } else if (compCls == typeof(TrapViewComponent)) { this.TrapViewComp = null; } else if (compCls == typeof(HousingComponent)) { this.HousingComp = null; } else if (compCls == typeof(SpawnComponent)) { this.SpawnComp = null; } return(base.Remove(compCls)); }
protected override Entity AddComponentAndDispatchAddEvent(ComponentBase comp, Type compCls) { bool flag = false; if (comp is AreaTriggerComponent) { this.AreaTriggerComp = (AreaTriggerComponent)comp; flag = true; } if (comp is ArmoryComponent) { this.ArmoryComp = (ArmoryComponent)comp; flag = true; } if (comp is AssetComponent) { this.AssetComp = (AssetComponent)comp; flag = true; } if (comp is AttackerComponent) { this.AttackerComp = (AttackerComponent)comp; flag = true; } if (comp is BarracksComponent) { this.BarracksComp = (BarracksComponent)comp; flag = true; } if (comp is BoardItemComponent) { this.BoardItemComp = (BoardItemComponent)comp; flag = true; } if (comp is BuildingAnimationComponent) { this.BuildingAnimationComp = (BuildingAnimationComponent)comp; flag = true; } if (comp is BuildingComponent) { this.BuildingComp = (BuildingComponent)comp; flag = true; } if (comp is ChampionComponent) { this.ChampionComp = (ChampionComponent)comp; flag = true; } if (comp is CivilianComponent) { this.CivilianComp = (CivilianComponent)comp; flag = true; } if (comp is ClearableComponent) { this.ClearableComp = (ClearableComponent)comp; flag = true; } if (comp is DamageableComponent) { this.DamageableComp = (DamageableComponent)comp; flag = true; } if (comp is DefenderComponent) { this.DefenderComp = (DefenderComponent)comp; flag = true; } if (comp is DefenseLabComponent) { this.DefenseLabComp = (DefenseLabComponent)comp; flag = true; } if (comp is DroidComponent) { this.DroidComp = (DroidComponent)comp; flag = true; } if (comp is DroidHutComponent) { this.DroidHutComp = (DroidHutComponent)comp; flag = true; } if (comp is SquadBuildingComponent) { this.SquadBuildingComp = (SquadBuildingComponent)comp; flag = true; } if (comp is NavigationCenterComponent) { this.NavigationCenterComp = (NavigationCenterComponent)comp; flag = true; } if (comp is FactoryComponent) { this.FactoryComp = (FactoryComponent)comp; flag = true; } if (comp is CantinaComponent) { this.CantinaComp = (CantinaComponent)comp; flag = true; } if (comp is FleetCommandComponent) { this.FleetCommandComp = (FleetCommandComponent)comp; flag = true; } if (comp is FollowerComponent) { this.FollowerComp = (FollowerComponent)comp; flag = true; } if (comp is GameObjectViewComponent) { this.GameObjectViewComp = (GameObjectViewComponent)comp; flag = true; } if (comp is GeneratorComponent) { this.GeneratorComp = (GeneratorComponent)comp; flag = true; } if (comp is GeneratorViewComponent) { this.GeneratorViewComp = (GeneratorViewComponent)comp; flag = true; } if (comp is HealerComponent) { this.HealerComp = (HealerComponent)comp; flag = true; } if (comp is TroopShieldComponent) { this.TroopShieldComp = (TroopShieldComponent)comp; flag = true; } if (comp is TroopShieldViewComponent) { this.TroopShieldViewComp = (TroopShieldViewComponent)comp; flag = true; } if (comp is TroopShieldHealthComponent) { this.TroopShieldHealthComp = (TroopShieldHealthComponent)comp; flag = true; } if (comp is HealthComponent) { this.HealthComp = (HealthComponent)comp; flag = true; } if (comp is HealthViewComponent) { this.HealthViewComp = (HealthViewComponent)comp; flag = true; } if (comp is HQComponent) { this.HQComp = (HQComponent)comp; flag = true; } if (comp is KillerComponent) { this.KillerComp = (KillerComponent)comp; flag = true; } if (comp is LootComponent) { this.LootComp = (LootComponent)comp; flag = true; } if (comp is MeterShaderComponent) { this.MeterShaderComp = (MeterShaderComponent)comp; flag = true; } if (comp is OffenseLabComponent) { this.OffenseLabComp = (OffenseLabComponent)comp; flag = true; } if (comp is PathingComponent) { this.PathingComp = (PathingComponent)comp; flag = true; } if (comp is SecondaryTargetsComponent) { this.SecondaryTargetsComp = (SecondaryTargetsComponent)comp; flag = true; } if (comp is ShieldBorderComponent) { this.ShieldBorderComp = (ShieldBorderComponent)comp; flag = true; } if (comp is ShieldGeneratorComponent) { this.ShieldGeneratorComp = (ShieldGeneratorComponent)comp; flag = true; } if (comp is SizeComponent) { this.SizeComp = (SizeComponent)comp; flag = true; } if (comp is ShooterComponent) { this.ShooterComp = (ShooterComponent)comp; flag = true; } if (comp is StarportComponent) { this.StarportComp = (StarportComponent)comp; flag = true; } if (comp is StateComponent) { this.StateComp = (StateComponent)comp; flag = true; } if (comp is StorageComponent) { this.StorageComp = (StorageComponent)comp; flag = true; } if (comp is SupportComponent) { this.SupportComp = (SupportComponent)comp; flag = true; } if (comp is SupportViewComponent) { this.SupportViewComp = (SupportViewComponent)comp; flag = true; } if (comp is TacticalCommandComponent) { this.TacticalCommandComp = (TacticalCommandComponent)comp; flag = true; } if (comp is ChampionPlatformComponent) { this.ChampionPlatformComp = (ChampionPlatformComponent)comp; flag = true; } if (comp is TeamComponent) { this.TeamComp = (TeamComponent)comp; flag = true; } if (comp is TrackingComponent) { this.TrackingComp = (TrackingComponent)comp; flag = true; } if (comp is TrackingGameObjectViewComponent) { this.TrackingGameObjectViewComp = (TrackingGameObjectViewComponent)comp; flag = true; } if (comp is TransformComponent) { this.TransformComp = (TransformComponent)comp; flag = true; } if (comp is TransportComponent) { this.TransportComp = (TransportComponent)comp; flag = true; } if (comp is TroopComponent) { this.TroopComp = (TroopComponent)comp; flag = true; } if (comp is TurretBuildingComponent) { this.TurretBuildingComp = (TurretBuildingComponent)comp; flag = true; } if (comp is TurretShooterComponent) { this.TurretShooterComp = (TurretShooterComponent)comp; flag = true; } if (comp is WalkerComponent) { this.WalkerComp = (WalkerComponent)comp; flag = true; } if (comp is WallComponent) { this.WallComp = (WallComponent)comp; flag = true; } if (comp is BuffComponent) { this.BuffComp = (BuffComponent)comp; flag = true; } if (comp is TrapComponent) { this.TrapComp = (TrapComponent)comp; flag = true; } if (comp is TrapViewComponent) { this.TrapViewComp = (TrapViewComponent)comp; flag = true; } if (comp is HousingComponent) { this.HousingComp = (HousingComponent)comp; flag = true; } if (comp is ScoutTowerComponent) { this.ScoutTowerComp = (ScoutTowerComponent)comp; flag = true; } if (comp is SpawnComponent) { this.SpawnComp = (SpawnComponent)comp; flag = true; } if (!flag && compCls != null) { Service.Logger.Error("Invalid component add: " + compCls.Name); } return(base.AddComponentAndDispatchAddEvent(comp, compCls)); }
public void UnstashBuildingByUID(string buildingUID, bool returnToOriginalPosition, bool stampable, bool panToBuilding, bool playLoweredSound) { if (this.stashedBuildingMap == null) { return; } if (!this.stashedBuildingMap.ContainsKey(buildingUID) || this.stashedBuildingMap[buildingUID].Count < 1) { Service.Logger.Error("Can't unstash! No buildings of : " + buildingUID + " currently stashed"); return; } List <SmartEntity> list = this.stashedBuildingMap[buildingUID]; SmartEntity smartEntity = list[0]; BuildingComponent buildingComp = smartEntity.BuildingComp; bool flag = false; if (stampable && this.IsBuildingStampable(smartEntity)) { flag = true; } Position pos = null; if (returnToOriginalPosition) { pos = this.lastSavedMap.GetPosition(buildingComp.BuildingTO.Key); if (flag) { flag = false; Service.Logger.Warn("No stamping while reverting!!"); } } BuildingController buildingController = Service.BuildingController; GameObjectViewComponent gameObjectViewComponent = smartEntity.Get <GameObjectViewComponent>(); TransformComponent transformComponent = smartEntity.Get <TransformComponent>(); if (gameObjectViewComponent != null) { gameObjectViewComponent.SetXYZ(Units.BoardToWorldX(transformComponent.CenterX()), 0f, Units.BoardToWorldZ(transformComponent.CenterZ())); } if (smartEntity.Has <HealthViewComponent>()) { HealthViewComponent healthViewComponent = smartEntity.Get <HealthViewComponent>(); healthViewComponent.SetupElements(); } List <SmartEntity> list2 = this.stashedBuildingMap[buildingUID]; if (list2.Contains(smartEntity)) { list2.Remove(smartEntity); if (!buildingController.PositionUnstashedBuilding(smartEntity, pos, flag, panToBuilding, playLoweredSound)) { Service.Logger.ErrorFormat("Unable to place building from stash. Building {0} {1}", new object[] { smartEntity.Get <BuildingComponent>().BuildingTO.Key, smartEntity.Get <BuildingComponent>().BuildingType.Uid }); Service.UXController.MiscElementsManager.ShowPlayerInstructionsError(Service.Lang.Get("NO_VALID_POSITION_FOR_UNSTASH", new object[0])); this.StashBuilding(smartEntity); } } }