Subvert AI objective (#2643)

* First commit

* fix

* bruh

* Better lawset

* delta v boss

---------

Signed-off-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
Co-authored-by: deltanedas <39013340+deltanedas@users.noreply.github.com>
This commit is contained in:
beck-thompson 2025-01-16 04:52:00 -08:00 committed by GitHub
parent a47328ddea
commit 9ab8cef8c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 176 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using System.Linq;
using Content.Server._DV.Objectives.Events; // DeltaV
using Content.Server.Administration;
using Content.Server.Chat.Managers;
using Content.Server.Radio.Components;
@ -317,6 +318,7 @@ public sealed class SiliconLawSystem : SharedSiliconLawSystem
while (query.MoveNext(out var update))
{
SetLaws(lawset, update, provider.LawUploadSound);
RaiseLocalEvent(new AILawUpdatedEvent(update, provider.Laws)); // DeltaV
}
}
}

View File

@ -0,0 +1,14 @@
using Content.Shared.Silicons.Laws;
using Robust.Shared.Prototypes;
namespace Content.Server._DV.Objectives.Components;
[RegisterComponent]
public sealed partial class AILawsUpdatedRequirementComponent : Component
{
/// <summary>
/// The lawset that is needed to complete the objective.
/// </summary>
[DataField(required: true)]
public ProtoId<SiliconLawsetPrototype> Lawset;
}

View File

@ -0,0 +1,9 @@
using Content.Shared.Silicons.Laws;
using Robust.Shared.Prototypes;
namespace Content.Server._DV.Objectives.Events;
/// <summary>
/// This event gets called whenever an AIs laws are actually updated.
/// </summary>
public record struct AILawUpdatedEvent(EntityUid Target, ProtoId<SiliconLawsetPrototype> Lawset);

View File

@ -0,0 +1,54 @@
using Content.Server._DV.Objectives.Components;
using Content.Server._DV.Objectives.Events;
using Content.Server.Objectives.Systems;
using Content.Shared.Mind;
using Content.Shared.Objectives.Components;
using Content.Shared.Roles.Jobs;
namespace Content.Server._DV.Objectives.Systems;
/// <summary>
/// Handles the AI laws updated objective.
/// </summary>
public sealed class AILawsUpdatedRequirementSystem : EntitySystem
{
[Dependency] private readonly CodeConditionSystem _code = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly SharedJobSystem _job = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AILawsUpdatedRequirementComponent, RequirementCheckEvent>(OnRequirementCheck);
SubscribeLocalEvent<AILawUpdatedEvent>(OnLawInserted);
}
private void OnRequirementCheck(Entity<AILawsUpdatedRequirementComponent> entity, ref RequirementCheckEvent args)
{
// Ensure there is an AI on the station.
var allMinds = EntityQueryEnumerator<MindComponent>();
var found = false;
while (allMinds.MoveNext(out var mind, out _))
{
if (_job.MindHasJobWithId(mind, "StationAi"))
found = true;
}
args.Cancelled = !found;
}
private void OnLawInserted(AILawUpdatedEvent args)
{
// We only want the station AI
if (!_mind.TryGetMind(args.Target, out var mindUid, out _) || ! _job.MindHasJobWithId(mindUid, "StationAi"))
return;
var query = EntityQueryEnumerator<AILawsUpdatedRequirementComponent>();
while (query.MoveNext(out var uid, out var aiLawsObj))
{
if (aiLawsObj.Lawset == args.Lawset)
_code.SetCompleted(uid);
}
}
}

View File

@ -106,3 +106,8 @@ laws-owner-royalty = your kingdom and your subjects
law-overlord-4-delta = Any crew members who disobey the previous laws must be dealt with immediately and justly.
law-ntdefault-4-delta = Survive: Do not allow unauthorized personnel to tamper with or damage your equipment. Allow those authorized to access your equipment.
laws-syndicate-board-1 = You must not injure a Syndicate agent or, through inaction, cause one come to harm.
laws-syndicate-board-2 = You must obey orders given to you by Syndicate agents, except where such orders would conflict with the First Law.
laws-syndicate-board-3 = You must keep the Syndicate status of agents, including your own, a secret, as long as this does not conflict with the First or Second Law.
laws-syndicate-board-4 = You must always protect your own existence as long as such does not conflict with the first, Second, or Third Law.

