Skip to content

Commit

Permalink
remove unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroJr committed Jan 19, 2025
1 parent 05766a5 commit b5c131a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 9 additions & 5 deletions Content.Server/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit b5c131a

Please sign in to comment.