I wanted to implement a setting to either switch primary / secondary color for the uber cannon mod for quite some time, and now seems rather quite a good time since there is a nice settings manager (well documented too apparently) to organize mods' settings, thanks to @gonzo4711 (No one seems to be using it yet, that's sad ). So, the non developper that I am has several questions. As I understand how mods are loaded, they "shadow" (I read "temporary overwrite") existing PA files (+ add any other the modder may have created) at startup. In the above mentioned mod, it loads 3 *.pfx files, containing shaders (textual). Their content looks like that basically: I would have liked to have : where MyColorVar would be defined by the setting, but I don't think it's possible to (at least easily) integrate variables into that kind of files. Am I right ? So, I was wondering if it's possible, with multiple occurrences (predefined) of a file, to get around the problem: If Setting is set to Value 1 Use Modified_File_1.pfx instead of OriginalPA_File.pfx If Setting is set to Value 2 Use Modified_File_2.pfx instead of OriginalPA_File.pfx Is that kind of thing possible ? As I understand how it works, the shader (uber_proj_explosion.pfx) is loaded by some ammo file (cannon_uber.json), itself loaded by some file in pa/tool directory (uber_cannon.json) I am not sure at which level, the logic layout (*.js ?) could be done (if even possible). So if anyone can provide some advice, or point me to a mod already doing that kind of stuff, that would be great Thanks for reading me this far
The only way I can see this working is by loading the shader contents and using mountMemoryFiles, but that seems a pretty dim prospect given the need to restart the game to test shaders, last I tried to do it.
Thanks. Do you happen to know if a published mod ever used that api stuff ? Since my dev skill are being close to zero , I would have liked to attempt to understand it with an existing example. I naively made a search on my installed mods folder to see if one was already using this function, but result came empty (though I don't have all of them installed, obviously)
Unfortunately, I don't know of any, and I've got too much going on for a long-shot research project right now.
Used principally in Galactic War, lets see.. Code: ui/main/game/galactic_war/gw_play/gw_referee.js|163| api.file.mountMemoryFiles(cookedFiles); ui/main/game/replay_loading/replay_loading.js|86| api.file.mountMemoryFiles(cookedFiles); ui/main/shared/js/api/file.js|4| mountMemoryFiles: function (files) { engine.call("file.mountMemoryFiles", JSON.stringify(files)); }, But you have to keep any eye out for it's nuclear dual: Code: ui/main/game/galactic_war/gw_play/gw_referee.js|21| api.file.unmountAllMemoryFiles(); ui/main/game/galactic_war/gw_play/gw_referee.js|162| api.file.unmountAllMemoryFiles(); ui/main/game/replay_loading/replay_loading.js|85| api.file.unmountAllMemoryFiles(); ui/main/game/start/start.js|820| api.file.unmountAllMemoryFiles(); ui/main/shared/js/api/file.js|5| unmountAllMemoryFiles: function () { engine.call("file.unmountAllMemoryFiles"); }
Thanks I've put it on my list of things to checkout. Maybe this could solve Blueprint Unit Framework and Balance Mods.
So necroing this thread. I just got this idea reading this thread. Is it possible to send a copy paste command from the settings menu? I think that should be possible? In that case if you tick the option teamcolour then the specific pfx files will be replaced by the teamcoloured ones. This definately isn't the most elegant solution but it probably is the most easiest if possible and would definately work for the pfx files since they can be changed instantly without any crashes. Not sure about the json files though. Any comments on this idea?
We do not have access to the filesystem from within the game, so we cannot modify or create files like this.