ForLoveOfCats / SkyOfSteel

Git repo and bug tracker for SkyOfSteel
https://skyofsteel.org
MIT License
42 stars 10 forks source link

Expanded modding API #10

Closed ForLoveOfCats closed 5 years ago

ForLoveOfCats commented 5 years ago

The core modding API systems are in place and all current ingame actions are piped to the mod scripts. However the function list needs great expanding.

ForLoveOfCats commented 5 years ago

This is now becoming a high priority as 0.1 has shipped.

Please comment suggestions and requests below as to what features are wished from the mod api.

RedstoneParadox commented 5 years ago

A few things I'd like to see/work on:

ForLoveOfCats commented 5 years ago

Yes I was meaning to mention that I need to add a JS type for structures. Save and load should be easy, however the custom functions to the console will be tricky. I have pondered it before and the main issue is that the console engine is never and should never be restarted as that would clear all user defined variables and functions. However when a mod is unloaded all functions it created in the console must be removed.

ForLoveOfCats commented 5 years ago

One way this could be achieved is by storing a list of all functions that the current gamemode has exposed to the console and setting them all to undefined when the gamemode is unloaded. (One cannot delete functions in JS)

ForLoveOfCats commented 5 years ago

We need a system to execute JS code in the target engine when exposing a type to said engine. Some features the these types must be implemented directly in JS itself (like overriding .toString) so this would allow for that.

ForLoveOfCats commented 5 years ago

So the new plan is unsandboxed IronPython scripts with explicit manual installation instead of autodownload from server and execute.

Work has begun in the IronPython branch https://github.com/ForLoveOfCats/SkyOfSteel/tree/IronPython

ForLoveOfCats commented 5 years ago

Exposing custom functions to the console will be possible now with IronPython as when the gamemode is unloaded we can delete the functions it exposed to the console. (Python allows deleting functions whereas JS does not)

ForLoveOfCats commented 5 years ago

Closing this as the game's entire internal API is now exposed with the new C# gamemode scripting