Closed HotaruBlaze closed 11 months ago
Alright, so we've tested this functionality on two debug servers now. It seems to work. Let's please get a list in here of what this MR is missing or cannot do so we can approach completing it.
The only real issue is the paths don't work between tes3mp loading it via require and via /load, because the paths don't match, it'll load the script twice
I added a checklist of the main issues I'm aware of, not gonna address the debug issue until that comes about as that's gonna end up requiring us to add another wrapper or changing how scripts are loaded.
Don't merge this yet, theirs a bug I'm currently diagnosing
Fixed it, it was a bug from when we removed the lookup table from customEventHooks.generateScriptID()
and made it always generate a new scriptID with the fixed seed logic.
We need to add an OnScriptLoad validator and handler, as well as move this logic into eventHandler.
This is now blocked until its added, as many scripts depend on OnServerInit or OnServerPostInit and theirs currently no way for the script itself to know it was loaded.
This allows you to easily remove and load active scripts via its scriptID without restarting.
When registering an handler/validator, you can optionally receive an scriptID, tied to your filename. This can be used to remove the event from tes3mp's event table This also adds a
"OnScriptUnload"
event that's triggered before we unload that scripts functionsrequire()
and/load
, as the ScriptID is based on the path, this will generate two different ID'sThis currently has a dedicated command for unloading due to their being an issue around /load and the filepath not matching what tes3mp is currently using, tho after figuring out this blocking issue, we should be able to implement it correctly into /loadThis is fixed now