Revert "Solution Entities" (#23160)

Revert "Solution Entities (#21916)"

This reverts commit d75e743dd7.
This commit is contained in:
Emisse
2023-12-28 20:45:42 -07:00
committed by GitHub
parent c2c76c2035
commit 938d6d9945
180 changed files with 2959 additions and 3543 deletions

View File

@@ -1,15 +1,16 @@
using Content.Server.Administration.Logs;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Database;
using Content.Shared.Glue;
using Content.Shared.Hands;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Components;
using Content.Shared.Item;
using Content.Shared.Popups;
using Robust.Shared.Audio.Systems;
using Content.Shared.Item;
using Content.Shared.Glue;
using Content.Shared.Interaction;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Database;
using Content.Shared.Hands;
using Robust.Shared.Timing;
using Content.Shared.Interaction.Components;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
namespace Content.Server.Glue;
@@ -32,7 +33,7 @@ public sealed class GlueSystem : SharedGlueSystem
}
// When glue bottle is used on item it will apply the glued and unremoveable components.
private void OnInteract(Entity<GlueComponent> entity, ref AfterInteractEvent args)
private void OnInteract(EntityUid uid, GlueComponent component, AfterInteractEvent args)
{
if (args.Handled)
return;
@@ -40,10 +41,10 @@ public sealed class GlueSystem : SharedGlueSystem
if (!args.CanReach || args.Target is not { Valid: true } target)
return;
if (TryGlue(entity, target, args.User))
if (TryGlue(uid, component, target, args.User))
{
args.Handled = true;
_audio.PlayPvs(entity.Comp.Squeeze, entity);
_audio.PlayPvs(component.Squeeze, uid);
_popup.PopupEntity(Loc.GetString("glue-success", ("target", target)), args.User, args.User, PopupType.Medium);
}
else
@@ -52,7 +53,7 @@ public sealed class GlueSystem : SharedGlueSystem
}
}
private bool TryGlue(Entity<GlueComponent> glue, EntityUid target, EntityUid actor)
private bool TryGlue(EntityUid uid, GlueComponent component, EntityUid target, EntityUid actor)
{
// if item is glued then don't apply glue again so it can be removed for reasonable time
if (HasComp<GluedComponent>(target) || !HasComp<ItemComponent>(target))
@@ -60,13 +61,13 @@ public sealed class GlueSystem : SharedGlueSystem
return false;
}
if (HasComp<ItemComponent>(target) && _solutionContainer.TryGetSolution(glue.Owner, glue.Comp.Solution, out _, out var solution))
if (HasComp<ItemComponent>(target) && _solutionContainer.TryGetSolution(uid, component.Solution, out var solution))
{
var quantity = solution.RemoveReagent(glue.Comp.Reagent, glue.Comp.ConsumptionUnit);
var quantity = solution.RemoveReagent(component.Reagent, component.ConsumptionUnit);
if (quantity > 0)
{
EnsureComp<GluedComponent>(target).Duration = quantity.Double() * glue.Comp.DurationPerUnit;
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(actor):actor} glued {ToPrettyString(target):subject} with {ToPrettyString(glue.Owner):tool}");
EnsureComp<GluedComponent>(target).Duration = quantity.Double() * component.DurationPerUnit;
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(actor):actor} glued {ToPrettyString(target):subject} with {ToPrettyString(uid):tool}");
return true;
}
}
@@ -89,17 +90,17 @@ public sealed class GlueSystem : SharedGlueSystem
}
}
private void OnGluedInit(Entity<GluedComponent> entity, ref ComponentInit args)
private void OnGluedInit(EntityUid uid, GluedComponent component, ComponentInit args)
{
var meta = MetaData(entity);
var meta = MetaData(uid);
var name = meta.EntityName;
entity.Comp.BeforeGluedEntityName = meta.EntityName;
_metaData.SetEntityName(entity.Owner, Loc.GetString("glued-name-prefix", ("target", name)));
component.BeforeGluedEntityName = meta.EntityName;
_metaData.SetEntityName(uid, Loc.GetString("glued-name-prefix", ("target", name)));
}
private void OnHandPickUp(Entity<GluedComponent> entity, ref GotEquippedHandEvent args)
private void OnHandPickUp(EntityUid uid, GluedComponent component, GotEquippedHandEvent args)
{
EnsureComp<UnremoveableComponent>(entity);
entity.Comp.Until = _timing.CurTime + entity.Comp.Duration;
EnsureComp<UnremoveableComponent>(uid);
component.Until = _timing.CurTime + component.Duration;
}
}