hoiv1.14.1.e4e7 #9

Open
tea wants to merge 3 commits from hoiv1.14.1.e4e7 into main
7 changed files with 664 additions and 728 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
__pycache__
.doit.db
*.kate-swp
/vanilla

47
dodo.py
View File

@ -4,14 +4,16 @@ from doit import get_var
DOIT_CONFIG = {
'default_tasks': ['build'],
'action_string_formatting': 'new'
'action_string_formatting': 'both'
}
def files(p):
for i in p:
if i.is_file():
yield i
class RawFiles(list):
def __init__(self, *args, **kwargs):
self.src_path = Path(kwargs.pop('src_path'))
@ -21,26 +23,33 @@ class RawFiles(list):
def sources(self):
for i in self:
yield self.src_path/i
def targets(self):
for i in self:
yield self.image_path/i
class BasePatchwork(dict):
patches_path = None
patchwork_path = None
vanilla_path = None
def __init__(self, *arkg, **kwargs):
self.patches_path = Path(kwargs.pop('patches_path'))
self.patchwork_path = Path(kwargs.pop('patchwork_path'))
self.vanilla_path = Path(kwargs.pop('vanilla_path'))
super().__init__(*arkg, **kwargs)
def targets(self):
for i in self.keys():
yield self.patchwork_path/i
def key_vanilla(self, orig_key):
return self.vanilla_path/orig_key
def key_target(self, orig_key):
return self.patchwork_path/orig_key
def tasks(self, actions):
def repack_action(action, **kwargs):
if callable(action):
@ -63,7 +72,6 @@ class BasePatchwork(dict):
}
class Patchwork(BasePatchwork):
def tasks_(self, actions):
for k, v in self.items():
@ -73,7 +81,7 @@ class Patchwork(BasePatchwork):
'targets': [self.patchwork_path/k],
'actions': [
f"mkdir -p {self.patchwork_path}/{Path(k).parent}",
f"patch -u --binary -N -o '{self.patchwork_path}/{k}' "\
f"patch -u --binary -N -o '{self.patchwork_path}/{k}' "
f"'{self.vanilla_path}/{k}' '{self.patches_path}/{v}'"
], # action ( mkdir, patch )
'clean': True
@ -87,9 +95,15 @@ class ScriptedPatchwork(BasePatchwork):
super().__init__(*args, **kwargs)
with open(file) as s:
for key, data in safe_load(s).items():
discovered_source = next((Path(self.vanilla_path)/'history'/'states').glob(f"{key}*"))
relative_path = discovered_source.relative_to(self.vanilla_path)
try:
discovered_source = next(
(Path(self.vanilla_path)/'history'/'states').glob(f"{key}*"))
relative_path = discovered_source.relative_to(
self.vanilla_path)
self[relative_path] = data
except StopIteration:
print(f"{key}: not found")
class RasterPatchwork(BasePatchwork):
@staticmethod
@ -135,8 +149,11 @@ class Patchset(list):
mod_name = 'randchgs'
mod_install_path = get_var('descriptor_mod_path', 'C:/Users/User/Documents/Paradox Interactive/Hearts of Iron IV/mod/randchgs')
dir_vanilla = Path(get_var('vanilla_path', '../vanilla/current'))
mod_install_path = get_var(
'descriptor_mod_path', 'C:/Users/User/Documents/Paradox Interactive/Hearts of Iron IV/mod/randchgs')
dir_vanilla = Path(get_var('vanilla_path', './vanilla/current'))
if not dir_vanilla.is_dir():
raise EnvironmentError(dir_vanilla)
dir_image = Path('build/image')
dir_modimage = dir_image/mod_name
dir_src_raw = Path('src/raw')
@ -150,7 +167,6 @@ dir_patchwork_path = Path('build/patched')
patchwork = Patchwork(
{
'map/definition.csv': 'map_definition.patch',
'history/countries/ISR - Israel.txt': 'history_countries_ISR.patch',
'history/states/454-Israel.txt': 'history_states_454.patch',
},
@ -185,6 +201,7 @@ patch_set = Patchset(
modimage_path=dir_modimage
)
def task_patch_history_states_scripted():
def history_state_patch(task, provinces):
source = Path(next(iter(task.file_dep)))
@ -199,9 +216,10 @@ def task_patch_history_states_scripted():
if not wrote_history and seen_history and '{' in line_in:
for province_id, province_info in provinces.items():
outfile.write(
"\t\tvictory_points = {\r\n"\
f"\t\t\t{province_id} {province_info['points']}\r\n"\
"\t\t}\r\n"\
"\t\tvictory_points = {\r\n"
f"\t\t\t{province_id} {
province_info['points']}\r\n"
"\t\t}\r\n"
)
wrote_history = True
for state_src, state_data in patchwork_scripted.items():
@ -213,9 +231,11 @@ def task_patch_history_states_scripted():
'clean': True
}
def task_patch_raster():
yield from patchwork_raster.tasks([patchwork_raster.patch_action])
def task_patch():
def mkdir(target, original, patch):
Path(target).parent.mkdir(parents=True, exist_ok=True)
@ -224,16 +244,18 @@ def task_patch():
"patch -u --binary -N -o '{target}' '{original}' '{patch}'"
])
def task_image():
return {
'file_dep': list(patch_set.image_sources()),
'targets': list(patch_set.image_files()),
'actions': [f"mkdir -p {dir_modimage}",
f"rsync -rv {dir_src_raw}/ {patchwork.patchwork_path}/"\
f"rsync -rv {dir_src_raw}/ {patchwork.patchwork_path}/"
f" {dir_modimage}/"],
'clean': True
}
def task_image_mod():
def prepare_modname_mod(task):
source = Path(next(iter(task.file_dep)))
@ -250,6 +272,7 @@ def task_image_mod():
'clean': True
}
def task_build():
return {
'file_dep': [f"{dir_image}/{mod_name}.mod"] + list(patch_set.image_files()),

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
--- ../vanilla/current/map/definition.csv 2023-10-10 13:46:35.000000000 +0400
+++ build/image/randchgs/map/definition.csv 2023-11-27 23:45:22.219054356 +0400
@@ -1013,7 +1013,7 @@
1012;5;17;244;sea;false;ocean;0
1013;5;18;30;land;true;plains;5
1014;5;18;85;land;true;jungle;6
-1015;5;18;135;land;true;desert;7
+1015;5;18;135;land;true;urban;7
1016;5;19;240;sea;false;ocean;0
1017;5;20;248;sea;false;ocean;0
1018;5;21;50;land;true;forest;6
@@ -1063,7 +1063,7 @@
1062;5;54;170;land;false;mountain;5
1063;5;57;30;land;true;forest;6
1064;5;57;85;land;false;desert;5
-1065;5;57;135;land;true;plains;7
+1065;5;57;135;land;true;urban;7
1066;5;60;50;land;false;mountain;6
1067;5;60;200;land;true;hills;6
1068;5;63;15;land;false;desert;5
@@ -1084,7 +1084,7 @@
1083;5;78;145;land;false;forest;6
1084;5;81;5;land;false;plains;6
1085;5;81;60;land;true;jungle;4
-1086;5;81;210;land;false;desert;7
+1086;5;81;210;land;false;urban;7
1087;5;84;25;land;false;plains;6
1088;5;84;70;land;true;plains;7
1089;5;84;175;land;true;hills;6

View File

@ -1,5 +0,0 @@
ISR_create_ships={
create_ship {
type = ship_hull_light_1
}
}

View File

@ -0,0 +1,133 @@
l_russian:
VICTORY_POINTS_11981:0 "Чжаньцзян"
VICTORY_POINTS_9970:0 "Шаогуань"
VICTORY_POINTS_4964:0 "Юйшу"
VICTORY_POINTS_10796:0 "Голмуд"
VICTORY_POINTS_7971:0 "Сучжоу"
VICTORY_POINTS_4704:0 "Хами"
VICTORY_POINTS_2074:0 "Чарклык"
VICTORY_POINTS_7926:0 "Сэни"
VICTORY_POINTS_5094:0 "Гегьэ"
VICTORY_POINTS_3427:0 "Ордос"
VICTORY_POINTS_4525:0 "Хундлун"
VICTORY_POINTS_12348:0 "Шилин-Хото"
VICTORY_POINTS_900:0 "Таншань"
VICTORY_POINTS_11801:0 "Чэндэ"
VICTORY_POINTS_7697:0 "Маньчжурия"
VICTORY_POINTS_4506:0 "Цицикар"
VICTORY_POINTS_6811:0 "Муданьцзян"
VICTORY_POINTS_1774:0 "Ховд"
VICTORY_POINTS_12669:0 "Даланзадгад"
VICTORY_POINTS_7374:0 "Бирендранагар"
VICTORY_POINTS_12366:0 "Гувахати"
VICTORY_POINTS_1116:0 "Итанагар"
VICTORY_POINTS_10088:0 "Кендрапара"
VICTORY_POINTS_10116:0 "Бхубанешвар"
VICTORY_POINTS_8005:0 "Лех"
VICTORY_POINTS_4321:0 "Гунтур"
VICTORY_POINTS_10583:0 "Бодайбо"
VICTORY_POINTS_6680:0 "Вадуц"
VICTORY_POINTS_10347:0 "Роча"
VICTORY_POINTS_1613:0 "Такуарембо"
VICTORY_POINTS_7260:0 "Коломбо"
VICTORY_POINTS_10149:0 "Пондичерри"
VICTORY_POINTS_2105:0 "Индаур"
VICTORY_POINTS_10801:0 "Джабалпур"
VICTORY_POINTS_12455:0 "Табук"
VICTORY_POINTS_8118:0 "Эль-Убайла"
VICTORY_POINTS_10901:0 "Эль-Джауф"
VICTORY_POINTS_8030:0 "Шарура"
VICTORY_POINTS_2103:0 "Салала"
VICTORY_POINTS_12234:0 "Пайети"
VICTORY_POINTS_12190:0 "Дили"
VICTORY_POINTS_1574:0 "Пиру"
VICTORY_POINTS_4579:0 "Ларат"
VICTORY_POINTS_4429:0 "Пуэрто-Принсеса"
VICTORY_POINTS_1311:0 "Лаоанг"
VICTORY_POINTS_5198:0 "Эроманга"
VICTORY_POINTS_4648:0 "Уэйпа"
VICTORY_POINTS_8209:0 "Дерби"
VICTORY_POINTS_8200:0 "Норсмен"
VICTORY_POINTS_1399:0 "Касивабара"
VICTORY_POINTS_5023:0 "Пуэрто-Вильямиль"
VICTORY_POINTS_7259:0 "Виктория"
VICTORY_POINTS_10548:0 "Принс-Руперт"
VICTORY_POINTS_10527:0 "Йеллоунайф"
VICTORY_POINTS_4739:0 "Саскатун"
VICTORY_POINTS_6779:0 "Ла-Лош"
VICTORY_POINTS_10721:0 "Ранкин-Инлет"
VICTORY_POINTS_5239:0 "Черчилл"
VICTORY_POINTS_6510:0 "Садбери"
VICTORY_POINTS_13196:0 "Форт-Джордж"
VICTORY_POINTS_761:0 "Аттавапискат"
VICTORY_POINTS_12503:0 "Хаппи-Валли"
VICTORY_POINTS_10715:0 "Сет-Иль"
VICTORY_POINTS_1657:0 "Сагеней"
VICTORY_POINTS_12205:0 "Валь-д’Ор"
VICTORY_POINTS_7893:0 "Шибугамо"
VICTORY_POINTS_4285:0 "Сент-Джон"
VICTORY_POINTS_12505:0 "Сент-Джонс"
VICTORY_POINTS_4723:0 "Шайенн"
VICTORY_POINTS_4799:0 "Лас-Вегас (нарисовать город)"
VICTORY_POINTS_4660:0 "Мегри"
VICTORY_POINTS_10723:0 "Печора"
VICTORY_POINTS_12502:0 "Воркута"
VICTORY_POINTS_11496:0 "Чистополь"
VICTORY_POINTS_9385:0 "Набережные Челны"
VICTORY_POINTS_3189:0 "Кемь"
VICTORY_POINTS_9055:0 "Онега"
VICTORY_POINTS_12128:0 "Оренбург"
VICTORY_POINTS_4389:0 "Караганда"
VICTORY_POINTS_10536:0 "Новый Урегой"
VICTORY_POINTS_2900:0 "Хатанга"
VICTORY_POINTS_12672:0 "Сургут"
VICTORY_POINTS_12655:0 "Енисейск"
VICTORY_POINTS_1803:0 "Братск"
VICTORY_POINTS_7726:0 "Киренск"
VICTORY_POINTS_1722:0 "Удачный"
VICTORY_POINTS_12657:0 "Благовещенск"
VICTORY_POINTS_4725:0 "Амурск"
VICTORY_POINTS_4246:0 "Биробиджан"
VICTORY_POINTS_12559:0 "Николаевск-на-Амуре"
VICTORY_POINTS_855:0 "Оха"
VICTORY_POINTS_12551:0 "Охотск"
VICTORY_POINTS_7878:0 "Петропавловск-Камчатский"
VICTORY_POINTS_4047:0 "Сурт"
VICTORY_POINTS_8069:0 "Марада"
VICTORY_POINTS_7063:0 "Адждабия"
VICTORY_POINTS_11940:0 "Бени-Валид"
VICTORY_POINTS_2012:0 "Кениеба"
VICTORY_POINTS_7954:0 "Гао"
VICTORY_POINTS_8034:0 "Порт=Харкорт"
VICTORY_POINTS_4972:0 "Хадеджиа"
VICTORY_POINTS_4997:0 "Майдугури"
VICTORY_POINTS_2046:0 "Бербер"
VICTORY_POINTS_12887:0 "Эд-Дамазин"
VICTORY_POINTS_5060:0 "Эль-Фашер"
VICTORY_POINTS_10827:0 "Бабануса"
VICTORY_POINTS_10764:0 "Ямбио"
VICTORY_POINTS_10761:0 "Гарисса"
VICTORY_POINTS_11145:0 "Лодвар"
VICTORY_POINTS_8144:0 "Кигома"
VICTORY_POINTS_12911:0 "Додома"
VICTORY_POINTS_2120:0 "Бейра"
VICTORY_POINTS_2123:0 "Мозамбик"
VICTORY_POINTS_13072:0 "Нгазиджа"
VICTORY_POINTS_13017:0 "Сен-Дени"
VICTORY_POINTS_13018:0 "Порт-Луи"
VICTORY_POINTS_5222:0 "Анциранана"
VICTORY_POINTS_10963:0 "Аус"
VICTORY_POINTS_10957:0 "Оучо"
VICTORY_POINTS_1552:0 "Куши"
VICTORY_POINTS_9986:0 "Кананга"
VICTORY_POINTS_10071:0 "Мбандака"
VICTORY_POINTS_1950:0 "Кисангани"
VICTORY_POINTS_1181:0 "Гома"
VICTORY_POINTS_11977:0 "Тэджон"
VICTORY_POINTS_11948:0 "Хэнам"
VICTORY_POINTS_6928:0 "Хыннам"
VICTORY_POINTS_12825:0 "Летисия"
VICTORY_POINTS_1076:0 "Сучжоу"
VICTORY_POINTS_4190:0 "Тяньцзинь"
VICTORY_POINTS_9215:0 "Сосновка"
VICTORY_POINTS_12519:0 "Рунду"

View File

@ -1,146 +0,0 @@
l_russian:
VICTORY_POINTS_1015:0 "Элат"
VICTORY_POINTS_1065:0 "Назарет"
VICTORY_POINTS_11981:0 "Чжаньцзян"
VICTORY_POINTS_9970:0 "Шаогуань"
VICTORY_POINTS_4964:0 "Юйшу"
VICTORY_POINTS_10796:0 "Голмуд"
VICTORY_POINTS_7971:0 "Сучжоу"
VICTORY_POINTS_4704:0 "Хами"
VICTORY_POINTS_2074:0 "Чарклык"
VICTORY_POINTS_7926:0 "Сэни"
VICTORY_POINTS_5094:0 "Гегьэ"
VICTORY_POINTS_3427:0 "Ордос"
VICTORY_POINTS_4525:0 "Хундлун"
VICTORY_POINTS_12348:0 "Шилин-Хото"
VICTORY_POINTS_900:0 "Таншань"
VICTORY_POINTS_11801:0 "Чэндэ"
VICTORY_POINTS_7697:0 "Маньчжурия"
VICTORY_POINTS_4506:0 "Цицикар"
VICTORY_POINTS_6811:0 "Муданьцзян"
VICTORY_POINTS_1774:0 "Ховд"
VICTORY_POINTS_12669:0 "Даланзадгад"
VICTORY_POINTS_7374:0 "Бирендранагар"
VICTORY_POINTS_12366:0 "Гувахати"
VICTORY_POINTS_1116:0 "Итанагар"
VICTORY_POINTS_10088:0 "Кендрапара"
VICTORY_POINTS_10116:0 "Бхубанешвар"
VICTORY_POINTS_8005:0 "Лех"
VICTORY_POINTS_4321:0 "Гунтур"
VICTORY_POINTS_7260:0 "Коломбо"
VICTORY_POINTS_10149:0 "Пондичерри"
VICTORY_POINTS_2105:0 "Индаур"
VICTORY_POINTS_10801:0 "Джабалпур"
VICTORY_POINTS_12702:0 "Даммам"
VICTORY_POINTS_5037:0 "Мекка"
VICTORY_POINTS_12455:0 "Табук"
VICTORY_POINTS_8118:0 "Эль-Убайла"
VICTORY_POINTS_10901:0 "Эль-Джауф"
VICTORY_POINTS_8030:0 "Шарура"
VICTORY_POINTS_2103:0 "Салала"
VICTORY_POINTS_12234:0 "Пайети"
VICTORY_POINTS_12190:0 "Дили"
VICTORY_POINTS_1574:0 "Пиру"
VICTORY_POINTS_4579:0 "Ларат"
VICTORY_POINTS_4429:0 "Пуэрто-Принсеса"
VICTORY_POINTS_1311:0 "Лаоанг"
VICTORY_POINTS_5198:0 "Эроманга"
VICTORY_POINTS_4648:0 "Уэйпа"
VICTORY_POINTS_8209:0 "Дерби"
VICTORY_POINTS_8200:0 "Норсмен"
VICTORY_POINTS_1399:0 "Касивабара"
VICTORY_POINTS_10953:0 "Комодоро-Ривадавия"
VICTORY_POINTS_8215:0 "Мендоса"
VICTORY_POINTS_2106:0 "Корриентес"
VICTORY_POINTS_10973:0 "Фуэрто-Олимпо"
VICTORY_POINTS_2161:0 "Койаке"
VICTORY_POINTS_1613:0 "Куртина"
VICTORY_POINTS_8181:0 "Куритиба"
VICTORY_POINTS_2181:0 "Кампу-Гранди"
VICTORY_POINTS_11010:0 "Педрас-Неграс"
VICTORY_POINTS_10934:0 "Манаус"
VICTORY_POINTS_12973:0 "Тринидад"
VICTORY_POINTS_5166:0 "Куско"
VICTORY_POINTS_8149:0 "Икитос"
VICTORY_POINTS_12869:0 "Тарма"
VICTORY_POINTS_12729:0 "Миту"
VICTORY_POINTS_5023:0 "Пуэрто-Вильямиль"
VICTORY_POINTS_7259:0 "Виктория"
VICTORY_POINTS_10548:0 "Принс-Руперт"
VICTORY_POINTS_10527:0 "Йеллоунайф"
VICTORY_POINTS_4739:0 "Саскатун"
VICTORY_POINTS_6779:0 "Ла-Лош"
VICTORY_POINTS_10721:0 "Ранкин-Инлет"
VICTORY_POINTS_5239:0 "Черчилл"
VICTORY_POINTS_6510:0 "Садбери"
VICTORY_POINTS_13196:0 "Форт-Джордж"
VICTORY_POINTS_761:0 "Аттавапискат"
VICTORY_POINTS_12503:0 "Хаппи-Валли"
VICTORY_POINTS_10715:0 "Сет-Иль"
VICTORY_POINTS_1657:0 "Сагеней"
VICTORY_POINTS_12205:0 "Валь-д’Ор"
VICTORY_POINTS_7893:0 "Шибугамо"
VICTORY_POINTS_4285:0 "Сент-Джон"
VICTORY_POINTS_12505:0 "Сент-Джонс"
VICTORY_POINTS_4723:0 "Шайенн"
VICTORY_POINTS_4799:0 "Лас-Вегас"
VICTORY_POINTS_4660:0 "Мегри"
VICTORY_POINTS_10723:0 "Печора"
VICTORY_POINTS_12502:0 "Воркута"
VICTORY_POINTS_11496:0 "Чистополь"
VICTORY_POINTS_9385:0 "Набережные Челны"
VICTORY_POINTS_3189:0 "Кемь"
VICTORY_POINTS_9055:0 "Онега"
VICTORY_POINTS_12128:0 "Оренбург"
VICTORY_POINTS_4389:0 "Караганда"
VICTORY_POINTS_10536:0 "Новый Урегой"
VICTORY_POINTS_2900:0 "Хатанга"
VICTORY_POINTS_12672:0 "Сургут"
VICTORY_POINTS_12655:0 "Енисейск"
VICTORY_POINTS_1803:0 "Братск"
VICTORY_POINTS_7726:0 "Киренск"
VICTORY_POINTS_1722:0 "Удачный"
VICTORY_POINTS_12657:0 "Благовещенск"
VICTORY_POINTS_4725:0 "Амурск"
VICTORY_POINTS_4246:0 "Биробиджан"
VICTORY_POINTS_12559:0 "Николаевск-на-Амуре"
VICTORY_POINTS_855:0 "Оха"
VICTORY_POINTS_12551:0 "Охотск"
VICTORY_POINTS_7878:0 "Петропавловск-Камчатский"
VICTORY_POINTS_4047:0 "Сурт"
VICTORY_POINTS_8069:0 "Марада"
VICTORY_POINTS_7063:0 "Адждабия"
VICTORY_POINTS_11940:0 "Бени-Валид"
VICTORY_POINTS_2012:0 "Кениеба"
VICTORY_POINTS_7954:0 "Гао"
VICTORY_POINTS_8034:0 "Порт-Харкорт"
VICTORY_POINTS_4972:0 "Хадеджиа"
VICTORY_POINTS_4997:0 "Майдугури"
VICTORY_POINTS_2046:0 "Бербер"
VICTORY_POINTS_12887:0 "Эд-Дамазин"
VICTORY_POINTS_5060:0 "Эль-Фашер"
VICTORY_POINTS_10827:0 "Бабануса"
VICTORY_POINTS_10764:0 "Ямбио"
VICTORY_POINTS_10761:0 "Гарисса"
VICTORY_POINTS_11145:0 "Лодвар"
VICTORY_POINTS_8144:0 "Кигома"
VICTORY_POINTS_12911:0 "Додома"
VICTORY_POINTS_2120:0 "Бейра"
VICTORY_POINTS_2123:0 "Мозамбик"
VICTORY_POINTS_13072:0 "Нгазиджа"
VICTORY_POINTS_13017:0 "Сен-Дени"
VICTORY_POINTS_13018:0 "Порт-Луи"
VICTORY_POINTS_5222:0 "Анциранана"
VICTORY_POINTS_10963:0 "Аус"
VICTORY_POINTS_10957:0 "Оучо"
VICTORY_POINTS_1552:0 "Куши"
VICTORY_POINTS_9986:0 "Кананга"
VICTORY_POINTS_10071:0 "Мбандака"
VICTORY_POINTS_1950:0 "Кисангани"
VICTORY_POINTS_1181:0 "Гома"
VICTORY_POINTS_5208:0 "Гояния"
VICTORY_POINTS_3658:0 "Кутаиси"
VICTORY_POINTS_11948:0 "Мокихо"
VICTORY_POINTS_11977:0 "Тэтджон"
VICTORY_POINTS_6928:0 "Ханнам"
VICTORY_POINTS_8136:0 "Ондангва"