✨ Add conditonal compilation
Adds conditional compilation using rollup-plugin
jscc` so we can have the option to build our plugins for both MV and MZ with one codebase while excluding code for one or the other.
Does it break compatibility?
Yes, as builds will no longer go to game/js/plugins
but instead will go to games/mv/js/plugins
and games/mz/js/pluigin
.
TODO:
-
Requires to fix tests -
Requires new tests to test the conditional compilation -
Requires additional documentation -
Requires Major version change v0.5.0 -> v1.0.0
Example:
//#if _MV
const PluginCommand = Game_Interpreter.prototype.pluginCommand
Game_Interpreter.prototype.pluginCommand = function (command, args) {
if (command.toLowerCase() === 'endless-runner') {
switch (args[0].toLowerCase()) {
case 'start':
SceneManager.push(Scene_Level)
break
default:
console.error(`There was a problem finding ${args[0]} are you sure it's a plugin command?`)
break
}
} else {
PluginCommand.call(this, command, args)
}
}
//#else
PluginManager.registerCommand('LTN_EndlessRunner', 'Play', () => {
SceneManager.push(Scene_Level)
})
//#endif
Edited by ltngames