Miasma update (#8943)

This commit is contained in:
Rane
2022-06-19 01:51:55 -04:00
committed by GitHub
parent 003bf74a42
commit a527658f6d
12 changed files with 143 additions and 42 deletions

View File

@@ -4,7 +4,10 @@ using Content.Shared.Atmos;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Temperature.Components; using Content.Server.Temperature.Components;
using Content.Server.Body.Components; using Content.Server.Body.Components;
using Content.Server.Popups;
using Content.Shared.Examine;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Player;
namespace Content.Server.Atmos.Miasma namespace Content.Server.Atmos.Miasma
{ {
@@ -13,6 +16,8 @@ namespace Content.Server.Atmos.Miasma
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!; [Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
public override void Update(float frameTime) public override void Update(float frameTime)
{ {
base.Update(frameTime); base.Update(frameTime);
@@ -35,8 +40,8 @@ namespace Content.Server.Atmos.Miasma
perishable.RotAccumulator -= 1f; perishable.RotAccumulator -= 1f;
DamageSpecifier damage = new(); DamageSpecifier damage = new();
damage.DamageDict.Add("Blunt", 0.25); // Slowly accumulate enough to gib after like half an hour damage.DamageDict.Add("Blunt", 0.3); // Slowly accumulate enough to gib after like half an hour
damage.DamageDict.Add("Cellular", 0.25); // Cloning rework might use this eventually damage.DamageDict.Add("Cellular", 0.3); // Cloning rework might use this eventually
_damageableSystem.TryChangeDamage(perishable.Owner, damage, true, true); _damageableSystem.TryChangeDamage(perishable.Owner, damage, true, true);
@@ -56,6 +61,7 @@ namespace Content.Server.Atmos.Miasma
base.Initialize(); base.Initialize();
SubscribeLocalEvent<PerishableComponent, MobStateChangedEvent>(OnMobStateChanged); SubscribeLocalEvent<PerishableComponent, MobStateChangedEvent>(OnMobStateChanged);
SubscribeLocalEvent<PerishableComponent, BeingGibbedEvent>(OnGibbed); SubscribeLocalEvent<PerishableComponent, BeingGibbedEvent>(OnGibbed);
SubscribeLocalEvent<PerishableComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<AntiRottingContainerComponent, EntInsertedIntoContainerMessage>(OnEntInserted); SubscribeLocalEvent<AntiRottingContainerComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
SubscribeLocalEvent<AntiRottingContainerComponent, EntRemovedFromContainerMessage>(OnEntRemoved); SubscribeLocalEvent<AntiRottingContainerComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
} }
@@ -71,10 +77,24 @@ namespace Content.Server.Atmos.Miasma
if (!TryComp<PhysicsComponent>(uid, out var physics)) if (!TryComp<PhysicsComponent>(uid, out var physics))
return; return;
if (component.DeathAccumulator <= component.RotAfter.TotalSeconds)
return;
var molsToDump = (component.MolsPerSecondPerUnitMass * physics.FixturesMass) * component.DeathAccumulator; var molsToDump = (component.MolsPerSecondPerUnitMass * physics.FixturesMass) * component.DeathAccumulator;
var tileMix = _atmosphereSystem.GetTileMixture(Transform(uid).Coordinates); var tileMix = _atmosphereSystem.GetTileMixture(Transform(uid).Coordinates);
if (tileMix != null) if (tileMix != null)
tileMix.AdjustMoles(Gas.Miasma, molsToDump); tileMix.AdjustMoles(Gas.Miasma, molsToDump);
foreach (var part in args.GibbedParts)
{
EntityManager.QueueDeleteEntity(part);
}
}
private void OnExamined(EntityUid uid, PerishableComponent component, ExaminedEvent args)
{
if (component.DeathAccumulator >= component.RotAfter.TotalSeconds)
args.PushMarkup(Loc.GetString("miasma-rotting"));
} }
private void OnEntInserted(EntityUid uid, AntiRottingContainerComponent component, EntInsertedIntoContainerMessage args) private void OnEntInserted(EntityUid uid, AntiRottingContainerComponent component, EntInsertedIntoContainerMessage args)

View File

@@ -23,7 +23,7 @@ namespace Content.Server.Atmos.Miasma
/// <summary> /// <summary>
/// When DeathAccumulator is greater than this, start rotting. /// When DeathAccumulator is greater than this, start rotting.
/// </summary> /// </summary>
public TimeSpan RotAfter = TimeSpan.FromMinutes(3); public TimeSpan RotAfter = TimeSpan.FromMinutes(5);
/// <summary> /// <summary>
/// Gasses are released every second. /// Gasses are released every second.
@@ -32,11 +32,10 @@ namespace Content.Server.Atmos.Miasma
public float RotAccumulator = 0f; public float RotAccumulator = 0f;
/// <summary> /// <summary>
/// How many moles of gas released per second, adjusted for mass. /// How many moles of gas released per second, per unit of mass.
/// Humans have a mass of 70. I am aiming for ten mols a minute, so
/// 1/6 of a minute, divided by 70 as a baseline.
/// </summary> /// </summary>
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]
public float MolsPerSecondPerUnitMass = 0.0025f; [DataField("molsPerSecondPerUnitMass")]
public float MolsPerSecondPerUnitMass = 0.0035f;
} }
} }

