public void React(GasMix gasMix, Vector3 tilePos, Matrix matrix) { if (gasMix.Temperature > AtmosDefines.WATER_VAPOR_FREEZE) { return; } if (gasMix.GetMoles(Gas.WaterVapor) < 2f) { //Not enough moles to freeze return; } var numberOfIceToSpawn = (int)Mathf.Floor(gasMix.GetMoles(Gas.WaterVapor) / 2f); //Stack size of ice is 50 if (numberOfIceToSpawn > 50) { numberOfIceToSpawn = 50; } if (numberOfIceToSpawn < 1) { return; } SpawnSafeThread.SpawnPrefab(tilePos, AtmosManager.Instance.iceShard, amountIfStackable: numberOfIceToSpawn); gasMix.RemoveGas(Gas.WaterVapor, numberOfIceToSpawn * 2f); }
public void React(GasMix gasMix, Vector3 tilePos, Matrix matrix) { var energyReleased = 0f; var oldHeatCap = gasMix.WholeHeatCapacity; var temperatureScale = 1f; if (gasMix.Temperature < AtmosDefines.FREON_LOWER_TEMPERATURE) { temperatureScale = 0; } else { temperatureScale = (AtmosDefines.FREON_MAXIMUM_BURN_TEMPERATURE - gasMix.Temperature) / (AtmosDefines.FREON_MAXIMUM_BURN_TEMPERATURE - AtmosDefines.FREON_LOWER_TEMPERATURE); } if (temperatureScale >= 0) { var oxygenBurnRate = AtmosDefines.OXYGEN_BURN_RATE_BASE - temperatureScale; var freonBurnRate = 0f; if (gasMix.GetMoles(Gas.Oxygen) > gasMix.GetMoles(Gas.Freon) * AtmosDefines.FREON_OXYGEN_FULLBURN) { freonBurnRate = gasMix.GetMoles(Gas.Freon) * temperatureScale / AtmosDefines.FREON_BURN_RATE_DELTA; } else { freonBurnRate = (temperatureScale * (gasMix.GetMoles(Gas.Oxygen) / AtmosDefines.FREON_OXYGEN_FULLBURN) / AtmosDefines.FREON_BURN_RATE_DELTA); } if (freonBurnRate > 0.0001f) { freonBurnRate = Mathf.Min(freonBurnRate, gasMix.GetMoles(Gas.Freon), gasMix.GetMoles(Gas.Oxygen)); gasMix.RemoveGas(Gas.Freon, freonBurnRate); gasMix.RemoveGas(Gas.Oxygen, freonBurnRate * oxygenBurnRate); gasMix.AddGas(Gas.CarbonDioxide, freonBurnRate); if (gasMix.Temperature < 160 && gasMix.Temperature > 120 && rnd.Next(0, 2) == 0) { SpawnSafeThread.SpawnPrefab(tilePos, AtmosManager.Instance.hotIce); } energyReleased += AtmosDefines.FIRE_FREON_ENERGY_RELEASED * freonBurnRate; } } if (energyReleased < 0) { var newHeatCap = gasMix.WholeHeatCapacity; if (newHeatCap > 0.0003f) { gasMix.SetTemperature((gasMix.Temperature * oldHeatCap + energyReleased) / newHeatCap); } } }
public void React(GasMix gasMix, Vector3 tilePos, Matrix matrix) { if (gasMix.Temperature <= AtmosDefines.WATER_VAPOR_FREEZE) { if (gasMix.GetMoles(Gas.WaterVapor) < 2f) { //Not enough moles to freeze return; } var numberOfIceToSpawn = Mathf.Floor(gasMix.GetMoles(Gas.WaterVapor) / 2f); for (var i = 0; i < numberOfIceToSpawn; i++) { SpawnSafeThread.SpawnPrefab(tilePos, AtmosManager.Instance.iceShard); } gasMix.RemoveGas(Gas.WaterVapor, numberOfIceToSpawn * 2f); } }