Proto-kinetic crusher (#16277)

Co-authored-by: AJCM-git <60196617+AJCM-git@users.noreply.github.com>
This commit is contained in:
metalgearsloth
2023-05-14 13:15:18 +10:00
committed by GitHub
parent 356bf96039
commit 6417bb4fa0
68 changed files with 926 additions and 312 deletions

View 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
}
}

View File

@@ -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)
{

View File

@@ -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");