mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-16 21:17:39 +03:00
* 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
80 lines
2.8 KiB
C#
80 lines
2.8 KiB
C#
using Content.Server.Mind.Components;
|
|
using Content.Shared.Containers.ItemSlots;
|
|
using Content.Shared.Silicons.Borgs.Components;
|
|
using Robust.Shared.Containers;
|
|
|
|
namespace Content.Server.Silicons.Borgs;
|
|
|
|
/// <inheritdoc/>
|
|
public sealed partial class BorgSystem
|
|
{
|
|
public void InitializeMMI()
|
|
{
|
|
SubscribeLocalEvent<MMIComponent, ComponentInit>(OnMMIInit);
|
|
SubscribeLocalEvent<MMIComponent, EntInsertedIntoContainerMessage>(OnMMIEntityInserted);
|
|
SubscribeLocalEvent<MMIComponent, MindAddedMessage>(OnMMIMindAdded);
|
|
SubscribeLocalEvent<MMIComponent, MindRemovedMessage>(OnMMIMindRemoved);
|
|
|
|
SubscribeLocalEvent<MMILinkedComponent, MindAddedMessage>(OnMMILinkedMindAdded);
|
|
SubscribeLocalEvent<MMILinkedComponent, EntGotRemovedFromContainerMessage>(OnMMILinkedRemoved);
|
|
}
|
|
|
|
private void OnMMIInit(EntityUid uid, MMIComponent component, ComponentInit args)
|
|
{
|
|
if (!TryComp<ItemSlotsComponent>(uid, out var itemSlots))
|
|
return;
|
|
|
|
if (ItemSlots.TryGetSlot(uid, component.BrainSlotId, out var slot, itemSlots))
|
|
component.BrainSlot = slot;
|
|
else
|
|
ItemSlots.AddItemSlot(uid, component.BrainSlotId, component.BrainSlot, itemSlots);
|
|
}
|
|
|
|
private void OnMMIEntityInserted(EntityUid uid, MMIComponent component, EntInsertedIntoContainerMessage args)
|
|
{
|
|
if (args.Container.ID != component.BrainSlotId)
|
|
return;
|
|
|
|
var ent = args.Entity;
|
|
var linked = EnsureComp<MMILinkedComponent>(ent);
|
|
linked.LinkedMMI = uid;
|
|
|
|
if (_mind.TryGetMind(ent, out var mind))
|
|
_mind.TransferTo(mind, uid, true);
|
|
|
|
_appearance.SetData(uid, MMIVisuals.BrainPresent, true);
|
|
}
|
|
|
|
private void OnMMIMindAdded(EntityUid uid, MMIComponent component, MindAddedMessage args)
|
|
{
|
|
_appearance.SetData(uid, MMIVisuals.HasMind, true);
|
|
}
|
|
|
|
private void OnMMIMindRemoved(EntityUid uid, MMIComponent component, MindRemovedMessage args)
|
|
{
|
|
_appearance.SetData(uid, MMIVisuals.HasMind, false);
|
|
}
|
|
|
|
private void OnMMILinkedMindAdded(EntityUid uid, MMILinkedComponent component, MindAddedMessage args)
|
|
{
|
|
if (!_mind.TryGetMind(uid, out var mind) || component.LinkedMMI == null)
|
|
return;
|
|
_mind.TransferTo(mind, component.LinkedMMI, true);
|
|
}
|
|
|
|
private void OnMMILinkedRemoved(EntityUid uid, MMILinkedComponent component, EntGotRemovedFromContainerMessage args)
|
|
{
|
|
if (Terminating(uid))
|
|
return;
|
|
|
|
if (component.LinkedMMI is not { } linked)
|
|
return;
|
|
RemComp(uid, component);
|
|
|
|
if (_mind.TryGetMind(linked, out var mind))
|
|
_mind.TransferTo(mind, uid, true);
|
|
|
|
_appearance.SetData(linked, MMIVisuals.BrainPresent, false);
|
|
}
|
|
}
|