Add telecommunication server (#14415)
This commit is contained in:
5
Content.Server/Radio/EntitySystems/TelecomSystem.cs
Normal file
5
Content.Server/Radio/EntitySystems/TelecomSystem.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Content.Server.Radio.EntitySystems;
|
||||
|
||||
public sealed class TelecomSystem : EntitySystem
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Content.Shared.Radio.Components;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed class TelecomServerComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -8,7 +8,6 @@ using Content.Shared.Radio.Components;
|
||||
using Content.Shared.Tools;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
@@ -56,7 +55,7 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
}
|
||||
|
||||
// if tool use ever gets predicted this needs changing.
|
||||
_popupSystem.PopupEntity(Loc.GetString("headset-encryption-keys-all-extracted"), uid, args.User);
|
||||
_popupSystem.PopupEntity(Loc.GetString("encryption-keys-all-extracted"), uid, args.User);
|
||||
_audio.PlayPvs(component.KeyExtractionSound, uid);
|
||||
component.Removing = false;
|
||||
}
|
||||
@@ -89,36 +88,46 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
|
||||
private void OnInteractUsing(EntityUid uid, EncryptionKeyHolderComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (!TryComp<ContainerManagerComponent>(uid, out var storage) || args.Handled || component.Removing)
|
||||
if (!TryComp<ContainerManagerComponent>(uid, out var _) || args.Handled || component.Removing)
|
||||
return;
|
||||
|
||||
if (TryComp<EncryptionKeyComponent>(args.Used, out var key))
|
||||
{
|
||||
args.Handled = true;
|
||||
|
||||
if (!component.KeysUnlocked)
|
||||
{
|
||||
if (_timing.IsFirstTimePredicted)
|
||||
_popupSystem.PopupEntity(Loc.GetString("headset-encryption-keys-are-locked"), uid, Filter.Local(), false);
|
||||
_popupSystem.PopupEntity(Loc.GetString("encryption-keys-are-locked"), uid, args.User);
|
||||
return;
|
||||
}
|
||||
if (TryComp<EncryptionKeyComponent>(args.Used, out var key))
|
||||
{
|
||||
TryInsertKey(uid, component, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
TryRemoveKey(uid, component, args);
|
||||
}
|
||||
}
|
||||
|
||||
private void TryInsertKey(EntityUid uid, EncryptionKeyHolderComponent component, InteractUsingEvent args)
|
||||
{
|
||||
args.Handled = true;
|
||||
|
||||
if (component.KeySlots <= component.KeyContainer.ContainedEntities.Count)
|
||||
{
|
||||
if (_timing.IsFirstTimePredicted)
|
||||
_popupSystem.PopupEntity(Loc.GetString("headset-encryption-key-slots-already-full"), uid, Filter.Local(), false);
|
||||
_popupSystem.PopupEntity(Loc.GetString("encryption-key-slots-already-full"), uid, args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.KeyContainer.Insert(args.Used))
|
||||
{
|
||||
if (_timing.IsFirstTimePredicted)
|
||||
_popupSystem.PopupEntity(Loc.GetString("headset-encryption-key-successfully-installed"), uid, Filter.Local(), false);
|
||||
_popupSystem.PopupEntity(Loc.GetString("encryption-key-successfully-installed"), uid, args.User);
|
||||
_audio.PlayPredicted(component.KeyInsertionSound, args.Target, args.User);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void TryRemoveKey(EntityUid uid, EncryptionKeyHolderComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (!TryComp<ToolComponent>(args.Used, out var tool) || !tool.Qualities.Contains(component.KeysExtractionMethod))
|
||||
return;
|
||||
|
||||
@@ -127,7 +136,7 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
if (component.KeyContainer.ContainedEntities.Count == 0)
|
||||
{
|
||||
if (_timing.IsFirstTimePredicted)
|
||||
_popupSystem.PopupEntity(Loc.GetString("headset-encryption-keys-no-keys"), uid, Filter.Local(), false);
|
||||
_popupSystem.PopupEntity(Loc.GetString("encryption-keys-no-keys"), uid, args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -136,8 +145,7 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
|
||||
var toolEvData = new ToolEventData(new EncryptionRemovalFinishedEvent(args.User), cancelledEv: new EncryptionRemovalCancelledEvent(), targetEntity: uid);
|
||||
|
||||
if(!_toolSystem.UseTool(args.Used, args.User, uid, 1f, new[] { component.KeysExtractionMethod }, toolEvData, toolComponent: tool))
|
||||
return;
|
||||
_toolSystem.UseTool(args.Used, args.User, uid, 1f, new[] { component.KeysExtractionMethod }, toolEvData, toolComponent: tool);
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, EncryptionKeyHolderComponent component, ComponentStartup args)
|
||||
@@ -153,14 +161,14 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
|
||||
if (component.KeyContainer.ContainedEntities.Count == 0)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("examine-headset-no-keys"));
|
||||
args.PushMarkup(Loc.GetString("encryption-keys-no-keys"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.Channels.Count > 0)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("examine-headset-channels-prefix"));
|
||||
AddChannelsExamine(component.Channels, component.DefaultChannel, args, _protoManager, "examine-headset-channel");
|
||||
args.PushMarkup(Loc.GetString("examine-encryption-channels-prefix"));
|
||||
AddChannelsExamine(component.Channels, component.DefaultChannel, args, _protoManager, "examine-encryption-channel");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +179,8 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
|
||||
if(component.Channels.Count > 0)
|
||||
{
|
||||
args.PushMarkup(Loc.GetString("examine-encryption-key-channels-prefix"));
|
||||
AddChannelsExamine(component.Channels, component.DefaultChannel, args, _protoManager, "examine-headset-channel");
|
||||
args.PushMarkup(Loc.GetString("examine-encryption-channels-prefix"));
|
||||
AddChannelsExamine(component.Channels, component.DefaultChannel, args, _protoManager, "examine-encryption-channel");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +195,7 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
RadioChannelPrototype? proto;
|
||||
foreach (var id in channels)
|
||||
{
|
||||
proto = protoManager.Index<RadioChannelPrototype>(id);
|
||||
proto = _protoManager.Index<RadioChannelPrototype>(id);
|
||||
|
||||
var key = id == SharedChatSystem.CommonChannel
|
||||
? SharedChatSystem.RadioCommonPrefix.ToString()
|
||||
@@ -202,12 +210,22 @@ public sealed class EncryptionKeySystem : EntitySystem
|
||||
|
||||
if (defaultChannel != null && _protoManager.TryIndex(defaultChannel, out proto))
|
||||
{
|
||||
var msg = Loc.GetString("examine-default-channel",
|
||||
if (HasComp<HeadsetComponent>(examineEvent.Examined))
|
||||
{
|
||||
var msg = Loc.GetString("examine-headset-default-channel",
|
||||
("prefix", SharedChatSystem.DefaultChannelPrefix),
|
||||
("channel", defaultChannel),
|
||||
("color", proto.Color));
|
||||
examineEvent.PushMarkup(msg);
|
||||
}
|
||||
if (HasComp<EncryptionKeyComponent>(examineEvent.Examined))
|
||||
{
|
||||
var msg = Loc.GetString("examine-encryption-default-channel",
|
||||
("channel", defaultChannel),
|
||||
("color", proto.Color));
|
||||
examineEvent.PushMarkup(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class EncryptionRemovalFinishedEvent : EntityEventArgs
|
||||
|
||||
@@ -1,22 +1,7 @@
|
||||
# Chat window radio wrap (prefix and postfix)
|
||||
chat-radio-message-wrap = [color={$color}]{$channel} {$name} says: "{$message}"[/color]
|
||||
|
||||
headset-encryption-key-successfully-installed = You put the key into the headset.
|
||||
headset-encryption-key-slots-already-full = There is no place for another key.
|
||||
headset-encryption-keys-all-extracted = You pop out the encryption keys from the headset!
|
||||
headset-encryption-keys-no-keys = This headset has no encryption keys!
|
||||
headset-encryption-keys-are-locked = The headset's key slots are locked, you cannot add or remove any keys.
|
||||
|
||||
examine-encryption-key-channels-prefix = It is providing these frequencies to the headset:
|
||||
|
||||
examine-radio-frequency = It's set to broadcast over the {$frequency} frequency.
|
||||
|
||||
examine-headset-channels-prefix = A small screen on the headset displays the following available frequencies:
|
||||
examine-headset-channel = [color={$color}]{$key} for {$id} ({$freq})[/color]
|
||||
examine-headset-no-keys = It seems broken. There are no encryption keys in it.
|
||||
examine-default-channel = Use {$prefix} for the default channel ([color={$color}]{$channel}[/color]).
|
||||
examine-headset-default-channel = It indicates that the default channel of this headset is [color={$color}]{$channel}[/color].
|
||||
examine-encryption-key-default-channel = The default channel is [color={$color}]{$channel}[/color].
|
||||
examine-headset-default-channel = Use {$prefix} for the default channel ([color={$color}]{$channel}[/color]).
|
||||
|
||||
chat-radio-common = Common
|
||||
chat-radio-centcom = CentCom
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
encryption-key-successfully-installed = You put the encryption key inside.
|
||||
encryption-key-slots-already-full = There is no place for another encryption key.
|
||||
encryption-keys-all-extracted = You pop out the encryption keys!
|
||||
encryption-keys-no-keys = This device has no encryption keys!
|
||||
encryption-keys-are-locked = Encryption key slots are locked!
|
||||
|
||||
examine-encryption-channels-prefix = Available frequencies:
|
||||
examine-encryption-channel = [color={$color}]{$key} for {$id} ({$freq})[/color]
|
||||
examine-encryption-default-channel = The default channel is [color={$color}]{$channel}[/color].
|
||||
@@ -376,6 +376,7 @@
|
||||
- SignalTrigger
|
||||
- VoiceTrigger
|
||||
- TimerTrigger
|
||||
- TelecomServerCircuitboard
|
||||
|
||||
- type: technology
|
||||
name: technologies-electrical-engineering
|
||||
|
||||
@@ -762,3 +762,18 @@
|
||||
Amount: 1
|
||||
DefaultPrototype: Beaker
|
||||
ExamineName: Glass Beaker
|
||||
|
||||
- type: entity
|
||||
id: TelecomServerCircuitboard
|
||||
parent: BaseMachineCircuitboard
|
||||
name: telecommunication server machine board
|
||||
description: A machine printed circuit board for an telecommunication server
|
||||
components:
|
||||
- type: MachineBoard
|
||||
prototype: TelecomServer
|
||||
requirements:
|
||||
Capacitor: 1
|
||||
ScanningModule: 2
|
||||
materialRequirements:
|
||||
Steel: 1
|
||||
Cable: 2
|
||||
|
||||
@@ -326,6 +326,7 @@
|
||||
- TraversalDistorterMachineCircuitboard
|
||||
- BoozeDispenserMachineCircuitboard
|
||||
- SodaDispenserMachineCircuitboard
|
||||
- TelecomServerCircuitboard
|
||||
- type: MaterialStorage
|
||||
whitelist:
|
||||
tags:
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
- type: entity
|
||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
||||
id: TelecomServer
|
||||
name: telecommunication server
|
||||
description: When powered and filled with encryption keys it allows radio headset communication
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Structures/Machines/telecomms.rsi
|
||||
snapCardinals: true
|
||||
netsync: false
|
||||
layers:
|
||||
- state: icon
|
||||
- state: unlit
|
||||
shader: unshaded
|
||||
map: ["enum.PowerDeviceVisualLayers.Powered"]
|
||||
- state: panel
|
||||
map: ["enum.WiresVisualLayers.MaintenancePanel"]
|
||||
- type: GenericVisualizer
|
||||
visuals:
|
||||
enum.PowerDeviceVisuals.Powered:
|
||||
enum.PowerDeviceVisualLayers.Powered:
|
||||
True: { visible: true }
|
||||
False: { visible: false }
|
||||
- type: Appearance
|
||||
- type: WiresVisuals
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
- shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.4,-0.4,0.4,0.4"
|
||||
density: 190
|
||||
mask:
|
||||
- MachineMask
|
||||
layer:
|
||||
- MachineLayer
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:DamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:ChangeConstructionNodeBehavior
|
||||
node: machineFrame
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
- type: Machine
|
||||
board: TelecomServerCircuitboard
|
||||
- type: Wires
|
||||
BoardName: "TelecomServer"
|
||||
LayoutId: TelecomServer
|
||||
- type: Transform
|
||||
anchored: true
|
||||
- type: Pullable
|
||||
- type: EncryptionKeyHolder
|
||||
keysExtractionMethod: Prying
|
||||
keySlots: 10
|
||||
- type: TelecomServer
|
||||
- type: ContainerContainer
|
||||
containers:
|
||||
key_slots: !type:Container
|
||||
machine_board: !type:Container
|
||||
machine_parts: !type:Container
|
||||
|
||||
- type: entity
|
||||
parent: TelecomServer
|
||||
id: TelecomServerFilled
|
||||
suffix: Filled
|
||||
components:
|
||||
- type: ContainerFill
|
||||
containers:
|
||||
key_slots:
|
||||
- EncryptionKeyCommon
|
||||
- EncryptionKeyCargo
|
||||
- EncryptionKeyEngineering
|
||||
- EncryptionKeyMedical
|
||||
- EncryptionKeyScience
|
||||
- EncryptionKeySecurity
|
||||
- EncryptionKeyService
|
||||
- EncryptionKeyCommand
|
||||
@@ -527,3 +527,11 @@
|
||||
materials:
|
||||
Steel: 100
|
||||
Glass: 900
|
||||
|
||||
- type: latheRecipe
|
||||
id: TelecomServerCircuitboard
|
||||
result: TelecomServerCircuitboard
|
||||
completetime: 4
|
||||
materials:
|
||||
Steel: 100
|
||||
Glass: 900
|
||||
|
||||
BIN
Resources/Textures/Structures/Machines/telecomms.rsi/icon.png
Normal file
BIN
Resources/Textures/Structures/Machines/telecomms.rsi/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 341 B |
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"version": 1,
|
||||
"license": "CC-BY-SA-3.0",
|
||||
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/blob/9c3494fd79e6bf8dc532300b9de4f688ff276ac9/icons/obj/machines/telecomms.dmi",
|
||||
"size": {
|
||||
"x": 32,
|
||||
"y": 32
|
||||
},
|
||||
"states": [
|
||||
{
|
||||
"name": "unlit",
|
||||
"delays": [
|
||||
[
|
||||
0.1,
|
||||
0.1,
|
||||
0.1,
|
||||
0.1,
|
||||
0.1,
|
||||
0.1,
|
||||
0.1,
|
||||
0.1,
|
||||
0.1,
|
||||
0.1
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "icon"
|
||||
},
|
||||
{
|
||||
"name": "panel"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
Resources/Textures/Structures/Machines/telecomms.rsi/panel.png
Normal file
BIN
Resources/Textures/Structures/Machines/telecomms.rsi/panel.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 860 B |
BIN
Resources/Textures/Structures/Machines/telecomms.rsi/unlit.png
Normal file
BIN
Resources/Textures/Structures/Machines/telecomms.rsi/unlit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Reference in New Issue
Block a user