From 9581c466b972dea685b33e60ae431d53928137a8 Mon Sep 17 00:00:00 2001 From: CaypenNow <66198468+CaypenNow@users.noreply.github.com> Date: Wed, 27 Mar 2024 09:35:15 +0500 Subject: [PATCH] Tweaks (#247) * fix: stimulator now have rainbow effect * tweak: botany return * tweak: up delay * tweak: change delay --- .../Botany/Components/SeedComponent.cs | 6 ---- .../Botany/Systems/BotanySystem.Seed.cs | 3 +- .../Botany/Systems/PlantHolderSystem.cs | 31 ++----------------- .../_White/Chemistry/NarcoticEffect.cs | 22 +++---------- .../Chemistry/NarcoticEffectComponent.cs | 6 ++-- .../components/plant-holder-component.ftl | 2 +- Resources/Prototypes/Actions/types.yml | 3 +- .../Objects/Misc/subdermal_implants.yml | 2 +- Resources/Prototypes/Reagents/narcotics.yml | 12 +++++++ 9 files changed, 25 insertions(+), 62 deletions(-) diff --git a/Content.Server/Botany/Components/SeedComponent.cs b/Content.Server/Botany/Components/SeedComponent.cs index f475ec3cfc..3e729dc906 100644 --- a/Content.Server/Botany/Components/SeedComponent.cs +++ b/Content.Server/Botany/Components/SeedComponent.cs @@ -15,12 +15,6 @@ namespace Content.Server.Botany.Components [DataField("seed")] public SeedData? Seed; - /// - /// If not null, overrides the plant's initial health. Otherwise, the plant's initial health is set to the Endurance value. - /// - [DataField] - public float? HealthOverride = null; - /// /// Name of a base seed prototype that is used if is null. /// diff --git a/Content.Server/Botany/Systems/BotanySystem.Seed.cs b/Content.Server/Botany/Systems/BotanySystem.Seed.cs index f64fcb3c43..c9389f832e 100644 --- a/Content.Server/Botany/Systems/BotanySystem.Seed.cs +++ b/Content.Server/Botany/Systems/BotanySystem.Seed.cs @@ -104,12 +104,11 @@ public sealed partial class BotanySystem : EntitySystem /// /// Spawns a new seed packet on the floor at a position, then tries to put it in the user's hands if possible. /// - public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user, float? healthOverride = null) + public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user) { var seed = Spawn(proto.PacketPrototype, coords); var seedComp = EnsureComp(seed); seedComp.Seed = proto; - seedComp.HealthOverride = healthOverride; var name = Loc.GetString(proto.Name); var noun = Loc.GetString(proto.Noun); diff --git a/Content.Server/Botany/Systems/PlantHolderSystem.cs b/Content.Server/Botany/Systems/PlantHolderSystem.cs index 570ae97082..4e35495f43 100644 --- a/Content.Server/Botany/Systems/PlantHolderSystem.cs +++ b/Content.Server/Botany/Systems/PlantHolderSystem.cs @@ -71,17 +71,6 @@ public sealed class PlantHolderSystem : EntitySystem } } - private int GetCurrentGrowthStage(Entity entity) - { - var (uid, component) = entity; - - if (component.Seed == null) - return 0; - - var result = Math.Max(1, (int) (component.Age * component.Seed.GrowthStages / component.Seed.Maturation)); - return result; - } - private void OnExamine(Entity entity, ref ExaminedEvent args) { if (!args.IsInDetailsRange) @@ -159,7 +148,6 @@ public sealed class PlantHolderSystem : EntitySystem if (!_botany.TryGetSeed(seeds, out var seed)) return; - float? seedHealth = seeds.HealthOverride; var name = Loc.GetString(seed.Name); var noun = Loc.GetString(seed.Noun); _popup.PopupCursor(Loc.GetString("plant-holder-component-plant-success-message", @@ -169,14 +157,7 @@ public sealed class PlantHolderSystem : EntitySystem component.Seed = seed; component.Dead = false; component.Age = 1; - if (seedHealth is float realSeedHealth) - { - component.Health = realSeedHealth; - } - else - { - component.Health = component.Seed.Endurance; - } + component.Health = component.Seed.Endurance; component.LastCycle = _gameTiming.CurTime; QueueDel(args.Used); @@ -277,15 +258,9 @@ public sealed class PlantHolderSystem : EntitySystem return; } - if (GetCurrentGrowthStage(entity) <= 1) - { - _popup.PopupCursor(Loc.GetString("plant-holder-component-early-sample-message"), args.User); - return; - } - component.Health -= (_random.Next(3, 5) * 10); component.Seed.Unique = false; - var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User, component.Health); + var seed = _botany.SpawnSeedPacket(component.Seed, Transform(args.User).Coordinates, args.User); _randomHelper.RandomOffset(seed, 0.25f); var displayName = Loc.GetString(component.Seed.DisplayName); _popup.PopupCursor(Loc.GetString("plant-holder-component-take-sample-message", @@ -919,7 +894,7 @@ public sealed class PlantHolderSystem : EntitySystem } else if (component.Age < component.Seed.Maturation) { - var growthStage = GetCurrentGrowthStage((uid, component)); + var growthStage = Math.Max(1, (int) (component.Age * component.Seed.GrowthStages / component.Seed.Maturation)); _appearance.SetData(uid, PlantHolderVisuals.PlantRsi, component.Seed.PlantRsi.ToString(), app); _appearance.SetData(uid, PlantHolderVisuals.PlantState, $"stage-{growthStage}", app); diff --git a/Content.Shared/_White/Chemistry/NarcoticEffect.cs b/Content.Shared/_White/Chemistry/NarcoticEffect.cs index 6af9301b16..c106f57d1e 100644 --- a/Content.Shared/_White/Chemistry/NarcoticEffect.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffect.cs @@ -2,6 +2,7 @@ using Content.Shared._White.Mood; using Content.Shared.Chemistry.Components; using Content.Shared.Damage.Systems; +using Content.Shared.Drugs; using Content.Shared.Drunk; using Content.Shared.Standing; using Content.Shared.StatusEffect; @@ -48,44 +49,29 @@ public sealed class NarcoticEffect : EntitySystem RaiseLocalEvent(uid, new MoodEffectEvent("Stimulator")); CancellationToken token = movespeedModifierComponent.CancelTokenSource.Token; - int timer = component.TimerInterval[_robustRandom.Next(0, component.TimerInterval.Count)]; int slur = component.SlurTime[_robustRandom.Next(0, component.SlurTime.Count)]; switch (Enum.GetValues(typeof(NarcoticEffects)).GetValue(index)) { - case NarcoticEffects.TremorAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): - Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 25F), token); - _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); - break; - case NarcoticEffects.Shake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case NarcoticEffects.StunAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): + case NarcoticEffects.LieDownAndShake when _statusEffectsSystem.HasStatusEffect(uid, "Drunk", statusEffectsComp): Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); _statusEffectsSystem.TryAddTime(uid, "Drunk", TimeSpan.FromSeconds(slur), statusEffectsComp); break; - case NarcoticEffects.Stun: + case NarcoticEffects.LieDown: Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); break; - case NarcoticEffects.TremorAndShake: - Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 25F), token); - _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); - break; - - case NarcoticEffects.Tremor: - Timer.SpawnRepeating(timer, () => _stamina.TakeStaminaDamage(uid, 25F), token); - break; - case NarcoticEffects.Shake: _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; - case NarcoticEffects.StunAndShake: + case NarcoticEffects.LieDownAndShake: Timer.SpawnRepeating(timer, () => _standingStateSystem.TryLieDown(uid, standingComp), token); _statusEffectsSystem.TryAddStatusEffect(uid, "Drunk", TimeSpan.FromSeconds(slur), true, statusEffectsComp); break; diff --git a/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs b/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs index 32e236ff59..a7fc3df146 100644 --- a/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs +++ b/Content.Shared/_White/Chemistry/NarcoticEffectComponent.cs @@ -19,9 +19,7 @@ public sealed partial class NarcoticEffectComponent : Component [Serializable, NetSerializable] public enum NarcoticEffects { - Stun, - Tremor, + LieDown, Shake, - TremorAndShake, - StunAndShake + LieDownAndShake } diff --git a/Resources/Locale/ru-RU/botany/components/plant-holder-component.ftl b/Resources/Locale/ru-RU/botany/components/plant-holder-component.ftl index 8522aa9e1a..c41fd8cf91 100644 --- a/Resources/Locale/ru-RU/botany/components/plant-holder-component.ftl +++ b/Resources/Locale/ru-RU/botany/components/plant-holder-component.ftl @@ -31,4 +31,4 @@ plant-holder-component-toxins-high-warning = Горит [color=red]предуп plant-holder-component-light-improper-warning = Мигает [color=yellow]предупреждение о неподходящем уровне освещения[/color]. plant-holder-component-heat-improper-warning = Мигает [color=orange]предупреждение о неподходящем уровне температуры[/color]. plant-holder-component-pressure-improper-warning = Мигает [color=lightblue]предупреждение о неподходящем атмосферном давлении[/color]. -plant-holder-component-gas-missing-warning = Мигает [color=cyan]предупреждение о неподходящем атмосферном составе[/color]. +plant-holder-component-gas-missing-warning = Мигает [color=cyan]предупреждение о неподходящем атмосферном составе[/color]. \ No newline at end of file diff --git a/Resources/Prototypes/Actions/types.yml b/Resources/Prototypes/Actions/types.yml index cd22605b64..5ed5ccddff 100644 --- a/Resources/Prototypes/Actions/types.yml +++ b/Resources/Prototypes/Actions/types.yml @@ -127,8 +127,7 @@ noSpawn: true components: - type: InstantAction - charges: 2 - useDelay: 5 + useDelay: 100 itemIconStyle: BigAction priority: -20 icon: diff --git a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml index 8d2b4d24d2..a425501872 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml @@ -206,7 +206,7 @@ implantAction: ActionActivateScramImplant - type: TriggerImplantAction - type: ScramImplant - teleportAttempts: 10 # small amount of risk of being teleported into space and lets you teleport off shuttles + teleportAttempts: 6 # small amount of risk of being teleported into space and lets you teleport off shuttles - type: entity parent: BaseSubdermalImplant diff --git a/Resources/Prototypes/Reagents/narcotics.yml b/Resources/Prototypes/Reagents/narcotics.yml index 24a072adf9..6160ce796e 100644 --- a/Resources/Prototypes/Reagents/narcotics.yml +++ b/Resources/Prototypes/Reagents/narcotics.yml @@ -25,6 +25,12 @@ Asphyxiation: 2 Narcotic: effects: + - !type:GenericStatusEffect + key: SeeingRainbows + component: SeeingRainbows + type: Add + time: 4 + refresh: false - !type:MovespeedModifier walkSpeedModifier: 1.35 sprintSpeedModifier: 1.35 @@ -63,6 +69,12 @@ metabolisms: Narcotic: effects: + - !type:GenericStatusEffect + key: SeeingRainbows + component: SeeingRainbows + type: Add + time: 4 + refresh: false - !type:MovespeedModifier walkSpeedModifier: 1.25 sprintSpeedModifier: 1.25