View File

@@ -0,0 +1,2 @@
miasma-smell = Something smells foul!
miasma-rotting = [color=orange]It's rotting![/color]

View File

@@ -67,4 +67,4 @@
gasOverlaySprite: /Textures/Effects/atmospherics.rsi gasOverlaySprite: /Textures/Effects/atmospherics.rsi
gasOverlayState: miasma gasOverlayState: miasma
color: 56941E color: 56941E
reagent: Miasma reagent: Miasma

View File

@@ -24,7 +24,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.25 radius: 0.25
mass: 5 mass: 2
mask: mask:
- FlyingMobMask - FlyingMobMask
layer: layer:
@@ -88,7 +88,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.1 radius: 0.1
mass: 5 mass: 1
mask: mask:
- FlyingMobMask - FlyingMobMask
layer: layer:
@@ -158,6 +158,16 @@
- map: ["enum.DamageStateVisualLayers.Base"] - map: ["enum.DamageStateVisualLayers.Base"]
state: chicken-0 state: chicken-0
sprite: Mobs/Animals/chicken.rsi sprite: Mobs/Animals/chicken.rsi
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
mass: 3
mask:
- MobMask
layer:
- MobLayer
- type: Appearance - type: Appearance
- type: DamageStateVisuals - type: DamageStateVisuals
states: states:
@@ -192,6 +202,16 @@
- map: ["enum.DamageStateVisualLayers.Base"] - map: ["enum.DamageStateVisualLayers.Base"]
state: duck-0 state: duck-0
sprite: Mobs/Animals/duck.rsi sprite: Mobs/Animals/duck.rsi
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
mass: 2 #They actually are pretty light, I looked it up
mask:
- MobMask
layer:
- MobLayer
- type: Appearance - type: Appearance
- type: DamageStateVisuals - type: DamageStateVisuals
states: states:
@@ -279,7 +299,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.2 radius: 0.2
mass: 5 mass: 1
mask: mask:
- FlyingMobMask - FlyingMobMask
layer: layer:
@@ -330,7 +350,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.40 radius: 0.40
mass: 45 mass: 700
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -390,7 +410,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 5 mass: 2
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -427,6 +447,16 @@
- map: ["enum.DamageStateVisualLayers.Base"] - map: ["enum.DamageStateVisualLayers.Base"]
state: goat state: goat
sprite: Mobs/Animals/goat.rsi sprite: Mobs/Animals/goat.rsi
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
mass: 60
mask:
- MobMask
layer:
- MobLayer
- type: Appearance - type: Appearance
- type: DamageStateVisuals - type: DamageStateVisuals
states: states:
@@ -476,6 +506,16 @@
state: goose state: goose
sprite: Mobs/Animals/goose.rsi sprite: Mobs/Animals/goose.rsi
- type: Appearance - type: Appearance
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
mass: 10
mask:
- MobMask
layer:
- MobLayer
- type: DamageStateVisuals - type: DamageStateVisuals
states: states:
Alive: Alive:
@@ -516,7 +556,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.48 radius: 0.48
mass: 60 mass: 150
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -553,17 +593,17 @@
- map: ["enum.DamageStateVisualLayers.Base"] - map: ["enum.DamageStateVisualLayers.Base"]
state: kangaroo state: kangaroo
sprite: Mobs/Animals/kangaroo.rsi sprite: Mobs/Animals/kangaroo.rsi
- type: Physics
- type: Fixtures - type: Fixtures
fixtures: fixtures:
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.25 radius: 0.35
mass: 60 mass: 50
mask: mask:
- MobMask - MobMask
layer: layer:
- MobLayer - MobLayer
- type: Physics
- type: Appearance - type: Appearance
- type: DamageStateVisuals - type: DamageStateVisuals
states: states:
@@ -627,6 +667,16 @@
flavorKind: primate flavorKind: primate
- type: Inventory - type: Inventory
templateId: monkey templateId: monkey
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
mass: 30
mask:
- MobMask
layer:
- MobLayer
- type: Strippable - type: Strippable
- type: UserInterface - type: UserInterface
interfaces: interfaces:
@@ -898,7 +948,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.2 radius: 0.2
mass: 5 mass: 1
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -944,7 +994,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.2 radius: 0.2
mass: 2 mass: 1
mask: mask:
- SmallMobMask - SmallMobMask
layer: layer:
@@ -993,7 +1043,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.25 radius: 0.25
mass: 5 mass: 2
mask: mask:
- FlyingMobMask - FlyingMobMask
layer: layer:
@@ -1091,7 +1141,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.25 radius: 0.25
mass: 10 mass: 5
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -1149,7 +1199,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.25 radius: 0.25
mass: 8 mass: 2
mask: mask:
- SmallMobMask - SmallMobMask
layer: layer:
@@ -1199,7 +1249,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 25 mass: 50
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -1384,7 +1434,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 20 mass: 20 #They actually are pretty light, I looked it up
mask: mask:
- MobMask - MobMask
layer: layer:

