Skip to content

Commit 0cd8635

Browse files
committed
No translate languages
1 parent be0e294 commit 0cd8635

File tree

7 files changed

+51
-0
lines changed

7 files changed

+51
-0
lines changed

Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Content.Server.Interaction;
55
using Content.Server.Popups;
66
using Content.Server.Power.EntitySystems;
7+
using Content.Shared._WL.Languages.Components; // WL-Changes
78
using Content.Shared.Chat;
89
using Content.Shared.Examine;
910
using Content.Shared.Interaction;
@@ -174,6 +175,16 @@ private void OnReceiveRadio(EntityUid uid, RadioSpeakerComponent component, ref
174175
if (uid == args.RadioSource)
175176
return;
176177

178+
// WL-Changes-Start
179+
if (TryComp<LanguagesComponent>(uid, out var languagesRadio))
180+
{
181+
if (TryComp<LanguagesComponent>(args.MessageSource, out var languagesSource))
182+
{
183+
languagesRadio.CurrentLanguage = languagesSource.CurrentLanguage;
184+
}
185+
}
186+
// WL-Changes-End
187+
177188
var nameEv = new TransformSpeakerNameEvent(args.MessageSource, Name(args.MessageSource));
178189
RaiseLocalEvent(args.MessageSource, nameEv);
179190

Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSpeakerSystem.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Content.Server.Chat.Systems;
22
using Content.Server.Speech;
33
using Content.Shared.Speech;
4+
using Content.Shared._WL.Languages.Components; // WL-Changes
45
using Content.Shared.Chat;
56
using Robust.Shared.Audio.Systems;
67
using Robust.Shared.Timing;
@@ -31,6 +32,16 @@ private void OnSpeechSent(EntityUid uid, SurveillanceCameraSpeakerComponent comp
3132
return;
3233
}
3334

35+
// WL-Changes-Start
36+
if (TryComp<LanguagesComponent>(uid, out var languagesSpeech))
37+
{
38+
if (TryComp<LanguagesComponent>(args.Speaker, out var languagesSpeaker))
39+
{
40+
languagesSpeech.CurrentLanguage = languagesSpeaker.CurrentLanguage;
41+
}
42+
}
43+
// WL-Changes-end
44+
3445
var time = _gameTiming.CurTime;
3546
var cd = TimeSpan.FromSeconds(component.SpeechSoundCooldown);
3647

Content.Server/_WL/Languages/LanguagesSystem.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ public void OnModifyInit(EntityUid ent, ModifyLanguagesComponent component, ref
107107

108108
public void OnComponentInit(EntityUid ent, LanguagesComponent component, ref ComponentInit args)
109109
{
110+
if (component.IsRadio)
111+
{
112+
var langPotos = GetLanguagePrototypes();
113+
component.Speaking = langPotos;
114+
component.Understood = langPotos;
115+
116+
}
117+
110118
var langs = component.Speaking;
111119
if (langs.Count == 0)
112120
return;

Content.Shared/_WL/Languages/Components/LanguageComponent.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ public sealed partial class LanguagesComponent : Component
1313
[DataField]
1414
public bool IsSpeaking = true;
1515

16+
[DataField]
17+
public bool IsRadio = false;
18+
1619
[DataField]
1720
public List<ProtoId<LanguagePrototype>> Speaking = [];
1821

Content.Shared/_WL/Languages/SharedLanguagesSystem.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Robust.Shared.Timing;
99
using System.Collections.Frozen;
1010
using System.Diagnostics.CodeAnalysis;
11+
using System.Linq;
1112
using System.Text;
1213

1314
namespace Content.Shared._WL.Languages;
@@ -54,6 +55,19 @@ private void CacheLanguages()
5455
return proto;
5556
}
5657

58+
public List<ProtoId<LanguagePrototype>> GetLanguagePrototypes()
59+
{
60+
var idlangs = new List<ProtoId<LanguagePrototype>>();
61+
var langs = _prototype.EnumeratePrototypes<LanguagePrototype>()
62+
.ToList();
63+
foreach (var language in langs)
64+
{
65+
idlangs.Add(language.ID);
66+
}
67+
68+
return idlangs;
69+
}
70+
5771
public void OnRadioLanguageCheck(EntityUid source, LanguagesComponent comp, ref RadioLanguageCheckEvent args)
5872
{
5973
var passability = CheckRadioPass(source, args.Message);

Resources/Prototypes/Entities/Objects/Devices/radio.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
- type: Tag
2525
tags:
2626
- Radio
27+
- type: Languages # WL-Changes
28+
isRadio: true
2729

2830
- type: entity
2931
name: security radio

Resources/Prototypes/Entities/Structures/Machines/Computers/computers.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,8 @@
13851385
type: SurveillanceCameraMonitorBoundUserInterface
13861386
enum.WiresUiKey.Key:
13871387
type: WiresBoundUserInterface
1388+
- type: Languages # WL-Changes
1389+
isRadio: true
13881390

13891391
- type: entity
13901392
parent: ComputerSurveillanceWirelessCameraMonitor

0 commit comments

Comments
 (0)