using Content.Server.Ghost.Roles.Components;
using Content.Server.Instruments;
using Content.Server.Kitchen.Components;
+using Content.Server.Store.Systems;
using Content.Shared.Interaction.Events;
using Content.Shared.Mind.Components;
using Content.Shared.PAI;
using Content.Shared.Popups;
+using Content.Shared.Store;
+using Content.Shared.Store.Components;
+using Content.Shared.Instruments;
using Robust.Shared.Random;
+using Robust.Shared.Prototypes;
using System.Text;
-using Content.Shared.Instruments;
-using Robust.Shared.Player;
namespace Content.Server.PAI;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
+ [Dependency] private readonly StoreSystem _store = default!;
[Dependency] private readonly ToggleableGhostRoleSystem _toggleableGhostRole = default!;
/// <summary>
/// Possible symbols that can be part of a scrambled pai's name.
/// </summary>
- private static readonly char[] SYMBOLS = new[] { '#', '~', '-', '@', '&', '^', '%', '$', '*', ' '};
+ private static readonly char[] SYMBOLS = new[] { '#', '~', '-', '@', '&', '^', '%', '$', '*', ' ' };
public override void Initialize()
{
SubscribeLocalEvent<PAIComponent, MindAddedMessage>(OnMindAdded);
SubscribeLocalEvent<PAIComponent, MindRemovedMessage>(OnMindRemoved);
SubscribeLocalEvent<PAIComponent, BeingMicrowavedEvent>(OnMicrowaved);
+
+ SubscribeLocalEvent<PAIComponent, PAIShopActionEvent>(OnShop);
}
private void OnUseInHand(EntityUid uid, PAIComponent component, UseInHandEvent args)
_metaData.SetEntityName(uid, val);
}
+ private void OnShop(Entity<PAIComponent> ent, ref PAIShopActionEvent args)
+ {
+ if (!TryComp<StoreComponent>(ent, out var store))
+ return;
+
+ _store.ToggleUi(args.Performer, ent, store);
+ }
+
public void PAITurningOff(EntityUid uid)
{
// Close the instrument interface if it was open
+using Content.Shared.FixedPoint;
+using Content.Shared.Store;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
[DataField, ViewVariables(VVAccess.ReadWrite)]
public EntityUid? LastUser;
- [DataField(serverOnly: true)]
- public EntProtoId? MidiActionId = "ActionPAIPlayMidi";
-
- [DataField(serverOnly: true)] // server only, as it uses a server-BUI event !type
- public EntityUid? MidiAction;
-
[DataField]
- public EntProtoId MapActionId = "ActionPAIOpenMap";
+ public EntProtoId ShopActionId = "ActionPAIOpenShop";
[DataField, AutoNetworkedField]
- public EntityUid? MapAction;
+ public EntityUid? ShopAction;
/// <summary>
/// When microwaved there is this chance to brick the pai, kicking out its player and preventing it from being used again.
using Content.Shared.Actions;
-namespace Content.Shared.PAI
+namespace Content.Shared.PAI;
+
+/// <summary>
+/// pAIs, or Personal AIs, are essentially portable ghost role generators.
+/// In their current implementation, they create a ghost role anyone can access,
+/// and that a player can also "wipe" (reset/kick out player).
+/// Theoretically speaking pAIs are supposed to use a dedicated "offer and select" system,
+/// with the player holding the pAI being able to choose one of the ghosts in the round.
+/// This seems too complicated for an initial implementation, though,
+/// and there's not always enough players and ghost roles to justify it.
+/// </summary>
+public abstract class SharedPAISystem : EntitySystem
{
- /// <summary>
- /// pAIs, or Personal AIs, are essentially portable ghost role generators.
- /// In their current implementation, they create a ghost role anyone can access,
- /// and that a player can also "wipe" (reset/kick out player).
- /// Theoretically speaking pAIs are supposed to use a dedicated "offer and select" system,
- /// with the player holding the pAI being able to choose one of the ghosts in the round.
- /// This seems too complicated for an initial implementation, though,
- /// and there's not always enough players and ghost roles to justify it.
- /// </summary>
- public abstract class SharedPAISystem : EntitySystem
- {
- [Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
+ [Dependency] private readonly SharedActionsSystem _actions = default!;
- public override void Initialize()
- {
- base.Initialize();
+ public override void Initialize()
+ {
+ base.Initialize();
- SubscribeLocalEvent<PAIComponent, MapInitEvent>(OnMapInit);
- SubscribeLocalEvent<PAIComponent, ComponentShutdown>(OnShutdown);
- }
+ SubscribeLocalEvent<PAIComponent, MapInitEvent>(OnMapInit);
+ SubscribeLocalEvent<PAIComponent, ComponentShutdown>(OnShutdown);
+ }
- 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 OnMapInit(Entity<PAIComponent> ent, ref MapInitEvent args)
+ {
+ _actions.AddAction(ent, ent.Comp.ShopActionId);
+ }
- private void OnShutdown(EntityUid uid, PAIComponent component, ComponentShutdown args)
- {
- _actionsSystem.RemoveAction(uid, component.MidiAction);
- _actionsSystem.RemoveAction(uid, component.MapAction);
- }
+ private void OnShutdown(Entity<PAIComponent> ent, ref ComponentShutdown args)
+ {
+ _actions.RemoveAction(ent, ent.Comp.ShopAction);
}
}
-
+public sealed partial class PAIShopActionEvent : InstantActionEvent
+{
+}
}
store-currency-display-telecrystal = TC
store-currency-display-stolen-essence = Stolen Essence
+store-currency-display-silicon-memory = Memory
store-currency-display-wizcoin = Wiz€oin™
--- /dev/null
+pai-mass-scanner-name = Mass Scanner
+pai-mass-scanner-desc = Enables you to scan nearby masses to assist in navigation.
+
+pai-midi-player-name = MIDI Player
+pai-midi-player-desc = Enables you to play music to entertain your owner.
+
+pai-station-map-name = Station Map
+pai-station-map-desc = Enables you to view the station map to assist in navigation.
--- /dev/null
+# Some things might seem like great ideas on paper for pAI apps, but have deliberately been excluded.
+# e.g. Monitoring (Power/Atmos/Crew), Cameras, etc. are excluded as apps for performance and balance reasons.
+# Generally speaking, if you're adding an application, it needs to *not* be round-impacting.
+# Remember that pAI's are *assistants*, not players.
+
+- type: listing
+ id: PAIMassScanner
+ name: pai-mass-scanner-name
+ description: pai-mass-scanner-desc
+ productAction: ActionPAIMassScanner
+ cost:
+ SiliconMemory: 10
+ categories:
+ - PAIAbilities
+ conditions:
+ - !type:ListingLimitedStockCondition
+ stock: 1
+
+- type: listing
+ id: PAIMIDIPlayer
+ name: pai-midi-player-name
+ description: pai-midi-player-desc
+ productAction: ActionPAIPlayMidi
+ cost:
+ SiliconMemory: 5
+ categories:
+ - PAIAbilities
+ conditions:
+ - !type:ListingLimitedStockCondition
+ stock: 1
+
+- type: listing
+ id: PAIStationMap
+ name: pai-station-map-name
+ description: pai-station-map-desc
+ productAction: ActionPAIOpenMap
+ cost:
+ SiliconMemory: 5
+ categories:
+ - PAIAbilities
+ conditions:
+ - !type:ListingLimitedStockCondition
+ stock: 1
program: 2
- type: UserInterface
interfaces:
+ enum.StoreUiKey.Key:
+ type: StoreBoundUserInterface
+ requireInputValidation: false
+ # available in pai shop
+ enum.RadarConsoleUiKey.Key:
+ type: RadarConsoleBoundUserInterface
+ requireInputValidation: false
enum.InstrumentUiKey.Key:
type: InstrumentBoundUserInterface
requireInputValidation: false
- Common
- type: DoAfter
- type: Actions
+ - type: Store
+ categories:
+ - PAIAbilities
+ currencyWhitelist:
+ - SiliconMemory
+ balance:
+ SiliconMemory: 30
+ - type: RadarConsole
+ maxRange: 256
+ followEntity: true
- type: TypingIndicator
proto: robot
- type: Speech
graph: PotatoAI
node: potatoai
+- type: entity
+ id: ActionPAIOpenShop
+ name: Software Catalog
+ description: Install new software to assist your owner.
+ components:
+ - type: InstantAction
+ checkCanInteract: false
+ checkConsciousness: false
+ icon: Interface/Actions/shop.png
+ event: !type:PAIShopActionEvent
+
+- type: entity
+ id: ActionPAIMassScanner
+ name: Mass Scanner
+ description: View a mass scanner interface.
+ components:
+ - type: InstantAction
+ checkCanInteract: false
+ checkConsciousness: false
+ icon: { sprite: Interface/Actions/actions_ai.rsi, state: mass_scanner }
+ itemIconStyle: NoItem
+ event: !type:OpenUiActionEvent
+ key: enum.RadarConsoleUiKey.Key
+
- type: entity
id: ActionPAIPlayMidi
name: Play MIDI
checkCanInteract: false
checkConsciousness: false
icon: Interface/Actions/pai-midi.png
+ itemIconStyle: NoItem
event: !type:OpenUiActionEvent
key: enum.InstrumentUiKey.Key
checkCanInteract: false
checkConsciousness: false
icon: { sprite: Interface/Actions/pai-map.rsi, state: icon }
+ itemIconStyle: NoItem
event: !type:OpenUiActionEvent
key: enum.StationMapUiKey.Key
id: RevenantAbilities
name: store-category-abilities
+#pai
+- type: storeCategory
+ id: PAIAbilities
+ name: store-category-abilities
+
- type: storeCategory
id: DiscountedItems
name: store-discounted-items
displayName: store-currency-display-stolen-essence
canWithdraw: false
+- type: currency
+ id: SiliconMemory
+ displayName: store-currency-display-silicon-memory
+ canWithdraw: false
+
- type: currency
id: WizCoin
displayName: store-currency-display-wizcoin