Set pAI up with a static map the pAI can use (#23499)
* Set pAI up with a trackless map * Added a untracked map user interface class to support gps-less mapping * Added to pAI by default, expect it to be given to borgs as well in time. As the personal AI is literally immobile as a ghost, it is useful to ensure that people carry one. With that idea in mind, it is worth giving the pAI a reason to be carried that doesn't depend on the player having a cracking selection of midi files on hand. * Tried to use new ProtoId and have EntityUid on the client as commented by metalgearsloth * Review --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -16,7 +16,6 @@ public sealed class NavMapBeaconBoundUserInterface : BoundUserInterface
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new NavMapBeaconWindow(Owner);
|
||||
_window.OpenCentered();
|
||||
_window.OnClose += Close;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Pinpointer.UI;
|
||||
|
||||
public sealed class UntrackedStationMapBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private StationMapWindow? _window;
|
||||
|
||||
public UntrackedStationMapBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
_window?.Close();
|
||||
EntityUid? gridUid = null;
|
||||
|
||||
if (EntMan.TryGetComponent<TransformComponent>(Owner, out var xform))
|
||||
{
|
||||
gridUid = xform.GridUid;
|
||||
}
|
||||
|
||||
_window = new StationMapWindow(gridUid, null);
|
||||
_window.OpenCentered();
|
||||
_window.OnClose += Close;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
_window?.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -14,38 +14,43 @@ namespace Content.Shared.PAI;
|
||||
/// and there's not always enough players and ghost roles to justify it.
|
||||
/// All logic in PAISystem.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class PAIComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The last person who activated this PAI.
|
||||
/// Used for assigning the name.
|
||||
/// </summary>
|
||||
[DataField("lastUser"), ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public EntityUid? LastUser;
|
||||
|
||||
[DataField("midiActionId", serverOnly: true,
|
||||
customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string? MidiActionId = "ActionPAIPlayMidi";
|
||||
[DataField(serverOnly: true)]
|
||||
public EntProtoId? MidiActionId = "ActionPAIPlayMidi";
|
||||
|
||||
[DataField("midiAction", serverOnly: true)] // server only, as it uses a server-BUI event !type
|
||||
[DataField(serverOnly: true)] // server only, as it uses a server-BUI event !type
|
||||
public EntityUid? MidiAction;
|
||||
|
||||
[DataField]
|
||||
public ProtoId<EntityPrototype> MapActionId = "ActionPAIOpenMap";
|
||||
|
||||
[DataField, AutoNetworkedField]
|
||||
public EntityUid? MapAction;
|
||||
|
||||
/// <summary>
|
||||
/// When microwaved there is this chance to brick the pai, kicking out its player and preventing it from being used again.
|
||||
/// </summary>
|
||||
[DataField("brickChance")]
|
||||
[DataField]
|
||||
public float BrickChance = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Locale id for the popup shown when the pai gets bricked.
|
||||
/// </summary>
|
||||
[DataField("brickPopup")]
|
||||
[DataField]
|
||||
public string BrickPopup = "pai-system-brick-popup";
|
||||
|
||||
/// <summary>
|
||||
/// Locale id for the popup shown when the pai is microwaved but does not get bricked.
|
||||
/// </summary>
|
||||
[DataField("scramblePopup")]
|
||||
[DataField]
|
||||
public string ScramblePopup = "pai-system-scramble-popup";
|
||||
}
|
||||
|
||||
@@ -26,11 +26,13 @@ namespace Content.Shared.PAI
|
||||
private void OnMapInit(EntityUid uid, PAIComponent component, MapInitEvent args)
|
||||
{
|
||||
_actionsSystem.AddAction(uid, ref component.MidiAction, component.MidiActionId);
|
||||
_actionsSystem.AddAction(uid, ref component.MapAction, component.MapActionId);
|
||||
}
|
||||
|
||||
private void OnShutdown(EntityUid uid, PAIComponent component, ComponentShutdown args)
|
||||
{
|
||||
_actionsSystem.RemoveAction(uid, component.MidiAction);
|
||||
_actionsSystem.RemoveAction(uid, component.MapAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
interfaces:
|
||||
- key: enum.InstrumentUiKey.Key
|
||||
type: InstrumentBoundUserInterface
|
||||
- key: enum.StationMapUiKey.Key
|
||||
type: UntrackedStationMapBoundUserInterface
|
||||
- type: Sprite
|
||||
sprite: Objects/Fun/pai.rsi
|
||||
layers:
|
||||
@@ -67,6 +69,7 @@
|
||||
Off: { state: pai-off-overlay }
|
||||
Searching: { state: pai-searching-overlay }
|
||||
On: { state: pai-on-overlay }
|
||||
- type: StationMap
|
||||
|
||||
- type: entity
|
||||
parent: PersonalAI
|
||||
@@ -138,3 +141,15 @@
|
||||
icon: Interface/Actions/pai-midi.png
|
||||
event: !type:OpenUiActionEvent
|
||||
key: enum.InstrumentUiKey.Key
|
||||
|
||||
- type: entity
|
||||
id: ActionPAIOpenMap
|
||||
name: Open Map
|
||||
description: Open your map interface and guide your owner.
|
||||
noSpawn: true
|
||||
components:
|
||||
- type: InstantAction
|
||||
checkCanInteract: false
|
||||
icon: Interface/home.png
|
||||
event: !type:OpenUiActionEvent
|
||||
key: enum.StationMapUiKey.Key
|
||||
|
||||
Reference in New Issue
Block a user