-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Новые газы, изменения экономики и РТ (#295)
<!-- ЭТО ШАБЛОН ВАШЕГО PULL REQUEST. Текст между стрелками - это комментарии - они не будут видны в PR. --> ## Описание PR Тут настолько много всего, что мне не описать словами прям-таки <!-- Ниже опишите ваш Pull Request. Что он изменяет? На что еще это может повлиять? Постарайтесь описать все внесённые вами изменения! --> **Медиа** Когда-то я научусь делать скрины, честно-честно <!-- Если приемлемо, добавьте скриншоты для демонстрации вашего PR. Если ваш PR представляет собой визуальное изменение, добавьте скриншоты, иначе он может быть закрыт. --> **Проверки** <!-- Выполнение всех следующих действий, если это приемлемо для вида изменений сильно ускорит разбор вашего PR --> - [x] PR полностью завершён и мне не нужна помощь чтобы его закончить. - [x] Я внимательно просмотрел все свои изменения и багов в них не нашёл. - [x] Я запускал локальный сервер со своими изменениями и всё протестировал. - [x] Я добавил скриншот/видео демонстрации PR в игре, **или** этот PR этого не требует. **Изменения** <!-- Здесь вы можете написать список изменений, который будет автоматически добавлен в игру, когда ваш PR будет принят. В журнал изменений следует помещать только то, что действительно важно игрокам. В списке изменений тип значка не является часть предложения, поэтому явно указывайте - Добавлен, Удалён, Изменён. плохо: - add: Новый инструмент для инженеров хорошо: - add: Добавлен новый инструмент для инженеров Вы можете указать своё имя после символа 🆑 именно оно будет отображаться в журнале изменений (иначе будет использоваться ваше имя на GitHub) Например: 🆑 Ian --> 🆑 KashRas2 - add: Атмос апдейт vol.1 - добавлено 11 новых газов прямиком из ТГ стейшн. - add: Атмос апдейт vol.2 - добавлен универсальный раздатчик труб, который позволяет дешево печатать трубы. - add: Разработчикам была добавлена возможность делать вендоматы бесплатными. - tweak: Цены в алкомате теперь чуть дороже. - tweak: РРТ теперь можно найти в шкафах СИ. - tweak: Утилизационные трубы теперь можно носить в двух руках. - tweak: Респрайт алкомата, портативного скруббера, воздушной сигнализации, а также раздатчика баллонов. - fix: Новакиды вновь дышат в плазме - fix: Центральное командование наконец-то выплачивает зарплату АВД и пилоту. --------- Co-authored-by: KashRas2 <[email protected]>
- Loading branch information
Showing
116 changed files
with
3,123 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Content.Server/ADT/Atmos/Reactions/BZProductionReaction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions; | ||
|
||
[UsedImplicitly] | ||
public sealed partial class BZProductionReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialNitrousOxide = mixture.GetMoles(Gas.NitrousOxide); | ||
var initialPlasma = mixture.GetMoles(Gas.Plasma); | ||
|
||
var environmentEfficiency = mixture.Volume / mixture.Pressure; | ||
var ratioEfficiency = Math.Min(initialNitrousOxide / initialPlasma, 1); | ||
|
||
var bZFormed = Math.Min(0.01f * ratioEfficiency * environmentEfficiency, Math.Min(initialNitrousOxide * 0.4f, initialPlasma * 0.8f)); | ||
|
||
if (initialNitrousOxide - bZFormed * 0.4f < 0 || initialPlasma - (0.8f - bZFormed) < 0 || bZFormed <= 0) | ||
return ReactionResult.NoReaction; | ||
|
||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
|
||
var amountDecomposed = 0.0f; | ||
var nitrousOxideDecomposedFactor = Math.Max(4.0f * (initialPlasma / (initialNitrousOxide + initialPlasma) - 0.75f), 0); | ||
if (nitrousOxideDecomposedFactor > 0) | ||
{ | ||
amountDecomposed = 0.4f * bZFormed * nitrousOxideDecomposedFactor; | ||
mixture.AdjustMoles(Gas.Oxygen, amountDecomposed); | ||
mixture.AdjustMoles(Gas.Nitrogen, 0.5f * amountDecomposed); | ||
} | ||
|
||
mixture.AdjustMoles(Gas.BZ, Math.Max(0f, bZFormed * (1.0f - nitrousOxideDecomposedFactor))); | ||
mixture.AdjustMoles(Gas.NitrousOxide, -0.4f * bZFormed); | ||
mixture.AdjustMoles(Gas.Plasma, -0.8f * bZFormed * (1.0f - nitrousOxideDecomposedFactor)); | ||
|
||
var energyReleased = bZFormed * (Atmospherics.BZFormationEnergy + nitrousOxideDecomposedFactor * (Atmospherics.NitrousOxideDecompositionEnergy - Atmospherics.BZFormationEnergy)); | ||
|
||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
Content.Server/ADT/Atmos/Reactions/HalonOxygenAbsorptionReaction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions; | ||
|
||
[UsedImplicitly] | ||
public sealed partial class HalonOxygenAbsorptionReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialHalon = mixture.GetMoles(Gas.Halon); | ||
var initialOxygen = mixture.GetMoles(Gas.Oxygen); | ||
|
||
var temperature = mixture.Temperature; | ||
|
||
var heatEfficiency = Math.Min(temperature / (Atmospherics.FireMinimumTemperatureToExist * 10f), Math.Min(initialHalon, initialOxygen * 20f)); | ||
if (heatEfficiency <= 0f || initialHalon - heatEfficiency < 0f || initialOxygen - heatEfficiency * 20f < 0f) | ||
return ReactionResult.NoReaction; | ||
|
||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
|
||
mixture.AdjustMoles(Gas.Halon, -heatEfficiency); | ||
mixture.AdjustMoles(Gas.Oxygen, -heatEfficiency * 20f); | ||
mixture.AdjustMoles(Gas.CarbonDioxide, heatEfficiency * 5f); | ||
|
||
var energyUsed = heatEfficiency * Atmospherics.HalonCombustionEnergy; | ||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyUsed) / newHeatCapacity, Atmospherics.TCMB); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
Content.Server/ADT/Atmos/Reactions/HealiumProductionReaction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions; | ||
|
||
[UsedImplicitly] | ||
public sealed partial class HealiumProductionReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialBZ = mixture.GetMoles(Gas.BZ); | ||
var initialFrezon = mixture.GetMoles(Gas.Frezon); | ||
|
||
var temperature = mixture.Temperature; | ||
var heatEfficiency = Math.Min(temperature * 0.3f, Math.Min(initialFrezon * 2.75f, initialBZ * 0.25f)); | ||
|
||
if (heatEfficiency <= 0 || initialFrezon - heatEfficiency * 2.75f < 0 || initialBZ - heatEfficiency * 0.25f < 0) | ||
return ReactionResult.NoReaction; | ||
|
||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
|
||
mixture.AdjustMoles(Gas.Frezon, -heatEfficiency * 2.75f); | ||
mixture.AdjustMoles(Gas.BZ, -heatEfficiency * 0.25f); | ||
mixture.AdjustMoles(Gas.Healium, heatEfficiency * 3); | ||
|
||
var energyReleased = heatEfficiency * Atmospherics.HealiumFormationEnergy; | ||
|
||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
Content.Server/ADT/Atmos/Reactions/HydrogenFireReaction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions | ||
{ | ||
[UsedImplicitly] | ||
[DataDefinition] | ||
public sealed partial class HydrogenFireReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var energyReleased = 0f; | ||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
var temperature = mixture.Temperature; | ||
var location = holder as TileAtmosphere; | ||
mixture.ReactionResults[GasReaction.Fire] = 0; | ||
|
||
var initialOxygen = mixture.GetMoles(Gas.Oxygen); | ||
var initialHydrogen = mixture.GetMoles(Gas.Hydrogen); | ||
|
||
var burnedFuel = Math.Min(initialHydrogen / Atmospherics.FireH2BurnRateDelta, Math.Min(initialOxygen / (Atmospherics.FireH2BurnRateDelta * Atmospherics.H2OxygenFullBurn), Math.Min(initialHydrogen, initialOxygen * 0.5f))); | ||
|
||
if (burnedFuel > 0) | ||
{ | ||
energyReleased += Atmospherics.FireH2EnergyReleased * burnedFuel; | ||
|
||
mixture.AdjustMoles(Gas.WaterVapor, burnedFuel); | ||
mixture.AdjustMoles(Gas.Hydrogen, -burnedFuel); | ||
mixture.AdjustMoles(Gas.Oxygen, -burnedFuel * 0.5f); | ||
|
||
mixture.ReactionResults[GasReaction.Fire] += burnedFuel; | ||
} | ||
|
||
if (energyReleased > 0) | ||
{ | ||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = (temperature * oldHeatCapacity + energyReleased) / newHeatCapacity; | ||
} | ||
|
||
if (location != null) | ||
{ | ||
temperature = mixture.Temperature; | ||
if (temperature > Atmospherics.FireMinimumTemperatureToExist) | ||
{ | ||
atmosphereSystem.HotspotExpose(location.GridIndex, location.GridIndices, temperature, mixture.Volume); | ||
} | ||
} | ||
|
||
return mixture.ReactionResults[GasReaction.Fire] != 0 ? ReactionResult.Reacting : ReactionResult.NoReaction; | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Content.Server/ADT/Atmos/Reactions/HyperNobliumProductionReaction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions; | ||
|
||
[UsedImplicitly] | ||
public sealed partial class HyperNobliumProductionReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialNitrogen = mixture.GetMoles(Gas.Nitrogen); | ||
var initialTritium = mixture.GetMoles(Gas.Tritium); | ||
var initialBZ = mixture.GetMoles(Gas.BZ); | ||
|
||
var nobFormed = Math.Min((initialNitrogen + initialTritium) * 0.01f, Math.Min(initialTritium * 5f, initialNitrogen * 10f)); | ||
if (nobFormed <= 0 || (initialTritium - 5f) * nobFormed < 0 || (initialNitrogen - 10f) * nobFormed < 0) | ||
return ReactionResult.NoReaction; | ||
|
||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
|
||
var reductionFactor = Math.Clamp(initialTritium / (initialTritium + initialBZ), 0.001f, 1f); | ||
|
||
mixture.AdjustMoles(Gas.Tritium, -5f * nobFormed * reductionFactor); | ||
mixture.AdjustMoles(Gas.Nitrogen, -10f * nobFormed); | ||
mixture.AdjustMoles(Gas.HyperNoblium, nobFormed); | ||
|
||
var energyReleased = nobFormed * (Atmospherics.NobliumFormationEnergy / Math.Max(initialBZ, 1)); | ||
|
||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
Content.Server/ADT/Atmos/Reactions/NitriumDecompositionReaction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions; | ||
|
||
[UsedImplicitly] | ||
public sealed partial class NitriumDecompositionReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialNitrium = mixture.GetMoles(Gas.Nitrium); | ||
|
||
var temperature = mixture.Temperature; | ||
var heatEfficiency = Math.Min(temperature / Atmospherics.NitriumDecompositionTempDivisor, initialNitrium); | ||
|
||
if (heatEfficiency <= 0 || initialNitrium - heatEfficiency < 0) | ||
return ReactionResult.NoReaction; | ||
|
||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
|
||
mixture.AdjustMoles(Gas.Nitrium, -heatEfficiency); | ||
mixture.AdjustMoles(Gas.Hydrogen, heatEfficiency); | ||
mixture.AdjustMoles(Gas.Nitrogen, heatEfficiency); | ||
|
||
var energyReleased = heatEfficiency * Atmospherics.NitriumDecompositionEnergy; | ||
|
||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity + energyReleased) / newHeatCapacity, Atmospherics.TCMB); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Content.Server/ADT/Atmos/Reactions/NitriumProductionReaction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Content.Server.Atmos.EntitySystems; | ||
using Content.Shared.Atmos; | ||
using Content.Shared.Atmos.Reactions; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Server.Atmos.Reactions; | ||
|
||
[UsedImplicitly] | ||
public sealed partial class NitriumProductionReaction : IGasReactionEffect | ||
{ | ||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale) | ||
{ | ||
var initialHyperNoblium = mixture.GetMoles(Gas.HyperNoblium); | ||
if (initialHyperNoblium >= 5.0f && mixture.Temperature > 20f) | ||
return ReactionResult.NoReaction; | ||
|
||
var initialTritium = mixture.GetMoles(Gas.Tritium); | ||
var initialNitrogen = mixture.GetMoles(Gas.Nitrogen); | ||
var initialBZ = mixture.GetMoles(Gas.BZ); | ||
|
||
var temperature = mixture.Temperature; | ||
var heatEfficiency = Math.Min(temperature / Atmospherics.NitriumFormationTempDivisor, Math.Min(initialTritium, Math.Min(initialNitrogen, initialBZ * 0.05f))); | ||
|
||
if (heatEfficiency <= 0 || initialTritium - heatEfficiency < 0 || initialNitrogen - heatEfficiency < 0 || initialBZ - heatEfficiency * 0.05f < 0) | ||
return ReactionResult.NoReaction; | ||
|
||
var oldHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
mixture.AdjustMoles(Gas.Tritium, -heatEfficiency); | ||
mixture.AdjustMoles(Gas.Nitrogen, -heatEfficiency); | ||
mixture.AdjustMoles(Gas.BZ, -heatEfficiency * 0.05f); | ||
mixture.AdjustMoles(Gas.Nitrium, heatEfficiency); | ||
|
||
var energyUsed = heatEfficiency * Atmospherics.NitriumFormationEnergy; | ||
|
||
var newHeatCapacity = atmosphereSystem.GetHeatCapacity(mixture, true); | ||
if (newHeatCapacity > Atmospherics.MinimumHeatCapacity) | ||
mixture.Temperature = Math.Max((mixture.Temperature * oldHeatCapacity - energyUsed) / newHeatCapacity, Atmospherics.TCMB); | ||
|
||
return ReactionResult.Reacting; | ||
} | ||
} |
Oops, something went wrong.