diff --git a/Content.Client/_White/WeaponsModules/WeaponModulesVisuals.cs b/Content.Client/_White/WeaponsModules/WeaponModulesVisuals.cs index 85eb8112af..e9f3ce4987 100644 --- a/Content.Client/_White/WeaponsModules/WeaponModulesVisuals.cs +++ b/Content.Client/_White/WeaponsModules/WeaponModulesVisuals.cs @@ -18,8 +18,6 @@ public sealed partial class WeaponModulesVisuals : VisualizerSystem(uid, ModuleVisualState.Module, out var module, args.Component) && module.Length != 0 && module != "none") { args.Sprite.LayerSetState(ModuleVisualState.Module, module); diff --git a/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs b/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs index 159777e58f..10d2b22d0f 100644 --- a/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs +++ b/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs @@ -70,9 +70,12 @@ public sealed class WeaponModulesSystem : EntitySystem weaponModulesComponent.Modules.Add(module); if(!TryComp(weapon, out var appearanceComponent)) return; + if (!TryComp(weapon, out var gunComp)) return; + + component.OldProjectileSpeed = gunComp.ProjectileSpeed; _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "laser", appearanceComponent); - _gunSystem.setProjectileSpeed(weapon, 35.5F); + _gunSystem.SetProjectileSpeed(weapon, component.OldProjectileSpeed + 15F); } private void FlameHiderModuleOnInsert(EntityUid module, FlameHiderModuleComponent component, EntGotInsertedIntoContainerMessage args) @@ -111,7 +114,7 @@ public sealed class WeaponModulesSystem : EntitySystem _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "silencer", appearanceComponent); weaponModulesComponent.UseEffect = true; - _gunSystem.setSound(weapon, component.NewSoundGunshot); + _gunSystem.SetSound(weapon, component.NewSoundGunshot); Dirty(module, weaponModulesComponent); } @@ -129,8 +132,12 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; + if (!TryComp(weapon, out var gunComp)) return; + + component.OldFireRate = gunComp.FireRate; + _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "accelerator", appearanceComponent); - _gunSystem.setFireRate(weapon, 7.5F); + _gunSystem.SetFireRate(weapon, component.OldFireRate + 2F); } #endregion @@ -168,7 +175,7 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent); - _gunSystem.setProjectileSpeed(weapon, 25F); + _gunSystem.SetProjectileSpeed(weapon, component.OldProjectileSpeed); } private void FlameHiderModuleOnEject(EntityUid module, FlameHiderModuleComponent component, EntGotRemovedFromContainerMessage args) @@ -204,7 +211,7 @@ public sealed class WeaponModulesSystem : EntitySystem _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent); weaponModulesComponent.UseEffect = false; - _gunSystem.setSound(weapon, component.OldSoundGunshot!); + _gunSystem.SetSound(weapon, component.OldSoundGunshot!); Dirty(module, weaponModulesComponent); } @@ -222,7 +229,7 @@ public sealed class WeaponModulesSystem : EntitySystem if(!TryComp(weapon, out var appearanceComponent)) return; _appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent); - _gunSystem.setFireRate(weapon, component.OldFireRate); + _gunSystem.SetFireRate(weapon, component.OldFireRate); } #endregion diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 01daf57ad6..c8afd64540 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -539,26 +539,32 @@ public abstract partial class SharedGunSystem : EntitySystem Dirty(gun); } // WD EDIT - public void setProjectileSpeed(EntityUid weapon, float projectileSpeed) + public void SetProjectileSpeed(EntityUid weapon, float projectileSpeed) { - TryComp(weapon, out var gunComponent); - gunComponent!.ProjectileSpeed = projectileSpeed; + if(!TryComp(weapon, out var gunComponent)) + return; + + gunComponent.ProjectileSpeed = projectileSpeed; RefreshModifiers(weapon); } - public void setFireRate(EntityUid weapon, float fireRate) + public void SetFireRate(EntityUid weapon, float fireRate) { - TryComp(weapon, out var gunComponent); - gunComponent!.FireRate = fireRate; + if(!TryComp(weapon, out var gunComponent)) + return; + + gunComponent.FireRate = fireRate; RefreshModifiers(weapon); } - public void setSound(EntityUid weapon, SoundSpecifier sound) + public void SetSound(EntityUid weapon, SoundSpecifier sound) { - TryComp(weapon, out var gunComponent); - gunComponent!.SoundGunshot = sound; + if(!TryComp(weapon, out var gunComponent)) + return; + + gunComponent.SoundGunshot = sound; RefreshModifiers(weapon); } diff --git a/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs b/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs index 8a398502d0..3f8404931b 100644 --- a/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs @@ -6,5 +6,6 @@ [RegisterComponent] public sealed partial class LaserModuleComponent : BaseModuleComponent { - + [ViewVariables(VVAccess.ReadWrite), DataField] + public float OldProjectileSpeed; } diff --git a/Content.Shared/_White/WeaponModules/LightModuleComponent.cs b/Content.Shared/_White/WeaponModules/LightModuleComponent.cs index 7f215dd818..b90bbfe04c 100644 --- a/Content.Shared/_White/WeaponModules/LightModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/LightModuleComponent.cs @@ -6,6 +6,6 @@ [RegisterComponent] public sealed partial class LightModuleComponent : BaseModuleComponent { - [ViewVariables(VVAccess.ReadWrite)] + [ViewVariables(VVAccess.ReadWrite), DataField] public bool Enabled; } diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml index b1847572a8..2a160f2936 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml @@ -74,6 +74,7 @@ - state: mag-0 map: [ "enum.GunVisualLayers.Mag" ] - state: laser + visible: false sprite: White/Objects/Weapons/modulesOnWeapon.rsi map: [ "enum.ModuleVisualState.Module" ] - type: Gun @@ -181,6 +182,7 @@ - state: mag-0 map: [ "enum.GunVisualLayers.Mag" ] - state: laser + visible: false sprite: White/Objects/Weapons/modulesOnWeapon.rsi map: [ "enum.ModuleVisualState.Module" ] - type: Clothing diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml index fb064d3960..1332894437 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml @@ -118,6 +118,7 @@ - state: mag-0 map: ["enum.GunVisualLayers.Mag"] - state: laser + visible: false sprite: White/Objects/Weapons/modulesOnWeapon.rsi map: [ "enum.ModuleVisualState.Module" ] - type: Clothing @@ -238,6 +239,7 @@ map: ["enum.GunVisualLayers.MagUnshaded"] shader: unshaded - state: laser + visible: false sprite: White/Objects/Weapons/modulesOnWeapon.rsi map: [ "enum.ModuleVisualState.Module" ] - type: Clothing