protected override void OnSpawn() { base.OnSpawn(); if (!IsThereLiquid()) { base.gameObject.DeleteObject(); } else { Grid.Objects[Grid.PosToCell(base.gameObject), 8] = base.gameObject; new WorkChore <Moppable>(Db.Get().ChoreTypes.Mop, this, null, true, null, null, null, true, null, false, true, null, false, true, true, PriorityScreen.PriorityClass.basic, 5, false, true); SetWorkTime(float.PositiveInfinity); KSelectable component = GetComponent <KSelectable>(); component.SetStatusItem(Db.Get().StatusItemCategories.Main, Db.Get().MiscStatusItems.WaitingForMop, null); Subscribe(493375141, OnRefreshUserMenuDelegate); overrideAnims = new KAnimFile[1] { Assets.GetAnim("anim_mop_dirtywater_kanim") }; partitionerEntry = GameScenePartitioner.Instance.Add("Moppable.OnSpawn", base.gameObject, new Extents(Grid.PosToCell(this), new CellOffset[1] { new CellOffset(0, 0) }), GameScenePartitioner.Instance.liquidChangedLayer, OnLiquidChanged); Refresh(); Subscribe(-1432940121, OnReachableChangedDelegate); ReachabilityMonitor.Instance instance = new ReachabilityMonitor.Instance(this); instance.StartSM(); SimAndRenderScheduler.instance.Remove(this); } }
protected override void OnSpawn() { base.OnSpawn(); int cell = Grid.PosToCell(this); if (!Grid.IsValidCell(cell)) { base.gameObject.DeleteObject(); } else { UpdateCachedCell(cell); ReachabilityMonitor.Instance instance = new ReachabilityMonitor.Instance(this); instance.StartSM(); FetchableMonitor.Instance instance2 = new FetchableMonitor.Instance(this); instance2.StartSM(); SetWorkTime(1.5f); faceTargetWhenWorking = true; KSelectable component = GetComponent<KSelectable>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { component.SetStatusIndicatorOffset(new Vector3(0f, -0.65f, 0f)); } OnTagsChanged(null); TryToOffsetIfBuried(); DecorProvider component2 = GetComponent<DecorProvider>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null && string.IsNullOrEmpty(component2.overrideName)) { component2.overrideName = UI.OVERLAYS.DECOR.CLUTTER; } UpdateEntombedVisualizer(); Subscribe(-1582839653, OnTagsChangedDelegate); } }
protected override void OnSpawn() { base.OnSpawn(); int num = Grid.PosToCell(this); originalDigElement = Grid.Element[num]; KSelectable component = GetComponent <KSelectable>(); component.SetStatusItem(Db.Get().StatusItemCategories.Main, Db.Get().MiscStatusItems.WaitingForDig, null); UpdateColor(isReachable); Grid.Objects[num, 7] = base.gameObject; ChoreType chore_type = Db.Get().ChoreTypes.Dig; if (choreTypeIdHash.IsValid) { chore_type = Db.Get().ChoreTypes.GetByHash(choreTypeIdHash); } chore = new WorkChore <Diggable>(chore_type, this, null, true, null, null, null, true, null, false, true, null, true, true, true, PriorityScreen.PriorityClass.basic, 5, false, true); SetWorkTime(float.PositiveInfinity); partitionerEntry = GameScenePartitioner.Instance.Add("Diggable.OnSpawn", base.gameObject, Grid.PosToCell(this), GameScenePartitioner.Instance.solidChangedLayer, OnSolidChanged); OnSolidChanged(null); ReachabilityMonitor.Instance instance = new ReachabilityMonitor.Instance(this); instance.StartSM(); Subscribe(493375141, OnRefreshUserMenuDelegate); handle = Game.Instance.Subscribe(-1523247426, UpdateStatusItem); Components.Diggables.Add(this); }
/// <summary> /// Enqueues a reachability monitor for updating. /// </summary> /// <param name="smi">The monitor to update.</param> public void Enqueue(ReachabilityMonitor.Instance smi) { if (smi != null && smi.master != null) { toDo.Enqueue(smi); } }
public override void OnSpawn() { base.OnSpawn(); smi = gameObject.GetSMI <RMI>(); UpdateOffsets(); FastGroupProber.Instance.Enqueue(smi); }
/// <summary> /// Adds a fast reachability monitor to the target workable, but does not immediately /// check for reachability, instead queuing it for a check on the group prober. /// </summary> /// <param name="smi">The existing reachability monitor state.</param> private static void UpdateReachability(RMI smi) { var workable = smi.master; if (workable != null) { workable.gameObject.AddOrGet <FastReachabilityMonitor>(); } }
protected override void OnSpawn() { base.OnSpawn(); Subscribe(2127324410, OnCancelDelegate); if ((UnityEngine.Object)rotatable != (UnityEngine.Object)null) { MarkArea(); } this.fetchList = new FetchList2(storage, Db.Get().ChoreTypes.BuildFetch); PrimaryElement component = GetComponent <PrimaryElement>(); Element element = ElementLoader.GetElement(SelectedElementsTags[0]); Debug.Assert(element != null, "Missing primary element for Constructable"); component.ElementID = element.id; float num3 = component.Temperature = (component.Temperature = 293.15f); Recipe.Ingredient[] allIngredients = Recipe.GetAllIngredients(selectedElementsTags); foreach (Recipe.Ingredient ingredient in allIngredients) { FetchList2 fetchList = this.fetchList; Tag tag = ingredient.tag; num3 = ingredient.amount; fetchList.Add(tag, null, null, num3, FetchOrder2.OperationalRequirement.None); MaterialNeeds.Instance.UpdateNeed(ingredient.tag, ingredient.amount); } if (!building.Def.IsTilePiece) { base.gameObject.layer = LayerMask.NameToLayer("Construction"); } building.RunOnArea(delegate(int offset_cell) { if ((UnityEngine.Object)base.gameObject.GetComponent <ConduitBridge>() == (UnityEngine.Object)null) { GameObject gameObject2 = Grid.Objects[offset_cell, 7]; if ((UnityEngine.Object)gameObject2 != (UnityEngine.Object)null) { gameObject2.DeleteObject(); } } }); if (IsReplacementTile) { GameObject gameObject = null; if (building.Def.ReplacementLayer != ObjectLayer.NumLayers) { int cell = Grid.PosToCell(base.transform.GetPosition()); gameObject = Grid.Objects[cell, (int)building.Def.ReplacementLayer]; if ((UnityEngine.Object)gameObject == (UnityEngine.Object)null || (UnityEngine.Object)gameObject == (UnityEngine.Object)base.gameObject) { Grid.Objects[cell, (int)building.Def.ReplacementLayer] = base.gameObject; if ((UnityEngine.Object)base.gameObject.GetComponent <SimCellOccupier>() != (UnityEngine.Object)null) { int renderLayer = LayerMask.NameToLayer("Overlay"); World.Instance.blockTileRenderer.AddBlock(renderLayer, building.Def, IsReplacementTile, SimHashes.Void, cell); } TileVisualizer.RefreshCell(cell, building.Def.TileLayer, building.Def.ReplacementLayer); } else { Debug.LogError("multiple replacement tiles on the same cell!"); Util.KDestroyGameObject(base.gameObject); } } } bool flag = building.Def.BuildingComplete.GetComponent <Ladder>(); waitForFetchesBeforeDigging = (flag || (bool)building.Def.BuildingComplete.GetComponent <SimCellOccupier>() || (bool)building.Def.BuildingComplete.GetComponent <Door>() || (bool)building.Def.BuildingComplete.GetComponent <LiquidPumpingStation>()); if (flag) { int x = 0; int y = 0; int cell2 = Grid.PosToCell(this); Grid.CellToXY(cell2, out x, out y); int y2 = y - 3; ladderDetectionExtents = new Extents(x, y2, 1, 5); ladderParititonerEntry = GameScenePartitioner.Instance.Add("Constructable.OnNearbyBuildingLayerChanged", base.gameObject, ladderDetectionExtents, GameScenePartitioner.Instance.objectLayers[1], OnNearbyBuildingLayerChanged); OnNearbyBuildingLayerChanged(null); } this.fetchList.Submit(OnFetchListComplete, true); PlaceDiggables(); ReachabilityMonitor.Instance instance = new ReachabilityMonitor.Instance(this); instance.StartSM(); Subscribe(493375141, OnRefreshUserMenuDelegate); Prioritizable component2 = GetComponent <Prioritizable>(); Prioritizable obj = component2; obj.onPriorityChanged = (Action <PrioritySetting>)Delegate.Combine(obj.onPriorityChanged, new Action <PrioritySetting>(OnPriorityChanged)); OnPriorityChanged(component2.GetMasterPriority()); }
/// <summary> /// Triggers an event when reachability changes. /// </summary> /// <param name="smi">The reachability monitor whose state changed.</param> private static void TriggerEvent(RMI smi) { smi.TriggerEvent(); }