change components, remake system
This commit is contained in:
@@ -1,16 +1,17 @@
|
|||||||
using Content.Client.Weapons.Ranged.Components;
|
using Content.Client.Weapons.Ranged.Components;
|
||||||
|
using Content.Shared._White.WeaponModules;
|
||||||
using Content.Shared.Rounding;
|
using Content.Shared.Rounding;
|
||||||
using Content.Shared.Weapons.Ranged.Systems;
|
using Content.Shared.Weapons.Ranged.Systems;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
|
||||||
namespace Content.Client._White.WeaponsModules;
|
namespace Content.Client._White.WeaponsModules;
|
||||||
|
|
||||||
public sealed partial class WeaponModulesVisuals : VisualizerSystem<WeaponModulesVisualsComponent>
|
public sealed partial class WeaponModulesVisuals : VisualizerSystem<WeaponModulesComponent>
|
||||||
{
|
{
|
||||||
|
|
||||||
[Dependency] private readonly PointLightSystem _lightSystem = default!;
|
[Dependency] private readonly PointLightSystem _lightSystem = default!;
|
||||||
|
|
||||||
protected override void OnAppearanceChange(EntityUid uid, WeaponModulesVisualsComponent component, ref AppearanceChangeEvent args)
|
protected override void OnAppearanceChange(EntityUid uid, WeaponModulesComponent component, ref AppearanceChangeEvent args)
|
||||||
{
|
{
|
||||||
base.OnAppearanceChange(uid, component, ref args);
|
base.OnAppearanceChange(uid, component, ref args);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
/// This is used for...
|
/// This is used for...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class AcceleratorModuleComponent : Component
|
public sealed partial class AcceleratorModuleComponent : Shared._White.WeaponModules.WeaponModulesComponent
|
||||||
{
|
{
|
||||||
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
|
public float OldFireRate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
/// This is used for...
|
/// This is used for...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class FlameHiderModuleComponent : Component
|
public sealed partial class FlameHiderModuleComponent : Shared._White.WeaponModules.WeaponModulesComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
/// This is used for...
|
/// This is used for...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class LaserModuleComponent : Component
|
public sealed partial class LaserModuleComponent : Shared._White.WeaponModules.WeaponModulesComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
/// LightModuleComponent
|
/// LightModuleComponent
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class LightModuleComponent : WeaponModulesComponent
|
public sealed partial class LightModuleComponent : Shared._White.WeaponModules.WeaponModulesComponent
|
||||||
{
|
{
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool Enabled;
|
public bool Enabled;
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
namespace Content.Server._White.WeaponModules;
|
using Robust.Shared.Audio;
|
||||||
|
|
||||||
|
namespace Content.Server._White.WeaponModules;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is used for...
|
/// This is used for...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class SilencerModuleComponent : Component
|
public sealed partial class SilencerModuleComponent : Shared._White.WeaponModules.WeaponModulesComponent
|
||||||
{
|
{
|
||||||
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
|
public SoundSpecifier? OldSoundGunshot;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
namespace Content.Server._White.WeaponModules;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Base Module Component
|
|
||||||
/// </summary>
|
|
||||||
[RegisterComponent]
|
|
||||||
public partial class WeaponModulesComponent : Component
|
|
||||||
{
|
|
||||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
|
||||||
public List<EntityUid> Modules = new();
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Client._White.WeaponsModules;
|
using Content.Shared._White.Chemistry;
|
||||||
|
using Content.Shared._White.WeaponModules;
|
||||||
using Content.Shared.Weapons.Ranged.Components;
|
using Content.Shared.Weapons.Ranged.Components;
|
||||||
|
using Content.Shared.Weapons.Ranged.Events;
|
||||||
using Content.Shared.Weapons.Ranged.Systems;
|
using Content.Shared.Weapons.Ranged.Systems;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server._White.WeaponModules;
|
namespace Content.Server._White.WeaponModules;
|
||||||
|
|
||||||
@@ -15,130 +18,200 @@ public sealed class WeaponModulesSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearanceSystem = default!;
|
||||||
[Dependency] private readonly SharedGunSystem _gunSystem = default!;
|
[Dependency] private readonly SharedGunSystem _gunSystem = default!;
|
||||||
|
|
||||||
SoundSpecifier? oldSoundGunshot;
|
|
||||||
private float oldFireRate;
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<WeaponModulesComponent, EntInsertedIntoContainerMessage>(OnInsert);
|
SubscribeLocalEvent<LightModuleComponent, EntGotInsertedIntoContainerMessage>(LightModuleOnInsert);
|
||||||
SubscribeLocalEvent<WeaponModulesComponent, EntRemovedFromContainerMessage>(OnEject);
|
SubscribeLocalEvent<LightModuleComponent, EntGotRemovedFromContainerMessage>(LightModuleOnEject);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<LaserModuleComponent, EntGotInsertedIntoContainerMessage>(LaserModuleOnInsert);
|
||||||
|
SubscribeLocalEvent<LaserModuleComponent, EntGotRemovedFromContainerMessage>(LaserModuleOnEject);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<FlameHiderModuleComponent, EntGotInsertedIntoContainerMessage>(FlameHiderModuleOnInsert);
|
||||||
|
SubscribeLocalEvent<FlameHiderModuleComponent, EntGotRemovedFromContainerMessage>(FlameHiderModuleOnEject);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<SilencerModuleComponent, EntGotInsertedIntoContainerMessage>(SilencerModuleOnInsert);
|
||||||
|
SubscribeLocalEvent<SilencerModuleComponent, EntGotRemovedFromContainerMessage>(SilencerModuleOnEject);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<AcceleratorModuleComponent, EntGotInsertedIntoContainerMessage>(AcceleratorModuleOnInsert);
|
||||||
|
SubscribeLocalEvent<AcceleratorModuleComponent, EntGotRemovedFromContainerMessage>(AcceleratorModuleOnEject);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInsert(EntityUid uid, WeaponModulesComponent comp, EntInsertedIntoContainerMessage args)
|
#region InsertModules
|
||||||
|
private void LightModuleOnInsert(EntityUid module, LightModuleComponent component, EntGotInsertedIntoContainerMessage args)
|
||||||
{
|
{
|
||||||
if (ModulesSlot != args.Container.ID)
|
if (ModulesSlot != args.Container.ID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntityUid module = args.Entity;
|
if(!component.Modules.Contains(module))
|
||||||
|
component.Modules.Add(module);
|
||||||
|
|
||||||
EntityUid weapon = args.Container.Owner;
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
|
||||||
if (TryComp<GunComponent>(weapon, out var gunComp))
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
{
|
|
||||||
oldSoundGunshot = gunComp.SoundGunshot;
|
|
||||||
oldFireRate = gunComp.FireRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
InsertModules(module, comp);
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "light", appearanceComponent);
|
||||||
ModuleEffect(module, weapon);
|
|
||||||
|
_lightSystem.EnsureLight(weapon);
|
||||||
|
|
||||||
|
_lightSystem.TryGetLight(weapon, out var light);
|
||||||
|
_appearanceSystem.SetData(weapon, Modules.Light, "none", appearanceComponent);
|
||||||
|
|
||||||
|
_lightSystem.SetRadius(weapon, 4F, light);
|
||||||
|
_lightSystem.SetEnabled(weapon, true, light);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEject(EntityUid uid, WeaponModulesComponent comp, EntRemovedFromContainerMessage args)
|
private void LaserModuleOnInsert(EntityUid module, LaserModuleComponent component, EntGotInsertedIntoContainerMessage args)
|
||||||
{
|
{
|
||||||
if (ModulesSlot != args.Container.ID)
|
if (ModulesSlot != args.Container.ID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EntityUid module = args.Entity;
|
if(!component.Modules.Contains(module))
|
||||||
|
component.Modules.Add(module);
|
||||||
|
|
||||||
EntityUid weapon = args.Container.Owner;
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
|
||||||
RemoveModules(module, comp);
|
|
||||||
RemoveModuleEffect(module, weapon);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InsertModules(EntityUid module, WeaponModulesComponent comp)
|
|
||||||
{
|
|
||||||
if(!comp.Modules.Contains(module))
|
|
||||||
comp.Modules.Add(module);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ModuleEffect(EntityUid module, EntityUid weapon)
|
|
||||||
{
|
|
||||||
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
switch (module)
|
|
||||||
{
|
|
||||||
case "LightModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "light", appearanceComponent);
|
|
||||||
|
|
||||||
_lightSystem.EnsureLight(weapon);
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "laser", appearanceComponent);
|
||||||
|
_gunSystem.setProjectileSpeed(weapon, 35.5F);
|
||||||
_lightSystem.TryGetLight(weapon, out var light);
|
|
||||||
_appearanceSystem.SetData(weapon, Modules.Light, "none", appearanceComponent);
|
|
||||||
|
|
||||||
_lightSystem.SetRadius(weapon, 4F, light);
|
|
||||||
_lightSystem.SetEnabled(weapon, true, light);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "LaserModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "laser", appearanceComponent);
|
|
||||||
_gunSystem.setProjectileSpeed(weapon, 35.5F);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "FlameHiderModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "flamehider", appearanceComponent);
|
|
||||||
_gunSystem.setUseEffect(weapon, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "SilencerModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "silencer", appearanceComponent);
|
|
||||||
_gunSystem.setUseEffect(weapon, true);
|
|
||||||
_gunSystem.setSound(weapon, new SoundPathSpecifier("/Audio/White/Weapons/Modules/silence.ogg"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "AcceleratorModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "accelerator", appearanceComponent);
|
|
||||||
_gunSystem.setFireRate(weapon, 7.5F);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveModules(EntityUid module, WeaponModulesComponent comp)
|
private void FlameHiderModuleOnInsert(EntityUid module, FlameHiderModuleComponent component, EntGotInsertedIntoContainerMessage args)
|
||||||
{
|
{
|
||||||
if(comp.Modules.Contains(module))
|
if (ModulesSlot != args.Container.ID)
|
||||||
comp.Modules.Remove(module);
|
return;
|
||||||
}
|
|
||||||
|
if(!component.Modules.Contains(module))
|
||||||
|
component.Modules.Add(module);
|
||||||
|
|
||||||
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
|
||||||
private void RemoveModuleEffect(EntityUid module, EntityUid weapon)
|
|
||||||
{
|
|
||||||
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
switch (module)
|
|
||||||
{
|
|
||||||
case "LightModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
|
||||||
_lightSystem.TryGetLight(weapon, out var light);
|
|
||||||
_lightSystem.SetEnabled(weapon, false, light);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "LaserModule":
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "flamehider", appearanceComponent);
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
component.UseEffect = true;
|
||||||
_gunSystem.setProjectileSpeed(weapon, 25F);
|
Dirty(module, component);
|
||||||
break;
|
|
||||||
|
|
||||||
case "FlameHiderModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
|
||||||
_gunSystem.setUseEffect(weapon, false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "SilencerModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
|
||||||
_gunSystem.setUseEffect(weapon, false);
|
|
||||||
_gunSystem.setSound(weapon, oldSoundGunshot!);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "AcceleratorModule":
|
|
||||||
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
|
||||||
_gunSystem.setFireRate(weapon, oldFireRate);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SilencerModuleOnInsert(EntityUid module, SilencerModuleComponent component, EntGotInsertedIntoContainerMessage args)
|
||||||
|
{
|
||||||
|
if (ModulesSlot != args.Container.ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!component.Modules.Contains(module))
|
||||||
|
component.Modules.Add(module);
|
||||||
|
|
||||||
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
|
||||||
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
|
if (!TryComp<GunComponent>(weapon, out var gunComp)) return;
|
||||||
|
|
||||||
|
component.OldSoundGunshot = gunComp.SoundGunshot;
|
||||||
|
|
||||||
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "silencer", appearanceComponent);
|
||||||
|
component.UseEffect = true;
|
||||||
|
_gunSystem.setSound(weapon, new SoundPathSpecifier("/Audio/White/Weapons/Modules/silence.ogg"));
|
||||||
|
|
||||||
|
Dirty(module, component);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AcceleratorModuleOnInsert(EntityUid module, AcceleratorModuleComponent component, EntGotInsertedIntoContainerMessage args)
|
||||||
|
{
|
||||||
|
if (ModulesSlot != args.Container.ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!component.Modules.Contains(module))
|
||||||
|
component.Modules.Add(module);
|
||||||
|
|
||||||
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
|
||||||
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
|
|
||||||
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "accelerator", appearanceComponent);
|
||||||
|
_gunSystem.setFireRate(weapon, 7.5F);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region EjectModules
|
||||||
|
private void LightModuleOnEject(EntityUid module, LightModuleComponent component, EntGotRemovedFromContainerMessage args)
|
||||||
|
{
|
||||||
|
if (ModulesSlot != args.Container.ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(component.Modules.Contains(module))
|
||||||
|
component.Modules.Remove(module);
|
||||||
|
|
||||||
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
|
|
||||||
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
||||||
|
_lightSystem.TryGetLight(weapon, out var light);
|
||||||
|
_lightSystem.SetEnabled(weapon, false, light);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LaserModuleOnEject(EntityUid module, LaserModuleComponent component, EntGotRemovedFromContainerMessage args)
|
||||||
|
{
|
||||||
|
if (ModulesSlot != args.Container.ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(component.Modules.Contains(module))
|
||||||
|
component.Modules.Remove(module);
|
||||||
|
|
||||||
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
|
|
||||||
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
||||||
|
_gunSystem.setProjectileSpeed(weapon, 25F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FlameHiderModuleOnEject(EntityUid module, FlameHiderModuleComponent component, EntGotRemovedFromContainerMessage args)
|
||||||
|
{
|
||||||
|
if (ModulesSlot != args.Container.ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(component.Modules.Contains(module))
|
||||||
|
component.Modules.Remove(module);
|
||||||
|
|
||||||
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
|
|
||||||
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
||||||
|
component.UseEffect = false;
|
||||||
|
Dirty(module, component);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SilencerModuleOnEject(EntityUid module, SilencerModuleComponent component, EntGotRemovedFromContainerMessage args)
|
||||||
|
{
|
||||||
|
if (ModulesSlot != args.Container.ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(component.Modules.Contains(module))
|
||||||
|
component.Modules.Remove(module);
|
||||||
|
|
||||||
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
|
|
||||||
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
||||||
|
component.UseEffect = false;
|
||||||
|
_gunSystem.setSound(weapon, component.OldSoundGunshot!);
|
||||||
|
Dirty(module, component);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AcceleratorModuleOnEject(EntityUid module, AcceleratorModuleComponent component, EntGotRemovedFromContainerMessage args)
|
||||||
|
{
|
||||||
|
if (ModulesSlot != args.Container.ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(component.Modules.Contains(module))
|
||||||
|
component.Modules.Remove(module);
|
||||||
|
|
||||||
|
EntityUid weapon = args.Container.Owner;
|
||||||
|
if(!TryComp<AppearanceComponent>(weapon, out var appearanceComponent)) return;
|
||||||
|
|
||||||
|
_appearanceSystem.SetData(weapon, ModuleVisualState.Module, "none", appearanceComponent);
|
||||||
|
_gunSystem.setFireRate(weapon, component.OldFireRate);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,12 +179,6 @@ public sealed partial class GunComponent : Component
|
|||||||
[DataField]
|
[DataField]
|
||||||
public bool ResetOnHandSelected = true;
|
public bool ResetOnHandSelected = true;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// For flamehider module | WD EDIT
|
|
||||||
/// </summary>
|
|
||||||
[DataField, AutoNetworkedField]
|
|
||||||
public bool canUseEffect;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base value for how fast the projectile moves.
|
/// The base value for how fast the projectile moves.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -237,7 +231,7 @@ public sealed partial class GunComponent : Component
|
|||||||
// WD START
|
// WD START
|
||||||
|
|
||||||
public EntityUid? Target;
|
public EntityUid? Target;
|
||||||
|
|
||||||
[DataField("forceThrowingAngle")]
|
[DataField("forceThrowingAngle")]
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool ForceThrowingAngle;
|
public bool ForceThrowingAngle;
|
||||||
|
|||||||
@@ -476,9 +476,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
|
|
||||||
protected void MuzzleFlash(EntityUid gun, AmmoComponent component, EntityUid? user = null)
|
protected void MuzzleFlash(EntityUid gun, AmmoComponent component, EntityUid? user = null)
|
||||||
{
|
{
|
||||||
TryComp<GunComponent>(gun, out var gunComponent); // WD EDIT
|
var attemptEv = new GunMuzzleFlashAttemptEvent();
|
||||||
|
|
||||||
var attemptEv = new GunMuzzleFlashAttemptEvent(gunComponent!.canUseEffect); // WD EDIT
|
|
||||||
RaiseLocalEvent(gun, ref attemptEv);
|
RaiseLocalEvent(gun, ref attemptEv);
|
||||||
if (attemptEv.Cancelled)
|
if (attemptEv.Cancelled)
|
||||||
return;
|
return;
|
||||||
@@ -560,14 +558,6 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
|
|
||||||
RefreshModifiers(weapon);
|
RefreshModifiers(weapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUseEffect(EntityUid weapon, bool state)
|
|
||||||
{
|
|
||||||
TryComp<GunComponent>(weapon, out var gunComponent);
|
|
||||||
gunComponent!.canUseEffect = state;
|
|
||||||
|
|
||||||
RefreshModifiers(weapon);
|
|
||||||
}
|
|
||||||
// WD EDIT END
|
// WD EDIT END
|
||||||
protected abstract void CreateEffect(EntityUid uid, MuzzleFlashEvent message, EntityUid? user = null);
|
protected abstract void CreateEffect(EntityUid uid, MuzzleFlashEvent message, EntityUid? user = null);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using Content.Shared.Weapons.Ranged.Events;
|
||||||
|
|
||||||
|
namespace Content.Shared._White.WeaponModules;
|
||||||
|
|
||||||
|
public abstract class SharedWeaponModulesSystem : EntitySystem
|
||||||
|
{
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
SubscribeLocalEvent<WeaponModulesComponent, GunMuzzleFlashAttemptEvent>(OnMuzzleFlashEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMuzzleFlashEvent(EntityUid weapon, WeaponModulesComponent component, ref GunMuzzleFlashAttemptEvent args)
|
||||||
|
{
|
||||||
|
args.Cancelled = component.UseEffect;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared._White.WeaponModules;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Base Module Component
|
||||||
|
/// </summary>
|
||||||
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||||
|
public partial class WeaponModulesComponent : Component
|
||||||
|
{
|
||||||
|
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||||
|
public List<EntityUid> Modules = new();
|
||||||
|
|
||||||
|
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||||
|
public bool UseEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum ModuleVisualState : byte
|
||||||
|
{
|
||||||
|
Module
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public enum Modules : byte
|
||||||
|
{
|
||||||
|
Light
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using Robust.Shared.GameStates;
|
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
|
|
||||||
namespace Content.Client._White.WeaponsModules;
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
|
||||||
[RegisterComponent]
|
|
||||||
public sealed partial class WeaponModulesVisualsComponent : Component
|
|
||||||
{
|
|
||||||
[DataField] public string? state;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public enum ModuleVisualState : byte
|
|
||||||
{
|
|
||||||
Module
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
|
||||||
public enum Modules : byte
|
|
||||||
{
|
|
||||||
Light
|
|
||||||
}
|
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
parent: BaseModule
|
parent: BaseModule
|
||||||
components:
|
components:
|
||||||
- type: Item
|
- type: Item
|
||||||
|
- type: LightModule
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: light
|
state: light
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
@@ -39,6 +40,7 @@
|
|||||||
parent: BaseModule
|
parent: BaseModule
|
||||||
components:
|
components:
|
||||||
- type: Item
|
- type: Item
|
||||||
|
- type: LaserModule
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: laser
|
state: laser
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
@@ -50,6 +52,7 @@
|
|||||||
parent: BaseModule
|
parent: BaseModule
|
||||||
components:
|
components:
|
||||||
- type: Item
|
- type: Item
|
||||||
|
- type: FlameHiderModule
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: flamehider
|
state: flamehider
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
@@ -61,6 +64,7 @@
|
|||||||
parent: BaseModule
|
parent: BaseModule
|
||||||
components:
|
components:
|
||||||
- type: Item
|
- type: Item
|
||||||
|
- type: SilencerModule
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: silencer
|
state: silencer
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
@@ -72,6 +76,7 @@
|
|||||||
parent: BaseModule
|
parent: BaseModule
|
||||||
components:
|
components:
|
||||||
- type: Item
|
- type: Item
|
||||||
|
- type: AcceleratorModule
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: accelerator
|
state: accelerator
|
||||||
- type: Appearance
|
- type: Appearance
|
||||||
Reference in New Issue
Block a user