Production Protection
To prevent players from inspecting the game, modifying variables through the console, or viewing source code in production builds, the project includes an automatic "Production Protection" system.
Features
When the game is NOT running in "Test Play" mode (i.e., Utils.isOptionValid("test") is false), the following protections are active:
Right-Click Disabled: The browser context menu is disabled to prevent "Inspect Element".
Keyboard Shortcuts Blocked: Common DevTools shortcuts are intercepted and canceled:
F12Ctrl+Shift+I/Cmd+Option+ICtrl+Shift+J/Cmd+Option+JCtrl+Shift+C/Cmd+Option+CCtrl+U(View Source)
Implementation Details
The protection logic is located in js/plugins/rpgreact/production_protection.js. During the packaging process (via build-package.ps1), this script is:
Bundled: Appended to the main
RPGReact.jsplugin.Minified: Compressed along with the rest of the plugin code to make it harder to bypass.
Automatic: Only active in production builds. In the RMMZ editor's Test Play, all DevTools and right-click functionality remain available for debugging.
Development Plugins Removal
The build script also automatically removes development-only plugins from the production package. For example:
js/plugins/DevToolsManage.jsis excluded from the file copy.The entry for
DevToolsManageis stripped fromjs/plugins.jsin the output folder.
This ensures that development tools do not leak into the final game and prevents errors caused by missing development-only files.
Customizing Protection
If you need to add more protections or allow certain shortcuts, you can edit js/plugins/rpgreact/production_protection.js. Note that this file is only used during the build process to be bundled into the production version of the RPGReact plugin.
Last updated