Improve AI garrisons, player recovery and mission administration

This commit is contained in:
2026-09-24 22:12:45 +02:00
parent 1b1a8b5173
commit 2551d171b3
115 changed files with 3622 additions and 547 deletions
+10 -2
View File
@@ -3,6 +3,7 @@
import argparse,json,os,tempfile,sys
from pathlib import Path
SCHEMA={
'keepWeaponOnUnconscious':(1,0,1),
'reportIntervalSeconds':(10,5,60),
'supportSquadLimit':(4,0,8),
'responseRadiusMetres':(2000,500,5000),
@@ -13,12 +14,13 @@ SCHEMA={
'timeMultiplier':(1,1,24),
'startDateCode':(0,0,1501231),
'weatherProfile':(0,0,3),
'stingerChanceOneIn':(15,0,10000),
'antiAirChancePercent':(7,0,100),
'antiPersonnelMineChancePercent':(60,0,100),
'automaticConvoyEnabled':(1,0,1),
'convoyCount':(3,0,20),
'heliTimerMinutes':(15,1,1440),
}
AI_KEYS=('reportIntervalSeconds','supportSquadLimit','responseRadiusMetres','stingerChanceOneIn','automaticConvoyEnabled','heliTimerMinutes')
AI_KEYS=('reportIntervalSeconds','supportSquadLimit','responseRadiusMetres','antiAirChancePercent','antiPersonnelMineChancePercent','automaticConvoyEnabled','heliTimerMinutes')
INTEL_KEYS=('aiIntelChancePercent','intelRevealChancePercent')
def merge(ai=None,intel=None):
result={key:spec[0] for key,spec in SCHEMA.items()};deferred=[]
@@ -34,6 +36,12 @@ def merge(ai=None,intel=None):
raise ValueError(f'{key} must be an integer in [{lo},{hi}]')
result[key]=int(value)
recognized=set(keys)|{'configVersion'}
if label=='ai' and 'stingerChanceOneIn' in data:
old=data['stingerChanceOneIn']
if type(old) not in (int,float) or not 0<=old<=10000 or int(old)!=old:
raise ValueError('stingerChanceOneIn must be an integer in [0,10000]')
if 'antiAirChancePercent' not in data:result['antiAirChancePercent']=int(100/old+0.5) if old else 0
recognized.add('stingerChanceOneIn')
if label=='ai' and 'convoyCount' in data:
if 'automaticConvoyEnabled' in data:raise ValueError('Supply either convoyCount or automaticConvoyEnabled, not both')
count=data['convoyCount']