mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-16 21:17:39 +03:00
# Description - Generalizes cocooning - Allows any mob to be cocooned - Cocoon bloodsucking moved to vampirism system - Any blood sucker can drink from cocoons - Vampirism no longer fails if bloodstream isn't normal blood, but gives a pop up - Vampirism `WebRequired` actually works in a way that makes sense - Adds cocooning and bloodsucker to all spider mobs + Arachnids resolves #978 --- # Changelog 🆑 - tweak: All spiders, arachne, and arachnids can cocoon mobs, and drink their blood. --------- Co-authored-by: VMSolidus <evilexecutive@gmail.com>
34 lines
1.5 KiB
C#
34 lines
1.5 KiB
C#
using Content.Shared.Cocoon;
|
|
using Content.Shared.Humanoid;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Containers;
|
|
using System.Numerics;
|
|
|
|
namespace Content.Client.Cocoon
|
|
{
|
|
public sealed class CocoonSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<CocoonComponent, EntInsertedIntoContainerMessage>(OnCocEntInserted);
|
|
}
|
|
|
|
private void OnCocEntInserted(EntityUid uid, CocoonComponent component, EntInsertedIntoContainerMessage args)
|
|
{
|
|
if (!TryComp<SpriteComponent>(uid, out var cocoonSprite))
|
|
return;
|
|
|
|
if (TryComp<HumanoidAppearanceComponent>(args.Entity, out var humanoidAppearance)) // If humanoid, use height and width
|
|
cocoonSprite.Scale = new Vector2(humanoidAppearance.Width, humanoidAppearance.Height);
|
|
else if (!TryComp<SpriteComponent>(args.Entity, out var entSprite))
|
|
return;
|
|
else if (entSprite.BaseRSI != null) // Set scale based on sprite scale + sprite dimensions. Ideally we would somehow get a bounding box from the sprite size not including transparent pixels, but FUCK figuring that out.
|
|
cocoonSprite.Scale = entSprite.Scale * (entSprite.BaseRSI.Size / 32);
|
|
else if (entSprite.Scale != cocoonSprite.Scale) // if basersi somehow not found (?) just use scale
|
|
cocoonSprite.Scale = entSprite.Scale;
|
|
}
|
|
}
|
|
}
|