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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user