Skip to content

Commit

Permalink
fix enemies respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxADIxzx committed Mar 13, 2024
1 parent e277841 commit f6506fe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Jaket/Content/Enemies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static bool SyncDamage(EnemyIdentifier enemyId, ref float damage, bool ex
if (enemyId.TryGetComponent<Entity>(out var entity) && (entity is not RemotePlayer player || !player.Invincible))
Bullets.SyncDamage(entity.Id, enemyId.hitter, damage, explode, critDamage);

if (!LobbyController.IsOwner) damage = 0f;
if (!LobbyController.IsOwner && damage + damage * critDamage >= enemyId.health - 1f) damage = 0.0001f;
return true;
}

Expand All @@ -137,8 +137,10 @@ public static void SyncDeath(EnemyIdentifier enemyId)
if (enemyId.TryGetComponent<Enemy>(out var enemy))
{
if (LobbyController.IsOwner)
Networking.Send(PacketType.KillEntity, w => w.Id(enemy.Id), (data, size) => Events.Post2(() => Networking.Redirect(data, size)), 8);

{
Networking.Send(PacketType.KillEntity, w => w.Id(enemy.Id), size: 8);
Networking.Entities[enemy.Id] = null;
}
Tools.Destroy(enemy);
}
}
Expand Down

0 comments on commit f6506fe

Please sign in to comment.