* Laws

* positronic brain and PAI rewrite

* MMI

* MMI pt. 2

* borg brain transfer

* Roleban support, Borg job (WIP), the end of mind shenaniganry

* battery drain, item slot cleanup, alerts

* visuals

* fix this pt1

* fix this pt2

* Modules, Lingering Stacks, Better borg flashlight

* Start on UI, fix battery alerts, expand activation/deactivation, low movement speed on no power.

* sprotes

* no zombie borgs

* oh fuck yeah i love a good relay

* charger

* fix the tiniest of sprite issues

* adjustable names

* a functional UI????

* foobar

* more modules

* this shit for some reason

* upstream

* genericize selectable borg modules

* upstream again

* holy fucking shit

* i love christ

* proper construction

* da job

* AA borgs

* and boom more shit

* admin logs

* laws redux

* ok just do this rq

* oh boy that looks like modules

* oh shit research

* testos passo

* so much shit holy fuck

* fuckit we SHIP

* last minute snags

* should've gotten me on a better day
This commit is contained in:
Nemanja
2023-08-12 17:39:58 -04:00
committed by GitHub
parent ac4f496535
commit 98fa00a21f
314 changed files with 7094 additions and 484 deletions

View File

@@ -1,91 +1,45 @@
using Content.Server.Ghost.Roles.Components;
using Content.Server.Instruments;
using Content.Server.Mind.Components;
using Content.Server.Popups;
using Content.Shared.Examine;
using Content.Shared.Interaction.Events;
using Content.Shared.PAI;
using Content.Shared.Popups;
using Content.Shared.Verbs;
using Robust.Server.GameObjects;
namespace Content.Server.PAI
{
public sealed class PAISystem : SharedPAISystem
{
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly InstrumentSystem _instrumentSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PAIComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<PAIComponent, UseInHandEvent>(OnUseInHand);
SubscribeLocalEvent<PAIComponent, MindAddedMessage>(OnMindAdded);
SubscribeLocalEvent<PAIComponent, MindRemovedMessage>(OnMindRemoved);
SubscribeLocalEvent<PAIComponent, GetVerbsEvent<ActivationVerb>>(AddWipeVerb);
}
private void OnExamined(EntityUid uid, PAIComponent component, ExaminedEvent args)
{
if (args.IsInDetailsRange)
{
if (EntityManager.TryGetComponent<MindContainerComponent>(uid, out var mind) && mind.HasMind)
{
args.PushMarkup(Loc.GetString("pai-system-pai-installed"));
}
else if (EntityManager.HasComponent<GhostTakeoverAvailableComponent>(uid))
{
args.PushMarkup(Loc.GetString("pai-system-still-searching"));
}
else
{
args.PushMarkup(Loc.GetString("pai-system-off"));
}
}
}
private void OnUseInHand(EntityUid uid, PAIComponent component, UseInHandEvent args)
{
if (args.Handled)
return;
if (!TryComp<MindContainerComponent>(uid, out var mind) || !mind.HasMind)
component.LastUser = args.User;
}
// Placeholder PAIs are essentially portable ghost role generators.
args.Handled = true;
// Check for pAI activation
if (EntityManager.TryGetComponent<MindContainerComponent>(uid, out var mind) && mind.HasMind)
{
_popupSystem.PopupEntity(Loc.GetString("pai-system-pai-installed"), uid, args.User, PopupType.Large);
private void OnMindAdded(EntityUid uid, PAIComponent component, MindAddedMessage args)
{
if (component.LastUser == null)
return;
}
else if (EntityManager.HasComponent<GhostTakeoverAvailableComponent>(uid))
{
_popupSystem.PopupEntity(Loc.GetString("pai-system-still-searching"), uid, args.User);
return;
}
// Ownership tag
string val = Loc.GetString("pai-system-pai-name", ("owner", args.User));
var val = Loc.GetString("pai-system-pai-name", ("owner", component.LastUser));
// TODO Identity? People shouldn't dox-themselves by carrying around a PAI.
// But having the pda's name permanently be "old lady's PAI" is weird.
// Changing the PAI's identity in a way that ties it to the owner's identity also seems weird.
// Cause then you could remotely figure out information about the owner's equipped items.
EntityManager.GetComponent<MetaDataComponent>(component.Owner).EntityName = val;
var ghostRole = EnsureComp<GhostRoleComponent>(uid);
EnsureComp<GhostTakeoverAvailableComponent>(uid);
ghostRole.RoleName = Loc.GetString("pai-system-role-name");
ghostRole.RoleDescription = Loc.GetString("pai-system-role-description");
_popupSystem.PopupEntity(Loc.GetString("pai-system-searching"), uid, args.User);
UpdatePAIAppearance(uid, PAIStatus.Searching);
_metaData.SetEntityName(uid, val);
}
private void OnMindRemoved(EntityUid uid, PAIComponent component, MindRemovedMessage args)
@@ -94,18 +48,8 @@ namespace Content.Server.PAI
PAITurningOff(uid);
}
private void OnMindAdded(EntityUid uid, PAIComponent pai, MindAddedMessage args)
public void PAITurningOff(EntityUid uid)
{
// Mind was added, shutdown the ghost role stuff so it won't get in the way
if (EntityManager.HasComponent<GhostTakeoverAvailableComponent>(uid))
EntityManager.RemoveComponent<GhostTakeoverAvailableComponent>(uid);
UpdatePAIAppearance(uid, PAIStatus.On);
}
private void PAITurningOff(EntityUid uid)
{
UpdatePAIAppearance(uid, PAIStatus.Off);
// Close the instrument interface if it was open
// before closing
if (HasComp<ActiveInstrumentComponent>(uid) && TryComp<ActorComponent>(uid, out var actor))
@@ -114,63 +58,12 @@ namespace Content.Server.PAI
}
// Stop instrument
if (EntityManager.TryGetComponent<InstrumentComponent>(uid, out var instrument)) _instrumentSystem.Clean(uid, instrument);
if (EntityManager.TryGetComponent<MetaDataComponent>(uid, out var metadata))
if (TryComp<InstrumentComponent>(uid, out var instrument)) _instrumentSystem.Clean(uid, instrument);
if (TryComp<MetaDataComponent>(uid, out var metadata))
{
var proto = metadata.EntityPrototype;
if (proto != null)
metadata.EntityName = proto.Name;
}
}
private void UpdatePAIAppearance(EntityUid uid, PAIStatus status)
{
if (EntityManager.TryGetComponent<AppearanceComponent>(uid, out var appearance))
{
_appearance.SetData(uid, PAIVisuals.Status, status, appearance);
}
}
private void AddWipeVerb(EntityUid uid, PAIComponent pai, GetVerbsEvent<ActivationVerb> args)
{
if (!args.CanAccess || !args.CanInteract)
return;
if (EntityManager.TryGetComponent<MindContainerComponent>(uid, out var mind) && mind.HasMind)
{
ActivationVerb verb = new();
verb.Text = Loc.GetString("pai-system-wipe-device-verb-text");
verb.Act = () => {
if (pai.Deleted)
return;
// Wiping device :(
// The shutdown of the Mind should cause automatic reset of the pAI during OnMindRemoved
// EDIT: But it doesn't!!!! Wtf? Do stuff manually
if (EntityManager.HasComponent<MindContainerComponent>(uid))
{
EntityManager.RemoveComponent<MindContainerComponent>(uid);
_popupSystem.PopupEntity(Loc.GetString("pai-system-wiped-device"), uid, args.User, PopupType.Large);
PAITurningOff(uid);
}
};
args.Verbs.Add(verb);
}
else if (EntityManager.HasComponent<GhostTakeoverAvailableComponent>(uid))
{
ActivationVerb verb = new();
verb.Text = Loc.GetString("pai-system-stop-searching-verb-text");
verb.Act = () => {
if (pai.Deleted)
return;
if (EntityManager.HasComponent<GhostTakeoverAvailableComponent>(uid))
{
EntityManager.RemoveComponent<GhostTakeoverAvailableComponent>(uid);
EntityManager.RemoveComponent<GhostRoleComponent>(uid);
_popupSystem.PopupEntity(Loc.GetString("pai-system-stopped-searching"), uid, args.User);
PAITurningOff(uid);
}
};
args.Verbs.Add(verb);
_metaData.SetEntityName(uid, proto.Name);
}
}
}