Intercoms and Radios both pick up proximate speech (#32737)
* Deduping of recent messages should consider the channel it's being sent to * rerun actions
This commit is contained in:
@@ -30,7 +30,7 @@ public sealed class RadioDeviceSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
|
||||||
// Used to prevent a shitter from using a bunch of radios to spam chat.
|
// Used to prevent a shitter from using a bunch of radios to spam chat.
|
||||||
private HashSet<(string, EntityUid)> _recentlySent = new();
|
private HashSet<(string, EntityUid, RadioChannelPrototype)> _recentlySent = new();
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -191,8 +191,9 @@ public sealed class RadioDeviceSystem : EntitySystem
|
|||||||
if (HasComp<RadioSpeakerComponent>(args.Source))
|
if (HasComp<RadioSpeakerComponent>(args.Source))
|
||||||
return; // no feedback loops please.
|
return; // no feedback loops please.
|
||||||
|
|
||||||
if (_recentlySent.Add((args.Message, args.Source)))
|
var channel = _protoMan.Index<RadioChannelPrototype>(component.BroadcastChannel)!;
|
||||||
_radio.SendRadioMessage(args.Source, args.Message, _protoMan.Index<RadioChannelPrototype>(component.BroadcastChannel), uid);
|
if (_recentlySent.Add((args.Message, args.Source, channel)))
|
||||||
|
_radio.SendRadioMessage(args.Source, args.Message, channel, uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAttemptListen(EntityUid uid, RadioMicrophoneComponent component, ListenAttemptEvent args)
|
private void OnAttemptListen(EntityUid uid, RadioMicrophoneComponent component, ListenAttemptEvent args)
|
||||||
|
|||||||
Reference in New Issue
Block a user