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:
Nemanja
2023-08-14 19:34:23 -04:00
committed by GitHub
parent 8b0eb7e4de
commit 7ddee71379
40 changed files with 299 additions and 175 deletions

View File

@@ -1,11 +1,7 @@
using Content.Shared.Roles;
using Content.Shared.Whitelist;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
namespace Content.Shared.Silicons.Borgs.Components;
@@ -17,12 +13,6 @@ namespace Content.Shared.Silicons.Borgs.Components;
[RegisterComponent, NetworkedComponent, Access(typeof(SharedBorgSystem)), AutoGenerateComponentState]
public sealed partial class BorgChassisComponent : Component
{
/// <summary>
/// Whether or not the borg currently has a player occupying it
/// </summary>
[DataField("hasPlayer")]
public bool HasPlayer;
/// <summary>
/// Whether or not the borg is activated, meaning it has access to modules and a heightened movement speed
/// </summary>
@@ -43,15 +33,9 @@ public sealed partial class BorgChassisComponent : Component
public string BrainContainerId = "borg_brain";
[ViewVariables(VVAccess.ReadWrite)]
public ContainerSlot BrainContainer = default!;
public ContainerSlot BrainContainer = new();
public EntityUid? BrainEntity => BrainContainer.ContainedEntity;
/// <summary>
/// A brain entity that fills the <see cref="BrainContainer"/> on roundstart
/// </summary>
[DataField("startingBrain", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? StartingBrain;
#endregion
#region Modules
@@ -77,33 +61,14 @@ public sealed partial class BorgChassisComponent : Component
public Container ModuleContainer = default!;
public int ModuleCount => ModuleContainer.ContainedEntities.Count;
/// <summary>
/// A list of modules that fill the borg on round start.
/// </summary>
[DataField("startingModules", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> StartingModules = new();
#endregion
/// <summary>
/// The job that corresponds to borgs
/// </summary>
[DataField("borgJobId", customTypeSerializer: typeof(PrototypeIdSerializer<JobPrototype>))]
public string BorgJobId = "Borg";
/// <summary>
/// The currently selected module
/// </summary>
[DataField("selectedModule")]
public EntityUid? SelectedModule;
/// <summary>
/// The access this cyborg has when a player is inhabiting it.
/// </summary>
[DataField("access"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public string AccessGroup = "AllAccess";
#region Visuals
[DataField("hasMindState")]
public string HasMindState = string.Empty;

View File

@@ -24,12 +24,21 @@ public sealed class MMIComponent : Component
[ViewVariables(VVAccess.ReadWrite)]
public ItemSlot BrainSlot = default!;
/// <summary>
/// The sprite state when the brain inserted has a mind.
/// </summary>
[DataField("hasMindState")]
public string HasMindState = "mmi_alive";
/// <summary>
/// The sprite state when the brain inserted doesn't have a mind.
/// </summary>
[DataField("noMindState")]
public string NoMindState = "mmi_dead";
/// <summary>
/// The sprite state when there is no brain inserted.
/// </summary>
[DataField("noBrainState")]
public string NoBrainState = "mmi_off";
}

View File

@@ -7,11 +7,12 @@ namespace Content.Shared.Silicons.Borgs.Components;
/// Mostly for receiving events.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SharedBorgSystem))]
public sealed class MMILinkedComponent : Component
[AutoGenerateComponentState]
public sealed partial class MMILinkedComponent : Component
{
/// <summary>
/// The MMI this entity is linked to.
/// </summary>
[DataField("linkedMMI")]
[DataField("linkedMMI"), AutoNetworkedField]
public EntityUid? LinkedMMI;
}

View File

@@ -30,7 +30,6 @@ public abstract partial class SharedBorgSystem : EntitySystem
SubscribeLocalEvent<BorgChassisComponent, EntInsertedIntoContainerMessage>(OnInserted);
SubscribeLocalEvent<BorgChassisComponent, EntRemovedFromContainerMessage>(OnRemoved);
SubscribeLocalEvent<BorgChassisComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeedModifiers);
SubscribeLocalEvent<BorgChassisComponent, GetAccessTagsEvent>(OnGetAccessTags);
InitializeRelay();
}
@@ -69,7 +68,8 @@ public abstract partial class SharedBorgSystem : EntitySystem
private void OnStartup(EntityUid uid, BorgChassisComponent component, ComponentStartup args)
{
var containerManager = EnsureComp<ContainerManagerComponent>(uid);
if (!TryComp<ContainerManagerComponent>(uid, out var containerManager))
return;
component.BrainContainer = Container.EnsureContainer<ContainerSlot>(uid, component.BrainContainerId, containerManager);
component.ModuleContainer = Container.EnsureContainer<Container>(uid, component.ModuleContainerId, containerManager);
@@ -96,12 +96,4 @@ public abstract partial class SharedBorgSystem : EntitySystem
var sprintDif = movement.BaseWalkSpeed / movement.BaseSprintSpeed;
args.ModifySpeed(1f, sprintDif);
}
private void OnGetAccessTags(EntityUid uid, BorgChassisComponent component, ref GetAccessTagsEvent args)
{
if (!component.HasPlayer)
return;
args.AddGroup(component.AccessGroup);
}
}