fix
This commit is contained in:
@@ -8,9 +8,7 @@ namespace Content.Client._White.WeaponsModules;
|
||||
|
||||
public sealed partial class WeaponModulesVisuals : VisualizerSystem<WeaponModulesComponent>
|
||||
{
|
||||
|
||||
[Dependency] private readonly PointLightSystem _lightSystem = default!;
|
||||
|
||||
protected override void OnAppearanceChange(EntityUid uid, WeaponModulesComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
base.OnAppearanceChange(uid, component, ref args);
|
||||
|
||||
@@ -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<AcceleratorModuleComponent, EntGotInsertedIntoContainerMessage>(AcceleratorModuleOnInsert);
|
||||
SubscribeLocalEvent<AcceleratorModuleComponent, EntGotRemovedFromContainerMessage>(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<AppearanceComponent>(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<AppearanceComponent>(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<AppearanceComponent>(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<GunComponent>(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<GunComponent>(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<GunComponent>(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);
|
||||
|
||||
@@ -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<WeaponModulesComponent>(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<TwoModeEnergyAmmoProviderComponent>(uid, out var comp))
|
||||
return;
|
||||
|
||||
|
||||
@@ -477,8 +477,8 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
|
||||
protected void MuzzleFlash(EntityUid gun, AmmoComponent component, EntityUid? user = null)
|
||||
{
|
||||
bool cancelled = TryComp<WeaponModulesComponent>(gun, out var weaponModulesComponent) && weaponModulesComponent.UseEffect;
|
||||
if(cancelled) return;
|
||||
bool cancelled = TryComp<WeaponModulesComponent>(gun, out var weaponModulesComponent) && weaponModulesComponent.WeaponFireEffect; // WD EDIT
|
||||
if(cancelled) return; // WD EDIT END
|
||||
|
||||
var attemptEv = new GunMuzzleFlashAttemptEvent();
|
||||
RaiseLocalEvent(gun, ref attemptEv);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public partial class WeaponModulesComponent : Component
|
||||
public List<EntityUid> Modules = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
||||
public bool UseEffect;
|
||||
public bool WeaponFireEffect;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
ent-LightModule = модульный фонарик
|
||||
.desc = Излучает свет.
|
||||
ent-LaserModule = лазерный модуль (улучшенный)
|
||||
.desc = Улучшенный модуль. Увеличивает скорость ваших пуль.
|
||||
ent-LaserModule = лазерный модуль
|
||||
.desc = За счет лазерной обработки пуль, увеличивает их скорость.
|
||||
ent-FlameHiderModule = пламегаситель
|
||||
.desc = Скрывает пламя огня во время выстрела.
|
||||
ent-SilencerModule = глушитель
|
||||
.desc = Скрывает пламя огня и приглушает звук во время выстрела.
|
||||
ent-AcceleratorModule = продвинутый модуль
|
||||
.desc = Увеличивает скорострельность оружия.
|
||||
.desc = Разработка NanoTrasen специально для отдела Службы Безопасности. Меняет затворную раму без видимых изменений, за счет этого увеличивает скорострельность оружия.
|
||||
gun-modules = Установленные модули: [color=cyan]{ $modules }[/color].
|
||||
@@ -248,8 +248,6 @@
|
||||
Plastic: 15
|
||||
Steel: 10
|
||||
Glass: 5
|
||||
Plasma: 10
|
||||
Silver: 5
|
||||
|
||||
- type: latheRecipe
|
||||
id: TargetHuman
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user