Files
crystall-punk-14/Content.Shared/Silicons/Borgs/Components/BorgChassisComponent.cs

107 lines
2.8 KiB
C#
Raw Permalink Normal View History

using Content.Shared.Alert;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Silicons.Borgs.Components;
/// <summary>
/// This is used for the core body of a borg. This manages a borg's
/// "brain", legs, modules, and battery. Essentially the master component
/// for borg logic.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SharedBorgSystem)), AutoGenerateComponentState]
public sealed partial class BorgChassisComponent : Component
{
#region Brain
/// <summary>
/// A whitelist for which entities count as valid brains
/// </summary>
[DataField("brainWhitelist")]
public EntityWhitelist? BrainWhitelist;
/// <summary>
/// The container ID for the brain
/// </summary>
[DataField("brainContainerId")]
public string BrainContainerId = "borg_brain";
[ViewVariables(VVAccess.ReadWrite)]
public ContainerSlot BrainContainer = default!;
public EntityUid? BrainEntity => BrainContainer.ContainedEntity;
#endregion
#region Modules
/// <summary>
/// A whitelist for what types of modules can be installed into this borg
/// </summary>
[DataField("moduleWhitelist")]
public EntityWhitelist? ModuleWhitelist;
/// <summary>
/// How many modules can be installed in this borg
/// </summary>
[DataField("maxModules"), ViewVariables(VVAccess.ReadWrite)]
public int MaxModules = 3;
/// <summary>
/// The ID for the module container
/// </summary>
[DataField("moduleContainerId")]
public string ModuleContainerId = "borg_module";
[ViewVariables(VVAccess.ReadWrite)]
public Container ModuleContainer = default!;
public int ModuleCount => ModuleContainer.ContainedEntities.Count;
#endregion
/// <summary>
/// The currently selected module
/// </summary>
item toggling giga rework + full ninja refactor (#28039) * item toggle refactoring and some new systems * add ToggleClothing component/system * unhardcode magboots gravity logic * make magboots and speedboots use ItemToggle and stuff * remove now useless clothing components * update client/server magboots systems * add note to use ItemToggledEvent in ToggleActionEvent doc * refactor PowerCellDraw to use ItemToggle for ui open/close control * add TryUseCharges, refactor charges system * update magboot trigger code * make borg use ItemToggle, network SelectedModule instead of now removed Activated * add AccessToggle for borg * the giga ninja refactor * update ninja yml * update ItemToggle usage for some stuff * fix activatableui requires power * random fixing * yaml fixing * nuke ItemToggleDisarmMalus * make defib use ItemToggle * make things that use power not turn on if missing use charge * pro * fix sound prediction * bruh * proximity detector use ItemToggle * oop * big idiot syndrome * fix ninja spawn rule and make it generic * fix ninja spawn rule yml * move loading profiles into AntagLoadProfileRule * more ninja refactor * ninja yml fixes * the dreaded copy paste ops * remove useless NinjaRuleComponent and ue AntagSelection for greeting * fix invisibility * move IsCompleted to SharedObjectivesSystem * ability fixes * oop fix powercell instantly draining itself * sentient speedboots gaming * make reflect use ItemToggle * fix other test * loadprofilerule moved into its own pr * remove conflict with dragon refactor * remove all GenericAntag code from ninja * ) * probably * remove old enabled * great language bravo vince * GREAT LANGUAGE * who made this language * because it stinks * reparent blood-red magboots to magboots probbbly works * most of the review stuff * hasGrav doesnt mean what i thought it did * make health analyzer use itemtoggle, not fail test * fix mag/speed boots being wacky * UNTROLL * add ItemToggle to the random health analyzers * a * remove unused obsolete borg func * untrolling * :trollface: * fix test * fix * g * untroll --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
2024-07-11 05:55:56 +00:00
[DataField("selectedModule"), AutoNetworkedField]
public EntityUid? SelectedModule;
#region Visuals
[DataField("hasMindState")]
public string HasMindState = string.Empty;
[DataField("noMindState")]
public string NoMindState = string.Empty;
#endregion
[DataField]
public ProtoId<AlertPrototype> BatteryAlert = "BorgBattery";
[DataField]
public ProtoId<AlertPrototype> NoBatteryAlert = "BorgBatteryNone";
}
[Serializable, NetSerializable]
public enum BorgVisuals : byte
{
HasPlayer
}
[Serializable, NetSerializable]
public enum BorgVisualLayers : byte
{
Borg type switching. (#32586) * Borg type switching. This allows borgs (new spawn or constructed) to select their chassis type on creation, like in SS13. This removes the need for the many different chassis types, and means round-start borgs can actually play the game immediately instead of waiting for science to unlock everything. New borgs have an additional action that allows them to select their type. This opens a nice window with basic information about the borgs and a select button. Once a type has been selected it is permanent for that borg chassis. These borg types also immediately start the borg with specific modules, so they do not need to be printed. Additional modules can still be inserted for upgrades, though this is now less critical. The built-in modules cannot be removed, but are shown in the UI. The modules that each borg type starts with: * Generic: tools * Engineering: advanced tools, construction, RCD, cable * Salvage: Grappling gun, appraisal, mining * Janitor: cleaning, light replacer * Medical: treatment * Service: music, service, clowning Specialized borgs have 3 additional module slots available on top of the ones listed above, generic borgs have 5. Borg types are specified in a new BorgTypePrototype. These prototypes specify all information about the borg type. It is assigned to the borg entity through a mix of client side, server, and shared code. Some of the involved components were made networked, others are just ensured they're set on both sides of the wire. The most gnarly change is the inventory template prototype, which needs to change purely to modify the borg hat offset. I managed to bodge this in with an API that *probably* won't explode for specifically for this use case, but it's still not the most clean of API designs. Parts for specific borg chassis have been removed (so much deleted YAML) and specialized borg modules that are in the base set of a type have been removed from the exosuit fab as there's no point to printing those. The ability to "downgrade" a borg so it can select a new chassis, like in SS13, is something that would be nice, but was not high enough priority for me to block the feature on. I did keep it in mind with some of the code, so it may be possible in the future. There is no fancy animation when selecting borg types like in SS13, because I didn't think it was high priority, and it would add a lot of complex code. * Fix sandbox failure due to collection expression. * Module tweak Fix salvage borg modules still having research/lathe recipes Engie borg has regular tool module, not advanced. * Fix inventory system breakage * Fix migrations Some things were missing * Guidebook rewordings & review * MinWidth on confirm selection button
2024-11-14 18:08:35 +01:00
/// <summary>
/// Main borg body layer.
/// </summary>
Body,
/// <summary>
/// Layer for the borg's mind state.
/// </summary>
Light,
/// <summary>
/// Layer for the borg flashlight status.
/// </summary>
LightStatus,
}