View File

@@ -22,7 +22,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.5 radius: 0.5
mass: 100 mass: 320
mask: mask:
- MobMask - MobMask
layer: layer:

View File

@@ -28,7 +28,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.40 radius: 0.40
mass: 20 mass: 40
mask: mask:
- MobMask - MobMask
layer: layer:

View File

@@ -28,7 +28,7 @@
- shape: - shape:
!type:PhysShapeAabb !type:PhysShapeAabb
bounds: "-0.35,-0.35,0.35,0.35" bounds: "-0.35,-0.35,0.35,0.35"
mass: 100 mass: 500
mask: mask:
- MobMask - MobMask
layer: layer:

View File

@@ -19,7 +19,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 20 mass: 12
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -243,7 +243,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 20 mass: 5
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -380,6 +380,16 @@
parent: MobCatCaracal parent: MobCatCaracal
description: He out here. description: He out here.
components: components:
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
mass: 15
mask:
- MobMask
layer:
- MobLayer
- type: Grammar - type: Grammar
attributes: attributes:
gender: male gender: male
@@ -405,7 +415,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 20 mass: 6
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -451,7 +461,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 20 mass: 2
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -508,7 +518,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 20 mass: 5
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -554,7 +564,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.35 radius: 0.35
mass: 20 mass: 8
mask: mask:
- MobMask - MobMask
layer: layer:

View File

@@ -153,7 +153,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.2 radius: 0.2
mass: 10 mass: 4 #Bulky by mouse standards...
mask: mask:
- SmallMobMask - SmallMobMask
layer: layer:

View File

@@ -32,7 +32,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.25 radius: 0.25
mass: 120 mass: 200
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -93,8 +93,10 @@
tags: tags:
- CannotSuicide - CannotSuicide
- DoorBumpOpener - DoorBumpOpener
- FootstepSound - FootstepSound
- type: NoSlip - type: NoSlip
- type: Perishable #Ummmm the acid kills a lot of the bacteria or something
molsPerSecondPerUnitMass: 0.0005
- type: entity - type: entity
name: Praetorian name: Praetorian
@@ -120,7 +122,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.45 radius: 0.45
mass: 120 mass: 250
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -153,7 +155,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.45 radius: 0.45
mass: 120 mass: 200
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -191,7 +193,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.45 radius: 0.45
mass: 120 mass: 10000
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -229,7 +231,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.45 radius: 0.45
mass: 120 mass: 600
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -267,7 +269,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.45 radius: 0.45
mass: 120 mass: 150
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -307,7 +309,7 @@
- shape: - shape:
!type:PhysShapeCircle !type:PhysShapeCircle
radius: 0.45 radius: 0.45
mass: 120 mass: 150
mask: mask:
- MobMask - MobMask
layer: layer:
@@ -365,6 +367,16 @@
solution: melee solution: melee
- type: SolutionTransfer - type: SolutionTransfer
maxTransferAmount: 3 maxTransferAmount: 3
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeCircle
radius: 0.35
mass: 10
mask:
- MobMask
layer:
- MobLayer
- type: entity - type: entity
name: space adder name: space adder

View File

@@ -198,6 +198,14 @@
- !type:ReagentThreshold - !type:ReagentThreshold
reagent: Miasma reagent: Miasma
min: 0.8 min: 0.8
- !type:PopupMessage
type: Local
messages: [ "miasma-smell" ]
probability: 0.1
conditions:
- !type:ReagentThreshold
reagent: Miasma
min: 0.25
- !type:HealthChange - !type:HealthChange
conditions: conditions:
- !type:OrganType - !type:OrganType