コード例 #1
0
    public void Close()
    {
        openCount = Mathf.Max(0, openCount - 1);
        if (openCount == 0 && DisplacesGas(doorType))
        {
            StructureTemperatureComponents structureTemperatures = GameComps.StructureTemperatures;
            HandleVector <int> .Handle     handle = structureTemperatures.GetHandle(base.gameObject);
            PrimaryElement component = GetComponent <PrimaryElement>();
            if (handle.IsValid() && !structureTemperatures.IsBypassed(handle))
            {
                float num = component.Temperature = structureTemperatures.GetPayload(handle).Temperature;
            }
        }
        switch (controlState)
        {
        case ControlState.Locked:
            controller.sm.isOpen.Set(false, controller);
            break;

        case ControlState.Auto:
            if (openCount == 0)
            {
                controller.sm.isOpen.Set(false, controller);
                Game.Instance.userMenu.Refresh(base.gameObject);
            }
            break;
        }
    }
コード例 #2
0
 public void Sim200ms(float dt)
 {
     if (!((Object)this == (Object)null))
     {
         if (doorOpenLiquidRefreshHack)
         {
             doorOpenLiquidRefreshTime -= dt;
             if (doorOpenLiquidRefreshTime <= 0f)
             {
                 doorOpenLiquidRefreshHack = false;
                 int[] placementCells = building.PlacementCells;
                 foreach (int cell in placementCells)
                 {
                     Pathfinding.Instance.AddDirtyNavGridCell(cell);
                 }
             }
         }
         if (applyLogicChange)
         {
             applyLogicChange = false;
             ApplyRequestedControlState(false);
         }
         if (do_melt_check)
         {
             StructureTemperatureComponents structureTemperatures = GameComps.StructureTemperatures;
             HandleVector <int> .Handle     handle = structureTemperatures.GetHandle(base.gameObject);
             if (handle.IsValid())
             {
                 StructureTemperaturePayload payload = structureTemperatures.GetPayload(handle);
                 if (!payload.enabled)
                 {
                     int[] placementCells2 = building.PlacementCells;
                     int   num             = 0;
                     while (true)
                     {
                         if (num >= placementCells2.Length)
                         {
                             return;
                         }
                         int i2 = placementCells2[num];
                         if (!Grid.Solid[i2])
                         {
                             break;
                         }
                         num++;
                     }
                     PrimaryElement component = GetComponent <PrimaryElement>();
                     StructureTemperatureComponents.DoMelt(component);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: Insulatable.cs プロジェクト: SuperCorgi/ONI-Mods
        private void ForceSimUpdate()
        {
            //Update the building temperature simulation, so that the conduit as a building itself transfers no heat.
            //Without this, heat will transfer to/from the conduit's surroudnings from/to the conduit itself (without affecting the conduit contents)
            StructureTemperatureComponents mgr = GameComps.StructureTemperatures;

            HandleVector <int> .Handle handle = mgr.GetHandle(gameObject);
            //Payload contains information such as the building, temperature, and the element the building is made out of
            StructureTemperaturePayload payload = mgr.GetPayload(handle);

            //In this instance, the InternalTemperature represents what the temperature of the building was when the save was first loaded. Temperature reprsents the current temperature
            payload.primaryElement.InternalTemperature = this.primaryElement.Temperature;
            object[] parameters = { payload };
            //The simulation will normally ignore that the payload had its primary element changed except when the game first runs after loading a save.
            //Force the simulation to update its information by invoking UpdateSimState.
            Harmony.AccessTools.Method(typeof(StructureTemperatureComponents), "UpdateSimState").Invoke(GameComps.StructureTemperatures, parameters);
        }