From 6a809889b0bec7e9e35aa63ef8105552cef85884 Mon Sep 17 00:00:00 2001 From: Velcroboy <107660393+IamVelcroboy@users.noreply.github.com> Date: Fri, 27 Sep 2024 04:50:41 -0500 Subject: [PATCH] Adds load acts + action bar loadout files (#1921) Co-authored-by: Velcroboy --- Content.Client/Commands/ActionsCommands.cs | 27 +++- Resources/mapping_actions_alarms.yml | 139 ++++++++++++++++++++ Resources/mapping_actions_deltav.yml | 136 ++++++++++++++++++++ Resources/mapping_actions_disposals.yml | 140 +++++++++++++++++++++ Resources/mapping_actions_pipes.yml | 139 ++++++++++++++++++++ Resources/mapping_actions_power.yml | 139 ++++++++++++++++++++ 6 files changed, 718 insertions(+), 2 deletions(-) create mode 100644 Resources/mapping_actions_alarms.yml create mode 100644 Resources/mapping_actions_deltav.yml create mode 100644 Resources/mapping_actions_disposals.yml create mode 100644 Resources/mapping_actions_pipes.yml create mode 100644 Resources/mapping_actions_power.yml diff --git a/Content.Client/Commands/ActionsCommands.cs b/Content.Client/Commands/ActionsCommands.cs index c155c7a9dea..738a6544763 100644 --- a/Content.Client/Commands/ActionsCommands.cs +++ b/Content.Client/Commands/ActionsCommands.cs @@ -1,5 +1,8 @@ -using Content.Client.Actions; +using Content.Client.Actions; +using System.IO; using Content.Shared.Administration; +using Robust.Client.UserInterface; +using YamlDotNet.RepresentationModel; using Robust.Shared.Console; namespace Content.Client.Commands; @@ -46,7 +49,7 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) { if (args.Length != 1) { - shell.WriteLine(Help); + LoadActs(); // DeltaV - Load from a file dialogue instead return; } @@ -59,4 +62,24 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args) shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error")); } } + + /// + /// DeltaV - Load actions from a file stream instead + /// + private static async void LoadActs() + { + var fileMan = IoCManager.Resolve(); + var actMan = IoCManager.Resolve().GetEntitySystem(); + + var stream = await fileMan.OpenFile(new FileDialogFilters(new FileDialogFilters.Group("yml"))); + if (stream is null) + return; + + var reader = new StreamReader(stream); + var yamlStream = new YamlStream(); + yamlStream.Load(reader); + + actMan.LoadActionAssignments(yamlStream); + reader.Close(); + } } diff --git a/Resources/mapping_actions_alarms.yml b/Resources/mapping_actions_alarms.yml new file mode 100644 index 00000000000..ce569d7d052 --- /dev/null +++ b/Resources/mapping_actions_alarms.yml @@ -0,0 +1,139 @@ +- action: !type:InstantActionComponent + icon: + entity: AirAlarm + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: AirAlarm + assignments: + - 0: 1 + name: Air Alarm +- action: !type:InstantActionComponent + icon: + entity: FireAlarm + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: FireAlarm + assignments: + - 0: 2 + name: Fire Alarm +- action: !type:InstantActionComponent + icon: + entity: AirSensor + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: AirSensor + assignments: + - 0: 3 + name: Air Sensor +- action: !type:InstantActionComponent + icon: + entity: Firelock + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: Firelock + assignments: + - 0: 4 + name: Firelock +- action: !type:InstantActionComponent + icon: + entity: FirelockGlass + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: FirelockGlass + assignments: + - 0: 5 + name: Firelock Glass +- action: !type:InstantActionComponent + icon: + entity: FirelockEdge + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: FirelockEdge + assignments: + - 0: 6 + name: Firelock Edge +- action: !type:InstantActionComponent + icon: + entity: Multitool + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: Multitool + assignments: + - 0: 7 + name: Multitool +- action: !type:InstantActionComponent + icon: + entity: GasVentScrubber + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasVentScrubber + assignments: + - 0: 8 + name: Gas Vent Scrubber +- action: !type:InstantActionComponent + icon: + entity: GasVentPump + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasVentPump + assignments: + - 0: 9 + name: Gas Vent Pump +- action: !type:InstantActionComponent + icon: Interface/VerbIcons/delete.svg.192dpi.png + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + eraser: True + assignments: + - 0: 0 + name: action-name-mapping-erase +... diff --git a/Resources/mapping_actions_deltav.yml b/Resources/mapping_actions_deltav.yml new file mode 100644 index 00000000000..2cf8994595d --- /dev/null +++ b/Resources/mapping_actions_deltav.yml @@ -0,0 +1,136 @@ +- action: !type:InstantActionComponent + icon: + entity: WallSolid + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: WallSolid + assignments: + - 0: 1 + name: Wall Solid +- action: !type:InstantActionComponent + icon: + entity: WallReinforced + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: WallReinforced + assignments: + - 0: 2 + name: WallReinforced +- action: !type:InstantActionComponent + icon: + entity: Window + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: Window + assignments: + - 0: 3 + name: Window +- action: !type:InstantActionComponent + icon: + entity: ReinforcedWindow + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: ReinforcedWindow + assignments: + - 0: 4 + name: ReinforcedWindow +- action: !type:InstantActionComponent + icon: + entity: Grille + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: Grille + assignments: + - 0: 5 + name: Grille +- action: !type:InstantActionComponent + icon: /Textures/Tiles/steel.png + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: AlignTileAny + tileId: FloorSteel + assignments: + - 0: 6 + name: steel floor +- action: !type:InstantActionComponent + icon: + entity: Firelock + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: Firelock + assignments: + - 0: 7 + name: Firelock +- action: !type:InstantActionComponent + icon: /Textures/Tiles/plating.png + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: AlignTileAny + tileId: Plating + assignments: + - 0: 8 + name: plating +- action: !type:InstantActionComponent + icon: /Textures/Tiles/cropped_parallax.png + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: AlignTileAny + tileId: Space + assignments: + - 0: 9 + name: space +- action: !type:InstantActionComponent + icon: Interface/VerbIcons/delete.svg.192dpi.png + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + eraser: True + assignments: + - 0: 0 + name: action-name-mapping-erase +... diff --git a/Resources/mapping_actions_disposals.yml b/Resources/mapping_actions_disposals.yml new file mode 100644 index 00000000000..bcccbefc17e --- /dev/null +++ b/Resources/mapping_actions_disposals.yml @@ -0,0 +1,140 @@ + +- action: !type:InstantActionComponent + icon: + entity: DisposalUnit + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: DisposalUnit + assignments: + - 0: 1 + name: Disposal Unit +- action: !type:InstantActionComponent + icon: + entity: DisposalTrunk + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: DisposalTrunk + assignments: + - 0: 2 + name: Disposal Trunk +- action: !type:InstantActionComponent + icon: + entity: DisposalPipe + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: DisposalPipe + assignments: + - 0: 3 + name: Disposal Pipe +- action: !type:InstantActionComponent + icon: + entity: DisposalBend + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: DisposalBend + assignments: + - 0: 4 + name: Disposal Bend +- action: !type:InstantActionComponent + icon: + entity: DisposalJunction + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: DisposalJunction + assignments: + - 0: 5 + name: Disposal Junction +- action: !type:InstantActionComponent + icon: + entity: DisposalJunctionFlipped + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: DisposalJunctionFlipped + assignments: + - 0: 6 + name: Disposal Junction Flipped +- action: !type:InstantActionComponent + icon: + entity: DisposalYJunction + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: DisposalYJunction + assignments: + - 0: 7 + name: Disposal Y-Junction +- action: !type:InstantActionComponent + icon: + entity: DisposalTagger + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: DisposalTagger + assignments: + - 0: 8 + name: Disposal Tagger +- action: !type:InstantActionComponent + icon: + entity: SignDisposalSpace + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: SignDisposalSpace + assignments: + - 0: 9 + name: Sign Disposal Space +- action: !type:InstantActionComponent + icon: Interface/VerbIcons/delete.svg.192dpi.png + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + eraser: True + assignments: + - 0: 0 + name: action-name-mapping-erase +... diff --git a/Resources/mapping_actions_pipes.yml b/Resources/mapping_actions_pipes.yml new file mode 100644 index 00000000000..5799fead740 --- /dev/null +++ b/Resources/mapping_actions_pipes.yml @@ -0,0 +1,139 @@ +- action: !type:InstantActionComponent + icon: + entity: GasPipeStraight + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasPipeStraight + assignments: + - 0: 1 + name: Gas Pipe Straight +- action: !type:InstantActionComponent + icon: + entity: GasPipeBend + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasPipeBend + assignments: + - 0: 2 + name: Gas Pipe Bend +- action: !type:InstantActionComponent + icon: + entity: GasPipeTJunction + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasPipeTJunction + assignments: + - 0: 3 + name: Gas Pipe T-Junction +- action: !type:InstantActionComponent + icon: + entity: GasPipeFourway + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasPipeFourway + assignments: + - 0: 4 + name: Gas Pipe Fourway +- action: !type:InstantActionComponent + icon: + entity: GasVentScrubber + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasVentScrubber + assignments: + - 0: 5 + name: Gas Vent Scrubber +- action: !type:InstantActionComponent + icon: + entity: GasVentPump + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasVentPump + assignments: + - 0: 6 + name: Gas Vent Pump +- action: !type:InstantActionComponent + icon: + entity: GasVolumePump + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasVolumePump + assignments: + - 0: 7 + name: Gas Volume Pump +- action: !type:InstantActionComponent + EntityIcon: + entity: GasPort + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasPort + assignments: + - 0: 8 + name: Gas Port +- action: !type:InstantActionComponent + icon: + entity: GasPressurePump + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: GasPressurePump + assignments: + - 0: 9 + name: Gas Pressure Pump +- action: !type:InstantActionComponent + icon: Interface/VerbIcons/delete.svg.192dpi.png + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + eraser: True + assignments: + - 0: 0 + name: action-name-mapping-erase +... diff --git a/Resources/mapping_actions_power.yml b/Resources/mapping_actions_power.yml new file mode 100644 index 00000000000..f1e59b9789b --- /dev/null +++ b/Resources/mapping_actions_power.yml @@ -0,0 +1,139 @@ +- action: !type:InstantActionComponent + icon: + entity: APCBasic + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: APCBasic + assignments: + - 0: 1 + name: APC Basic +- action: !type:InstantActionComponent + icon: + entity: CableApcExtension + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: CableApcExtension + assignments: + - 0: 2 + name: Cable ApcExtension +- action: !type:InstantActionComponent + icon: + entity: CableMV + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: CableMV + assignments: + - 0: 3 + name: Cable MV +- action: !type:InstantActionComponent + icon: + entity: CableHV + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: CableHV + assignments: + - 0: 4 + name: Cable HV +- action: !type:InstantActionComponent + icon: + entity: SubstationBasic + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: SubstationBasic + assignments: + - 0: 5 + name: Substation Basic +- action: !type:InstantActionComponent + icon: + entity: SMESBasic + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: SMESBasic + assignments: + - 0: 6 + name: SMES Basic +- action: !type:InstantActionComponent + icon: + entity: CableTerminal + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: CableTerminal + assignments: + - 0: 7 + name: Cable Terminal +- action: !type:InstantActionComponent + icon: + entity: Poweredlight + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: Poweredlight + assignments: + - 0: 8 + name: Powered light +- action: !type:InstantActionComponent + icon: + entity: PoweredSmallLightMaintenance + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + placementOption: SnapgridCenter + entityType: PoweredSmallLightMaintenance + assignments: + - 0: 9 + name: Small Light Maintenance +- action: !type:InstantActionComponent + icon: Interface/VerbIcons/delete.svg.192dpi.png + keywords: [] + checkCanInteract: False + clientExclusive: True + autoPopulate: False + temporary: True + event: !type:StartPlacementActionEvent + eraser: True + assignments: + - 0: 0 + name: action-name-mapping-erase +...