Let ghosts sometimes make certain devices say creepy things (#34368)

* Add SpookySpeaker component/system

* Shuffle Boo action targets before trying to activate them

* Add SpookySpeaker to vending machines

* Fix chatcode eating messages starting with "..."

* Add SpookySpeaker to recycler

* Oops

* Decrease speak probability for vending machines

* Add spooky speaker to arcade machines
This commit is contained in:
Tayrtahn
2025-01-10 21:48:13 -05:00
committed by GitHub
parent 5deab7d41f
commit c6e4d19883
8 changed files with 135 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Server.Ghost
@@ -63,6 +64,7 @@ namespace Content.Server.Ghost
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IRobustRandom _random = default!;
private EntityQuery<GhostComponent> _ghostQuery;
private EntityQuery<PhysicsComponent> _physicsQuery;
@@ -127,7 +129,9 @@ namespace Content.Server.Ghost
if (args.Handled)
return;
var entities = _lookup.GetEntitiesInRange(args.Performer, component.BooRadius);
var entities = _lookup.GetEntitiesInRange(args.Performer, component.BooRadius).ToList();
// Shuffle the possible targets so we don't favor any particular entities
_random.Shuffle(entities);
var booCounter = 0;
foreach (var ent in entities)