Skip to content

fix: IW3 & T4 restrict VM shutdown handlers to game script shutdowns - #257

Merged
michaeloliverx merged 2 commits into
michaeloliverx:mainfrom
regenerance:iw3-t4-replacefunc-vm-bugfix
Oct 7, 2026
Merged

michaeloliverx merged 2 commits into
michaeloliverx:mainfrom
regenerance:iw3-t4-replacefunc-vm-bugfix

Conversation

@regenerance

Copy link
Copy Markdown
Contributor

Title

fix: IW3 & T4 restrict VM shutdown handlers to game script shutdowns

Description

Fixes IW3 & T4 VM shutdown handling so plugin-owned script state is only cleared when the game script system is actually being torn down.

Previously, vmShutdownHandlers were executed for every Scr_ShutdownSystem call regardless of the sys value. IW3 & T4 uses this value to identify different script/string-system shutdown categories, including temporary and zone-related cleanup.

Temporary shutdowns occur during normal gametype initialization and transitions. Treating these as a complete VM shutdown caused persistent script state, such as replacefunc mappings, to be cleared prematurely.

The shutdown hook now executes VM shutdown handlers only for SCRIPT_USER_GAME a.k.a. sys == 1 for IW3 and bComplete on T4.

This prevents temporary shutdowns from incorrectly clearing game VM state.

Changes

  • Restrict vmShutdownHandlers to SCRIPT_USER_GAME shutdowns.
  • Preserve plugin-owned VM state during temporary script-system cleanup.
  • Prevent replacefunc mappings and other VM-owned state from being cleared during normal gametype initialization.

@michaeloliverx
michaeloliverx merged commit 421fe68 into michaeloliverx:main Oct 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants