This repository was archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
This repository was archived by the owner on May 8, 2024. It is now read-only.
Modding #11
Copy link
Copy link
Open
Description
Modding (modifying) the game is currently possible using the dynamic plugin system. Simply use Reflection to inject your custom code into the game.
There are some limitations, for example, it is impossible to override module functions.
(warning: pseudo-code below)
// module
export function test () {
return 'a'
}// plugin/custom
import { test } from 'module'
// This will just rename test
test = () => 'b'
// Also won't work
Object.assign(test, () => 'b')
// Event after completely destroying test...
Object.setPrototypeOf(test, null)
for (const k of Object.getOwnPropertyNames(test)) {
test[k] = undefined
delete test[k]
}
// And ensuring its completely destroyed...
Object.getPrototypeOf(test) // null
Object.getOwnPropertyNames(test) // ['arguments', 'caller', 'prototype']
test.arguments // null
test.caller // null
test.prototype // undefined
// It still works...
test() // 'a'The DX is also not great since all your code needs to be files inside the src[/public]/plugin (for ease of sharing and avoiding conflicts).
You also can not modify any non-code files without doing Reflection on the loaders themselves or using the node:fs module.
All that makes for a horrible, horrendous, impractical way of doing anything even slightly complex.
Metadata
Metadata
Assignees
Labels
No labels