Fix Antags Being Crazy Smol (#6398)
* Fixed antags being crazy smol * Update Content.Shared/Sprite/SharedScaleVisualsSystem.cs Signed-off-by: Sir Warock <67167466+SirWarock@users.noreply.github.com> --------- Signed-off-by: Sir Warock <67167466+SirWarock@users.noreply.github.com> Co-authored-by: Sir Warock <67167466+SirWarock@users.noreply.github.com>
This commit is contained in:
parent
52ed881e2c
commit
1f09c717f3
|
|
@ -43,14 +43,10 @@ public sealed class HumanoidProfileSystem : EntitySystem
|
|||
}
|
||||
|
||||
// START DeltaV - Apply profile/species size
|
||||
Vector2 scale = new(profile.Height, profile.Height);
|
||||
|
||||
// If visuals already exist, then re-apply
|
||||
if (TryComp<ScaleVisualsComponent>(ent, out var scaledVisuals))
|
||||
scale *= scaledVisuals.Scale;
|
||||
|
||||
var speciesProto = _prototype.Index(profile.Species);
|
||||
scale *= speciesProto.BaseScale;
|
||||
// Assume 1.0 scale unless the original scale exists (blame Allulalo)
|
||||
var scale = Vector2.One;
|
||||
if (TryComp<ScaleVisualsComponent>(ent, out var scaledVisuals) && scaledVisuals.OriginalScale is { } originalScale)
|
||||
scale = originalScale;
|
||||
|
||||
_scale.SetSpriteScale(ent, scale);
|
||||
// END DeltaV
|
||||
|
|
|
|||
|
|
@ -24,4 +24,28 @@ public sealed partial class ScaleVisualsComponent : Component
|
|||
[DataField]
|
||||
[ViewVariables]
|
||||
public Vector2? OriginalScale;
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - Contains the species scale. Set dynamically by
|
||||
/// baseScale in the Species prototype.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
[ViewVariables]
|
||||
public Vector2 SpeciesScale = new(1f, 1f);
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - Contains the user-defined scale from the character creation
|
||||
/// screen.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
[ViewVariables]
|
||||
public Vector2 ProfileScale = new(1f, 1f);
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV - Contains the computer scale from applying Scale, SpeciesScale, and ProfileScale.
|
||||
/// This will contain the actual scale after all modifiers are applied.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
[ViewVariables]
|
||||
public Vector2 ComputedScale;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System.Numerics;
|
||||
using Content.Shared.Humanoid; // DeltaV
|
||||
using Robust.Shared.Prototypes; // DeltaV
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Sprite;
|
||||
|
|
@ -6,6 +8,7 @@ namespace Content.Shared.Sprite;
|
|||
public abstract class SharedScaleVisualsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!; // DeltaV
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
|
@ -39,6 +42,24 @@ public abstract class SharedScaleVisualsSystem : EntitySystem
|
|||
{
|
||||
var comp = EnsureComp<ScaleVisualsComponent>(uid);
|
||||
comp.Scale = scale;
|
||||
|
||||
// BEGIN DeltaV - Apply species and profile height
|
||||
// We have to ensure this is idempotent so that if it gets applied more than once
|
||||
// the sprite size at the end is the same.
|
||||
if (TryComp<HumanoidProfileComponent>(uid, out var profile))
|
||||
{
|
||||
var speciesProto = _proto.Index(profile.Species);
|
||||
comp.SpeciesScale = speciesProto.BaseScale;
|
||||
scale *= comp.SpeciesScale; // Apply both species scale and character-defined height
|
||||
|
||||
Vector2 profileHeight = new(profile.Height, profile.Height);
|
||||
comp.ProfileScale = profileHeight;
|
||||
scale *= comp.ProfileScale;
|
||||
}
|
||||
|
||||
comp.ComputedScale = scale; // Nice to know what the computed size is in case of bugs
|
||||
// END DeltaV
|
||||
|
||||
Dirty(uid, comp);
|
||||
|
||||
var appearanceComponent = EnsureComp<AppearanceComponent>(uid);
|
||||
|
|
|
|||
|
|
@ -228,6 +228,7 @@
|
|||
# because Allulalo have to be the special kid on the block.
|
||||
- type: ScaleVisuals
|
||||
scale: 2.0, 2.0
|
||||
originalScale: 2.0, 2.0
|
||||
# END DeltaV
|
||||
|
||||
- type: entity
|
||||
|
|
|
|||
Loading…
Reference in New Issue