Add a garbage collection component for grid movement (#7776)
If we move a station and there's thousands of bullets in the way we shouldn't just indefinitely lag the server as a result.
This commit is contained in:
@@ -66,6 +66,7 @@ namespace Content.Client.Entry
|
||||
"Drain",
|
||||
"Food",
|
||||
"DeployableBarrier",
|
||||
"SpaceGarbage",
|
||||
"MagicMirror",
|
||||
"DiseaseSwab",
|
||||
"FloorTile",
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Content.Server.Shuttles.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Cleanup component that deletes the entity if it has a cross-grid collision.
|
||||
/// Useful for small, unimportant items like bullets to avoid generating many contacts.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class SpaceGarbageComponent : Component {}
|
||||
28
Content.Server/Shuttles/EntitySystems/SpaceGarbageSystem.cs
Normal file
28
Content.Server/Shuttles/EntitySystems/SpaceGarbageSystem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Content.Server.Shuttles.Components;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
namespace Content.Server.Shuttles.EntitySystems;
|
||||
|
||||
/// <summary>
|
||||
/// Deletes anything with <see cref="SpaceGarbageComponent"/> that has a cross-grid collision with a static body.
|
||||
/// </summary>
|
||||
public sealed class SpaceGarbageSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<SpaceGarbageComponent, StartCollideEvent>(OnCollide);
|
||||
}
|
||||
|
||||
private void OnCollide(EntityUid uid, SpaceGarbageComponent component, StartCollideEvent args)
|
||||
{
|
||||
var ourXform = Transform(args.OurFixture.Body.Owner);
|
||||
var otherXform = Transform(args.OtherFixture.Body.Owner);
|
||||
|
||||
if (ourXform.GridID == otherXform.GridID ||
|
||||
args.OtherFixture.Body.BodyType != BodyType.Static) return;
|
||||
|
||||
QueueDel(uid);
|
||||
}
|
||||
}
|
||||
@@ -2103,9 +2103,9 @@
|
||||
sprite: Objects/Consumable/Drinks/ramen.rsi
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
parent: DrinkRamen
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
stateOpen: icon_open
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: ItemCooldown
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
parent: DrinkCanBaseFull
|
||||
|
||||
@@ -52,9 +52,9 @@
|
||||
acts: [ "Destruction" ]
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
# Containers
|
||||
- type: entity
|
||||
|
||||
@@ -59,9 +59,9 @@
|
||||
netsync: false
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
name: bowl
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
acts: [ "Destruction" ]
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
name: broken plate
|
||||
@@ -60,9 +60,9 @@
|
||||
netsync: false
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
# Small Plate
|
||||
|
||||
@@ -142,3 +142,4 @@
|
||||
tags:
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
- Egg
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
# Egg
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
components:
|
||||
- type: Food
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
|
||||
|
||||
@@ -259,3 +259,4 @@
|
||||
tags:
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
- type: Extractable
|
||||
grindableSolutionName: food
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
name: carrot
|
||||
|
||||
@@ -206,9 +206,9 @@
|
||||
HeldPrefix: packet
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
noSpawn: true
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
openIcon: open
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
id: CigCartonRed
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- Cigarette
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: Clothing
|
||||
sprite: Objects/Consumable/Smokeables/Cigarettes/cigarette.rsi
|
||||
Slots: [ mask ]
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- Cigarette
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: Clothing
|
||||
sprite: Objects/Consumable/Smokeables/Cigarettes/blunt.rsi
|
||||
Slots: [ mask ]
|
||||
@@ -43,9 +43,9 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- Cigarette
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: Clothing
|
||||
sprite: Objects/Consumable/Smokeables/Cigarettes/blunt.rsi
|
||||
Slots: [ mask ]
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- CigPack
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: Storage
|
||||
capacity: 6
|
||||
- type: Item
|
||||
|
||||
@@ -57,10 +57,10 @@
|
||||
size: 2
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- RollingPaper
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
id: CigaretteFilter
|
||||
@@ -81,6 +81,5 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- CigFilter
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
- type: BurnStateVisualizer
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
# Base for all cigars and cigarettes.
|
||||
- type: entity
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
tags:
|
||||
- Write
|
||||
- Crayon
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.CrayonUiKey.Key
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
Slash: 2
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: Damageable
|
||||
damageContainer: Inorganic
|
||||
damageModifierSet: Glass
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
Slash: 2
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
sprite: Objects/Misc/utensils.rsi
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
parent: UtensilBase
|
||||
|
||||
@@ -54,9 +54,9 @@
|
||||
- type: LightBulbVisualizer
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
# Lighting color values gathered from
|
||||
# https://andi-siess.de/rgb-to-color-temperature/
|
||||
|
||||
@@ -51,9 +51,9 @@
|
||||
emptySpriteName: medipen_empty
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
- type: entity
|
||||
name: emergency medipen
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- Bottle
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: Sprite
|
||||
sprite: Objects/Specific/Chemistry/bottle.rsi
|
||||
netsync: false
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- Flare
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: ExpendableLight
|
||||
spentName: spent flare
|
||||
spentDesc: It looks like this flare has burnt out. What a bummer.
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
components:
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: ExpendableLight
|
||||
spentName: spent green glowstick
|
||||
spentDesc: It looks like this glowstick has stopped glowing. How tragic.
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- Matchstick
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
sprite: Objects/Tools/matches.rsi
|
||||
@@ -81,6 +81,6 @@
|
||||
- matchbox3
|
||||
- type: Tag
|
||||
tags:
|
||||
- Recyclable
|
||||
- Trash
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
- type: Tag
|
||||
tags:
|
||||
- Cartridge
|
||||
- Recyclable
|
||||
- type: Item
|
||||
size: 1
|
||||
- type: Recyclable
|
||||
- type: SpaceGarbage
|
||||
|
||||
Reference in New Issue
Block a user