diff --git a/Content.Client/ADT/Quirks/QuirksSystem.cs b/Content.Client/ADT/Quirks/QuirksSystem.cs new file mode 100644 index 0000000000..4a8f77b4fc --- /dev/null +++ b/Content.Client/ADT/Quirks/QuirksSystem.cs @@ -0,0 +1,46 @@ +using Content.Shared.ADT.Traits; +using Content.Client.Storage.Components; +using Content.Shared.Storage.EntitySystems; +using Content.Shared.Verbs; +using Content.Shared.Tools.Components; +using Content.Shared.Whitelist; +using Content.Shared.Lock; + +namespace Content.Client.ADT.Traits; + +public sealed class QuirksSystem : SharedQuirksSystem +{ + [Dependency] private readonly EntityWhitelistSystem _whitelist = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent>(OnGetHideVerbs); + + } + + private void OnGetHideVerbs(EntityUid uid, EntityStorageComponent comp, GetVerbsEvent args) + { + if (!args.CanAccess || !args.CanInteract) + return; + + if (!HasComp(args.User)) + return; + if (TryComp(uid, out var weldable) && weldable.IsWelded) + return; + if (_whitelist.IsWhitelistFail(comp.Whitelist, args.User)) + return; + if (TryComp(uid, out var lockComponent) && lockComponent.Locked) + return; + + AlternativeVerb verb = new() + { + Act = () => TryHide(args.User, uid), + Text = Loc.GetString("quirk-fast-locker-hide-verb"), + }; + args.Verbs.Add(verb); + + } + +} diff --git a/Content.Server/ADT/Quirks/QuirksSystem.cs b/Content.Server/ADT/Quirks/QuirksSystem.cs new file mode 100644 index 0000000000..821e048deb --- /dev/null +++ b/Content.Server/ADT/Quirks/QuirksSystem.cs @@ -0,0 +1,46 @@ +using Content.Shared.ADT.Traits; +using Content.Server.Storage.Components; +using Content.Shared.Storage.EntitySystems; +using Content.Shared.Verbs; +using Content.Shared.Tools.Components; +using Content.Shared.Whitelist; +using Content.Shared.Lock; + +namespace Content.Server.ADT.Traits; + +public sealed class QuirksSystem : SharedQuirksSystem +{ + [Dependency] private readonly EntityWhitelistSystem _whitelist = default!; + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent>(OnGetHideVerbs); + + } + + private void OnGetHideVerbs(EntityUid uid, EntityStorageComponent comp, GetVerbsEvent args) + { + if (!args.CanAccess || !args.CanInteract) + return; + + if (!HasComp(args.User)) + return; + if (TryComp(uid, out var weldable) && weldable.IsWelded) + return; + + if (_whitelist.IsWhitelistFail(comp.Whitelist, args.User)) + return; + if (TryComp(uid, out var lockComponent) && lockComponent.Locked) + return; + + AlternativeVerb verb = new() + { + Act = () => TryHide(args.User, uid), + Text = Loc.GetString("quirk-fast-locker-hide-verb"), + }; + args.Verbs.Add(verb); + + } + +} diff --git a/Content.Shared/ADT/Quirks/Components/FastLockersComponent.cs b/Content.Shared/ADT/Quirks/Components/FastLockersComponent.cs new file mode 100644 index 0000000000..84b25d99bc --- /dev/null +++ b/Content.Shared/ADT/Quirks/Components/FastLockersComponent.cs @@ -0,0 +1,9 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.ADT.Traits; + +[RegisterComponent] +[NetworkedComponent] +public sealed partial class FastLockersComponent : Component +{ +} diff --git a/Content.Shared/ADT/Quirks/Components/FreerunningComponent.cs b/Content.Shared/ADT/Quirks/Components/FreerunningComponent.cs new file mode 100644 index 0000000000..66815973a9 --- /dev/null +++ b/Content.Shared/ADT/Quirks/Components/FreerunningComponent.cs @@ -0,0 +1,14 @@ +using Content.Shared.Tag; +using Robust.Shared.Prototypes; +using Robust.Shared.GameStates; + +namespace Content.Shared.ADT.Traits; + +[RegisterComponent] +[NetworkedComponent] +public sealed partial class FreerunningComponent : Component +{ + [DataField] + [ViewVariables(VVAccess.ReadWrite)] + public float Modifier = 0.6f; +} diff --git a/Content.Shared/ADT/Quirks/Components/HardThrowerComponent.cs b/Content.Shared/ADT/Quirks/Components/HardThrowerComponent.cs new file mode 100644 index 0000000000..c5cd561ea6 --- /dev/null +++ b/Content.Shared/ADT/Quirks/Components/HardThrowerComponent.cs @@ -0,0 +1,14 @@ +using Content.Shared.Tag; +using Robust.Shared.Prototypes; +using Robust.Shared.GameStates; + +namespace Content.Shared.ADT.Traits; + +[RegisterComponent] +[NetworkedComponent] +public sealed partial class HardThrowerComponent : Component +{ + [DataField] + [ViewVariables(VVAccess.ReadWrite)] + public float Modifier = 0.8f; +} diff --git a/Content.Shared/ADT/Quirks/Components/SoftWalkComponent.cs b/Content.Shared/ADT/Quirks/Components/SoftWalkComponent.cs new file mode 100644 index 0000000000..625ba07e2f --- /dev/null +++ b/Content.Shared/ADT/Quirks/Components/SoftWalkComponent.cs @@ -0,0 +1,11 @@ +using Content.Shared.Tag; +using Robust.Shared.Prototypes; +using Robust.Shared.GameStates; + +namespace Content.Shared.ADT.Traits; + +[RegisterComponent] +[NetworkedComponent] +public sealed partial class SoftWalkComponent : Component +{ +} diff --git a/Content.Shared/ADT/Quirks/Components/SprinterComponent.cs b/Content.Shared/ADT/Quirks/Components/SprinterComponent.cs new file mode 100644 index 0000000000..5a5111e77e --- /dev/null +++ b/Content.Shared/ADT/Quirks/Components/SprinterComponent.cs @@ -0,0 +1,14 @@ +using Content.Shared.Tag; +using Robust.Shared.Prototypes; +using Robust.Shared.GameStates; + +namespace Content.Shared.ADT.Traits; + +[RegisterComponent] +[NetworkedComponent] +public sealed partial class SprinterComponent : Component +{ + [DataField] + [ViewVariables(VVAccess.ReadWrite)] + public float Modifier = 1.1f; +} diff --git a/Content.Shared/ADT/Quirks/EntitySystems/SharedQuirksSystem.cs b/Content.Shared/ADT/Quirks/EntitySystems/SharedQuirksSystem.cs new file mode 100644 index 0000000000..0eb4ffa0e8 --- /dev/null +++ b/Content.Shared/ADT/Quirks/EntitySystems/SharedQuirksSystem.cs @@ -0,0 +1,69 @@ +using Robust.Shared.Prototypes; +using Robust.Shared.Random; +using Content.Shared.Climbing.Events; +using Robust.Shared.Network; +using Content.Shared.Throwing; +using Content.Shared.Verbs; +using Content.Shared.Tools.Components; +using Content.Shared.StepTrigger.Systems; +using Content.Shared.Storage.EntitySystems; +using Content.Shared.Popups; +using Content.Shared.Tag; +using Content.Shared.Movement.Components; +using Content.Shared.Movement.Systems; +using Content.Shared.StepTrigger.Components; + +namespace Content.Shared.ADT.Traits; + +public abstract class SharedQuirksSystem : EntitySystem +{ + [Dependency] private readonly SharedEntityStorageSystem _storage = default!; + [Dependency] protected readonly IRobustRandom _random = default!; + [Dependency] private readonly MovementSpeedModifierSystem _movementSpeed = default!; + [Dependency] private readonly SharedPopupSystem _popup = default!; + [Dependency] private readonly TagSystem _tag = default!; + + public override void Initialize() + { + SubscribeLocalEvent(OnFreerunningClimbTimeModify); + + SubscribeLocalEvent(OnSprinterMapInit); + SubscribeLocalEvent(OnRefreshMovespeed); + + SubscribeLocalEvent(OnThrowerRangeModify); + } + + public void TryHide(EntityUid uid, EntityUid closet) + { + if (_storage.Insert(uid, closet)) + { + _popup.PopupClient(Loc.GetString("quirk-fast-locker-hide-success"), uid); + } + else + _popup.PopupCursor(Loc.GetString("quirk-fast-locker-hide-fail"), uid); + } + + private void OnFreerunningClimbTimeModify(EntityUid uid, FreerunningComponent comp, ref CheckClimbSpeedModifiersEvent args) + { + if (args.User == args.Climber) + args.Time *= comp.Modifier; + } + + private void OnSprinterMapInit(EntityUid uid, SprinterComponent comp, MapInitEvent args) + { + if (!TryComp(uid, out var move)) + return; + _movementSpeed.RefreshMovementSpeedModifiers(uid, move); + } + private void OnRefreshMovespeed(EntityUid uid, SprinterComponent component, RefreshMovementSpeedModifiersEvent args) + { + args.ModifySpeed(1f, component.Modifier); + } + + private void OnThrowerRangeModify(EntityUid uid, HardThrowerComponent component, ref CheckThrowRangeModifiersEvent args) + { + args.SpeedMod = component.Modifier; + args.VectorMod = component.Modifier; + } + +} diff --git a/Content.Shared/Climbing/Events/CheckClimbSpeedModifiers.cs b/Content.Shared/Climbing/Events/CheckClimbSpeedModifiers.cs new file mode 100644 index 0000000000..59a60639a2 --- /dev/null +++ b/Content.Shared/Climbing/Events/CheckClimbSpeedModifiers.cs @@ -0,0 +1,6 @@ +namespace Content.Shared.Climbing.Events; // ADT File + +[ByRefEvent] +public record struct CheckClimbSpeedModifiersEvent(EntityUid User, EntityUid Climber, EntityUid Climbable, float Time) +{ +} diff --git a/Content.Shared/Climbing/Systems/ClimbSystem.cs b/Content.Shared/Climbing/Systems/ClimbSystem.cs index 635bf36049..e82364520e 100644 --- a/Content.Shared/Climbing/Systems/ClimbSystem.cs +++ b/Content.Shared/Climbing/Systems/ClimbSystem.cs @@ -216,8 +216,12 @@ public bool TryClimb( RaiseLocalEvent(climbable, ref ev); if (ev.Cancelled) return false; + // ADT Quirks start + var speedEv = new CheckClimbSpeedModifiersEvent(user, entityToMove, climbable, comp.ClimbDelay); + RaiseLocalEvent(entityToMove, ref speedEv); + var delay = speedEv.Time; - var args = new DoAfterArgs(EntityManager, user, comp.ClimbDelay, new ClimbDoAfterEvent(), + var args = new DoAfterArgs(EntityManager, user, delay, new ClimbDoAfterEvent(), entityToMove, target: climbable, used: entityToMove) @@ -226,7 +230,7 @@ public bool TryClimb( BreakOnDamage = true, DuplicateCondition = DuplicateConditions.SameTool | DuplicateConditions.SameTarget }; - + // ADT Quirks end _audio.PlayPredicted(comp.StartClimbSound, climbable, user); return _doAfterSystem.TryStartDoAfter(args, out id); } diff --git a/Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs b/Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs index 74e10bafce..27c1f4b4fa 100644 --- a/Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs +++ b/Content.Shared/StepTrigger/Components/StepTriggerImmuneComponent.cs @@ -6,4 +6,4 @@ namespace Content.Shared.StepTrigger.Components; /// Grants the attached entity to step triggers. /// [RegisterComponent, NetworkedComponent] -public sealed partial class StepTriggerImmuneComponent : Component; +public sealed partial class StepTriggerImmuneComponent : Component {} // "{}" is ADT part diff --git a/Content.Shared/StepTrigger/Systems/StepTriggerImmuneSystem.cs b/Content.Shared/StepTrigger/Systems/StepTriggerImmuneSystem.cs index ca72a20ae9..077225669f 100644 --- a/Content.Shared/StepTrigger/Systems/StepTriggerImmuneSystem.cs +++ b/Content.Shared/StepTrigger/Systems/StepTriggerImmuneSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.Examine; +using Content.Shared.ADT.Traits; +using Content.Shared.Examine; using Content.Shared.Inventory; using Content.Shared.StepTrigger.Components; using Content.Shared.Tag; @@ -24,6 +25,9 @@ private void OnStepTriggerAttempt(Entity ent, ref St private void OnStepTriggerClothingAttempt(EntityUid uid, ClothingRequiredStepTriggerComponent component, ref StepTriggerAttemptEvent args) { + if (HasComp(args.Tripper)) // ADT Quirks + args.Cancelled = true; + if (_inventory.TryGetInventoryEntity(args.Tripper, out _)) { args.Cancelled = true; diff --git a/Content.Shared/Throwing/CheckThrowRangeModifiersEvent.cs b/Content.Shared/Throwing/CheckThrowRangeModifiersEvent.cs new file mode 100644 index 0000000000..ce26a71bb1 --- /dev/null +++ b/Content.Shared/Throwing/CheckThrowRangeModifiersEvent.cs @@ -0,0 +1,9 @@ +using System.Numerics; // ADT File + +namespace Content.Shared.Throwing; + +/// +/// Raised on thrown entity. +/// +[ByRefEvent] +public record struct CheckThrowRangeModifiersEvent(EntityUid? User, float VectorMod = 1f, float SpeedMod = 1f); diff --git a/Content.Shared/Throwing/ThrowingSystem.cs b/Content.Shared/Throwing/ThrowingSystem.cs index 549473278e..355684cd19 100644 --- a/Content.Shared/Throwing/ThrowingSystem.cs +++ b/Content.Shared/Throwing/ThrowingSystem.cs @@ -198,6 +198,13 @@ public void TryThrow(EntityUid uid, // If someone changes how tile friction works at some point, this will have to be adjusted. var throwSpeed = compensateFriction ? direction.Length() / (flyTime + 1 / tileFriction) : baseThrowSpeed; var impulseVector = direction.Normalized() * throwSpeed * physics.Mass; + // ADT Quirks start + var modifiersEv = new CheckThrowRangeModifiersEvent(user); + RaiseLocalEvent(user ?? EntityUid.Invalid, ref modifiersEv); + throwSpeed *= modifiersEv.SpeedMod; + impulseVector *= modifiersEv.VectorMod; + // ADT Quirks end + _physics.ApplyLinearImpulse(uid, impulseVector, body: physics); if (comp.LandTime == null || comp.LandTime <= TimeSpan.Zero) diff --git a/Resources/Locale/ru-RU/ADT/Interaction/fast-hide-popups.ftl b/Resources/Locale/ru-RU/ADT/Interaction/fast-hide-popups.ftl new file mode 100644 index 0000000000..01b7f99125 --- /dev/null +++ b/Resources/Locale/ru-RU/ADT/Interaction/fast-hide-popups.ftl @@ -0,0 +1,3 @@ +quirk-fast-locker-hide-success = Вы успешно спрятались. +quirk-fast-locker-hide-fail = Вы не можете забраться сюда. +quirk-fast-locker-hide-verb = Спрятаться diff --git a/Resources/Locale/ru-RU/ADT/traits/categories.ftl b/Resources/Locale/ru-RU/ADT/traits/categories.ftl index f714bd58c5..ad62730731 100644 --- a/Resources/Locale/ru-RU/ADT/traits/categories.ftl +++ b/Resources/Locale/ru-RU/ADT/traits/categories.ftl @@ -1 +1,3 @@ -trait-category-height = Рост \ No newline at end of file +trait-category-quirks = Особенности +trait-category-height = Рост + diff --git a/Resources/Locale/ru-RU/ADT/traits/positive.ftl b/Resources/Locale/ru-RU/ADT/traits/positive.ftl new file mode 100644 index 0000000000..9c9ba595a8 --- /dev/null +++ b/Resources/Locale/ru-RU/ADT/traits/positive.ftl @@ -0,0 +1,14 @@ +trait-soft-walk-name = Осторожный шаг +trait-soft-walk-desc = Вы достаточно осторожны, чтобы не наступать на опасные точки даже без обуви. + +trait-freerunning-name = Паркурщик +trait-freerunning-desc = Вы гораздо быстрее забираетесь на столы. + +trait-sprinter-name = Спринтер +trait-sprinter-desc = Вы бегаете чуть быстрее остальных представителей своего вида. + +trait-fast-lockers-name = Ловкий +trait-fast-lockers-desc = Вы можете моментально и максимально незаметно забраться внутрь шкафа, или ящика. + +trait-hard-thrower-name = Сильный бросок +trait-hard-thrower-desc = Вы бросаетесь вещами сильнее остальных. diff --git a/Resources/Locale/ru-RU/preferences/ui/humanoid-profile-editor.ftl b/Resources/Locale/ru-RU/preferences/ui/humanoid-profile-editor.ftl index 77f2f665a1..fdcfd24d65 100644 --- a/Resources/Locale/ru-RU/preferences/ui/humanoid-profile-editor.ftl +++ b/Resources/Locale/ru-RU/preferences/ui/humanoid-profile-editor.ftl @@ -54,4 +54,4 @@ humanoid-profile-editor-no-traits = Нет доступных черт humanoid-profile-editor-trait-count-hint = Доступно очков: [{ $current }/{ $max }] trait-category-disabilities = Ограничения trait-category-speech = Черты речи -trait-category-quirks = Причуды +#trait-category-quirks = Причуды # Название фигня, в адт папке лучше diff --git a/Resources/Prototypes/ADT/Traits/disabilities.yml b/Resources/Prototypes/ADT/Traits/disabilities.yml index fc43fc11af..ad1a32c1f1 100644 --- a/Resources/Prototypes/ADT/Traits/disabilities.yml +++ b/Resources/Prototypes/ADT/Traits/disabilities.yml @@ -2,10 +2,11 @@ id: ADTHemophilia name: trait-hemophilia-name description: trait-hemophilia-desc - category: Disabilities + category: Quirks # ADT Quirks components: - type: Hemophilia modifier: 0.01 + cost: -2 # ADT Quirks # Simple Station @@ -13,6 +14,7 @@ id: ColorBlindnessMonochrome name: trait-monochromacy-name description: trait-monochromacy-description - category: Disabilities + category: Quirks # ADT Quirks components: - type: Monochromacy + cost: -1 # ADT Quirks diff --git a/Resources/Prototypes/ADT/Traits/quirks.yml b/Resources/Prototypes/ADT/Traits/quirks.yml new file mode 100644 index 0000000000..3fa205905a --- /dev/null +++ b/Resources/Prototypes/ADT/Traits/quirks.yml @@ -0,0 +1,49 @@ +# ADT + +- type: trait + id: ADTSoftWalk + name: trait-soft-walk-name + description: trait-soft-walk-desc + category: Quirks + components: + - type: SoftWalk + cost: 2 + +- type: trait + id: ADTFreerunning + name: trait-freerunning-name + description: trait-freerunning-desc + category: Quirks + components: + - type: Freerunning + cost: 1 + +- type: trait + id: ADTSprinter + name: trait-sprinter-name + description: trait-sprinter-desc + category: Quirks + components: + - type: Sprinter + modifier: 1.1 + cost: 2 + +- type: trait + id: ADTFastLockers + name: trait-fast-lockers-name + description: trait-fast-lockers-desc + category: Quirks + components: + - type: FastLockers + cost: 2 + +- type: trait + id: ADTHardThrower + name: trait-hard-thrower-name + description: trait-hard-thrower-desc + category: Quirks + components: + - type: HardThrower + modifier: 1.3 + cost: 2 + diff --git a/Resources/Prototypes/Traits/categories.yml b/Resources/Prototypes/Traits/categories.yml index d024b3fcff..0c86fab860 100644 --- a/Resources/Prototypes/Traits/categories.yml +++ b/Resources/Prototypes/Traits/categories.yml @@ -10,3 +10,4 @@ - type: traitCategory id: Quirks name: trait-category-quirks + maxTraitPoints: 0 # ADT quirks diff --git a/Resources/Prototypes/Traits/disabilities.yml b/Resources/Prototypes/Traits/disabilities.yml index c562c2fec0..5a88985504 100644 --- a/Resources/Prototypes/Traits/disabilities.yml +++ b/Resources/Prototypes/Traits/disabilities.yml @@ -3,60 +3,65 @@ name: trait-blindness-name description: trait-blindness-desc traitGear: WhiteCane - category: Disabilities + category: Quirks # ADT Quirks whitelist: components: - Blindable components: - type: PermanentBlindness + cost: -3 # ADT Quirks - type: trait id: PoorVision name: trait-poor-vision-name description: trait-poor-vision-desc traitGear: ClothingEyesGlasses - category: Disabilities + category: Quirks # ADT Quirks whitelist: components: - Blindable components: - type: PermanentBlindness blindness: 4 + cost: -2 # ADT Quirks - type: trait id: Narcolepsy name: trait-narcolepsy-name description: trait-narcolepsy-desc - category: Disabilities + category: Quirks # ADT Quirks components: - type: Narcolepsy timeBetweenIncidents: 300, 600 durationOfIncident: 10, 30 + cost: -2 # ADT Quirks - type: trait id: Unrevivable name: trait-unrevivable-name description: trait-unrevivable-desc - category: Disabilities + category: Quirks # ADT Quirks components: - type: Unrevivable + cost: -1 # ADT Quirks - type: trait id: Muted name: trait-muted-name description: trait-muted-desc - category: Disabilities + category: Quirks # ADT Quirks blacklist: components: - BorgChassis components: - type: Muted + cost: -2 # ADT Quirks - type: trait id: Paracusia name: trait-paracusia-name description: trait-paracusia-desc - category: Disabilities + category: Quirks # ADT Quirks components: - type: Paracusia minTimeBetweenIncidents: 0.1 @@ -64,3 +69,4 @@ maxSoundDistance: 7 sounds: collection: Paracusia + cost: -1 # ADT Quirks diff --git a/Resources/Prototypes/Traits/quirks.yml b/Resources/Prototypes/Traits/quirks.yml index d01bf6218a..28979dcc23 100644 --- a/Resources/Prototypes/Traits/quirks.yml +++ b/Resources/Prototypes/Traits/quirks.yml @@ -5,6 +5,7 @@ category: Quirks components: - type: Pacified + cost: -2 # ADT quirks - type: trait id: LightweightDrunk @@ -14,6 +15,7 @@ components: - type: LightweightDrunk boozeStrengthMultiplier: 2 + cost: -1 # ADT quirks - type: trait id: Snoring @@ -22,3 +24,4 @@ category: Quirks components: - type: Snoring + cost: -1 # ADT quirks