fix(bridge): the ZoneManager helper copies the player list without ToArray
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in 10s
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in 10s
Found compiling on the rust-oxide rig: BasePlayer.activePlayerList is Facepunch's ListHashSet, which has no ToArray, so the helper did not compile. It now copies into a List, which it needs anyway: entering a player can eject or kill them and change the live list mid-loop. HarmonyLib itself resolved on Oxide with no reference directive, and the helper patched ZoneManager 3.1.14 on both frameworks once this compiled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -292,7 +292,9 @@ namespace Oxide.Plugins
|
||||
|
||||
int entered = 0;
|
||||
|
||||
foreach (BasePlayer player in BasePlayer.activePlayerList.ToArray())
|
||||
// A copy: entering a player can eject or kill them, which changes the live list.
|
||||
// `activePlayerList` is Facepunch's ListHashSet, which has no ToArray.
|
||||
foreach (BasePlayer player in new List<BasePlayer>(BasePlayer.activePlayerList))
|
||||
{
|
||||
if (player == null || player.IsNpc || player.transform == null)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user