From 7ff984bbc2e53f7070580a4cc4b1b43f8f0461d0 Mon Sep 17 00:00:00 2001 From: MilenVolf Date: Fri, 13 Dec 2024 01:56:19 +0300 Subject: [PATCH] Make clumsy work only when dragged by owner entity & Check for reclaimer comp --- .../BiomassReclaimer/BiomassReclaimerSystem.cs | 2 +- Content.Shared/Clumsy/ClumsySystem.cs | 12 ++++++++---- .../BiomassReclaimerComponent.cs | 17 +++++++++-------- 3 files changed, 18 insertions(+), 13 deletions(-) rename {Content.Server => Content.Shared}/Medical/BiomassReclaimer/BiomassReclaimerComponent.cs (84%) diff --git a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs index 868e6d99f251a0..63944ab0f25421 100644 --- a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs +++ b/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerSystem.cs @@ -20,6 +20,7 @@ using Content.Shared.Medical; using Content.Shared.Mind; using Content.Shared.Materials; +using Content.Shared.Medical.BiomassReclaimer; using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Content.Shared.Nutrition.Components; @@ -30,7 +31,6 @@ using Robust.Shared.Audio.Systems; using Robust.Shared.Configuration; using Robust.Shared.Physics.Components; -using Robust.Shared.Prototypes; using Robust.Shared.Random; namespace Content.Server.Medical.BiomassReclaimer diff --git a/Content.Shared/Clumsy/ClumsySystem.cs b/Content.Shared/Clumsy/ClumsySystem.cs index 4804b6b723433c..b5bd52155669f3 100644 --- a/Content.Shared/Clumsy/ClumsySystem.cs +++ b/Content.Shared/Clumsy/ClumsySystem.cs @@ -5,6 +5,7 @@ using Content.Shared.Damage; using Content.Shared.IdentityManagement; using Content.Shared.Medical; +using Content.Shared.Medical.BiomassReclaimer; using Content.Shared.Popups; using Content.Shared.Stunnable; using Content.Shared.Weapons.Ranged.Events; @@ -38,7 +39,7 @@ public override void Initialize() private void BeforeHyposprayEvent(Entity ent, ref SelfBeforeHyposprayInjectsEvent args) { // Clumsy people sometimes inject themselves! Apparently syringes are clumsy proof... - + // checks if ClumsyHypo is false, if so, skips. if (!ent.Comp.ClumsyHypo) return; @@ -54,7 +55,7 @@ private void BeforeHyposprayEvent(Entity ent, ref SelfBeforeHyp private void BeforeDefibrillatorZapsEvent(Entity ent, ref SelfBeforeDefibrillatorZapsEvent args) { // Clumsy people sometimes defib themselves! - + // checks if ClumsyDefib is false, if so, skips. if (!ent.Comp.ClumsyDefib) return; @@ -97,14 +98,17 @@ private void BeforeGunShotEvent(Entity ent, ref SelfBeforeGunSh private void OnBeforeClimbEvent(Entity ent, ref SelfBeforeClimbEvent args) { // checks if ClumsyVaulting is false, if so, skips. - if (!ent.Comp.ClumsyVaulting) + if (!ent.Comp.ClumsyVaulting + || HasComp(args.BeingClimbedOn)) return; // This event is called in shared, thats why it has all the extra prediction stuff. var rand = new System.Random((int)_timing.CurTick.Value); // If someone is putting you on the table, always get past the guard. - if (!_cfg.GetCVar(CCVars.GameTableBonk) && args.PuttingOnTable == ent.Owner && !rand.Prob(ent.Comp.ClumsyDefaultCheck)) + if (_cfg.GetCVar(CCVars.GameTableBonk) + || args.PuttingOnTable != ent.Owner + || !rand.Prob(ent.Comp.ClumsyDefaultCheck)) return; HitHeadClumsy(ent, args.BeingClimbedOn); diff --git a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerComponent.cs b/Content.Shared/Medical/BiomassReclaimer/BiomassReclaimerComponent.cs similarity index 84% rename from Content.Server/Medical/BiomassReclaimer/BiomassReclaimerComponent.cs rename to Content.Shared/Medical/BiomassReclaimer/BiomassReclaimerComponent.cs index 61d36f98b96060..d5e004a32aaa50 100644 --- a/Content.Server/Medical/BiomassReclaimer/BiomassReclaimerComponent.cs +++ b/Content.Shared/Medical/BiomassReclaimer/BiomassReclaimerComponent.cs @@ -1,8 +1,9 @@ using Content.Shared.Storage; +using Robust.Shared.GameStates; -namespace Content.Server.Medical.BiomassReclaimer +namespace Content.Shared.Medical.BiomassReclaimer { - [RegisterComponent] + [RegisterComponent, NetworkedComponent] public sealed partial class BiomassReclaimerComponent : Component { /// @@ -15,7 +16,7 @@ public sealed partial class BiomassReclaimerComponent : Component /// /// The interval for . /// - [ViewVariables(VVAccess.ReadWrite), DataField] + [DataField] public TimeSpan RandomMessInterval = TimeSpan.FromSeconds(5); /// @@ -47,31 +48,31 @@ public sealed partial class BiomassReclaimerComponent : Component /// /// How many units of biomass it produces for each unit of mass. /// - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public float YieldPerUnitMass = 0.4f; /// /// How many seconds to take to insert an entity per unit of its mass. /// - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public float BaseInsertionDelay = 0.1f; /// /// How much to multiply biomass yield from botany produce. /// - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public float ProduceYieldMultiplier = 0.25f; /// /// The time it takes to process a mob, per mass. /// - [DataField, ViewVariables(VVAccess.ReadWrite)] + [DataField] public float ProcessingTimePerUnitMass = 0.5f; /// /// Will this refuse to gib a living mob? /// - [ViewVariables(VVAccess.ReadWrite), DataField] + [DataField] public bool SafetyEnabled = true; } }