示例#1
0
 public override void OnBlockGenerated(int value, int x, int y, int z, bool isLoaded)
 {
     value = BlastBlowerBlock.Index;
     if (ComponentEngine.IsPowered(Utils.Terrain, x, y, z) &&
         (Check(x + 1, y, z) ||
          Check(x - 1, y, z) ||
          Check(x, y + 1, z) ||
          Check(x, y - 1, z) ||
          Check(x, y, z + 1) ||
          Check(x, y, z - 1)))
     {
         value |= FurnaceNBlock.SetHeatLevel(Terrain.ExtractData(Utils.Terrain.GetCellValue(x, y, z)), 1) << 14;
     }
     Utils.SubsystemTerrain.ChangeCell(x, y, z, value);
 }
示例#2
0
 public void Update(float dt)
 {
     if (HeatLevel > 0f)
     {
         m_fireTimeRemaining = MathUtils.Max(0f, m_fireTimeRemaining - dt);
         if (m_fireTimeRemaining == 0f)
         {
             HeatLevel = 0f;
         }
     }
     if (m_updateSmeltingRecipe)
     {
         m_updateSmeltingRecipe = false;
         m_smeltingRecipe2      = FindSmeltingRecipe();
         if (m_smeltingRecipe2 != m_smeltingRecipe)
         {
             m_smeltingRecipe = m_smeltingRecipe2;
             SmeltingProgress = 0f;
             //m_music = 0;
         }
     }
     if (m_smeltingRecipe2 != null)
     {
         Point3 coordinates = m_componentBlockEntity.Coordinates;
         m_smeltingRecipe = ComponentEngine.IsPowered(Utils.Terrain, coordinates.X, coordinates.Y, coordinates.Z) ? m_smeltingRecipe2 : null;
     }
     if (m_smeltingRecipe == null)
     {
         HeatLevel           = 0f;
         m_fireTimeRemaining = 0f;
         //m_music = -1;
     }
     else
     {
         m_fireTimeRemaining = 100f;
     }
     if (m_fireTimeRemaining <= 0f)
     {
         m_smeltingRecipe = null;
         SmeltingProgress = 0f;
         //m_music = -1;
     }
     if (m_smeltingRecipe != null)
     {
         SmeltingProgress = MathUtils.Min(SmeltingProgress + m_speed * dt, 1f);
         if (SmeltingProgress >= 1f)
         {
             for (int l = 0; l < m_furnaceSize; l++)
             {
                 if (m_slots[l].Count > 0)
                 {
                     m_slots[l].Count--;
                 }
             }
             m_slots[ResultSlotIndex].Value  = ItemBlock.IdTable[m_smeltingRecipe];
             m_slots[ResultSlotIndex].Count += m_count;
             m_smeltingRecipe       = null;
             SmeltingProgress       = 0f;
             m_updateSmeltingRecipe = true;
         }
     }
 }
示例#3
0
 public void OnNeighborBlockChanged(SubsystemTerrain subsystemTerrain, int neighborX, int neighborY, int neighborZ)
 {
     Powered = ComponentEngine.IsPowered(subsystemTerrain.Terrain, Point.X, Point.Y, Point.Z);
 }
示例#4
0
 public void OnBlockAdded(SubsystemTerrain subsystemTerrain, int value, int oldValue)
 {
     Powered = ComponentEngine.IsPowered(subsystemTerrain.Terrain, Point.X, Point.Y, Point.Z);
 }