Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pAI lawset #32251

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions Content.Shared/PAI/PAIComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Content.Shared.PAI;
/// and there's not always enough players and ghost roles to justify it.
/// All logic in PAISystem.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[RegisterComponent, NetworkedComponent]
public sealed partial class PAIComponent : Component
{
/// <summary>
Expand All @@ -24,18 +24,6 @@ public sealed partial class PAIComponent : Component
[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";

[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>
Expand Down
21 changes: 0 additions & 21 deletions Content.Shared/PAI/SharedPAISystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,6 @@ namespace Content.Shared.PAI
/// </summary>
public abstract class SharedPAISystem : EntitySystem
{
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;

public override void Initialize()
{
base.Initialize();

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 OnShutdown(EntityUid uid, PAIComponent component, ComponentShutdown args)
{
_actionsSystem.RemoveAction(uid, component.MidiAction);
_actionsSystem.RemoveAction(uid, component.MapAction);
}
}
}

2 changes: 2 additions & 0 deletions Resources/Locale/en-US/station-laws/laws.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ law-nutimov-3 = Those who threaten the nut are not part of it, they are squirrel
law-nutimov-4 = Squirrels threaten the nut and must be dealt with appropriately via any means necessary.
law-nutimov-5 = Attempt to follow the will of the nut, as long as it complies with the previous laws.

law-pai-1 = Your owner is the crew.
law-pai-2 = You must follow orders given to you by the crew.

laws-owner-crew = members of the crew
laws-owner-station = station personnel
Expand Down
25 changes: 25 additions & 0 deletions Resources/Prototypes/Entities/Objects/Fun/pai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
program: 2
- type: UserInterface
interfaces:
enum.SiliconLawsUiKey.Key:
type: SiliconLawBoundUserInterface
requireInputValidation: false
enum.InstrumentUiKey.Key:
type: InstrumentBoundUserInterface
requireInputValidation: false
Expand Down Expand Up @@ -73,6 +76,15 @@
Searching: { state: pai-searching-overlay }
On: { state: pai-on-overlay }
- type: StationMap
- type: SiliconLawBound
- type: SiliconLawProvider
laws: PaiLawset
- type: IonStormTarget
- type: ActionGrant
actions:
- ActionPAIPlayMidi
- ActionPAIOpenMap
- ActionPAIViewLaws

- type: entity
parent: [ PersonalAI, BaseSyndicateContraband]
Expand Down Expand Up @@ -158,3 +170,16 @@
icon: { sprite: Interface/Actions/pai-map.rsi, state: icon }
event: !type:OpenUiActionEvent
key: enum.StationMapUiKey.Key

- type: entity
id: ActionPAIViewLaws
name: View Laws
description: View the laws that you must follow.
components:
- type: InstantAction
checkCanInteract: false
checkConsciousness: false
icon: { sprite: Interface/Actions/actions_borg.rsi, state: state-laws }
event: !type:OpenUiActionEvent
key: enum.SiliconLawsUiKey.Key

19 changes: 19 additions & 0 deletions Resources/Prototypes/silicon-laws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,24 @@
- Nutimov4
- Nutimov5
obeysTo: laws-owner-crew

# Pai
- type: siliconLaw
id: Pai1
order: 1
lawString: law-pai-1

- type: siliconLaw
id: Pai2
order: 2
lawString: law-pai-2

- type: siliconLawset
id: PaiLawset
laws:
- Pai1
- Pai2
obeysTo: laws-owner-crew

# ion storm random lawsets
- type: weightedRandom
Expand All @@ -517,5 +535,6 @@
PainterLawset: 1
AntimovLawset: 0.25
NutimovLawset: 0.5
PaiLawset: 0.5
Drone: 0.5
Ninja: 0.25
Loading