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> (cherry picked from commit 550612a37f4fd61088c994b289c833ed3d564855)
This commit is contained in:
parent
09e756b874
commit
c0bfa9fc96
|
|
@ -3,6 +3,7 @@ using Content.Server.DoAfter;
|
|||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.Forensics.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Forensics;
|
||||
using Content.Shared.Interaction;
|
||||
|
|
@ -27,6 +28,7 @@ namespace Content.Server.Forensics
|
|||
|
||||
SubscribeLocalEvent<DnaComponent, BeingGibbedEvent>(OnBeingGibbed);
|
||||
SubscribeLocalEvent<ForensicsComponent, MeleeHitEvent>(OnMeleeHit);
|
||||
SubscribeLocalEvent<ForensicsComponent, GotRehydratedEvent>(OnRehydrated);
|
||||
SubscribeLocalEvent<CleansForensicsComponent, AfterInteractEvent>(OnAfterInteract, after: new[] { typeof(AbsorbentSystem) });
|
||||
SubscribeLocalEvent<ForensicsComponent, CleanForensicsDoAfterEvent>(OnCleanForensicsDoAfter);
|
||||
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)
|
||||
{
|
||||
if (args.Handled)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Friends.Components;
|
||||
using Content.Server.NPC.Components;
|
||||
using Content.Server.NPC.Systems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
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.FixedPoint;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Chemistry.Components;
|
||||
namespace Content.Shared.Chemistry.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Basically, monkey cubes.
|
||||
|
|
@ -16,20 +16,20 @@ public sealed partial class RehydratableComponent : Component
|
|||
/// <summary>
|
||||
/// The reagent that must be present to count as hydrated.
|
||||
/// </summary>
|
||||
[DataField("catalyst", customTypeSerializer: typeof(PrototypeIdSerializer<ReagentPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||
public string CatalystPrototype = "Water";
|
||||
[DataField("catalyst")]
|
||||
public ProtoId<ReagentPrototype> CatalystPrototype = "Water";
|
||||
|
||||
/// <summary>
|
||||
/// The minimum amount of catalyst that must be present to be hydrated.
|
||||
/// </summary>
|
||||
[DataField("catalystMinimum"), ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField]
|
||||
public FixedPoint2 CatalystMinimum = FixedPoint2.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// The entity to create when hydrated.
|
||||
/// </summary>
|
||||
[DataField("possibleSpawns"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public List<string> PossibleSpawns = new();
|
||||
[DataField(required: true)]
|
||||
public List<EntProtoId> PossibleSpawns = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1,17 +1,16 @@
|
|||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Chemistry.EntitySystems;
|
||||
namespace Content.Shared.Chemistry.EntitySystems;
|
||||
|
||||
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 SharedPopupSystem _popup = default!;
|
||||
[Dependency] private readonly SharedSolutionContainerSystem _solutions = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xform = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
|
@ -20,27 +19,26 @@ public sealed class RehydratableSystem : EntitySystem
|
|||
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);
|
||||
if (quantity != FixedPoint2.Zero && quantity >= entity.Comp.CatalystMinimum)
|
||||
var quantity = _solutions.GetTotalPrototypeQuantity(ent, ent.Comp.CatalystPrototype);
|
||||
if (quantity != FixedPoint2.Zero && quantity >= ent.Comp.CatalystMinimum)
|
||||
{
|
||||
Expand(entity);
|
||||
Expand(ent);
|
||||
}
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
_popups.PopupEntity(Loc.GetString("rehydratable-component-expands-message", ("owner", uid)), uid);
|
||||
var (uid, comp) = ent;
|
||||
|
||||
var randomMob = _random.Pick(comp.PossibleSpawns);
|
||||
|
||||
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);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
Loading…
Reference in New Issue