From b5c131a023b5b220375714553188bff8436e08bf Mon Sep 17 00:00:00 2001 From: ElectroJr Date: Sun, 19 Jan 2025 21:15:44 +1300 Subject: [PATCH] remove unnecessary changes --- Content.Client/Weapons/Ranged/Systems/GunSystem.cs | 3 +-- Content.Server/Weapons/Ranged/Systems/GunSystem.cs | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index fb6e58809189..e9b20bc8745f 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -104,13 +104,12 @@ private void OnHitscan(HitscanEvent ev) { // ALL I WANT IS AN ANIMATED EFFECT + // TODO EFFECTS // This is very jank // because the effect consists of three unrelatd entities, the hitscan beam can be split appart. // E.g., if a grid rotates while part of the beam is parented to the grid, and part of it is parented to the map. // Ideally, there should only be one entity, with one sprite that has multiple layers // Or at the very least, have the other entities parented to the same entity to make sure they stick together. - // TODO EFFECTS - // Fix this jank foreach (var a in ev.Sprites) { if (a.Sprite is not SpriteSpecifier.Rsi rsi) diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs index 374ad507e983..316b2a6ad553 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs @@ -415,26 +415,30 @@ private void FireEffects(EntityCoordinates fromCoordinates, float distance, Angl angle -= _transform.GetWorldRotation(fromXform); } - var fromNetCoords = GetNetCoordinates(fromCoordinates); - var dir = angle.ToVec(); if (distance >= 1f) { if (hitscan.MuzzleFlash != null) { - var netCoords = new NetCoordinates(fromNetCoords.NetEntity, fromNetCoords.Position + dir / 2); + var coords = fromCoordinates.Offset(angle.ToVec().Normalized() / 2); + var netCoords = GetNetCoordinates(coords); + sprites.Add((netCoords, angle, hitscan.MuzzleFlash, 1f)); } if (hitscan.TravelFlash != null) { - var netCoords = new NetCoordinates(fromNetCoords.NetEntity, fromNetCoords.Position + dir * (distance + 0.5f) / 2); + var coords = fromCoordinates.Offset(angle.ToVec() * (distance + 0.5f) / 2); + var netCoords = GetNetCoordinates(coords); + sprites.Add((netCoords, angle, hitscan.TravelFlash, distance - 1.5f)); } } if (hitscan.ImpactFlash != null) { - var netCoords = new NetCoordinates(fromNetCoords.NetEntity,fromNetCoords.Position + dir * distance); + var coords = fromCoordinates.Offset(angle.ToVec() * distance); + var netCoords = GetNetCoordinates(coords); + sprites.Add((netCoords, angle.FlipPositive(), hitscan.ImpactFlash, 1f)); }