Skip to content

Commit

Permalink
Adds load acts + action bar loadout files (DeltaV-Station#1921)
Browse files Browse the repository at this point in the history
Co-authored-by: Velcroboy <velcroboy333@hotmail.com>
  • Loading branch information
IamVelcroboy and BurningRash authored Sep 27, 2024
1 parent 17f48f5 commit 6a80988
Show file tree
Hide file tree
Showing 6 changed files with 718 additions and 2 deletions.
27 changes: 25 additions & 2 deletions Content.Client/Commands/ActionsCommands.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -59,4 +62,24 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args)
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
}
}

/// <summary>
/// DeltaV - Load actions from a file stream instead
/// </summary>
private static async void LoadActs()
{
var fileMan = IoCManager.Resolve<IFileDialogManager>();
var actMan = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ActionsSystem>();

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();
}
}
139 changes: 139 additions & 0 deletions Resources/mapping_actions_alarms.yml
Original file line number Diff line number Diff line change
@@ -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
...
136 changes: 136 additions & 0 deletions Resources/mapping_actions_deltav.yml
Original file line number Diff line number Diff line change
@@ -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
...
Loading

0 comments on commit 6a80988

Please sign in to comment.