rotting meat (#18515)
Co-authored-by: deltanedas <@deltanedas:kde.org> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@ using Content.Server.Temperature.Components;
|
|||||||
using Content.Shared.Atmos.Miasma;
|
using Content.Shared.Atmos.Miasma;
|
||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Rejuvenate;
|
using Content.Shared.Rejuvenate;
|
||||||
using Robust.Server.Containers;
|
using Robust.Server.Containers;
|
||||||
@@ -81,8 +82,8 @@ public sealed class RottingSystem : EntitySystem
|
|||||||
if (!Resolve(uid, ref perishable, false))
|
if (!Resolve(uid, ref perishable, false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// only dead things perish
|
// only dead things or inanimate objects can rot
|
||||||
if (!_mobState.IsDead(uid))
|
if (TryComp<MobStateComponent>(uid, out var mobState) && !_mobState.IsDead(uid, mobState))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (_container.TryGetOuterContainer(uid, Transform(uid), out var container) &&
|
if (_container.TryGetOuterContainer(uid, Transform(uid), out var container) &&
|
||||||
@@ -119,10 +120,7 @@ public sealed class RottingSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnExamined(EntityUid uid, RottingComponent component, ExaminedEvent args)
|
private void OnExamined(EntityUid uid, RottingComponent component, ExaminedEvent args)
|
||||||
{
|
{
|
||||||
if (!TryComp<PerishableComponent>(uid, out var perishable))
|
var stage = RotStage(uid, component);
|
||||||
return;
|
|
||||||
|
|
||||||
var stage = (int) (component.TotalRotTime.TotalSeconds / perishable.RotAfter.TotalSeconds);
|
|
||||||
var description = stage switch
|
var description = stage switch
|
||||||
{
|
{
|
||||||
>= 2 => "miasma-extremely-bloated",
|
>= 2 => "miasma-extremely-bloated",
|
||||||
@@ -132,6 +130,17 @@ public sealed class RottingSystem : EntitySystem
|
|||||||
args.PushMarkup(Loc.GetString(description));
|
args.PushMarkup(Loc.GetString(description));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return the rot stage, usually from 0 to 2 inclusive.
|
||||||
|
/// </summary>
|
||||||
|
public int RotStage(EntityUid uid, RottingComponent? comp = null, PerishableComponent? perishable = null)
|
||||||
|
{
|
||||||
|
if (!Resolve(uid, ref comp, ref perishable))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return (int) (comp.TotalRotTime.TotalSeconds / perishable.RotAfter.TotalSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnRejuvenate(EntityUid uid, RottingComponent component, RejuvenateEvent args)
|
private void OnRejuvenate(EntityUid uid, RottingComponent component, RejuvenateEvent args)
|
||||||
{
|
{
|
||||||
RemCompDeferred<RottingComponent>(uid);
|
RemCompDeferred<RottingComponent>(uid);
|
||||||
@@ -183,6 +192,17 @@ public sealed class RottingSystem : EntitySystem
|
|||||||
_damageable.TryChangeDamage(uid, damage, true, false);
|
_damageable.TryChangeDamage(uid, damage, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TryComp<RotIntoComponent>(uid, out var rotInto))
|
||||||
|
{
|
||||||
|
var stage = RotStage(uid, rotting, perishable);
|
||||||
|
if (stage >= rotInto.Stage)
|
||||||
|
{
|
||||||
|
Spawn(rotInto.Entity, xform.Coordinates);
|
||||||
|
QueueDel(uid);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!TryComp<PhysicsComponent>(uid, out var physics))
|
if (!TryComp<PhysicsComponent>(uid, out var physics))
|
||||||
continue;
|
continue;
|
||||||
// We need a way to get the mass of the mob alone without armor etc in the future
|
// We need a way to get the mass of the mob alone without armor etc in the future
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public sealed class PerishableComponent : Component
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How often the rotting ticks.
|
/// How often the rotting ticks.
|
||||||
/// Feel free to weak this if there are perf concerns.
|
/// Feel free to tweak this if there are perf concerns.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("perishUpdateRate"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("perishUpdateRate"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public TimeSpan PerishUpdateRate = TimeSpan.FromSeconds(5);
|
public TimeSpan PerishUpdateRate = TimeSpan.FromSeconds(5);
|
||||||
|
|||||||
26
Content.Shared/Atmos/Miasma/RotIntoComponent.cs
Normal file
26
Content.Shared/Atmos/Miasma/RotIntoComponent.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
|
namespace Content.Shared.Atmos.Miasma;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Lets an entity rot into another entity.
|
||||||
|
/// Used by raw meat to turn into rotten meat.
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent, NetworkedComponent]
|
||||||
|
public sealed class RotIntoComponent : Component
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Entity to rot into.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("entity", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public string Entity = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rotting stage to turn at, this is a multiplier of the total rot time.
|
||||||
|
/// 0 = rotting, 1 = bloated, 2 = extremely bloated
|
||||||
|
/// </summary>
|
||||||
|
[DataField("stage"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public int Stage;
|
||||||
|
}
|
||||||
@@ -33,6 +33,25 @@
|
|||||||
materialComposition:
|
materialComposition:
|
||||||
Meaterial: 300
|
Meaterial: 300
|
||||||
|
|
||||||
|
- type: entity
|
||||||
|
parent: FoodMeatBase
|
||||||
|
id: FoodMeatRawBase
|
||||||
|
abstract: true
|
||||||
|
components:
|
||||||
|
- type: Tag
|
||||||
|
tags:
|
||||||
|
- Raw
|
||||||
|
- type: Perishable
|
||||||
|
# raw meat rots in 5 minutes, get it into the freezer fast
|
||||||
|
rotAfter: 300
|
||||||
|
# don't want meat giving off miasma only bodies
|
||||||
|
molsPerSecondPerUnitMass: 0
|
||||||
|
- type: RotInto
|
||||||
|
entity: FoodMeatRotten
|
||||||
|
# once it would say bloated, turn into the rotten prototype
|
||||||
|
stage: 1
|
||||||
|
|
||||||
|
# bruh
|
||||||
- type: Tag
|
- type: Tag
|
||||||
id: Raw
|
id: Raw
|
||||||
|
|
||||||
@@ -46,13 +65,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw meat
|
name: raw meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeat
|
id: FoodMeat
|
||||||
description: A slab of raw meat.
|
description: A slab of raw meat.
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: plain
|
state: plain
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -73,13 +89,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw human meat
|
name: raw human meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatHuman
|
id: FoodMeatHuman
|
||||||
description: Gross.
|
description: Gross.
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: plain
|
state: plain
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -121,6 +134,7 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw bacon
|
name: raw bacon
|
||||||
|
# bacon is cured so not raw = cant rot
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatBase
|
||||||
id: FoodMeatBacon
|
id: FoodMeatBacon
|
||||||
description: A raw piece of bacon.
|
description: A raw piece of bacon.
|
||||||
@@ -141,13 +155,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw bear meat
|
name: raw bear meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatBear
|
id: FoodMeatBear
|
||||||
description: A very manly slab of raw bear meat.
|
description: A very manly slab of raw bear meat.
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: bear
|
state: bear
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -168,13 +179,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw penguin meat
|
name: raw penguin meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatPenguin
|
id: FoodMeatPenguin
|
||||||
description: A slab of raw penguin meat. Can be used as a substitute for fish in recipes.
|
description: A slab of raw penguin meat. Can be used as a substitute for fish in recipes.
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: bird
|
state: bird
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -195,13 +203,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw chicken meat
|
name: raw chicken meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatChicken
|
id: FoodMeatChicken
|
||||||
description: A slab of raw chicken. Remember to wash your hands!
|
description: A slab of raw chicken. Remember to wash your hands!
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: bird
|
state: bird
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -222,13 +227,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw duck meat
|
name: raw duck meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatDuck
|
id: FoodMeatDuck
|
||||||
description: A slab of raw duck. Remember to wash your hands!
|
description: A slab of raw duck. Remember to wash your hands!
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: bird
|
state: bird
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -249,6 +251,7 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: prime-cut corgi meat
|
name: prime-cut corgi meat
|
||||||
|
# can't rot since that would be very bad for syndies
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatBase
|
||||||
id: FoodMeatCorgi
|
id: FoodMeatCorgi
|
||||||
description: The tainted gift of an evil crime. The meat may be delicious, but at what cost?
|
description: The tainted gift of an evil crime. The meat may be delicious, but at what cost?
|
||||||
@@ -270,16 +273,13 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw crab meat
|
name: raw crab meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatCrab
|
id: FoodMeatCrab
|
||||||
description: A pile of raw crab meat.
|
description: A pile of raw crab meat.
|
||||||
components:
|
components:
|
||||||
- type: FlavorProfile
|
- type: FlavorProfile
|
||||||
flavors:
|
flavors:
|
||||||
- crabby
|
- crabby
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: crab
|
state: crab
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -297,13 +297,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw goliath meat
|
name: raw goliath meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatGoliath
|
id: FoodMeatGoliath
|
||||||
description: A slab of goliath meat. It's not very edible now, but it cooks great in lava.
|
description: A slab of goliath meat. It's not very edible now, but it cooks great in lava.
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: goliath
|
state: goliath
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -347,13 +344,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw rat meat
|
name: raw rat meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatRat
|
id: FoodMeatRat
|
||||||
description: Prime meat from maintenance!
|
description: Prime meat from maintenance!
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: plain
|
state: plain
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -367,13 +361,10 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw lizard meat
|
name: raw lizard meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatLizard
|
id: FoodMeatLizard
|
||||||
description: Delicious dino damage.
|
description: Delicious dino damage.
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: lizard
|
state: lizard
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -417,17 +408,18 @@
|
|||||||
food:
|
food:
|
||||||
reagents:
|
reagents:
|
||||||
- ReagentId: UncookedAnimalProteins
|
- ReagentId: UncookedAnimalProteins
|
||||||
Quantity: 20
|
Quantity: 5
|
||||||
|
- ReagentId: Toxin
|
||||||
|
Quantity: 4
|
||||||
|
- ReagentId: Fat
|
||||||
|
Quantity: 4
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw spider meat
|
name: raw spider meat
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatRawBase
|
||||||
id: FoodMeatSpider
|
id: FoodMeatSpider
|
||||||
description: A slab of spider meat. That's so Kafkaesque.
|
description: A slab of spider meat. That's so Kafkaesque.
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: spider
|
state: spider
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -448,9 +440,6 @@
|
|||||||
id: FoodMeatSpiderLeg
|
id: FoodMeatSpiderLeg
|
||||||
description: A still twitching leg of a giant spider... you don't really want to eat this, do you?
|
description: A still twitching leg of a giant spider... you don't really want to eat this, do you?
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: spiderleg
|
state: spiderleg
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -468,9 +457,6 @@
|
|||||||
id: FoodMeatWheat
|
id: FoodMeatWheat
|
||||||
description: This doesn't look like meat, but your standards aren't that high to begin with.
|
description: This doesn't look like meat, but your standards aren't that high to begin with.
|
||||||
components:
|
components:
|
||||||
- type: Tag
|
|
||||||
tags:
|
|
||||||
- Raw
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: clump
|
state: clump
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
@@ -482,6 +468,7 @@
|
|||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: raw xeno meat
|
name: raw xeno meat
|
||||||
|
# not raw since acid kills bacteria or something, same as xeno
|
||||||
parent: FoodMeatBase
|
parent: FoodMeatBase
|
||||||
id: FoodMeatXeno
|
id: FoodMeatXeno
|
||||||
description: A slab of xeno meat, dripping with acid.
|
description: A slab of xeno meat, dripping with acid.
|
||||||
@@ -581,7 +568,7 @@
|
|||||||
- type: entity
|
- type: entity
|
||||||
parent: BaseItem
|
parent: BaseItem
|
||||||
id: MaterialSmileExtract
|
id: MaterialSmileExtract
|
||||||
name: extract smile
|
name: smile extract
|
||||||
description: It's a real panacea. But at what cost?
|
description: It's a real panacea. But at what cost?
|
||||||
components:
|
components:
|
||||||
- type: Food
|
- type: Food
|
||||||
|
|||||||
Reference in New Issue
Block a user