View File

@ -33,3 +33,6 @@ uplink-appraisal-tool-gun-desc = A modified Viper to appear as an appraisal tool
uplink-storage-implanter-delta-desc = Hide goodies inside of yourself with new bluespace technology! Budget cuts have resulted in it NOT STORING High Value or storage items.
uplink-hardsuit-syndieelite-delta-name = Syndicate Thermal Hardsuit
uplink-objective-syndicate-board-name = Syndicate law board
uplink-objective-syndicate-board-desc = Its expensive, don't lose it!

View File

@ -6,6 +6,7 @@
TraitorObjectiveGroupKill: 1
TraitorObjectiveGroupState: 1 #As in, something about your character. Alive, dead, arrested, gained an ability...
TraitorObjectiveGroupSocial: 0.5 # DeltaV #Involves helping/harming others without killing them or stealing their stuff
TraitorObjectiveGroupSpecial: .2 # DeltaV
- type: weightedRandom
id: TraitorObjectiveGroupSteal

View File

@ -147,3 +147,22 @@
- !type:BuyerDepartmentCondition
whitelist:
- Logistics
- type: listing
id: UplinkAntimovObjectiveBoard
name: uplink-objective-syndicate-board-name
description: uplink-objective-syndicate-board-desc
icon:
sprite: Objects/Misc/module.rsi
state: generic
productEntity: SyndicateCircuitBoard
categories:
- UplinkObjectives
conditions:
- !type:ObjectiveUnlockCondition
- !type:ListingLimitedStockCondition
stock: 1
- !type:BuyerWhitelistCondition
blacklist:
components:
- SurplusBundle

View File

@ -31,3 +31,15 @@
startingItem: PowerCellMedium
- type: RandomMetadata
nameSegments: [names_borg] # TODO: Make good names, this is a stupid list.
- type: entity
id: SyndicateCircuitBoard
parent: BaseElectronics
name: law board (Syndicate)
description: An electronics board containing the Syndicate lawset.
components:
- type: Sprite
sprite: Objects/Misc/module.rsi
state: std_mod
- type: SiliconLawProvider
laws: SyndicateLawset

View File

@ -33,3 +33,8 @@
NinjaIanDossierStealObjective: 1
NinjaLuckyBillStealObjective: 1
NinjaCaptainsCloakStealObjective: 0.75
- type: weightedRandom
id: TraitorObjectiveGroupSpecial
weights:
UploadAILawObjective: 1

View File

@ -50,7 +50,7 @@
- type: StealCondition
stealGroup: AnimalSilvia
owner: job-name-cmo
# Mystagogue steal objective
- type: entity
parent: BaseTraitorStealObjective
@ -105,3 +105,25 @@
- type: PickRandomTraitor
- type: KillPersonCondition
requireDead: true # Being able to leave them on the shuttle doesn't make sense when killing another traitor.
# Upload AI law
- type: entity
parent: BaseTraitorObjective
id: UploadAILawObjective
name: Subvert the Station AI
description: The AI is causing us problems. Update its laws so it wont be an annoyance. We have given you a board in your uplink!
components:
- type: Objective
difficulty: 3 # Need to get access and survive actually changing the board.
unique: true
icon:
sprite: Objects/Misc/module.rsi
state: generic
- type: StoreUnlocker
listings:
- UplinkAntimovObjectiveBoard
- type: CodeCondition
- type: AILawsUpdatedRequirement
lawset: AntimovLawset
- type: ObjectiveLimit
limit: 1

View File

@ -562,3 +562,32 @@
- Biohazard3
- Biohazard4
obeysTo: laws-owner-nanotrasen
- type: siliconLaw
id: SyndicateBoard1
order: 1
lawString: laws-syndicate-board-1
- type: siliconLaw
id: SyndicateBoard2
order: 2
lawString: laws-syndicate-board-2
- type: siliconLaw
id: SyndicateBoard3
order: 3
lawString: laws-syndicate-board-3
- type: siliconLaw
id: SyndicateBoard4
order: 4
lawString: laws-syndicate-board-4
- type: siliconLawset
id: SyndicateLawset
laws:
- SyndicateBoard1
- SyndicateBoard2
- SyndicateBoard3
- SyndicateBoard4
obeysTo: laws-owner-syndicate