Miasma update (#8943)
This commit is contained in:
@@ -4,7 +4,10 @@ using Content.Shared.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Examine;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Atmos.Miasma
|
||||
{
|
||||
@@ -13,6 +16,8 @@ namespace Content.Server.Atmos.Miasma
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
@@ -35,8 +40,8 @@ namespace Content.Server.Atmos.Miasma
|
||||
perishable.RotAccumulator -= 1f;
|
||||
|
||||
DamageSpecifier damage = new();
|
||||
damage.DamageDict.Add("Blunt", 0.25); // 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("Blunt", 0.3); // Slowly accumulate enough to gib after like half an hour
|
||||
damage.DamageDict.Add("Cellular", 0.3); // Cloning rework might use this eventually
|
||||
|
||||
_damageableSystem.TryChangeDamage(perishable.Owner, damage, true, true);
|
||||
|
||||
@@ -56,6 +61,7 @@ namespace Content.Server.Atmos.Miasma
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<PerishableComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||
SubscribeLocalEvent<PerishableComponent, BeingGibbedEvent>(OnGibbed);
|
||||
SubscribeLocalEvent<PerishableComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<AntiRottingContainerComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
|
||||
SubscribeLocalEvent<AntiRottingContainerComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
|
||||
}
|
||||
@@ -71,10 +77,24 @@ namespace Content.Server.Atmos.Miasma
|
||||
if (!TryComp<PhysicsComponent>(uid, out var physics))
|
||||
return;
|
||||
|
||||
if (component.DeathAccumulator <= component.RotAfter.TotalSeconds)
|
||||
return;
|
||||
|
||||
var molsToDump = (component.MolsPerSecondPerUnitMass * physics.FixturesMass) * component.DeathAccumulator;
|
||||
var tileMix = _atmosphereSystem.GetTileMixture(Transform(uid).Coordinates);
|
||||
if (tileMix != null)
|
||||
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)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Server.Atmos.Miasma
|
||||
/// <summary>
|
||||
/// When DeathAccumulator is greater than this, start rotting.
|
||||
/// </summary>
|
||||
public TimeSpan RotAfter = TimeSpan.FromMinutes(3);
|
||||
public TimeSpan RotAfter = TimeSpan.FromMinutes(5);
|
||||
|
||||
/// <summary>
|
||||
/// Gasses are released every second.
|
||||
@@ -32,11 +32,10 @@ namespace Content.Server.Atmos.Miasma
|
||||
public float RotAccumulator = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// How many moles of gas released per second, adjusted for 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.
|
||||
/// How many moles of gas released per second, per unit of mass.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float MolsPerSecondPerUnitMass = 0.0025f;
|
||||
[DataField("molsPerSecondPerUnitMass")]
|
||||
public float MolsPerSecondPerUnitMass = 0.0035f;
|
||||
}
|
||||
}
|
||||
|
||||
2
Resources/Locale/en-US/disease/miasma.ftl
Normal file
2
Resources/Locale/en-US/disease/miasma.ftl
Normal file
@@ -0,0 +1,2 @@
|
||||
miasma-smell = Something smells foul!
|
||||
miasma-rotting = [color=orange]It's rotting![/color]
|
||||
@@ -67,4 +67,4 @@
|
||||
gasOverlaySprite: /Textures/Effects/atmospherics.rsi
|
||||
gasOverlayState: miasma
|
||||
color: 56941E
|
||||
reagent: Miasma
|
||||
reagent: Miasma
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.25
|
||||
mass: 5
|
||||
mass: 2
|
||||
mask:
|
||||
- FlyingMobMask
|
||||
layer:
|
||||
@@ -88,7 +88,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.1
|
||||
mass: 5
|
||||
mass: 1
|
||||
mask:
|
||||
- FlyingMobMask
|
||||
layer:
|
||||
@@ -158,6 +158,16 @@
|
||||
- map: ["enum.DamageStateVisualLayers.Base"]
|
||||
state: chicken-0
|
||||
sprite: Mobs/Animals/chicken.rsi
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 3
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
- MobLayer
|
||||
- type: Appearance
|
||||
- type: DamageStateVisuals
|
||||
states:
|
||||
@@ -192,6 +202,16 @@
|
||||
- map: ["enum.DamageStateVisualLayers.Base"]
|
||||
state: duck-0
|
||||
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: DamageStateVisuals
|
||||
states:
|
||||
@@ -279,7 +299,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.2
|
||||
mass: 5
|
||||
mass: 1
|
||||
mask:
|
||||
- FlyingMobMask
|
||||
layer:
|
||||
@@ -330,7 +350,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.40
|
||||
mass: 45
|
||||
mass: 700
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -390,7 +410,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 5
|
||||
mass: 2
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -427,6 +447,16 @@
|
||||
- map: ["enum.DamageStateVisualLayers.Base"]
|
||||
state: goat
|
||||
sprite: Mobs/Animals/goat.rsi
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 60
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
- MobLayer
|
||||
- type: Appearance
|
||||
- type: DamageStateVisuals
|
||||
states:
|
||||
@@ -476,6 +506,16 @@
|
||||
state: goose
|
||||
sprite: Mobs/Animals/goose.rsi
|
||||
- type: Appearance
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 10
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
- MobLayer
|
||||
- type: DamageStateVisuals
|
||||
states:
|
||||
Alive:
|
||||
@@ -516,7 +556,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.48
|
||||
mass: 60
|
||||
mass: 150
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -553,17 +593,17 @@
|
||||
- map: ["enum.DamageStateVisualLayers.Base"]
|
||||
state: kangaroo
|
||||
sprite: Mobs/Animals/kangaroo.rsi
|
||||
- type: Physics
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.25
|
||||
mass: 60
|
||||
radius: 0.35
|
||||
mass: 50
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
- MobLayer
|
||||
- type: Physics
|
||||
- type: Appearance
|
||||
- type: DamageStateVisuals
|
||||
states:
|
||||
@@ -627,6 +667,16 @@
|
||||
flavorKind: primate
|
||||
- type: Inventory
|
||||
templateId: monkey
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 30
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
- MobLayer
|
||||
- type: Strippable
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
@@ -898,7 +948,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.2
|
||||
mass: 5
|
||||
mass: 1
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -944,7 +994,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.2
|
||||
mass: 2
|
||||
mass: 1
|
||||
mask:
|
||||
- SmallMobMask
|
||||
layer:
|
||||
@@ -993,7 +1043,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.25
|
||||
mass: 5
|
||||
mass: 2
|
||||
mask:
|
||||
- FlyingMobMask
|
||||
layer:
|
||||
@@ -1091,7 +1141,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.25
|
||||
mass: 10
|
||||
mass: 5
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -1149,7 +1199,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.25
|
||||
mass: 8
|
||||
mass: 2
|
||||
mask:
|
||||
- SmallMobMask
|
||||
layer:
|
||||
@@ -1199,7 +1249,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 25
|
||||
mass: 50
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -1384,7 +1434,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 20
|
||||
mass: 20 #They actually are pretty light, I looked it up
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.5
|
||||
mass: 100
|
||||
mass: 320
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.40
|
||||
mass: 20
|
||||
mass: 40
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.35,-0.35,0.35,0.35"
|
||||
mass: 100
|
||||
mass: 500
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 20
|
||||
mass: 12
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -243,7 +243,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 20
|
||||
mass: 5
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -380,6 +380,16 @@
|
||||
parent: MobCatCaracal
|
||||
description: He out here.
|
||||
components:
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 15
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
- MobLayer
|
||||
- type: Grammar
|
||||
attributes:
|
||||
gender: male
|
||||
@@ -405,7 +415,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 20
|
||||
mass: 6
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -451,7 +461,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 20
|
||||
mass: 2
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -508,7 +518,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 20
|
||||
mass: 5
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -554,7 +564,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 20
|
||||
mass: 8
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.2
|
||||
mass: 10
|
||||
mass: 4 #Bulky by mouse standards...
|
||||
mask:
|
||||
- SmallMobMask
|
||||
layer:
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.25
|
||||
mass: 120
|
||||
mass: 200
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -93,8 +93,10 @@
|
||||
tags:
|
||||
- CannotSuicide
|
||||
- DoorBumpOpener
|
||||
- FootstepSound
|
||||
- FootstepSound
|
||||
- type: NoSlip
|
||||
- type: Perishable #Ummmm the acid kills a lot of the bacteria or something
|
||||
molsPerSecondPerUnitMass: 0.0005
|
||||
|
||||
- type: entity
|
||||
name: Praetorian
|
||||
@@ -120,7 +122,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.45
|
||||
mass: 120
|
||||
mass: 250
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -153,7 +155,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.45
|
||||
mass: 120
|
||||
mass: 200
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -191,7 +193,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.45
|
||||
mass: 120
|
||||
mass: 10000
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -229,7 +231,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.45
|
||||
mass: 120
|
||||
mass: 600
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -267,7 +269,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.45
|
||||
mass: 120
|
||||
mass: 150
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -307,7 +309,7 @@
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.45
|
||||
mass: 120
|
||||
mass: 150
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
@@ -365,6 +367,16 @@
|
||||
solution: melee
|
||||
- type: SolutionTransfer
|
||||
maxTransferAmount: 3
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeCircle
|
||||
radius: 0.35
|
||||
mass: 10
|
||||
mask:
|
||||
- MobMask
|
||||
layer:
|
||||
- MobLayer
|
||||
|
||||
- type: entity
|
||||
name: space adder
|
||||
|
||||
@@ -198,6 +198,14 @@
|
||||
- !type:ReagentThreshold
|
||||
reagent: Miasma
|
||||
min: 0.8
|
||||
- !type:PopupMessage
|
||||
type: Local
|
||||
messages: [ "miasma-smell" ]
|
||||
probability: 0.1
|
||||
conditions:
|
||||
- !type:ReagentThreshold
|
||||
reagent: Miasma
|
||||
min: 0.25
|
||||
- !type:HealthChange
|
||||
conditions:
|
||||
- !type:OrganType
|
||||
|
||||
Reference in New Issue
Block a user