fishops nerf real (#25148)
* refactor ops * inherit dna and fiber when fish hydrated * :trollface: * kid named finger * :trollface: * move rehydrating to shared :trollface: * nobody noticed the popup being missing all this time * method ops --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.DoAfter;
|
|||||||
using Content.Server.Fluids.EntitySystems;
|
using Content.Server.Fluids.EntitySystems;
|
||||||
using Content.Server.Forensics.Components;
|
using Content.Server.Forensics.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.DoAfter;
|
using Content.Shared.DoAfter;
|
||||||
using Content.Shared.Forensics;
|
using Content.Shared.Forensics;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
@@ -27,6 +28,7 @@ namespace Content.Server.Forensics
|
|||||||
|
|
||||||
SubscribeLocalEvent<DnaComponent, BeingGibbedEvent>(OnBeingGibbed);
|
SubscribeLocalEvent<DnaComponent, BeingGibbedEvent>(OnBeingGibbed);
|
||||||
SubscribeLocalEvent<ForensicsComponent, MeleeHitEvent>(OnMeleeHit);
|
SubscribeLocalEvent<ForensicsComponent, MeleeHitEvent>(OnMeleeHit);
|
||||||
|
SubscribeLocalEvent<ForensicsComponent, GotRehydratedEvent>(OnRehydrated);
|
||||||
SubscribeLocalEvent<CleansForensicsComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(AbsorbentSystem) });
|
SubscribeLocalEvent<CleansForensicsComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(AbsorbentSystem) });
|
||||||
SubscribeLocalEvent<ForensicsComponent, CleanForensicsDoAfterEvent>(OnCleanForensicsDoAfter);
|
SubscribeLocalEvent<ForensicsComponent, CleanForensicsDoAfterEvent>(OnCleanForensicsDoAfter);
|
||||||
SubscribeLocalEvent<DnaComponent, TransferDnaEvent>(OnTransferDnaEvent);
|
SubscribeLocalEvent<DnaComponent, TransferDnaEvent>(OnTransferDnaEvent);
|
||||||
@@ -71,6 +73,34 @@ namespace Content.Server.Forensics
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnRehydrated(Entity<ForensicsComponent> ent, ref GotRehydratedEvent args)
|
||||||
|
{
|
||||||
|
CopyForensicsFrom(ent.Comp, args.Target);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Copy forensic information from a source entity to a destination.
|
||||||
|
/// Existing forensic information on the target is still kept.
|
||||||
|
/// </summary>
|
||||||
|
public void CopyForensicsFrom(ForensicsComponent src, EntityUid target)
|
||||||
|
{
|
||||||
|
var dest = EnsureComp<ForensicsComponent>(target);
|
||||||
|
foreach (var dna in src.DNAs)
|
||||||
|
{
|
||||||
|
dest.DNAs.Add(dna);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var fiber in src.Fibers)
|
||||||
|
{
|
||||||
|
dest.Fibers.Add(fiber);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var print in src.Fingerprints)
|
||||||
|
{
|
||||||
|
dest.Fingerprints.Add(print);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnAfterInteract(EntityUid uid, CleansForensicsComponent component, AfterInteractEvent args)
|
private void OnAfterInteract(EntityUid uid, CleansForensicsComponent component, AfterInteractEvent args)
|
||||||
{
|
{
|
||||||
if (args.Handled)
|
if (args.Handled)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Server.Chemistry.Components;
|
|
||||||
using Content.Server.Friends.Components;
|
using Content.Server.Friends.Components;
|
||||||
using Content.Server.NPC.Components;
|
using Content.Server.NPC.Components;
|
||||||
using Content.Server.NPC.Systems;
|
using Content.Server.NPC.Systems;
|
||||||
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using Content.Server.Chemistry.EntitySystems;
|
using Content.Shared.Chemistry.EntitySystems;
|
||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Components;
|
namespace Content.Shared.Chemistry.Components;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Basically, monkey cubes.
|
/// Basically, monkey cubes.
|
||||||
@@ -16,20 +16,20 @@ public sealed partial class RehydratableComponent : Component
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The reagent that must be present to count as hydrated.
|
/// The reagent that must be present to count as hydrated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("catalyst", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
[DataField("catalyst")]
|
||||||
public string CatalystPrototype = "Water";
|
public ProtoId<ReagentPrototype> CatalystPrototype = "Water";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum amount of catalyst that must be present to be hydrated.
|
/// The minimum amount of catalyst that must be present to be hydrated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("catalystMinimum"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public FixedPoint2 CatalystMinimum = FixedPoint2.Zero;
|
public FixedPoint2 CatalystMinimum = FixedPoint2.Zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The entity to create when hydrated.
|
/// The entity to create when hydrated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("possibleSpawns"), ViewVariables(VVAccess.ReadWrite)]
|
[DataField(required: true)]
|
||||||
public List<string> PossibleSpawns = new();
|
public List<EntProtoId> PossibleSpawns = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
using Content.Server.Chemistry.Components;
|
using Content.Shared.Chemistry.Components;
|
||||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
|
||||||
using Content.Shared.Chemistry.EntitySystems;
|
|
||||||
using Content.Shared.FixedPoint;
|
using Content.Shared.FixedPoint;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.EntitySystems;
|
namespace Content.Shared.Chemistry.EntitySystems;
|
||||||
|
|
||||||
public sealed class RehydratableSystem : EntitySystem
|
public sealed class RehydratableSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly SharedPopupSystem _popups = default!;
|
|
||||||
[Dependency] private readonly SolutionContainerSystem _solutions = default!;
|
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
|
[Dependency] private readonly SharedSolutionContainerSystem _solutions = default!;
|
||||||
|
[Dependency] private readonly SharedTransformSystem _xform = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -20,27 +19,26 @@ public sealed class RehydratableSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<RehydratableComponent, SolutionContainerChangedEvent>(OnSolutionChange);
|
SubscribeLocalEvent<RehydratableComponent, SolutionContainerChangedEvent>(OnSolutionChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSolutionChange(Entity<RehydratableComponent> entity, ref SolutionContainerChangedEvent args)
|
private void OnSolutionChange(Entity<RehydratableComponent> ent, ref SolutionContainerChangedEvent args)
|
||||||
{
|
{
|
||||||
var quantity = _solutions.GetTotalPrototypeQuantity(entity, entity.Comp.CatalystPrototype);
|
var quantity = _solutions.GetTotalPrototypeQuantity(ent, ent.Comp.CatalystPrototype);
|
||||||
if (quantity != FixedPoint2.Zero && quantity >= entity.Comp.CatalystMinimum)
|
if (quantity != FixedPoint2.Zero && quantity >= ent.Comp.CatalystMinimum)
|
||||||
{
|
{
|
||||||
Expand(entity);
|
Expand(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try not to make this public if you can help it.
|
// Try not to make this public if you can help it.
|
||||||
private void Expand(Entity<RehydratableComponent> entity)
|
private void Expand(Entity<RehydratableComponent> ent)
|
||||||
{
|
{
|
||||||
var (uid, comp) = entity;
|
var (uid, comp) = ent;
|
||||||
|
|
||||||
_popups.PopupEntity(Loc.GetString("rehydratable-component-expands-message", ("owner", uid)), uid);
|
|
||||||
|
|
||||||
var randomMob = _random.Pick(comp.PossibleSpawns);
|
var randomMob = _random.Pick(comp.PossibleSpawns);
|
||||||
|
|
||||||
var target = Spawn(randomMob, Transform(uid).Coordinates);
|
var target = Spawn(randomMob, Transform(uid).Coordinates);
|
||||||
|
_popup.PopupEntity(Loc.GetString("rehydratable-component-expands-message", ("owner", uid)), target);
|
||||||
|
|
||||||
Transform(target).AttachToGridOrMap();
|
_xform.AttachToGridOrMap(target);
|
||||||
var ev = new GotRehydratedEvent(target);
|
var ev = new GotRehydratedEvent(target);
|
||||||
RaiseLocalEvent(uid, ref ev);
|
RaiseLocalEvent(uid, ref ev);
|
||||||
|
|
||||||
Reference in New Issue
Block a user