Space Exploration - scripts

by Quezler

Bruteforces access to some of the constants and util functions.

Internal
7 months ago
1.1
16.6K

g Does this mod let you make changes to SE's script variables, or just read them?

11 months ago

Can one use this mod to modify the SE scripts, or is that not possible? I've been working with data-stage modding for a while, but I'm very new to the control stage so apologies if it is a silly question.

11 months ago

Hi, thanks for asking.

It's basically impossible to chance anything in the control stage of other mods that isn't based on config values or callable via remote interfaces.

I wrote this mod for one purpose, and it's to read constants from the top of space exploration script files, they often rely on mod_prefix and Event. so this wrapper script sets the minimal variables required to get the script to load in (you can require any lua file of any mod's control stage, but it acts as though it runs from within your own mod) and after i grabbed the copy of what i needed i'm unsetting the global variables again and passing just the part that i need onto other mods, its often just the names of guis/buttons and other "magic numbers"

For example here you can see the "magic sauce" for zonelist:
https://github.com/Quezler/glutenfree/blob/main/mods/space-exploration-scripts/zonelist.lua

And if you open these 2 files and search for Zonelist you'll see some simple usages, sometimes (as is the case for Zonelist) it has a function that works purely on the zone data passed to it so it still functions:
https://github.com/Quezler/glutenfree/blob/2eacfe563e80132fe5a4e3aa2e19f59f3e1b1722/mods/se-universe-explorer-show-chunk-count/scripts/handler.lua#L4
https://github.com/Quezler/glutenfree/blob/2eacfe563e80132fe5a4e3aa2e19f59f3e1b1722/mods/glutenfree-se-tinted-pyramids/scripts/handler.lua#L4

But sometimes (as is the case for zones) i need to override some functions entirely, for example Zone.get_signal_name originally checks zone.parent but when i ask for a zone's information via space exploration's remote interfaces it doesn't include nested tables (for good reason) so i had to add my own Zone.parent function that calls for another zone in the background, as well as edit that get_signal_name function to call for parents via there, the functions i add/override in there get passed on to mods that rely on this script:
https://github.com/Quezler/glutenfree/blob/main/mods/space-exploration-scripts/zone.lua
(there's even a custom Zone._get_rich_text_name function in there that was originally part of just my cargo rocket label mod but i needed those icons in my interplanetary construction turrets and later on the signal transmission buildings as well, so i just sneaked the function into my own copy for convenience :3)

New response