Files
OldThink/Content.Server/Radio/EntitySystems/RadioSystem.cs

33 lines
951 B
C#
Raw Normal View History

using System.Collections.Generic;
Headsets (#2023) * add headset component * add basic headset logic * fix formatting in listening component, add dependency to headset * test function for headset * implement headset as listener * ANNIHILATES ListeningComponent, refactor of radio/listener sys * basic headset functionality * rename RadioComponent to HandheldRadioComponent * change channel to list of channels * basic headset implementation complete * message now always excludes ';' * add radio color; state channel freq. and source name * undocumented game breaking bug commit (DO NOT RESEARCH) actually just changes frequency from 1457 (what signalers are set to by default) to 1459, the actual frequency for common * Add more sprites * Reorganizes * Added job headsets * Adds headset as an ignored component * Jobs now spawn with headsets * remove system.tracing * Catchup commits * Add headset property serialization * Turn GetChannels into a property * ListenRange property and serializatioon * Adjust interfaces * Address reviews * Cleanup * Address reviews * Update rsi * Fix licenses and copyright * Fix missing textures * Merge fixes * Move headset textures from objects/devices to clothing/ears * Fix rsi state names and add equipped states * Fix headsets not working * Add missing brackets to channel number in chat * heck * Fix broken rsi * Fix radio id and names * Put quotes around headset messages * Fix method names * Fix handheld radios * Fix capitalization when using radio channels and trim * Remove unnecessary dependency * Indent that * Separate this part * Goodbye icons * Implement IActivate in HandheldRadioComponent * Add examine tooltip to radios and headsets * Rename IListen methods Co-authored-by: Bright <nsmoak10@yahoo.com> Co-authored-by: Swept <jamesurquhartwebb@gmail.com> Co-authored-by: Bright0 <55061890+Bright0@users.noreply.github.com>
2020-10-07 14:02:12 +02:00
using System.Linq;
2021-06-09 22:19:39 +02:00
using Content.Server.Radio.Components;
Headsets (#2023) * add headset component * add basic headset logic * fix formatting in listening component, add dependency to headset * test function for headset * implement headset as listener * ANNIHILATES ListeningComponent, refactor of radio/listener sys * basic headset functionality * rename RadioComponent to HandheldRadioComponent * change channel to list of channels * basic headset implementation complete * message now always excludes ';' * add radio color; state channel freq. and source name * undocumented game breaking bug commit (DO NOT RESEARCH) actually just changes frequency from 1457 (what signalers are set to by default) to 1459, the actual frequency for common * Add more sprites * Reorganizes * Added job headsets * Adds headset as an ignored component * Jobs now spawn with headsets * remove system.tracing * Catchup commits * Add headset property serialization * Turn GetChannels into a property * ListenRange property and serializatioon * Adjust interfaces * Address reviews * Cleanup * Address reviews * Update rsi * Fix licenses and copyright * Fix missing textures * Merge fixes * Move headset textures from objects/devices to clothing/ears * Fix rsi state names and add equipped states * Fix headsets not working * Add missing brackets to channel number in chat * heck * Fix broken rsi * Fix radio id and names * Put quotes around headset messages * Fix method names * Fix handheld radios * Fix capitalization when using radio channels and trim * Remove unnecessary dependency * Indent that * Separate this part * Goodbye icons * Implement IActivate in HandheldRadioComponent * Add examine tooltip to radios and headsets * Rename IListen methods Co-authored-by: Bright <nsmoak10@yahoo.com> Co-authored-by: Swept <jamesurquhartwebb@gmail.com> Co-authored-by: Bright0 <55061890+Bright0@users.noreply.github.com>
2020-10-07 14:02:12 +02:00
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
2021-06-09 22:19:39 +02:00
namespace Content.Server.Radio.EntitySystems
{
Headsets (#2023) * add headset component * add basic headset logic * fix formatting in listening component, add dependency to headset * test function for headset * implement headset as listener * ANNIHILATES ListeningComponent, refactor of radio/listener sys * basic headset functionality * rename RadioComponent to HandheldRadioComponent * change channel to list of channels * basic headset implementation complete * message now always excludes ';' * add radio color; state channel freq. and source name * undocumented game breaking bug commit (DO NOT RESEARCH) actually just changes frequency from 1457 (what signalers are set to by default) to 1459, the actual frequency for common * Add more sprites * Reorganizes * Added job headsets * Adds headset as an ignored component * Jobs now spawn with headsets * remove system.tracing * Catchup commits * Add headset property serialization * Turn GetChannels into a property * ListenRange property and serializatioon * Adjust interfaces * Address reviews * Cleanup * Address reviews * Update rsi * Fix licenses and copyright * Fix missing textures * Merge fixes * Move headset textures from objects/devices to clothing/ears * Fix rsi state names and add equipped states * Fix headsets not working * Add missing brackets to channel number in chat * heck * Fix broken rsi * Fix radio id and names * Put quotes around headset messages * Fix method names * Fix handheld radios * Fix capitalization when using radio channels and trim * Remove unnecessary dependency * Indent that * Separate this part * Goodbye icons * Implement IActivate in HandheldRadioComponent * Add examine tooltip to radios and headsets * Rename IListen methods Co-authored-by: Bright <nsmoak10@yahoo.com> Co-authored-by: Swept <jamesurquhartwebb@gmail.com> Co-authored-by: Bright0 <55061890+Bright0@users.noreply.github.com>
2020-10-07 14:02:12 +02:00
[UsedImplicitly]
public class RadioSystem : EntitySystem
{
private readonly List<string> _messages = new();
Headsets (#2023) * add headset component * add basic headset logic * fix formatting in listening component, add dependency to headset * test function for headset * implement headset as listener * ANNIHILATES ListeningComponent, refactor of radio/listener sys * basic headset functionality * rename RadioComponent to HandheldRadioComponent * change channel to list of channels * basic headset implementation complete * message now always excludes ';' * add radio color; state channel freq. and source name * undocumented game breaking bug commit (DO NOT RESEARCH) actually just changes frequency from 1457 (what signalers are set to by default) to 1459, the actual frequency for common * Add more sprites * Reorganizes * Added job headsets * Adds headset as an ignored component * Jobs now spawn with headsets * remove system.tracing * Catchup commits * Add headset property serialization * Turn GetChannels into a property * ListenRange property and serializatioon * Adjust interfaces * Address reviews * Cleanup * Address reviews * Update rsi * Fix licenses and copyright * Fix missing textures * Merge fixes * Move headset textures from objects/devices to clothing/ears * Fix rsi state names and add equipped states * Fix headsets not working * Add missing brackets to channel number in chat * heck * Fix broken rsi * Fix radio id and names * Put quotes around headset messages * Fix method names * Fix handheld radios * Fix capitalization when using radio channels and trim * Remove unnecessary dependency * Indent that * Separate this part * Goodbye icons * Implement IActivate in HandheldRadioComponent * Add examine tooltip to radios and headsets * Rename IListen methods Co-authored-by: Bright <nsmoak10@yahoo.com> Co-authored-by: Swept <jamesurquhartwebb@gmail.com> Co-authored-by: Bright0 <55061890+Bright0@users.noreply.github.com>
2020-10-07 14:02:12 +02:00
public void SpreadMessage(IRadio source, IEntity speaker, string message, int channel)
{
if (_messages.Contains(message)) return;
_messages.Add(message);
foreach (var radio in EntityManager.EntityQuery<IRadio>(true))
{
Headsets (#2023) * add headset component * add basic headset logic * fix formatting in listening component, add dependency to headset * test function for headset * implement headset as listener * ANNIHILATES ListeningComponent, refactor of radio/listener sys * basic headset functionality * rename RadioComponent to HandheldRadioComponent * change channel to list of channels * basic headset implementation complete * message now always excludes ';' * add radio color; state channel freq. and source name * undocumented game breaking bug commit (DO NOT RESEARCH) actually just changes frequency from 1457 (what signalers are set to by default) to 1459, the actual frequency for common * Add more sprites * Reorganizes * Added job headsets * Adds headset as an ignored component * Jobs now spawn with headsets * remove system.tracing * Catchup commits * Add headset property serialization * Turn GetChannels into a property * ListenRange property and serializatioon * Adjust interfaces * Address reviews * Cleanup * Address reviews * Update rsi * Fix licenses and copyright * Fix missing textures * Merge fixes * Move headset textures from objects/devices to clothing/ears * Fix rsi state names and add equipped states * Fix headsets not working * Add missing brackets to channel number in chat * heck * Fix broken rsi * Fix radio id and names * Put quotes around headset messages * Fix method names * Fix handheld radios * Fix capitalization when using radio channels and trim * Remove unnecessary dependency * Indent that * Separate this part * Goodbye icons * Implement IActivate in HandheldRadioComponent * Add examine tooltip to radios and headsets * Rename IListen methods Co-authored-by: Bright <nsmoak10@yahoo.com> Co-authored-by: Swept <jamesurquhartwebb@gmail.com> Co-authored-by: Bright0 <55061890+Bright0@users.noreply.github.com>
2020-10-07 14:02:12 +02:00
if (radio.Channels.Contains(channel))
{
Headsets (#2023) * add headset component * add basic headset logic * fix formatting in listening component, add dependency to headset * test function for headset * implement headset as listener * ANNIHILATES ListeningComponent, refactor of radio/listener sys * basic headset functionality * rename RadioComponent to HandheldRadioComponent * change channel to list of channels * basic headset implementation complete * message now always excludes ';' * add radio color; state channel freq. and source name * undocumented game breaking bug commit (DO NOT RESEARCH) actually just changes frequency from 1457 (what signalers are set to by default) to 1459, the actual frequency for common * Add more sprites * Reorganizes * Added job headsets * Adds headset as an ignored component * Jobs now spawn with headsets * remove system.tracing * Catchup commits * Add headset property serialization * Turn GetChannels into a property * ListenRange property and serializatioon * Adjust interfaces * Address reviews * Cleanup * Address reviews * Update rsi * Fix licenses and copyright * Fix missing textures * Merge fixes * Move headset textures from objects/devices to clothing/ears * Fix rsi state names and add equipped states * Fix headsets not working * Add missing brackets to channel number in chat * heck * Fix broken rsi * Fix radio id and names * Put quotes around headset messages * Fix method names * Fix handheld radios * Fix capitalization when using radio channels and trim * Remove unnecessary dependency * Indent that * Separate this part * Goodbye icons * Implement IActivate in HandheldRadioComponent * Add examine tooltip to radios and headsets * Rename IListen methods Co-authored-by: Bright <nsmoak10@yahoo.com> Co-authored-by: Swept <jamesurquhartwebb@gmail.com> Co-authored-by: Bright0 <55061890+Bright0@users.noreply.github.com>
2020-10-07 14:02:12 +02:00
//TODO: once voice identity gets added, pass into receiver via source.GetSpeakerVoice()
radio.Receive(message, channel, speaker);
}
}
_messages.Remove(message);
}
}
}