Exosuit: Ripley (#12668)

* mechs

* interaction relay

* atmos handling

* fuck around with interaction events

SPAGHETTI CODE OH MY GOD

* more sprites and whatever the hell

* more mech shit

* more shit for equipment

* starting equipment (for nukie mechs and such)

* equipment cycling

* starting with some of the ui

* a fat chunk of ui prototyping

* done tinkering with ui

* a bunch of ui stuff and what have yous

* cleaning up grabber and state handling

* make the ui actually functional + watch me port a million icons

I swear i'll prune the sprites later blease

* start on construction

* construction yo mamma

* remove some unused files

* fix a silly

* make the graph sane

* make it actually constructible.

* print the boards as well, bozo

* rebalance part prices

* eject action

also i appease the russians by remembering to localize

* Punch Shit

* make mech integrity and repairs work

* Make the UI more based

STOMP STOMP STOMP STOMP

* make equipment even more based

* batteries and other such delights

* make the ui look pimpin af

* make the construction mega based

* UI but so epic

* equipment

* some sweat tweaks

* damage rebalancing

* restructure tech

* fix some shit

* mechs inherit access

* make icons actually use sprite specifiers

* TRAILING COMMAA!!!!!

* fix a mild indentation sin

* undo this change because it isn't needed

* actually fix this

* secret webeditting shhhh

* place this tech here

* comments

* foo
This commit is contained in:
Nemanja
2022-12-10 12:05:39 -05:00
committed by GitHub
parent 11d81aa155
commit 913e1ee676
218 changed files with 3956 additions and 34 deletions

View File

@@ -0,0 +1,71 @@
using Content.Server.Mech.Components;
using Content.Server.Mech.Systems;
using Content.Server.Power.Components;
using Content.Shared.Construction;
using JetBrains.Annotations;
using Robust.Server.Containers;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Construction.Completions;
/// <summary>
/// Creates the mech entity while transferring all relevant parts inside of it,
/// for right now, the cell that was used in construction.
/// </summary>
[UsedImplicitly, DataDefinition]
public sealed class BuildMech : IGraphAction
{
[DataField("mechPrototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string MechPrototype = string.Empty;
[DataField("container")]
public string Container = "battery-container";
public void PerformAction(EntityUid uid, EntityUid? userUid, IEntityManager entityManager)
{
if (!entityManager.TryGetComponent(uid, out ContainerManagerComponent? containerManager))
{
Logger.Warning($"Mech construct entity {uid} did not have a container manager! Aborting build mech action.");
return;
}
var containerSystem = entityManager.EntitySysManager.GetEntitySystem<ContainerSystem>();
var mechSys = entityManager.System<MechSystem>();
if (!containerSystem.TryGetContainer(uid, Container, out var container, containerManager))
{
Logger.Warning($"Mech construct entity {uid} did not have the specified '{Container}' container! Aborting build mech action.");
return;
}
if (container.ContainedEntities.Count != 1)
{
Logger.Warning($"Mech construct entity {uid} did not have exactly one item in the specified '{Container}' container! Aborting build mech action.");
}
var cell = container.ContainedEntities[0];
if (!entityManager.TryGetComponent<BatteryComponent>(cell, out var batteryComponent))
{
Logger.Warning($"Mech construct entity {uid} had an invalid entity in container \"{Container}\"! Aborting build mech action.");
return;
}
container.Remove(cell);
var transform = entityManager.GetComponent<TransformComponent>(uid);
var mech = entityManager.SpawnEntity(MechPrototype, transform.Coordinates);
if (entityManager.TryGetComponent<MechComponent>(mech, out var mechComp) && mechComp.BatterySlot.ContainedEntity == null)
{
mechSys.InsertBattery(mech, cell, mechComp, batteryComponent);
mechComp.BatterySlot.Insert(cell);
}
// Delete the original entity.
entityManager.DeleteEntity(uid);
}
}