Closed P-D-E closed 3 years ago
@stephengtuggy According to data/modules/fg_util.py
if no faction file is found when needed, the choice falls back to universe/names.txt
so even removing them all does no practical harm; but there are historical design reasons linking factions to name choices, the Minister of Information might shed some light on that.
As for the exact duplicates, I suppose a link would suffice to preserve variety and faction distinction; or, if links are unpractical, ReadBaseNameList
in data/modules/fg_util.py
could be slightly modified to point to a single file for the andolian, confed, forsaken, highborn, homeland-security, LIHW, merchant, purist, shaper, and unadorned, whose files are indeed identical (no wonder as they're all human/post-human factions).
Note that, tho, while the current faction/file 1:1 match is totally flexible hence mod friendly, the grouping logic above would be strictly UtCS; a link based solution, which setups should possibly take care of, would be the cleanest and most flexible at the same time.
@P-D-E That makes a lot of sense.
@ministerofinformation @evertvorster feel free to chime in here.
I think there's something to be said both for flexibility/mod friendliness and for saving disk space. So yes, maybe links are the way to go. Maybe.
Possible solution: since ReadBaseNameList
in data/modules/fg_util.py
already looks for a few fallbacks,
filename = 'universe/fgnames/'+faction+'.txt'
...
f = open (filename,'r')
...
f = open ('../'+filename,'r')
...
f = open ('../universe/names.txt','r')
...
f = open ('universe/names.txt','r')
the 3rd attempt could be f = open ('names.txt','r')
where names.txt
is only one of the 10 identical files. How about this?
Real life is getting in the way of me playing with Vega Strike as much as I would have liked.
Links do not work the same way on Windows, and are not necessary. As long as the common denominator file is the fallback, that would be awesome.
Adding in a little bit of funky characters in the names do add depth to the experience of the game. This is of course only provided that it is not causing crashes or other issues... stability trumps window dressing every time.
I will be happy to play test once this one is merged. :)
We can do links in the future; but I'd suggest we do them in the data schema instead of in the file system.
{
"link": "filename or other identifier",
}
Also, if we want lists, we could do a loop'd iteration:
x = ['foo', 'foo1', 'foo2']
for v in x:
try:
with open(v, ...) as input_data:
...
break
except OSError: # parent of IsADirectoryError, FileNotFound, PermissionError, etc.
continue
We were still discussing file de-duplication, also I second Ben's suggestion about lists instead of the original nested try's, do I open another PR for that?
@P-D-E yes please
Thank you for submitting a pull request and becoming a contributor to Vega Strike: Upon the Coldest Sea.
Please answer the following:
Code Changes:
Issues:
Purpose: