diff --git a/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs b/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs index b7db9f1eed..e48fd36bb1 100644 --- a/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs +++ b/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared._White.WeaponModules; +using System.Diagnostics.CodeAnalysis; +using Content.Shared._White.WeaponModules; using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Systems; using Robust.Server.GameObjects; @@ -32,7 +33,6 @@ public sealed class WeaponModulesSystem : EntitySystem SubscribeLocalEvent(AcceleratorModuleOnInsert); SubscribeLocalEvent(AcceleratorModuleOnEject); } - private bool TryInsertModule(EntityUid module, EntityUid weapon, EntGotInsertedIntoContainerMessage args) { if (TryComp(weapon, out var weaponModulesComponent) && ModulesSlot == args.Container.ID) @@ -57,6 +57,11 @@ public sealed class WeaponModulesSystem : EntitySystem return false; } + private void SetAppearance(EntityUid weapon, Enum key, string value, AppearanceComponent appearanceComponent) + { + _appearanceSystem.SetData(weapon, key, value, appearanceComponent); + } + #region InsertModules private void LightModuleOnInsert(EntityUid module, LightModuleComponent component, EntGotInsertedIntoContainerMessage args) { @@ -67,7 +72,7 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "light", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, component.AppearanceValue, appearanceComponent); _lightSystem.EnsureLight(weapon); @@ -90,7 +95,7 @@ public sealed class WeaponModulesSystem : EntitySystem component.OldProjectileSpeed = gunComp.ProjectileSpeed; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "laser", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, component.AppearanceValue, appearanceComponent); _gunSystem.SetProjectileSpeed(weapon, component.OldProjectileSpeed + 15F); } @@ -103,7 +108,7 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "flamehider", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, component.AppearanceValue, appearanceComponent); weaponModulesComponent.UseEffect = true; Dirty(module, weaponModulesComponent); } @@ -120,7 +125,7 @@ public sealed class WeaponModulesSystem : EntitySystem component.OldSoundGunshot = gunComp.SoundGunshot; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "silencer", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, component.AppearanceValue, appearanceComponent); weaponModulesComponent.UseEffect = true; _gunSystem.SetSound(weapon, component.NewSoundGunshot); @@ -140,7 +145,7 @@ public sealed class WeaponModulesSystem : EntitySystem component.OldFireRate = gunComp.FireRate; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "accelerator", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, component.AppearanceValue, appearanceComponent); _gunSystem.SetFireRate(weapon, component.OldFireRate + 2F); } #endregion @@ -155,7 +160,7 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, "none", appearanceComponent); _lightSystem.TryGetLight(weapon, out var light); _lightSystem.SetRadius(weapon, 0F, light); _lightSystem.SetEnabled(weapon, false, light); @@ -170,7 +175,7 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, "none", appearanceComponent); _gunSystem.SetProjectileSpeed(weapon, component.OldProjectileSpeed); } @@ -183,7 +188,7 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, "none", appearanceComponent); weaponModulesComponent.UseEffect = false; Dirty(module, weaponModulesComponent); } @@ -197,7 +202,7 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, "none", appearanceComponent); weaponModulesComponent.UseEffect = false; _gunSystem.SetSound(weapon, component.OldSoundGunshot!); Dirty(module, weaponModulesComponent); @@ -212,9 +217,8 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; - _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent); + SetAppearance(weapon, ModuleVisualState.Module, "none", appearanceComponent); _gunSystem.SetFireRate(weapon, component.OldFireRate); - } #endregion } diff --git a/Content.Shared/_White/WeaponModules/AcceleratorModuleComponent.cs b/Content.Shared/_White/WeaponModules/AcceleratorModuleComponent.cs index 389c84c198..31e10e6214 100644 --- a/Content.Shared/_White/WeaponModules/AcceleratorModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/AcceleratorModuleComponent.cs @@ -8,4 +8,7 @@ public sealed partial class AcceleratorModuleComponent : BaseModuleComponent { [ViewVariables(VVAccess.ReadWrite), DataField] public float OldFireRate; + + [ViewVariables(VVAccess.ReadWrite), DataField] + public string AppearanceValue = "accelerator"; } diff --git a/Content.Shared/_White/WeaponModules/FlameHiderModuleComponent.cs b/Content.Shared/_White/WeaponModules/FlameHiderModuleComponent.cs index 94c9a9f02b..19a1e58bd4 100644 --- a/Content.Shared/_White/WeaponModules/FlameHiderModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/FlameHiderModuleComponent.cs @@ -6,4 +6,6 @@ [RegisterComponent] public sealed partial class FlameHiderModuleComponent : BaseModuleComponent { + [ViewVariables(VVAccess.ReadWrite), DataField] + public string AppearanceValue = "flamehider"; } diff --git a/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs b/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs index 3f8404931b..b2230a7d1b 100644 --- a/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs @@ -8,4 +8,7 @@ public sealed partial class LaserModuleComponent : BaseModuleComponent { [ViewVariables(VVAccess.ReadWrite), DataField] public float OldProjectileSpeed; + + [ViewVariables(VVAccess.ReadWrite), DataField] + public string AppearanceValue = "laser"; } diff --git a/Content.Shared/_White/WeaponModules/LightModuleComponent.cs b/Content.Shared/_White/WeaponModules/LightModuleComponent.cs index b90bbfe04c..689311586d 100644 --- a/Content.Shared/_White/WeaponModules/LightModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/LightModuleComponent.cs @@ -8,4 +8,7 @@ public sealed partial class LightModuleComponent : BaseModuleComponent { [ViewVariables(VVAccess.ReadWrite), DataField] public bool Enabled; + + [ViewVariables(VVAccess.ReadWrite), DataField] + public string AppearanceValue = "light"; } diff --git a/Content.Shared/_White/WeaponModules/SharedWeaponModulesSystem.cs b/Content.Shared/_White/WeaponModules/SharedWeaponModulesSystem.cs deleted file mode 100644 index 8c46a14130..0000000000 --- a/Content.Shared/_White/WeaponModules/SharedWeaponModulesSystem.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Content.Shared.Weapons.Ranged.Events; - -namespace Content.Shared._White.WeaponModules; - -public abstract class SharedWeaponModulesSystem : EntitySystem -{ - public override void Initialize() - { - } -} diff --git a/Content.Shared/_White/WeaponModules/SilencerModuleComponent.cs b/Content.Shared/_White/WeaponModules/SilencerModuleComponent.cs index 074a21ae77..146d8bae52 100644 --- a/Content.Shared/_White/WeaponModules/SilencerModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/SilencerModuleComponent.cs @@ -13,4 +13,7 @@ public sealed partial class SilencerModuleComponent : BaseModuleComponent [ViewVariables(VVAccess.ReadWrite), DataField] public SoundSpecifier NewSoundGunshot = new SoundPathSpecifier("/Audio/White/Weapons/Modules/silence.ogg"); + + [ViewVariables(VVAccess.ReadWrite), DataField] + public string AppearanceValue = "silencer"; }