More borg tweaks (#19143)
* borg tweaks but i'm gonna go code fun stuff first * werkin' on it * a ton of tweaks * fuck everyone and then myself
This commit is contained in:
@@ -38,6 +38,7 @@ public sealed partial class BorgSystem
|
||||
var ent = args.Entity;
|
||||
var linked = EnsureComp<MMILinkedComponent>(ent);
|
||||
linked.LinkedMMI = uid;
|
||||
Dirty(uid, component);
|
||||
|
||||
if (_mind.TryGetMind(ent, out var mind))
|
||||
_mind.TransferTo(mind, uid, true);
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.PowerCell;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.IdentityManagement;
|
||||
@@ -13,6 +14,7 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.PowerCell;
|
||||
using Content.Shared.PowerCell.Components;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.Silicons.Borgs;
|
||||
using Content.Shared.Silicons.Borgs.Components;
|
||||
using Content.Shared.Throwing;
|
||||
@@ -30,6 +32,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
[Dependency] private readonly IAdminLogManager _adminLog = default!;
|
||||
[Dependency] private readonly IBanManager _banManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedAccessSystem _access = default!;
|
||||
[Dependency] private readonly ActionsSystem _actions = default!;
|
||||
[Dependency] private readonly AlertsSystem _alerts = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
@@ -41,6 +44,9 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
[Dependency] private readonly ThrowingSystem _throwing = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||
|
||||
[ValidatePrototypeId<JobPrototype>]
|
||||
public const string BorgJobId = "Borg";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -66,18 +72,6 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
{
|
||||
UpdateBatteryAlert(uid);
|
||||
_movementSpeedModifier.RefreshMovementSpeedModifiers(uid);
|
||||
|
||||
var coordinates = Transform(uid).Coordinates;
|
||||
|
||||
if (component.StartingBrain != null)
|
||||
{
|
||||
component.BrainContainer.Insert(Spawn(component.StartingBrain, coordinates), EntityManager);
|
||||
}
|
||||
|
||||
foreach (var startingModule in component.StartingModules)
|
||||
{
|
||||
component.ModuleContainer.Insert(Spawn(startingModule, coordinates), EntityManager);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnChassisInteractUsing(EntityUid uid, BorgChassisComponent component, AfterInteractUsingEvent args)
|
||||
@@ -104,7 +98,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
{
|
||||
if (_mind.TryGetMind(used, out var mind) && mind.Session != null)
|
||||
{
|
||||
if (!CanPlayerBeBorgged(mind.Session, component))
|
||||
if (!CanPlayerBeBorgged(mind.Session))
|
||||
{
|
||||
Popup.PopupEntity(Loc.GetString("borg-player-not-allowed"), used, args.User);
|
||||
return;
|
||||
@@ -218,7 +212,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
if (!_mind.TryGetMind(uid, out var mind) || mind.Session == null)
|
||||
return;
|
||||
|
||||
if (!CanPlayerBeBorgged(mind.Session, chassisComponent))
|
||||
if (!CanPlayerBeBorgged(mind.Session))
|
||||
{
|
||||
Popup.PopupEntity(Loc.GetString("borg-player-not-allowed-eject"), uid);
|
||||
Container.RemoveEntity(containerEnt, uid);
|
||||
@@ -284,9 +278,9 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
/// </summary>
|
||||
public void BorgActivate(EntityUid uid, BorgChassisComponent component)
|
||||
{
|
||||
component.HasPlayer = true;
|
||||
Popup.PopupEntity(Loc.GetString("borg-mind-added", ("name", Identity.Name(uid, EntityManager))), uid);
|
||||
_powerCell.SetPowerCellDrawEnabled(uid, true);
|
||||
_access.SetAccessEnabled(uid, true);
|
||||
_appearance.SetData(uid, BorgVisuals.HasPlayer, true);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
@@ -296,9 +290,9 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
/// </summary>
|
||||
public void BorgDeactivate(EntityUid uid, BorgChassisComponent component)
|
||||
{
|
||||
component.HasPlayer = false;
|
||||
Popup.PopupEntity(Loc.GetString("borg-mind-removed", ("name", Identity.Name(uid, EntityManager))), uid);
|
||||
_powerCell.SetPowerCellDrawEnabled(uid, false);
|
||||
_access.SetAccessEnabled(uid, false);
|
||||
_appearance.SetData(uid, BorgVisuals.HasPlayer, false);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
@@ -307,9 +301,9 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
/// Checks that a player has fulfilled the requirements for the borg job.
|
||||
/// If they don't have enough hours, they cannot be placed into a chassis.
|
||||
/// </summary>
|
||||
public bool CanPlayerBeBorgged(IPlayerSession session, BorgChassisComponent component)
|
||||
public bool CanPlayerBeBorgged(IPlayerSession session)
|
||||
{
|
||||
if (_banManager.GetJobBans(session.UserId)?.Contains(component.BorgJobId) == true)
|
||||
if (_banManager.GetJobBans(session.UserId)?.Contains(BorgJobId) == true)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user