コード例 #1
0
    protected override void OnSpawn()
    {
        HandleVector <Game.CallbackInfo> .Handle callbackHandle = Game.Instance.callbackManager.Add(new Game.CallbackInfo(OnModifyComplete, false));
        int   num           = building.Def.PlacementOffsets.Length;
        float mass_per_cell = primaryElement.Mass / (float)num;

        building.RunOnArea(delegate(int offset_cell)
        {
            if (doReplaceElement)
            {
                SimMessages.ReplaceAndDisplaceElement(offset_cell, primaryElement.ElementID, CellEventLogger.Instance.SimCellOccupierOnSpawn, mass_per_cell, primaryElement.Temperature, primaryElement.DiseaseIdx, primaryElement.DiseaseCount, callbackHandle.index);
                callbackHandle = HandleVector <Game.CallbackInfo> .InvalidHandle;
                SimMessages.SetStrength(offset_cell, 0, strengthMultiplier);
                Game.Instance.RemoveSolidChangedFilter(offset_cell);
            }
            else
            {
                ForceSetGameCellData(offset_cell);
                Game.Instance.AddSolidChangedFilter(offset_cell);
            }
            Sim.Cell.Properties simCellProperties = GetSimCellProperties();
            SimMessages.SetCellProperties(offset_cell, (byte)simCellProperties);
            Grid.RenderedByWorld[offset_cell] = false;
            Game.Instance.GetComponent <EntombedItemVisualizer>().ForceClear(offset_cell);
        });
        Subscribe(-1699355994, OnBuildingRepairedDelegate);
    }
コード例 #2
0
 private Sim.Cell.Properties GetSimCellProperties()
 {
     Sim.Cell.Properties properties = Sim.Cell.Properties.SolidImpermeable;
     if (setGasImpermeable)
     {
         properties |= Sim.Cell.Properties.GasImpermeable;
     }
     if (setLiquidImpermeable)
     {
         properties |= Sim.Cell.Properties.LiquidImpermeable;
     }
     if (setTransparent)
     {
         properties |= Sim.Cell.Properties.Transparent;
     }
     if (setOpaque)
     {
         properties |= Sim.Cell.Properties.Opaque;
     }
     if (notifyOnMelt)
     {
         properties |= Sim.Cell.Properties.NotifyOnMelt;
     }
     return(properties);
 }
コード例 #3
0
 public void DestroySelf(System.Action onComplete)
 {
     callDestroy = false;
     for (int i = 0; i < building.PlacementCells.Length; i++)
     {
         int num = building.PlacementCells[i];
         Game.Instance.RemoveSolidChangedFilter(num);
         Sim.Cell.Properties simCellProperties = GetSimCellProperties();
         SimMessages.ClearCellProperties(num, (byte)simCellProperties);
         if (doReplaceElement && Grid.Element[num].id == primaryElement.ElementID)
         {
             HandleVector <int> .Handle handle = GameComps.DiseaseContainers.GetHandle(base.gameObject);
             if (handle.IsValid())
             {
                 DiseaseHeader header = GameComps.DiseaseContainers.GetHeader(handle);
                 header.diseaseIdx   = Grid.DiseaseIdx[num];
                 header.diseaseCount = Grid.DiseaseCount[num];
                 GameComps.DiseaseContainers.SetHeader(handle, header);
             }
             if (onComplete != null)
             {
                 HandleVector <Game.CallbackInfo> .Handle handle2 = Game.Instance.callbackManager.Add(new Game.CallbackInfo(onComplete, false));
                 int              gameCell    = num;
                 SimHashes        new_element = SimHashes.Vacuum;
                 CellElementEvent simCellOccupierDestroySelf = CellEventLogger.Instance.SimCellOccupierDestroySelf;
                 float            mass        = 0f;
                 float            temperature = -1f;
                 int              index       = handle2.index;
                 SimMessages.ReplaceElement(gameCell, new_element, simCellOccupierDestroySelf, mass, temperature, byte.MaxValue, 0, index);
             }
             else
             {
                 SimMessages.ReplaceElement(num, SimHashes.Vacuum, CellEventLogger.Instance.SimCellOccupierDestroySelf, 0f, -1f, byte.MaxValue, 0, -1);
             }
             SimMessages.SetStrength(num, 1, 1f);
         }
         else
         {
             Grid.SetSolid(num, false, CellEventLogger.Instance.SimCellOccupierDestroy);
             onComplete.Signal();
             World.Instance.OnSolidChanged(num);
             GameScenePartitioner.Instance.TriggerEvent(num, GameScenePartitioner.Instance.solidChangedLayer, null);
         }
     }
 }
コード例 #4
0
 private static void Postfix(ref Sim.Cell.Properties __result)
 {
     SimMessages_Utils.Log(MethodBase.GetCurrentMethod(),
                           __result);
     //return true;
 }