Skip to content

Commit

Permalink
fix enemy respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxADIxzx committed Mar 10, 2024
1 parent e42df2f commit 3f72c8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Jaket/Content/Enemies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static bool Sync(EnemyIdentifier enemyId)
}

/// <summary> Synchronizes damage dealt to the enemy. </summary>
public static bool SyncDamage(EnemyIdentifier enemyId, float damage, bool explode, float critDamage, GameObject source)
public static bool SyncDamage(EnemyIdentifier enemyId, ref float damage, bool explode, float critDamage, GameObject source)
{
if (LobbyController.Lobby == null || enemyId.dead) return true;

Expand All @@ -125,7 +125,7 @@ public static bool SyncDamage(EnemyIdentifier enemyId, float damage, bool explod
if (enemyId.TryGetComponent<Entity>(out var entity) && (entity is not RemotePlayer player || !player.Invincible))
Bullets.SyncDamage(entity.Id, enemyId.hitter, damage, explode, critDamage);

// the entity was created before the lobby
if (!LobbyController.IsOwner) damage = 0f;
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Jaket/Patches/EnemyPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class EnemyPatch

[HarmonyPrefix]
[HarmonyPatch(nameof(EnemyIdentifier.DeliverDamage))]
static bool Damage(EnemyIdentifier __instance, float multiplier, bool tryForExplode, float critMultiplier, GameObject sourceWeapon) =>
Enemies.SyncDamage(__instance, multiplier, tryForExplode, critMultiplier, sourceWeapon);
static bool Damage(EnemyIdentifier __instance, ref float multiplier, bool tryForExplode, float critMultiplier, GameObject sourceWeapon) =>
Enemies.SyncDamage(__instance, ref multiplier, tryForExplode, critMultiplier, sourceWeapon);

[HarmonyPrefix]
[HarmonyPatch(nameof(EnemyIdentifier.Death))]
Expand Down

0 comments on commit 3f72c8c

Please sign in to comment.