-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hook into station init and Barge implementation for testing
- Loading branch information
1 parent
e7a7e5c
commit 8314886
Showing
5 changed files
with
133 additions
and
17 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
Content.Server/_NF/Station/Components/StationRenameHolopadsComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Content.Server.Station.Components; | ||
|
||
/// <summary> | ||
/// Rename all holopads on a station when station name changes. | ||
/// Only holopads with "Ship or POI" will be affected. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class StationRenameHolopadsComponent : Component | ||
{ | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
Content.Server/_NF/Station/Systems/StationRenameHolopadsSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Content.Server.Station.Components; | ||
using Content.Server.Station.Events; | ||
using Content.Shared.Fax.Components; | ||
using Content.Shared.Holopad; | ||
using Content.Shared.Labels.Components; | ||
|
||
namespace Content.Server.Station.Systems; | ||
|
||
public sealed class StationRenameHolopadsSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly StationSystem _stationSystem = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<StationRenameHolopadsComponent, StationPostInitEvent>(OnPostInit); | ||
} | ||
|
||
private void OnPostInit(EntityUid uid, StationRenameHolopadsComponent component, ref StationPostInitEvent args) | ||
{ | ||
SyncHolopadsNames(uid); | ||
} | ||
|
||
private void SyncHolopadsNames(EntityUid stationUid) | ||
{ | ||
// update all holopads that belong to this station grid | ||
var query = EntityQueryEnumerator<HolopadComponent>(); | ||
while (query.MoveNext(out var uid, out var pad)) | ||
{ | ||
if (!pad.UseStationName) | ||
continue; | ||
|
||
var padStationUid = _stationSystem.GetOwningStation(uid); | ||
if (padStationUid != stationUid) | ||
continue; | ||
|
||
var padName = ""; | ||
|
||
if (!string.IsNullOrEmpty(pad.StationNamePrefix)) | ||
{ | ||
padName += pad.StationNamePrefix + " "; | ||
} | ||
|
||
padName += Name(padStationUid.Value); | ||
|
||
if (!string.IsNullOrEmpty(pad.StationNameSuffix)) | ||
{ | ||
padName += " " + pad.StationNameSuffix; | ||
} | ||
|
||
var padLabel = EnsureComp<LabelComponent>(uid); | ||
padLabel.CurrentLabel = padName; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
Resources/Prototypes/_NF/Entities/Structures/Machines/holopad.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- type: entity | ||
name: long-range holopad | ||
description: "An experimental floor-mounted device for projecting holographic images via bluespace." | ||
parent: Holopad | ||
id: NFHolopadShip | ||
suffix: Ship | ||
components: | ||
- type: Telephone | ||
ringTone: /Audio/Machines/double_ring.ogg #change me to something funny | ||
listeningRange: 3 | ||
speakerVolume: Speak | ||
transmissionRange: Map | ||
compatibleRanges: | ||
- Grid | ||
- Map | ||
- Unlimited | ||
ignoreTelephonesOnSameGrid: true | ||
- type: Holopad | ||
hologramProtoId: HolopadHologram | ||
useStationName: true | ||
- type: AccessReader | ||
access: [ [ "HeadOfSecurity" ] ] |