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",
|
"Drain",
|
||||||
"Food",
|
"Food",
|
||||||
"DeployableBarrier",
|
"DeployableBarrier",
|
||||||
|
"SpaceGarbage",
|
||||||
"MagicMirror",
|
"MagicMirror",
|
||||||
"DiseaseSwab",
|
"DiseaseSwab",
|
||||||
"FloorTile",
|
"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
|
sprite: Objects/Consumable/Drinks/ramen.rsi
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: DrinkRamen
|
parent: DrinkRamen
|
||||||
|
|||||||
@@ -36,10 +36,10 @@
|
|||||||
stateOpen: icon_open
|
stateOpen: icon_open
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: ItemCooldown
|
- type: ItemCooldown
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: DrinkCanBaseFull
|
parent: DrinkCanBaseFull
|
||||||
|
|||||||
@@ -52,9 +52,9 @@
|
|||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
# Containers
|
# Containers
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
netsync: false
|
netsync: false
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: bowl
|
name: bowl
|
||||||
|
|||||||
@@ -44,9 +44,9 @@
|
|||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: broken plate
|
name: broken plate
|
||||||
@@ -60,9 +60,9 @@
|
|||||||
netsync: false
|
netsync: false
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
# Small Plate
|
# Small Plate
|
||||||
|
|
||||||
@@ -142,3 +142,4 @@
|
|||||||
tags:
|
tags:
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|||||||
@@ -110,6 +110,7 @@
|
|||||||
- Egg
|
- Egg
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
# Egg
|
# Egg
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
components:
|
components:
|
||||||
- type: Food
|
- type: Food
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
netsync: false
|
netsync: false
|
||||||
|
|
||||||
|
|||||||
@@ -259,3 +259,4 @@
|
|||||||
tags:
|
tags:
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|||||||
@@ -211,6 +211,7 @@
|
|||||||
- type: Extractable
|
- type: Extractable
|
||||||
grindableSolutionName: food
|
grindableSolutionName: food
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: carrot
|
name: carrot
|
||||||
|
|||||||
@@ -206,9 +206,9 @@
|
|||||||
HeldPrefix: packet
|
HeldPrefix: packet
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
noSpawn: true
|
noSpawn: true
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
openIcon: open
|
openIcon: open
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: CigCartonRed
|
id: CigCartonRed
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Cigarette
|
- Cigarette
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
sprite: Objects/Consumable/Smokeables/Cigarettes/cigarette.rsi
|
sprite: Objects/Consumable/Smokeables/Cigarettes/cigarette.rsi
|
||||||
Slots: [ mask ]
|
Slots: [ mask ]
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Cigarette
|
- Cigarette
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
sprite: Objects/Consumable/Smokeables/Cigarettes/blunt.rsi
|
sprite: Objects/Consumable/Smokeables/Cigarettes/blunt.rsi
|
||||||
Slots: [ mask ]
|
Slots: [ mask ]
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Cigarette
|
- Cigarette
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
sprite: Objects/Consumable/Smokeables/Cigarettes/blunt.rsi
|
sprite: Objects/Consumable/Smokeables/Cigarettes/blunt.rsi
|
||||||
Slots: [ mask ]
|
Slots: [ mask ]
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- CigPack
|
- CigPack
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: Storage
|
- type: Storage
|
||||||
capacity: 6
|
capacity: 6
|
||||||
- type: Item
|
- type: Item
|
||||||
|
|||||||
@@ -57,10 +57,10 @@
|
|||||||
size: 2
|
size: 2
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- RollingPaper
|
- RollingPaper
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
id: CigaretteFilter
|
id: CigaretteFilter
|
||||||
@@ -81,6 +81,5 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- CigFilter
|
- CigFilter
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
- type: BurnStateVisualizer
|
- type: BurnStateVisualizer
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
# Base for all cigars and cigarettes.
|
# Base for all cigars and cigarettes.
|
||||||
- type: entity
|
- type: entity
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
tags:
|
tags:
|
||||||
- Write
|
- Write
|
||||||
- Crayon
|
- Crayon
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
- key: enum.CrayonUiKey.Key
|
- key: enum.CrayonUiKey.Key
|
||||||
|
|||||||
@@ -25,9 +25,9 @@
|
|||||||
Slash: 2
|
Slash: 2
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: Damageable
|
- type: Damageable
|
||||||
damageContainer: Inorganic
|
damageContainer: Inorganic
|
||||||
damageModifierSet: Glass
|
damageModifierSet: Glass
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
Slash: 2
|
Slash: 2
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
sprite: Objects/Misc/utensils.rsi
|
sprite: Objects/Misc/utensils.rsi
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: UtensilBase
|
parent: UtensilBase
|
||||||
|
|||||||
@@ -54,9 +54,9 @@
|
|||||||
- type: LightBulbVisualizer
|
- type: LightBulbVisualizer
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
# Lighting color values gathered from
|
# Lighting color values gathered from
|
||||||
# https://andi-siess.de/rgb-to-color-temperature/
|
# https://andi-siess.de/rgb-to-color-temperature/
|
||||||
|
|||||||
@@ -51,9 +51,9 @@
|
|||||||
emptySpriteName: medipen_empty
|
emptySpriteName: medipen_empty
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: emergency medipen
|
name: emergency medipen
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Bottle
|
- Bottle
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Specific/Chemistry/bottle.rsi
|
sprite: Objects/Specific/Chemistry/bottle.rsi
|
||||||
netsync: false
|
netsync: false
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Flare
|
- Flare
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: ExpendableLight
|
- type: ExpendableLight
|
||||||
spentName: spent flare
|
spentName: spent flare
|
||||||
spentDesc: It looks like this flare has burnt out. What a bummer.
|
spentDesc: It looks like this flare has burnt out. What a bummer.
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
components:
|
components:
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: ExpendableLight
|
- type: ExpendableLight
|
||||||
spentName: spent green glowstick
|
spentName: spent green glowstick
|
||||||
spentDesc: It looks like this glowstick has stopped glowing. How tragic.
|
spentDesc: It looks like this glowstick has stopped glowing. How tragic.
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Matchstick
|
- Matchstick
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
netsync: false
|
netsync: false
|
||||||
sprite: Objects/Tools/matches.rsi
|
sprite: Objects/Tools/matches.rsi
|
||||||
@@ -81,6 +81,6 @@
|
|||||||
- matchbox3
|
- matchbox3
|
||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Recyclable
|
|
||||||
- Trash
|
- Trash
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- Cartridge
|
- Cartridge
|
||||||
- Recyclable
|
|
||||||
- type: Item
|
- type: Item
|
||||||
size: 1
|
size: 1
|
||||||
- type: Recyclable
|
- type: Recyclable
|
||||||
|
- type: SpaceGarbage
|
||||||
|
|||||||
Reference in New Issue
Block a user