diff --git a/Content.Client/_White/WeaponsModules/WeaponModulesVisuals.cs b/Content.Client/_White/WeaponsModules/WeaponModulesVisuals.cs index 85eb8112af..40f840be23 100644 --- a/Content.Client/_White/WeaponsModules/WeaponModulesVisuals.cs +++ b/Content.Client/_White/WeaponsModules/WeaponModulesVisuals.cs @@ -8,9 +8,7 @@ namespace Content.Client._White.WeaponsModules; public sealed partial class WeaponModulesVisuals : VisualizerSystem { - [Dependency] private readonly PointLightSystem _lightSystem = default!; - protected override void OnAppearanceChange(EntityUid uid, WeaponModulesComponent component, ref AppearanceChangeEvent args) { base.OnAppearanceChange(uid, component, ref args); diff --git a/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs b/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs index b2455b2046..1251efa1d0 100644 --- a/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs +++ b/Content.Server/_White/WeaponModules/WeaponModulesSystem.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using Content.Shared._White.WeaponModules; using Content.Shared.Weapons.Ranged.Components; +using Content.Shared.Weapons.Ranged.Events; using Content.Shared.Weapons.Ranged.Systems; using Linguini.Syntax.Ast; using Robust.Server.GameObjects; @@ -34,12 +35,12 @@ public sealed class WeaponModulesSystem : EntitySystem SubscribeLocalEvent(AcceleratorModuleOnInsert); SubscribeLocalEvent(AcceleratorModuleOnEject); } + private bool TryInsertModule(EntityUid module, EntityUid weapon, BaseModuleComponent component, - EntGotInsertedIntoContainerMessage args, [NotNullWhen(true)] out WeaponModulesComponent? weaponModulesComponent, - [NotNullWhen(true)] out AppearanceComponent? appearanceComponent) + string containerId, [NotNullWhen(true)] out WeaponModulesComponent? weaponModulesComponent) { - if (!TryComp(weapon, out weaponModulesComponent) || !TryComp(weapon, out appearanceComponent) || - ModulesSlot != args.Container.ID) + if (!TryComp(weapon, out weaponModulesComponent) || !TryComp(weapon, out var appearanceComponent) || + containerId != ModulesSlot) { weaponModulesComponent = null; appearanceComponent = null; @@ -53,9 +54,9 @@ public sealed class WeaponModulesSystem : EntitySystem return true; } - private bool TryEjectModule(EntityUid module, EntityUid weapon, EntGotRemovedFromContainerMessage args, [NotNullWhen(true)] out WeaponModulesComponent? weaponModulesComponent, [NotNullWhen(true)] out AppearanceComponent? appearanceComponent) + private bool TryEjectModule(EntityUid module, EntityUid weapon, string containerId, [NotNullWhen(true)] out WeaponModulesComponent? weaponModulesComponent) { - if (!TryComp(weapon, out weaponModulesComponent) || !TryComp(weapon, out appearanceComponent) || ModulesSlot != args.Container.ID) + if (!TryComp(weapon, out weaponModulesComponent) || !TryComp(weapon, out var appearanceComponent) || containerId != ModulesSlot) { weaponModulesComponent = null; appearanceComponent = null; @@ -74,12 +75,13 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryInsertModule(module, weapon, component, args, out var weaponModulesComponent, out var appearanceComponent)) + if(!TryInsertModule(module, weapon, component, args.Container.ID, out var weaponModulesComponent)) return; - _lightSystem.EnsureLight(weapon); + TryComp(weapon, out var appearanceComponent); + + SharedPointLightComponent light = _lightSystem.EnsureLight(weapon); - _lightSystem.TryGetLight(weapon, out var light); _appearanceSystem.SetData(weapon, Modules.Light, "none", appearanceComponent); _lightSystem.SetRadius(weapon, component.Radius, light); @@ -90,11 +92,11 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryInsertModule(module, weapon, component, args, out var weaponModulesComponent, out var appearanceComponent)) - return; - if (!TryComp(weapon, out var gunComp)) return; + if(!TryInsertModule(module, weapon, component, args.Container.ID, out var weaponModulesComponent)) + return; + component.OldProjectileSpeed = gunComp.ProjectileSpeed; _gunSystem.SetProjectileSpeed(weapon, component.OldProjectileSpeed + component.ProjectileSpeedAdd); @@ -104,10 +106,10 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryInsertModule(module, weapon, component, args, out var weaponModulesComponent, out var appearanceComponent)) + if(!TryInsertModule(module, weapon, component, args.Container.ID, out var weaponModulesComponent)) return; - weaponModulesComponent.UseEffect = true; + weaponModulesComponent.WeaponFireEffect = true; Dirty(module, weaponModulesComponent); } @@ -115,14 +117,14 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryInsertModule(module, weapon, component, args, out var weaponModulesComponent, out var appearanceComponent)) - return; - if (!TryComp(weapon, out var gunComp)) return; + if(!TryInsertModule(module, weapon, component, args.Container.ID, out var weaponModulesComponent)) + return; + component.OldSoundGunshot = gunComp.SoundGunshot; - weaponModulesComponent.UseEffect = true; + weaponModulesComponent.WeaponFireEffect = true; _gunSystem.SetSound(weapon, component.NewSoundGunshot); Dirty(module, weaponModulesComponent); @@ -132,11 +134,11 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryInsertModule(module, weapon, component, args, out var weaponModulesComponent, out var appearanceComponent)) - return; - if (!TryComp(weapon, out var gunComp)) return; + if(!TryInsertModule(module, weapon, component, args.Container.ID, out var weaponModulesComponent)) + return; + component.OldFireRate = gunComp.FireRate; _gunSystem.SetFireRate(weapon, component.OldFireRate + component.FireRateAdd); @@ -148,10 +150,12 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryEjectModule(module, weapon, args, out var weaponModulesComponent, out var appearanceComponent)) + if(!TryEjectModule(module, weapon, args.Container.ID, out var weaponModulesComponent)) + return; + + if(!_lightSystem.TryGetLight(weapon, out var light)) return; - _lightSystem.TryGetLight(weapon, out var light); _lightSystem.SetRadius(weapon, 0F, light); _lightSystem.SetEnabled(weapon, false, light); } @@ -160,7 +164,7 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryEjectModule(module, weapon, args, out var weaponModulesComponent, out var appearanceComponent)) + if(!TryEjectModule(module, weapon, args.Container.ID, out var weaponModulesComponent)) return; _gunSystem.SetProjectileSpeed(weapon, component.OldProjectileSpeed); @@ -170,10 +174,10 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryEjectModule(module, weapon, args, out var weaponModulesComponent, out var appearanceComponent)) + if(!TryEjectModule(module, weapon, args.Container.ID, out var weaponModulesComponent)) return; - weaponModulesComponent.UseEffect = false; + weaponModulesComponent.WeaponFireEffect = false; Dirty(module, weaponModulesComponent); } @@ -181,10 +185,10 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryEjectModule(module, weapon, args, out var weaponModulesComponent, out var appearanceComponent)) + if(!TryEjectModule(module, weapon, args.Container.ID, out var weaponModulesComponent)) return; - weaponModulesComponent.UseEffect = false; + weaponModulesComponent.WeaponFireEffect = false; _gunSystem.SetSound(weapon, component.OldSoundGunshot!); Dirty(module, weaponModulesComponent); } @@ -193,7 +197,7 @@ public sealed class WeaponModulesSystem : EntitySystem { EntityUid weapon = args.Container.Owner; - if(!TryEjectModule(module, weapon, args, out var weaponModulesComponent, out var appearanceComponent)) + if(!TryEjectModule(module, weapon, args.Container.ID, out var weaponModulesComponent)) return; _gunSystem.SetFireRate(weapon, component.OldFireRate); diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs index 2e85803d7d..da185c01f0 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Interactions.cs @@ -1,3 +1,4 @@ +using Content.Shared._White.WeaponModules; using Content.Shared.Actions; using Content.Shared.Examine; using Content.Shared.Hands; @@ -21,6 +22,20 @@ public abstract partial class SharedGunSystem args.PushMarkup(Loc.GetString("gun-fire-rate-examine", ("color", FireRateExamineColor), ("fireRate", $"{component.FireRateModified:0.0}"))); + if (TryComp(uid, out var weaponModulesComponent)) + { + if (weaponModulesComponent.Modules.Count == 0) + { + args.PushMarkup(Loc.GetString("gun-modules", ("modules", "Пусто"))); + return; + } + + foreach (var module in weaponModulesComponent.Modules) + { + args.PushMarkup(Loc.GetString("gun-modules", ("modules", Name(module)))); + } + } + if (!TryComp(uid, out var comp)) return; diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index c8afd64540..37d2c21d6d 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -477,8 +477,8 @@ public abstract partial class SharedGunSystem : EntitySystem protected void MuzzleFlash(EntityUid gun, AmmoComponent component, EntityUid? user = null) { - bool cancelled = TryComp(gun, out var weaponModulesComponent) && weaponModulesComponent.UseEffect; - if(cancelled) return; + bool cancelled = TryComp(gun, out var weaponModulesComponent) && weaponModulesComponent.WeaponFireEffect; // WD EDIT + if(cancelled) return; // WD EDIT END var attemptEv = new GunMuzzleFlashAttemptEvent(); RaiseLocalEvent(gun, ref attemptEv); diff --git a/Content.Shared/_White/WeaponModules/AcceleratorModuleComponent.cs b/Content.Shared/_White/WeaponModules/AcceleratorModuleComponent.cs index bd6d877ad5..597976a2a4 100644 --- a/Content.Shared/_White/WeaponModules/AcceleratorModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/AcceleratorModuleComponent.cs @@ -6,9 +6,7 @@ [RegisterComponent] public sealed partial class AcceleratorModuleComponent : BaseModuleComponent { - [ViewVariables(VVAccess.ReadWrite), DataField] public float OldFireRate; - [ViewVariables(VVAccess.ReadWrite), DataField] public float FireRateAdd = 2.4F; } diff --git a/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs b/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs index f048d99832..3fd6a91103 100644 --- a/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/LaserModuleComponent.cs @@ -6,9 +6,7 @@ [RegisterComponent] public sealed partial class LaserModuleComponent : BaseModuleComponent { - [ViewVariables(VVAccess.ReadWrite), DataField] public float OldProjectileSpeed; - [ViewVariables(VVAccess.ReadWrite), DataField] public float ProjectileSpeedAdd = 15F; } diff --git a/Content.Shared/_White/WeaponModules/LightModuleComponent.cs b/Content.Shared/_White/WeaponModules/LightModuleComponent.cs index fb05d387e4..136663e886 100644 --- a/Content.Shared/_White/WeaponModules/LightModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/LightModuleComponent.cs @@ -6,9 +6,7 @@ [RegisterComponent] public sealed partial class LightModuleComponent : BaseModuleComponent { - [ViewVariables(VVAccess.ReadWrite), DataField] public bool Enabled; - [ViewVariables(VVAccess.ReadWrite), DataField] public float Radius = 4F; } diff --git a/Content.Shared/_White/WeaponModules/SilencerModuleComponent.cs b/Content.Shared/_White/WeaponModules/SilencerModuleComponent.cs index 074a21ae77..d3e72065c8 100644 --- a/Content.Shared/_White/WeaponModules/SilencerModuleComponent.cs +++ b/Content.Shared/_White/WeaponModules/SilencerModuleComponent.cs @@ -8,9 +8,7 @@ namespace Content.Shared._White.WeaponModules; [RegisterComponent] public sealed partial class SilencerModuleComponent : BaseModuleComponent { - [ViewVariables(VVAccess.ReadWrite), DataField] public SoundSpecifier? OldSoundGunshot; - [ViewVariables(VVAccess.ReadWrite), DataField] public SoundSpecifier NewSoundGunshot = new SoundPathSpecifier("/Audio/White/Weapons/Modules/silence.ogg"); } diff --git a/Content.Shared/_White/WeaponModules/WeaponModulesComponent.cs b/Content.Shared/_White/WeaponModules/WeaponModulesComponent.cs index 4610382fc9..783648bc3f 100644 --- a/Content.Shared/_White/WeaponModules/WeaponModulesComponent.cs +++ b/Content.Shared/_White/WeaponModules/WeaponModulesComponent.cs @@ -13,7 +13,7 @@ public partial class WeaponModulesComponent : Component public List Modules = new(); [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] - public bool UseEffect; + public bool WeaponFireEffect; } [Serializable, NetSerializable] diff --git a/Resources/Locale/ru-RU/locales-new/autotranslate-57.ftl b/Resources/Locale/ru-RU/locales-new/autotranslate-57.ftl index 22a5530a80..b280261f02 100644 --- a/Resources/Locale/ru-RU/locales-new/autotranslate-57.ftl +++ b/Resources/Locale/ru-RU/locales-new/autotranslate-57.ftl @@ -1,10 +1,11 @@ ent-LightModule = модульный фонарик .desc = Излучает свет. -ent-LaserModule = лазерный модуль (улучшенный) - .desc = Улучшенный модуль. Увеличивает скорость ваших пуль. +ent-LaserModule = лазерный модуль + .desc = За счет лазерной обработки пуль, увеличивает их скорость. ent-FlameHiderModule = пламегаситель .desc = Скрывает пламя огня во время выстрела. ent-SilencerModule = глушитель .desc = Скрывает пламя огня и приглушает звук во время выстрела. ent-AcceleratorModule = продвинутый модуль - .desc = Увеличивает скорострельность оружия. \ No newline at end of file + .desc = Разработка NanoTrasen специально для отдела Службы Безопасности. Меняет затворную раму без видимых изменений, за счет этого увеличивает скорострельность оружия. +gun-modules = Установленные модули: [color=cyan]{ $modules }[/color]. \ No newline at end of file diff --git a/Resources/Prototypes/Recipes/Lathes/security.yml b/Resources/Prototypes/Recipes/Lathes/security.yml index e8d007cd3a..1a33745634 100644 --- a/Resources/Prototypes/Recipes/Lathes/security.yml +++ b/Resources/Prototypes/Recipes/Lathes/security.yml @@ -248,8 +248,6 @@ Plastic: 15 Steel: 10 Glass: 5 - Plasma: 10 - Silver: 5 - type: latheRecipe id: TargetHuman diff --git a/Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Modules/modules.yml b/Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Modules/modules.yml index c4adde47a5..dd2ec684aa 100644 --- a/Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Modules/modules.yml +++ b/Resources/Prototypes/_White/Entities/Objects/Weapons/Guns/Modules/modules.yml @@ -27,7 +27,6 @@ name: "light module" parent: BaseModule components: - - type: Item - type: LightModule value: "light" - type: Sprite @@ -40,7 +39,6 @@ name: "laser module" parent: BaseModule components: - - type: Item - type: LaserModule value: "laser" - type: Sprite @@ -53,7 +51,6 @@ name: "flamehider module" parent: BaseModule components: - - type: Item - type: FlameHiderModule value: "flamehider" - type: Sprite @@ -66,7 +63,6 @@ name: "silencer module" parent: BaseModule components: - - type: Item - type: SilencerModule value: "silencer" - type: Sprite @@ -79,7 +75,6 @@ name: "accelerator module" parent: BaseModule components: - - type: Item - type: AcceleratorModule value: "accelerator" - type: Sprite