Skip to content

Commit

Permalink
HostHub doesnt exist until the round starts now??
Browse files Browse the repository at this point in the history
  • Loading branch information
marchellc committed Nov 26, 2024
1 parent eb5ccec commit 089e097
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
5 changes: 0 additions & 5 deletions LabExtended/Core/Hooking/HookManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ public static class HookManager
ev => InternalEvents.InternalHandlePlayerAuth((PlayerPreauthEvent)ev)
},

[typeof(MapGeneratedEvent)] = new List<Action<object>>()
{
_ => InternalEvents.InternalHandleMapGenerated()
},

[typeof(PlayerDyingEvent)] = new List<Action<object>>()
{
ev => CustomItem.InternalHandleDying((PlayerDyingEvent)ev),
Expand Down
16 changes: 4 additions & 12 deletions LabExtended/Events/InternalEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ internal static class InternalEvents
{
internal static void InternalHandleRoundWaiting()
{
ExMap.GenerateMap();
ExMap.OnRoundWait();

ExPlayer._preauthData.Clear();

if (ExPlayer._hostPlayer != null)
Expand All @@ -37,12 +40,7 @@ internal static void InternalHandleRoundWaiting()
ExPlayer._hostPlayer = null;
}

DamageInfo._wrappers.Clear();

if (ReferenceHub.TryGetHostHub(out var hostHub))
ExPlayer._hostPlayer = new ExPlayer(hostHub);
else
ApiLog.Warn("Player API", $"Failed to fetch the host player.");
DamageInfo._wrappers.Clear();

ExRound.RoundNumber++;

Expand All @@ -51,7 +49,6 @@ internal static void InternalHandleRoundWaiting()
ExRound.StartedAt = DateTime.MinValue;
ExRound.State = RoundState.WaitingForPlayers;

ExMap.OnRoundWait();
Prefabs.ReloadPrefabs();
}

Expand Down Expand Up @@ -213,10 +210,5 @@ internal static void InternalHandleRoleChange(PlayerSpawningArgs args)

ListPool<VoiceProfile>.Shared.Return(profilesToRemove);
}

internal static void InternalHandleMapGenerated()
{
ExMap.GenerateMap();
}
}
}

0 comments on commit 089e097

Please sign in to comment.