diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index 49676426dff..42108069364 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -33,6 +33,7 @@ using Robust.Shared.Physics.Components; using Robust.Shared.Prototypes; using Robust.Shared.Random; +using Robust.Shared.Serialization.Manager; namespace Content.Server.Cloning { @@ -61,6 +62,8 @@ public sealed class CloningSystem : EntitySystem [Dependency] private readonly MetaDataSystem _metaSystem = default!; [Dependency] private readonly SharedJobSystem _jobs = default!; + [Dependency] private readonly ISerializationManager _serialization = default!; // Corvax-Next + public readonly Dictionary ClonesWaitingForMind = new(); public const float EasyModeCloningCost = 0.7f; @@ -215,6 +218,18 @@ public bool TryCloning(EntityUid uid, EntityUid bodyToClone, Entity(OnComponentInit); + SubscribeLocalEvent(OnComponentShutdown); + } + private void OnComponentShutdown(EntityUid uid, SizeAttributeComponent component, ComponentShutdown args) + { + if (!TryComp(uid, out var whitelist)) + return; + + if (whitelist.Tall && component.Tall) + { + Scale(uid, component, 1 / whitelist.TallScale); + } + else if (whitelist.Short && component.Short) + { + Scale(uid, component, 1 / whitelist.ShortScale); + } + + RemComp(uid); + } + private void OnComponentInit(EntityUid uid, SizeAttributeComponent component, ComponentInit args) + { + if (!TryComp(uid, out var whitelist)) + return; + + if (whitelist.Tall && component.Tall) + { + Scale(uid, component, Math.Max(1, whitelist.TallScale)); + } + else if (whitelist.Short && component.Short) + { + Scale(uid, component, Math.Max(Math.Min(1, whitelist.ShortScale), 0)); + } + } + + private void Scale(EntityUid uid, SizeAttributeComponent component, float scale) + { + if (scale <= 0f) + return; + + EnsureComp(uid); + + var appearanceComponent = _entityManager.EnsureComponent(uid); + if (!_appearance.TryGetData(uid, ScaleVisuals.Scale, out var oldScale, appearanceComponent)) + oldScale = Vector2.One; + + _appearance.SetData(uid, ScaleVisuals.Scale, oldScale * scale, appearanceComponent); + + if (TryComp(uid, out FixturesComponent? manager)) + { + foreach (var (id, fixture) in manager.Fixtures) + { + if (!fixture.Hard || fixture.Density <= 1f) + continue; // This will skip the flammable fixture and any other fixture that is not supposed to contribute to mass + + switch (fixture.Shape) + { + case PhysShapeCircle circle: + _physics.SetPositionRadius(uid, id, fixture, circle, circle.Position * scale, circle.Radius * scale, manager); + break; + default: + break; + } + } + } + } + } +} diff --git a/Content.Server/_CorvaxNext/Traits/Assorted/SizeAttributeWhitelistComponent.cs b/Content.Server/_CorvaxNext/Traits/Assorted/SizeAttributeWhitelistComponent.cs new file mode 100644 index 00000000000..0cc83e73efe --- /dev/null +++ b/Content.Server/_CorvaxNext/Traits/Assorted/SizeAttributeWhitelistComponent.cs @@ -0,0 +1,23 @@ +namespace Content.Server.Next.Traits.Assorted +{ + [RegisterComponent] + public sealed partial class SizeAttributeWhitelistComponent : Component + { + [ViewVariables(VVAccess.ReadOnly)] + [DataField("short")] + public bool Short = false; + + [ViewVariables(VVAccess.ReadOnly)] + [DataField("shortscale")] + public float ShortScale = 0f; + + [ViewVariables(VVAccess.ReadOnly)] + [DataField("tall")] + public bool Tall = false; + + [ViewVariables(VVAccess.ReadOnly)] + [DataField("tallscale")] + public float TallScale = 0f; + + } +} diff --git a/Content.Shared/_CorvaxNext/Cloning/ITransferredByCloning.cs b/Content.Shared/_CorvaxNext/Cloning/ITransferredByCloning.cs new file mode 100644 index 00000000000..d2504c4c67f --- /dev/null +++ b/Content.Shared/_CorvaxNext/Cloning/ITransferredByCloning.cs @@ -0,0 +1,9 @@ +namespace Content.Shared.Cloning +{ + /// + /// Indicates that this Component should be transferred to the new entity when the entity is cloned (for example, using a cloner) + /// + public interface ITransferredByCloning + { + } +} diff --git a/Resources/Locale/ru-RU/_corvaxnext/traits/traits.ftl b/Resources/Locale/ru-RU/_corvaxnext/traits/traits.ftl index ca416b903b0..66e05b0a26e 100644 --- a/Resources/Locale/ru-RU/_corvaxnext/traits/traits.ftl +++ b/Resources/Locale/ru-RU/_corvaxnext/traits/traits.ftl @@ -1,2 +1,10 @@ +trait-category-sizetraits = Рост + +trait-tall-name = Высокий +trait-tall-desc = У вас проблемы с гигантизмом. + +trait-short-name = Низкий +trait-short-desc = Вы коротковаты ростом. + trait-hushed-name = Тихоня trait-hushed-desc = Вы слишком скромны и можете говорить только шёпотом. diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index 4a27bc59eaa..57eb1be6195 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -217,6 +217,11 @@ - type: Targeting # _CorvaxNext: surgery - type: SurgeryTarget # _CorvaxNext: surgery - type: LayingDown # _CorvaxNext: LayingDown Laying Down + - type: SizeAttributeWhitelist # Corvax-Next + tall: true + tallscale: 1.1 + short: true + shortscale: 0.90 - type: AutoCryoSleepable # Corvax-Next-AutoCryo - type: entity diff --git a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml index c925f3a0081..7074911485a 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/dwarf.yml @@ -63,6 +63,12 @@ 32: sprite: Mobs/Species/Human/displacement.rsi state: jumpsuit-female + - type: SizeAttributeWhitelist # Corvax-Next + tall: false + short: false + - type: FootprintVisualizer # Corvax-Next-Footprints + leftBarePrint: "footprint-left-bare-dwarf" + rightBarePrint: "footprint-right-bare-dwarf" - type: InnateMiningScannerViewer # Corvax-Next-Dwarfs pingSound: null viewRange: 3 diff --git a/Resources/Prototypes/_CorvaxNext/Traits/categories.yml b/Resources/Prototypes/_CorvaxNext/Traits/categories.yml index fd2f9aa6796..e295c2d13d8 100644 --- a/Resources/Prototypes/_CorvaxNext/Traits/categories.yml +++ b/Resources/Prototypes/_CorvaxNext/Traits/categories.yml @@ -1,3 +1,8 @@ +- type: traitCategory + id: SizeTraits + name: trait-category-sizetraits + maxTraitPoints: 1 + - type: traitCategory id: MoodTraits name: trait-category-mood diff --git a/Resources/Prototypes/_CorvaxNext/Traits/sizeattribute.yml b/Resources/Prototypes/_CorvaxNext/Traits/sizeattribute.yml new file mode 100644 index 00000000000..ea0e4cffd4a --- /dev/null +++ b/Resources/Prototypes/_CorvaxNext/Traits/sizeattribute.yml @@ -0,0 +1,31 @@ +- type: trait + id: Tall + name: trait-tall-name + description: trait-tall-desc + category: SizeTraits + cost: 1 + whitelist: + components: + - SizeAttributeWhitelist + blacklist: + components: + - SizeAttribute + components: + - type: SizeAttribute + tall: true + +- type: trait + id: Short + name: trait-short-name + description: trait-short-desc + category: SizeTraits + cost: 1 + whitelist: + components: + - SizeAttributeWhitelist + blacklist: + components: + - SizeAttribute + components: + - type: SizeAttribute + short: true \ No newline at end of file