Thanks, let's get this party started! I sure hope we can figure this out; it would improve and allow so many mods. Basically my end goal is to make a framework mod like one of raevn's that would allow other mods to edit JSON at runtime. From there I could use it to improve my custom unit names mod and probably turn it into a framework too. Also, @raevn we could really use your PA backend js knowledge here.
I sure hope that's not the case but I guess it makes sense based on what I saw in the js code I was looking at.
This is a little far fetched but maybe we could make a native tool that runs a localhost server that you can ping with js and then it will edit the JSON files through a shadowing mod.
That was my impression as well, which is I posted it in the API requests. It was mostly guesswork before but "unit_info.json" appears in the PA executable, not in the moddable UI. So unless there's some sort of callback we've missed, the UI doesn't do it.
Not that far fetched. You could write a python script(Easily compiled on all platforms) and open a websocket. The only problem is your would probably have to reload the game for the new files to update.
Most game files are automatically reloaded on the fly if they are edited (this is really cool & useful). It won't pick up newly added files though.
I just tried replacing a URL in a shadowed unit_list.json with a localhost address and PA outright crashed immediately on start.
So in theory we could shadow all unit json files in a mod and then have the python script edit them on command to do our bidding...
I'd simply like to be able to make supplementary changes to one or more attributes of an existing unit. E.g. Setting the line build settings of a unit without changing the other settings, so that I can make an area build mod that doesn't break every time unit stats are changed.
Ahh... why do you need to edit the JSON files at runtime? It's JS. You can just go object.property = value all day long.
In hindsight, that doesn't surprise me in the slightest. There's no point screwing with JSON for unit data unless we can screw with it on the server as well.
In general true, but there are some values which are client-side only, and you can also change models etc.
Technically, a note though. The only things that would really make a difference in the game json files would be unit names, models, and effects(Off the top of my head)
There's a few more (such as sounds, line/area build settings etc), but those are the main ones. In general, if it affects gameplay, it can't be changed client-side.