Parent muzzle flashes to the shooter (#1935)

I didn't do hitscan because it would look weird af unless someone has a better idea.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-08-29 20:47:03 +10:00
committed by GitHub
parent cc1125cd91
commit 033ddb04e0
2 changed files with 4 additions and 3 deletions

View File

@@ -128,7 +128,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
return entity; return entity;
} }
public void MuzzleFlash(GridCoordinates grid, Angle angle) public void MuzzleFlash(IEntity entity, Angle angle)
{ {
if (_muzzleFlashSprite == null) if (_muzzleFlashSprite == null)
{ {
@@ -145,7 +145,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
EffectSprite = _muzzleFlashSprite, EffectSprite = _muzzleFlashSprite,
Born = time, Born = time,
DeathTime = deathTime, DeathTime = deathTime,
Coordinates = grid.Translated(offset), AttachedEntityUid = entity.Uid,
AttachedOffset = offset,
//Rotated from east facing //Rotated from east facing
Rotation = (float) angle.Theta, Rotation = (float) angle.Theta,
Color = Vector4.Multiply(new Vector4(255, 255, 255, 255), 1.0f), Color = Vector4.Multiply(new Vector4(255, 255, 255, 255), 1.0f),

View File

@@ -260,7 +260,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
if (CanMuzzleFlash) if (CanMuzzleFlash)
{ {
ammoComponent.MuzzleFlash(Owner.Transform.GridPosition, angle); ammoComponent.MuzzleFlash(Owner, angle);
} }
if (ammoComponent.Caseless) if (ammoComponent.Caseless)