Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -131,18 +131,20 @@ public abstract partial class SharedGunSystem : EntitySystem
return;
}
if (ent != msg.Gun)
if (ent != GetEntity(msg.Gun))
return;
gun.ShootCoordinates = msg.Coordinates;
gun.ShootCoordinates = GetCoordinates(msg.Coordinates);
Log.Debug($"Set shoot coordinates to {gun.ShootCoordinates}");
AttemptShoot(user.Value, ent, gun);
}
private void OnStopShootRequest(RequestStopShootEvent ev, EntitySessionEventArgs args)
{
var gunUid = GetEntity(ev.Gun);
if (args.SenderSession.AttachedEntity == null ||
!TryComp<GunComponent>(ev.Gun, out var gun) ||
!TryComp<GunComponent>(gunUid, out var gun) ||
!TryGetGun(args.SenderSession.AttachedEntity.Value, out _, out var userGun))
{
return;
@@ -151,7 +153,7 @@ public abstract partial class SharedGunSystem : EntitySystem
if (userGun != gun)
return;
StopShooting(ev.Gun, gun);
StopShooting(gunUid, gun);
}
public bool CanShoot(GunComponent component)
@@ -432,7 +434,7 @@ public abstract partial class SharedGunSystem : EntitySystem
if (sprite == null)
return;
var ev = new MuzzleFlashEvent(gun, sprite, user == gun);
var ev = new MuzzleFlashEvent(GetNetEntity(gun), sprite, user == gun);
CreateEffect(gun, ev, user);
}
@@ -454,7 +456,7 @@ public abstract partial class SharedGunSystem : EntitySystem
[Serializable, NetSerializable]
public sealed class HitscanEvent : EntityEventArgs
{
public List<(EntityCoordinates coordinates, Angle angle, SpriteSpecifier Sprite, float Distance)> Sprites = new();
public List<(NetCoordinates coordinates, Angle angle, SpriteSpecifier Sprite, float Distance)> Sprites = new();
}
}