Skip to content

Commit

Permalink
Готово
Browse files Browse the repository at this point in the history
  • Loading branch information
Odleer committed Dec 7, 2024
1 parent d7d5f74 commit 97ce982
Show file tree
Hide file tree
Showing 30 changed files with 520 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public sealed partial class AtmosAlarmEntryContainer : BoxContainer
[Gas.Plasma] = "P",
[Gas.Tritium] = "T",
[Gas.WaterVapor] = "H₂O",
[Gas.BZ] = "BZ", //SunRise edit
[Gas.Healium] = "F11BZ", //SunRise edit
};

public AtmosAlarmEntryContainer(NetEntity uid, EntityCoordinates? coordinates)
Expand Down
4 changes: 3 additions & 1 deletion Content.Server/Atmos/Portable/PortableScrubberComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public sealed partial class PortableScrubberComponent : Component
Gas.WaterVapor,
Gas.Ammonia,
Gas.NitrousOxide,
Gas.Frezon
Gas.Frezon,
Gas.BZ, //SunRise edit
Gas.Healium, //SunRise edit
};

[ViewVariables(VVAccess.ReadWrite)]
Expand Down
44 changes: 44 additions & 0 deletions Content.Server/Atmos/Reactions/BZFormationReaction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Reactions;
using JetBrains.Annotations;

namespace Content.Server.Atmos.Reactions;

/// <summary>
/// Forms BZ from mixing Plasma and Nitrous Oxide at low pressure. Also decomposes Nitrous Oxide when there are more than 3 parts Plasma per N2O.
/// </summary>
[UsedImplicitly]
public sealed partial class BZFormationReaction : IGasReactionEffect
{
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
{
var initN2O = mixture.GetMoles(Gas.NitrousOxide);
var initPlasma = mixture.GetMoles(Gas.Plasma);
var pressure = mixture.Pressure;
var volume = mixture.Volume;

var environmentEfficiency = volume / pressure; // more volume and less pressure gives better rates
var ratioEfficiency = Math.Min(initN2O / initPlasma, 1); // less n2o than plasma gives lower rates

var totalRate = environmentEfficiency * ratioEfficiency / Atmospherics.BZFormationRate;

var n2oRemoved = totalRate * 2f;
var plasmaRemoved = totalRate * 4f;
var bzFormed = totalRate * 5f;

if (n2oRemoved > initN2O || plasmaRemoved > initPlasma)
return ReactionResult.NoReaction;

mixture.AdjustMoles(Gas.NitrousOxide, -n2oRemoved);
mixture.AdjustMoles(Gas.Plasma, -plasmaRemoved);
mixture.AdjustMoles(Gas.BZ, bzFormed);

var energyReleased = bzFormed * Atmospherics.BZFormationEnergy;
var heatCap = atmosphereSystem.GetHeatCapacity(mixture, true);
if (heatCap > Atmospherics.MinimumHeatCapacity)
mixture.Temperature = Math.Max((mixture.Temperature * heatCap + energyReleased) / heatCap, Atmospherics.TCMB);

return ReactionResult.Reacting;
}
}
40 changes: 40 additions & 0 deletions Content.Server/Atmos/Reactions/HealiumProductionReaction.cs
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;

/// <summary>
/// Produces Healium by mixing BZ and Frezon at temperatures between 23K and 293K. Efficiency increases in colder temperatures.
/// </summary>
[UsedImplicitly]
public sealed partial class HealiumProductionReaction : IGasReactionEffect
{
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, AtmosphereSystem atmosphereSystem, float heatScale)
{
var initBZ = mixture.GetMoles(Gas.BZ);
var initFrezon = mixture.GetMoles(Gas.Frezon);

var rate = mixture.Temperature / Atmospherics.T20C;
var efficiency = 23.15f / mixture.Temperature;

var bZRemoved = 1f * rate;
var frezonRemoved = 11f * rate;
var healiumProduced = 12f * rate * efficiency;

if (bZRemoved > initBZ || frezonRemoved > initFrezon || mixture.Temperature > Atmospherics.T20C)
return ReactionResult.NoReaction;

mixture.AdjustMoles(Gas.BZ, -bZRemoved);
mixture.AdjustMoles(Gas.Frezon, -frezonRemoved);
mixture.AdjustMoles(Gas.Healium, healiumProduced);

var energyReleased = healiumProduced * Atmospherics.HealiumProductionEnergy;
var heatCap = atmosphereSystem.GetHeatCapacity(mixture, true);
if (heatCap > Atmospherics.MinimumHeatCapacity)
mixture.Temperature = Math.Max((mixture.Temperature * heatCap + energyReleased) / heatCap, Atmospherics.TCMB);

return ReactionResult.Reacting;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public sealed partial class GasLeakRuleComponent : Component
Gas.Tritium,
Gas.Frezon,
Gas.WaterVapor, // the fog
Gas.BZ, //SunRise edit
Gas.Healium //SunRise edit
};

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public sealed partial class GasArtifactComponent : Component
Gas.Tritium,
Gas.Ammonia,
Gas.NitrousOxide,
Gas.Frezon
Gas.Frezon,
Gas.BZ, //SunRise edit
Gas.Healium //SunRise edit
};

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public sealed partial class ArtifactGasTriggerComponent : Component
Gas.Nitrogen,
Gas.CarbonDioxide,
Gas.Ammonia,
Gas.NitrousOxide
Gas.NitrousOxide,
Gas.BZ, //SunRise edit
Gas.Healium, //SunRise edit
};

