Enable finite automatic convoy startup and scoped gunner skill
This commit is contained in:
@@ -14,8 +14,9 @@ SCHEMA={
|
||||
'startDateCode':(0,0,1501231),
|
||||
'weatherProfile':(0,0,3),
|
||||
'stingerChanceOneIn':(15,0,10000),
|
||||
'automaticConvoyEnabled':(1,0,1),
|
||||
}
|
||||
AI_KEYS=('reportIntervalSeconds','supportSquadLimit','responseRadiusMetres','stingerChanceOneIn')
|
||||
AI_KEYS=('reportIntervalSeconds','supportSquadLimit','responseRadiusMetres','stingerChanceOneIn','automaticConvoyEnabled')
|
||||
INTEL_KEYS=('aiIntelChancePercent','intelRevealChancePercent')
|
||||
def merge(ai=None,intel=None):
|
||||
result={key:spec[0] for key,spec in SCHEMA.items()};deferred=[]
|
||||
@@ -30,7 +31,16 @@ def merge(ai=None,intel=None):
|
||||
if type(value) not in (int,float) or not lo<=value<=hi or int(value)!=value:
|
||||
raise ValueError(f'{key} must be an integer in [{lo},{hi}]')
|
||||
result[key]=int(value)
|
||||
deferred.extend(label+':'+key for key in data if key not in keys and key!='configVersion')
|
||||
recognized=set(keys)|{'configVersion'}
|
||||
if label=='ai' and 'convoyCount' in data:
|
||||
if 'automaticConvoyEnabled' in data:raise ValueError('Supply either convoyCount or automaticConvoyEnabled, not both')
|
||||
count=data['convoyCount']
|
||||
if type(count) not in (int,float) or not 0<=count<=20 or int(count)!=count:
|
||||
raise ValueError('convoyCount must be an integer in [0,20]')
|
||||
result['automaticConvoyEnabled']=int(count>0)
|
||||
recognized.add('convoyCount')
|
||||
if count>1:deferred.append(f'ai:convoyCount={int(count)} mapped to automaticConvoyEnabled=1; successor capped at one initial convoy')
|
||||
deferred.extend(label+':'+key for key in data if key not in recognized)
|
||||
return result,deferred
|
||||
|
||||
def write_new(path,text):
|
||||
@@ -55,6 +65,6 @@ def main():
|
||||
text=json.dumps(result,indent=2,allow_nan=False)+'\n'
|
||||
if a.out:write_new(a.out,text)
|
||||
else:print(text,end='')
|
||||
if deferred:print('Settings awaiting controller migration (source files retained): '+', '.join(deferred),file=sys.stderr)
|
||||
if deferred:print('Migration notes; unrecognized settings remain deferred (source files retained): '+', '.join(deferred),file=sys.stderr)
|
||||
except (ValueError,OSError) as e:p.error(str(e))
|
||||
if __name__=='__main__':main()
|
||||
|
||||
Reference in New Issue
Block a user