Proto-kinetic crusher (#16277)
Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
This commit is contained in:
@@ -1,48 +1,49 @@
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Markers
|
||||
namespace Content.Client.Markers;
|
||||
|
||||
public sealed class MarkerSystem : EntitySystem
|
||||
{
|
||||
public sealed class MarkerSystem : EntitySystem
|
||||
private bool _markersVisible;
|
||||
|
||||
public bool MarkersVisible
|
||||
{
|
||||
private bool _markersVisible;
|
||||
|
||||
public bool MarkersVisible
|
||||
get => _markersVisible;
|
||||
set
|
||||
{
|
||||
get => _markersVisible;
|
||||
set
|
||||
{
|
||||
_markersVisible = value;
|
||||
UpdateMarkers();
|
||||
}
|
||||
_markersVisible = value;
|
||||
UpdateMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<MarkerComponent, ComponentStartup>(OnStartup);
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, MarkerComponent marker, ComponentStartup args)
|
||||
{
|
||||
UpdateVisibility(uid);
|
||||
}
|
||||
|
||||
private void UpdateVisibility(EntityUid uid)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(uid, out SpriteComponent? sprite))
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<MarkerComponent, ComponentStartup>(OnStartup);
|
||||
sprite.Visible = MarkersVisible;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, MarkerComponent marker, ComponentStartup args)
|
||||
{
|
||||
UpdateVisibility(marker);
|
||||
}
|
||||
private void UpdateMarkers()
|
||||
{
|
||||
var query = AllEntityQuery<MarkerComponent>();
|
||||
|
||||
private void UpdateVisibility(MarkerComponent marker)
|
||||
while (query.MoveNext(out var uid, out var comp))
|
||||
{
|
||||
if (EntityManager.TryGetComponent(marker.Owner, out SpriteComponent? sprite))
|
||||
{
|
||||
sprite.Visible = MarkersVisible;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateMarkers()
|
||||
{
|
||||
foreach (var markerComponent in EntityManager.EntityQuery<MarkerComponent>(true))
|
||||
{
|
||||
UpdateVisibility(markerComponent);
|
||||
}
|
||||
UpdateVisibility(uid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ProjectileComponent, ComponentHandleState>(OnHandleState);
|
||||
SubscribeNetworkEvent<ImpactEffectEvent>(OnProjectileImpact);
|
||||
}
|
||||
|
||||
@@ -54,11 +53,4 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
||||
_player.Play(ent, anim, "impact-effect");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnHandleState(EntityUid uid, ProjectileComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not ProjectileComponentState state) return;
|
||||
component.Shooter = state.Shooter;
|
||||
component.IgnoreShooter = state.IgnoreShooter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Client.Toggleable;
|
||||
public sealed class ToggleableLightVisualsComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Sprite layer that will have it's visibility toggled when this item is toggled.
|
||||
/// Sprite layer that will have its visibility toggled when this item is toggled.
|
||||
/// </summary>
|
||||
[DataField("spriteLayer")]
|
||||
public string SpriteLayer = "light";
|
||||
|
||||
39
Content.Client/Weapons/Marker/DamageMarkerSystem.cs
Normal file
39
Content.Client/Weapons/Marker/DamageMarkerSystem.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Content.Shared.Weapons.Marker;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.Weapons.Marker;
|
||||
|
||||
public sealed class DamageMarkerSystem : SharedDamageMarkerSystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<DamageMarkerComponent, ComponentStartup>(OnMarkerStartup);
|
||||
SubscribeLocalEvent<DamageMarkerComponent, ComponentShutdown>(OnMarkerShutdown);
|
||||
}
|
||||
|
||||
private void OnMarkerStartup(EntityUid uid, DamageMarkerComponent component, ComponentStartup args)
|
||||
{
|
||||
if (!_timing.ApplyingState || component.Effect == null || !TryComp<SpriteComponent>(uid, out var sprite))
|
||||
return;
|
||||
|
||||
var layer = sprite.LayerMapReserveBlank(DamageMarkerKey.Key);
|
||||
sprite.LayerSetState(layer, component.Effect.RsiState, component.Effect.RsiPath);
|
||||
}
|
||||
|
||||
private void OnMarkerShutdown(EntityUid uid, DamageMarkerComponent component, ComponentShutdown args)
|
||||
{
|
||||
if (!_timing.ApplyingState || !TryComp<SpriteComponent>(uid, out var sprite) || !sprite.LayerMapTryGet(DamageMarkerKey.Key, out var weh))
|
||||
return;
|
||||
|
||||
sprite.RemoveLayer(weh);
|
||||
}
|
||||
|
||||
private enum DamageMarkerKey : byte
|
||||
{
|
||||
Key
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.StatusEffect;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
@@ -85,6 +86,16 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
||||
// Heavy attack.
|
||||
if (altDown == BoundKeyState.Down)
|
||||
{
|
||||
// TODO: Need to make alt-fire melee its own component I guess?
|
||||
// Melee and guns share a lot in the middle but share virtually nothing at the start and end so
|
||||
// it's kinda tricky.
|
||||
// I think as long as we make secondaries their own component it's probably fine
|
||||
// as long as guncomp has an alt-use key then it shouldn't be too much of a PITA to deal with.
|
||||
if (HasComp<GunComponent>(weaponUid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// We did the click to end the attack but haven't pulled the key up.
|
||||
if (weapon.Attacking)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Content.Client.Items;
|
||||
using Content.Client.Weapons.Ranged.Components;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Spawners.Components;
|
||||
using Content.Shared.Weapons.Ranged;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
@@ -137,7 +138,9 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (_inputSystem.CmdStates.GetState(EngineKeyFunctions.Use) != BoundKeyState.Down)
|
||||
var useKey = gun.UseKey ? EngineKeyFunctions.Use : EngineKeyFunctions.UseSecondary;
|
||||
|
||||
if (_inputSystem.CmdStates.GetState(useKey) != BoundKeyState.Down)
|
||||
{
|
||||
if (gun.ShotCounter != 0)
|
||||
EntityManager.RaisePredictiveEvent(new RequestStopShootEvent { Gun = gunUid });
|
||||
@@ -296,6 +299,9 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
_animPlayer.Play(ent, anim, "muzzle-flash");
|
||||
var light = EnsureComp<PointLightComponent>(uid);
|
||||
|
||||
if (light.Enabled)
|
||||
return;
|
||||
|
||||
light.NetSyncEnabled = false;
|
||||
light.Enabled = true;
|
||||
light.Color = Color.FromHex("#cc8e2b");
|
||||
|
||||
Reference in New Issue
Block a user