change components, remake system
This commit is contained in:
@@ -179,12 +179,6 @@ public sealed partial class GunComponent : Component
|
||||
[DataField]
|
||||
public bool ResetOnHandSelected = true;
|
||||
|
||||
/// <summary>
|
||||
/// For flamehider module | WD EDIT
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public bool canUseEffect;
|
||||
|
||||
/// <summary>
|
||||
/// The base value for how fast the projectile moves.
|
||||
/// </summary>
|
||||
@@ -237,7 +231,7 @@ public sealed partial class GunComponent : Component
|
||||
// WD START
|
||||
|
||||
public EntityUid? Target;
|
||||
|
||||
|
||||
[DataField("forceThrowingAngle")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool ForceThrowingAngle;
|
||||
|
||||
@@ -476,9 +476,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
|
||||
protected void MuzzleFlash(EntityUid gun, AmmoComponent component, EntityUid? user = null)
|
||||
{
|
||||
TryComp<GunComponent>(gun, out var gunComponent); // WD EDIT
|
||||
|
||||
var attemptEv = new GunMuzzleFlashAttemptEvent(gunComponent!.canUseEffect); // WD EDIT
|
||||
var attemptEv = new GunMuzzleFlashAttemptEvent();
|
||||
RaiseLocalEvent(gun, ref attemptEv);
|
||||
if (attemptEv.Cancelled)
|
||||
return;
|
||||
@@ -560,14 +558,6 @@ public abstract partial class SharedGunSystem : EntitySystem
|
||||
|
||||
RefreshModifiers(weapon);
|
||||
}
|
||||
|
||||
public void setUseEffect(EntityUid weapon, bool state)
|
||||
{
|
||||
TryComp<GunComponent>(weapon, out var gunComponent);
|
||||
gunComponent!.canUseEffect = state;
|
||||
|
||||
RefreshModifiers(weapon);
|
||||
}
|
||||
// WD EDIT END
|
||||
protected abstract void CreateEffect(EntityUid uid, MuzzleFlashEvent message, EntityUid? user = null);
|
||||
/// <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
|
||||
}
|
||||
Reference in New Issue
Block a user