Esempio n. 1
0
        public override void CompTickRare()
        {
            base.CompTickRare();
            float num = 15f;

            if (parent.MapHeld != null)
            {
                num = GridsUtility.GetTemperature(parent.PositionHeld, parent.MapHeld);
            }
            CompEquippable comp = parent.GetComp <CompEquippable>();

            if (comp != null)
            {
                Pawn casterPawn = comp.PrimaryVerb.CasterPawn;
                if (casterPawn != null)
                {
                    num = GridsUtility.GetTemperature(casterPawn.PositionHeld, casterPawn.MapHeld);
                }
            }
            if (parent.Spawned)
            {
                List <Thing> thingList = GridsUtility.GetThingList(parent.PositionHeld, parent.MapHeld);
                for (int i = 0; i < thingList.Count; i++)
                {
                    CompRefrigerator fridge = ThingCompUtility.TryGetComp <CompRefrigerator>(thingList[i]);
                    if (fridge != null)
                    {
                        num = fridge.currentTemp;
                        break;
                    }
                }
            }
            temperature += (num - temperature) * 0.05f;
        }
 public Dialog_RenameFridge(CompRefrigerator fridge)
 {
     forcePause              = true;
     doCloseX                = true;
     closeOnClickedOutside   = true;
     absorbInputAroundWindow = true;
     closeOnClickedOutside   = true;
     curName     = fridge.parent.Label;
     this.fridge = fridge;
 }
Esempio n. 3
0
        public static bool TryGetFridge(IntVec3 cell, int mapIndex, out CompRefrigerator comp)
        {
            var c = GetFridgeCache(mapIndex);

            if (c != null)
            {
                return(c.FridgeGrid.TryGetValue(cell, out comp));
            }
            comp = null;
            return(false);
        }
Esempio n. 4
0
        public static void RemoveFridge(CompRefrigerator comp, Map map)
        {
            var c = GetFridgeCache(map);

            if (c != null)
            {
                foreach (IntVec3 cell in GenAdj.OccupiedRect(comp.parent))
                {
                    c.FridgeGrid.Remove(cell);
                }
            }
        }
Esempio n. 5
0
        public static void RemoveFridge(CompRefrigerator comp, int mapIndex)
        {
            var c = GetFridgeCache(mapIndex);

            if (c != null)
            {
                c.fridgeBuildings.Remove(comp.parent);
                foreach (IntVec3 cell in GenAdj.OccupiedRect(comp.parent))
                {
                    c.FridgeGrid.Remove(cell);
                }
            }
        }
        static void Postfix(bool __result, ref IntVec3 c, ref Map map, ref float tempResult)
        {
            IEnumerable <Thing> things = map?.thingGrid.ThingsAt(c);

            if (things != null)
            {
                foreach (Thing thing in things)
                {
                    CompRefrigerator fridge = ThingCompUtility.TryGetComp <CompRefrigerator>(thing);
                    if (fridge != null)
                    {
                        tempResult = fridge.currentTemp;
                        __result   = true;
                    }
                }
            }
        }