2024-03-19 18:58:24 +05:00
|
|
|
|
using Content.Client.Weapons.Ranged.Components;
|
2024-03-22 16:27:51 +05:00
|
|
|
|
using Content.Shared._White.WeaponModules;
|
2024-03-19 18:58:24 +05:00
|
|
|
|
using Content.Shared.Rounding;
|
|
|
|
|
|
using Content.Shared.Weapons.Ranged.Systems;
|
|
|
|
|
|
using Robust.Client.GameObjects;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Client._White.WeaponsModules;
|
|
|
|
|
|
|
2024-03-22 16:27:51 +05:00
|
|
|
|
public sealed partial class WeaponModulesVisuals : VisualizerSystem<WeaponModulesComponent>
|
2024-03-19 18:58:24 +05:00
|
|
|
|
{
|
2024-08-21 23:23:23 +03:00
|
|
|
|
[Dependency] private readonly PointLightSystem _lightSystem = default!;
|
2024-03-22 16:27:51 +05:00
|
|
|
|
protected override void OnAppearanceChange(EntityUid uid, WeaponModulesComponent component, ref AppearanceChangeEvent args)
|
2024-03-19 18:58:24 +05:00
|
|
|
|
{
|
2024-03-20 21:07:17 +05:00
|
|
|
|
base.OnAppearanceChange(uid, component, ref args);
|
2024-03-19 18:58:24 +05:00
|
|
|
|
|
2024-03-20 21:07:17 +05:00
|
|
|
|
if(args.Sprite == null)
|
|
|
|
|
|
return;
|
2024-03-19 18:58:24 +05:00
|
|
|
|
|
2024-08-21 23:23:23 +03:00
|
|
|
|
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.BarrelModule, out var barrelModule, args.Component))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (barrelModule.Length != 0 && barrelModule != "none")
|
|
|
|
|
|
{
|
|
|
|
|
|
args.Sprite.LayerSetState(ModuleVisualState.BarrelModule, barrelModule);
|
|
|
|
|
|
args.Sprite.LayerSetVisible(ModuleVisualState.BarrelModule, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
args.Sprite.LayerSetVisible(ModuleVisualState.BarrelModule, false);
|
|
|
|
|
|
}
|
2024-03-24 16:00:19 +05:00
|
|
|
|
|
2024-08-21 23:23:23 +03:00
|
|
|
|
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.HandGuardModule, out var handguardModule, args.Component))
|
2024-03-20 21:07:17 +05:00
|
|
|
|
{
|
2024-08-21 23:23:23 +03:00
|
|
|
|
if (handguardModule.Length != 0 && handguardModule != "none")
|
|
|
|
|
|
{
|
|
|
|
|
|
args.Sprite.LayerSetState(ModuleVisualState.HandGuardModule, handguardModule);
|
|
|
|
|
|
args.Sprite.LayerSetVisible(ModuleVisualState.HandGuardModule, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
args.Sprite.LayerSetVisible(ModuleVisualState.HandGuardModule, false);
|
2024-04-04 18:44:55 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-21 23:23:23 +03:00
|
|
|
|
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.AimModule, out var aimModule, args.Component))
|
2024-04-04 18:44:55 +05:00
|
|
|
|
{
|
2024-08-21 23:23:23 +03:00
|
|
|
|
if (aimModule.Length != 0 && aimModule != "none")
|
|
|
|
|
|
{
|
|
|
|
|
|
args.Sprite.LayerSetState(ModuleVisualState.AimModule, aimModule);
|
|
|
|
|
|
args.Sprite.LayerSetVisible(ModuleVisualState.AimModule, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
args.Sprite.LayerSetVisible(ModuleVisualState.AimModule, false);
|
2024-03-20 21:07:17 +05:00
|
|
|
|
}
|
2024-03-19 18:58:24 +05:00
|
|
|
|
|
2024-08-21 23:23:23 +03:00
|
|
|
|
if (AppearanceSystem.TryGetData<string>(uid, ModuleVisualState.ShutterModule, out var shutterModule, args.Component))
|
2024-06-21 15:24:13 +05:00
|
|
|
|
{
|
2024-08-21 23:23:23 +03:00
|
|
|
|
if (shutterModule.Length != 0 && shutterModule != "none")
|
|
|
|
|
|
{
|
|
|
|
|
|
args.Sprite.LayerSetState(ModuleVisualState.ShutterModule, shutterModule);
|
|
|
|
|
|
args.Sprite.LayerSetVisible(ModuleVisualState.ShutterModule, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
args.Sprite.LayerSetVisible(ModuleVisualState.ShutterModule, false);
|
2024-06-21 15:24:13 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-21 23:23:23 +03:00
|
|
|
|
if (AppearanceSystem.TryGetData(uid, Modules.Light, out _, args.Component))
|
2024-03-19 18:58:24 +05:00
|
|
|
|
{
|
2024-03-20 21:07:17 +05:00
|
|
|
|
if (TryComp<PointLightComponent>(uid, out var pointLightComponent))
|
|
|
|
|
|
{
|
|
|
|
|
|
if(!pointLightComponent.Enabled)
|
|
|
|
|
|
return;
|
2024-08-21 23:23:23 +03:00
|
|
|
|
|
2024-03-20 21:07:17 +05:00
|
|
|
|
_lightSystem.SetMask("/Textures/White/Effects/LightMasks/lightModule.png", pointLightComponent!);
|
|
|
|
|
|
}
|
2024-03-19 18:58:24 +05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|