/// <summary>
Expand Down
25 changes: 23 additions & 2 deletions Content.Shared/Atmos/Atmospherics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public static class Atmospherics
/// <summary>
/// Total number of gases. Increase this if you want to add more!
/// </summary>
public const int TotalNumberOfGases = 9;
public const int TotalNumberOfGases = 11; //SunRise edit

/// <summary>
/// This is the actual length of the gases arrays in mixtures.
Expand Down Expand Up @@ -250,6 +250,25 @@ public static class Atmospherics
/// </summary>
public const float AmmoniaOxygenReactionRate = 10f;

///SunRise start

/// <summary>
/// The amount of energy 1 mole of BZ forming from N2O and plasma releases.
/// </summary>
public const float BZFormationEnergy = 80e3f;

/// <summary>
/// Some number taken from the air to keep BZ from instantly converting everything.
/// </summary>
public const float BZFormationRate = 5f;

/// <summary>
/// The amount of energy 1 mol of Healium forming from BZ and frezon releases.
/// </summary>
public const float HealiumProductionEnergy = 10e3f;

///SunRise end

/// <summary>
/// Determines at what pressure the ultra-high pressure red icon is displayed.
/// </summary>
Expand Down Expand Up @@ -336,6 +355,8 @@ public enum Gas : sbyte
WaterVapor = 5,
Ammonia = 6,
NitrousOxide = 7,
Frezon = 8
Frezon = 8,
BZ = 9, //SunRise edit
Healium = 10, //SunRise edit
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
reagent-name-bz = БЗ
reagent-desc-bz = Мощный галлюциноген, который также усыпляет слаймолюдов.
reagent-name-healium = хилиум
reagent-desc-healium = Мощное снотворное средство с регенерирующими свойствами.
gases-healium = Хилиум
gases-bz = БЗ
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
Ammonia: stationAmmonia
NitrousOxide: stationNO
Frezon: danger
BZ: danger #SunRise edit
Healium: stationNO #SunRise edit
- type: Tag
tags:
- AirSensor
Expand Down
19 changes: 19 additions & 0 deletions Resources/Prototypes/_Sunrise/Atmospherics/gases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- type: gas
id: 9
name: gases-bz
specificHeat: 20
heatCapacityRatio: 1.4
molarMass: 10
color: 9370db
reagent: BZ
pricePerMole: 0.15

- type: gas
id: 10
name: gases-healium
specificHeat: 20
heatCapacityRatio: 1.4
molarMass: 10
color: 8b0000
reagent: Healium
pricePerMole: 0.8
33 changes: 33 additions & 0 deletions Resources/Prototypes/_Sunrise/Atmospherics/reactions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- type: gasReaction
id: bzFormation
priority: 2
maximumTemperature: 313.149 # Atmospherics.FireMinimumTemperatureToExist - 60
minimumRequirements:
- 0 # oxygen
- 0 # nitrogen
- 0 # carbon dioxide
- 10 # plasma
- 0 # tritium
- 0 # vapor
- 0 # miasma
- 10 # n2o
- 0 # frezon
effects:
- !type:BZFormationReaction {}

- type: gasReaction
id: HealiumProduction
priority: 2
minimumRequirements:
- 0 # oxygen
- 0 # nitrogen
- 0 # carbon dioxide
- 0 # plasma
- 0 # tritium
- 0 # vapor
- 0 # miasma
- 0 # n2o
- 5 # frezon
- 5 # bz
effects:
- !type:HealiumProductionReaction {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
- type: entity
parent: GasCanister
id: BZCanister
name: канистра БЗ
description: Канистра, в которой может содержаться газ любого вида. В этой, предположительно, содержится БЗ. Можно прикрепить к порту коннектора с помощью гаечного ключа.
components:
- type: Sprite
sprite: _Sunrise/Structures/Storage/canister.rsi
layers:
- state: bz
- type: GasCanister
gasMixture:
volume: 1000
moles:
- 0 # oxygen
- 0 # nitrogen
- 0 # CO2
- 0 # Plasma
- 0 # Tritium
- 0 # Water vapor
- 0 # Miasma
- 0 # N2O
- 0 # Frezon
- 1871.71051 # BZ
temperature: 293.15
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 600
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- trigger:
!type:DamageTrigger
damage: 300
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:SpawnEntitiesBehavior
spawn:
BZCanisterBroken:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- !type:DumpCanisterBehavior
- type: Lock
locked: true

- type: entity
parent: GasCanister
id: HealiumCanister
name: канистра хилиум
description: Канистра, в которой может содержаться газ любого вида. В этой, предположительно, содержится хилиум. Можно прикрепить к порту коннектора с помощью гаечного ключа.
components:
- type: Sprite
sprite: _Sunrise/Structures/Storage/canister.rsi
layers:
- state: healium
- type: GasCanister
gasMixture:
volume: 1000
moles:
- 0 # oxygen
- 0 # nitrogen
- 0 # CO2
- 0 # Plasma
- 0 # Tritium
- 0 # Water vapor
- 0 # Miasma
- 0 # N2O
- 0 # Frezon
- 0 # BZ
- 1871.71051 # Healium
temperature: 293.15
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 600
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- trigger:
!type:DamageTrigger
damage: 300
behaviors:
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
- !type:SpawnEntitiesBehavior
spawn:
HealiumCanisterBroken:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- !type:DumpCanisterBehavior
- type: Lock
locked: true



- type: entity
parent: GasCanisterBrokenBase
id: BZCanisterBroken
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: _Sunrise/Structures/Storage/canister.rsi
state: bz-1

- type: entity
parent: GasCanisterBrokenBase
id: HealiumCanisterBroken
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: _Sunrise/Structures/Storage/canister.rsi
state: healium-1
Loading

0 comments on commit 97ce982

Please sign in to comment.