diff --git a/museca@asphyxia/index.ts b/museca@asphyxia/index.ts index e5838f4..f447d09 100644 --- a/museca@asphyxia/index.ts +++ b/museca@asphyxia/index.ts @@ -1,9 +1,10 @@ import { common, exception, lounge, shop, hiscore, frozen } from "./handlers/common"; import { load, load_m, newProfile, save, save_m } from "./handlers/player"; +import { isRequiredVersion } from "./utils"; export function register() { - if(!R.DataFile) { // TODO: Better implementation. - return console.error("You need newer version of Core.") + if(!isRequiredVersion(1, 19)) { + console.error("You need newer version of Core. v1.19 or newer required.") } R.GameCode('PIX'); diff --git a/museca@asphyxia/utils.ts b/museca@asphyxia/utils.ts index 6b67e21..dfa7c78 100644 --- a/museca@asphyxia/utils.ts +++ b/museca@asphyxia/utils.ts @@ -1,4 +1,11 @@ export function IDToCode(id: number) { const padded = _.padStart(id.toString(), 8); return `${padded.slice(0, 4)}-${padded.slice(4)}`; +} + +export function isRequiredVersion(major: number, minor: number) { + // version value exposed since Core v1.19 + const core_major = typeof CORE_VERSION_MAJOR === "number" ? CORE_VERSION_MAJOR : 1 + const core_minor = typeof CORE_VERSION_MINOR === "number" ? CORE_VERSION_MINOR : 18 + return core_major >= major && core_minor >= minor } \ No newline at end of file