File size: 63,550 Bytes
b6a38d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 |
-- ========== GENERATED BY ClassDef Editor (Ctrl-Alt-F3) DO NOT EDIT MANUALLY! ==========
PlaceObj('ClassDef', {
group = "Satellite View",
id = "Camp",
PlaceObj('PropertyDefNumber', {
'id', "Standing",
'default', 0,
'min', -100,
'max', 100,
}),
})
PlaceObj('ClassDef', {
DefParentClassList = {
"CampaignObject",
},
group = "Satellite View",
id = "CampaignCity",
PlaceObj('PropertyDefText', {
'id', "Id",
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "DisplayName",
'name', "Display Name",
}),
PlaceObj('PropertyDefNumber', {
'id', "Loyalty",
'name', "Loyalty",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefText', {
'id', "template_key",
'read_only', true,
'no_edit', true,
'translate', false,
}),
PlaceObj('ClassMethodDef', {
'name', "GetEditorView",
'code', function (self)
return self.DisplayName or Untranslated(self.Id or "(unnamed city)")
end,
}),
PlaceObj('PropertyDefNumber', {
'id', "currentCivilianDeathPenalty",
'name', "",
'no_edit', true,
'default', 0,
'min', 0,
'max', 30,
}),
})
PlaceObj('ClassDef', {
group = "Satellite View",
id = "EnemySquadUnit",
PlaceObj('ClassMethodDef', {
'name', "GetError",
'code', function (self)
if not self.weightedList then
return "Choose at least one unit type"
elseif not self.UnitCountMin or not self.UnitCountMax then
return "Choose units count range (min-max)"
elseif self.UnitCountMin > self.UnitCountMax then
return "min should not be more than max"
end
end,
}),
PlaceObj('PropertyDefNestedList', {
'id', "weightedList",
'name', "Unit List",
'help', "Weighted list with unit types to choose from",
'base_class', "UnitTypeListWithWeights",
}),
PlaceObj('ClassMethodDef', {
'name', "GetEditorView",
'code', function (self)
if self.weightedList then
return tostring(self.UnitCountMin).."-"..tostring(self.UnitCountMax).." {"..table.concat(table.map(self.weightedList, "unitType"), "/").."}"
end
end,
}),
PlaceObj('PropertyDefNumber', {
'id', "UnitCountMin",
'name', "Unit Count Min",
'min', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "UnitCountMax",
'name', "Unit Count Max",
'min', 0,
}),
})
PlaceObj('PresetDef', {
DefEditorIcon = "CommonAssets/UI/Icons/delivery fast packing truck.png",
DefEditorMenubar = "Scripting",
DefEditorName = "Event Operation Outcomes",
DefGlobalMap = "EventOperationsOutcomes",
DefHasParameters = true,
group = "Satellite View",
id = "EventOperationOutcome",
PlaceObj('PropertyDefNumber', {
'id', "Weight",
'help', "Event 'Weight' when choose outcome",
}),
PlaceObj('PropertyDefChoice', {
'id', "Stat",
'name', "Unit Stat",
'help', "Weight depends from that stat",
'items', function (self) return GetUnitStatsCombo() end,
}),
PlaceObj('PropertyDefBool', {
'id', "Desending",
'help', "The way the weight depends from the stat. Desending: heigher stat->lower weight",
}),
PlaceObj('PropertyDefPresetId', {
'id', "PopupId",
'preset_class', "PopupNotification",
'preset_group', "Outcome",
}),
PlaceObj('PropertyDefFunc', {
'id', "Condition",
'params', "self,operation_id,sector, mercs",
'default', function (self,operation_id,sector, mercs)
return true
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "Effect",
'params', "self,operation_id,sector, mercs",
}),
PlaceObj('ClassMethodDef', {
'name', "GetWeight",
'params', "operation_id, sector, mercs",
'code', function (self, operation_id, sector, mercs)
if self.Weight and self.Weight>0 then
return self.Weight
end
local stat = self.Stat
if stat and mercs and #mercs>0 then
local max_merc = table.max(mercs, function(m) return m[stat] end )
local max_stat = max_merc[stat]
return self.Descending and Min((100-max_stat), 20) or max_stat
end
return 0
end,
}),
})
PlaceObj('ClassDef', {
DefParentClassList = {
"CampaignObject",
},
group = "Satellite View",
id = "Intel",
PlaceObj('PropertyDefText', {
'id', "Id",
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "Description",
}),
PlaceObj('PropertyDefBool', {
'id', "Discoverable",
'default', true,
}),
PlaceObj('PropertyDefBool', {
'id', "discovered",
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'id', "sector_id",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "template_key",
'no_edit', true,
'translate', false,
}),
PlaceObj('ClassMethodDef', {
'name', "GetCampaignTemplate",
'code', function (self)
if self.template_key and Game and Game.Campaign and CampaignPresets[Game.Campaign] then
local campaign = CampaignPresets[Game.Campaign]
local sector = table.find_value(campaign.Sectors, "Id", self.sector_id)
return sector and sector.Intel and table.find_value(sector.Intel, "Id", self.Id)
end
end,
}),
PlaceObj('ClassMethodDef', {
'name', "LoadFirstPriorityProps",
'params', "prop_data, obj",
'code', function (self, prop_data, obj)
CampaignObject.LoadFirstPriorityProps(self, prop_data, obj)
-- sector_id used when finding the intel template
local idx = table.find(prop_data, "sector_id")
if idx then
obj.sector_id = prop_data[idx + 1]
end
end,
}),
})
PlaceObj('ClassDef', {
DefParentClassList = {
"CampaignObject",
},
group = "Satellite View",
id = "SatelliteSector",
PlaceObj('ClassMethodDef', {
'name', "GetError",
'code', function (self)
local errors = {}
if self.Guardpost and not next(self.EnemySquadsList) then
table.insert(errors, string.format("%s: Please select at least one enemy squad for guardpost", self.Id))
elseif self.Guardpost then
for _, squad in ipairs(self.EnemySquadsList) do
if squad == "" then
table.insert(errors, string.format("Please remove empty entries from guardpost enemy squads", self.Id))
break
end
end
end
local radios = Presets.RadioStationPreset["Default"]
if not radios[self.MusicCombat] then
table.insert(errors, string.format("%s: '%s' Music Combat radio station is invalid!", self.Id, self.MusicCombat))
end
if not radios[self.MusicConflict] then
table.insert(errors, string.format("%s: '%s' Music Conflict radio station is invalid!", self.Id, self.MusicConflict))
end
if not radios[self.MusicExploration] then
table.insert(errors, string.format("%s: '%s' Music Exploration radio station is invalid!", self.Id, self.MusicExploration))
end
local mapdata = MapData[self.Map]
local region = mapdata and mapdata.Region
if region and GameStateDefs[region].WeatherCycle and not self.WeatherZone then
table.insert(errors, string.format("Sectors from region %s need to have WeatherZone defined", region))
end
return next(errors) and table.concat(errors, "\n") or nil
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "SetId",
'no_edit', true,
'params', "self, id",
'default', function (self, id)
if self.modId then return end
self.name = id
CampaignObject.SetId(self, id)
end,
}),
PlaceObj('ClassMethodDef', {
'name', "OnEditorNew",
'params', "parent, ged, is_paste",
'code', function (self, parent, ged, is_paste)
if parent.mod and IsKindOf(parent, "ModItemSector") then
self.Id = parent.sectorId
self.Map = parent:GetMapName()
self.modId = parent.mod.id
self.bidirectionalRoadApply = true
self.bidirectionalBlockApply = true
parent.SatelliteSectorObj = self
parent:PostLoad()
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "Setdisplay_name",
'no_edit', true,
'params', "self, display_name",
'default', function (self, display_name)
self.display_name = display_name
if self.modId then return end
if display_name then
self.name = string.format("%s %s", self.Id, _InternalTranslate(display_name))
else
self.name = self.Id
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "OnEditorSetProperty",
'no_edit', true,
'params', "self, prop_id",
'default', function (self, prop_id)
if not self.modId and prop_id == "Roads" or prop_id == "BlockTravel" then
SatelliteSectorSetDirectionsProp(self, prop_id)
end
if g_SatelliteUI then
g_SatelliteUI:UpdateSectorVisuals(self.Id)
end
if prop_id == "WeatherZone" then
g_WeatherZones = false
end
end,
}),
PlaceObj('PropertyDefHelp', {
'category', "Data",
'id', "generated_hint",
'help', "<center>This is an automatically-generated empty sector.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.generated end,
}),
PlaceObj('PropertyDefHelp', {
'category', "Data",
'id', "inherited_hint",
'help', "<center>This is an inherited sector - use the button below to override it in this DLC.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.inherited end,
}),
PlaceObj('PropertyDefButtons', {
'category', "Data",
'id', "edit_sector_button",
'buttons', {
PlaceObj('PropertyDefPropButton', {
'Name', "Edit sector",
'FuncName', "EditGeneratedSector",
'IsHidden', function (self)
if self.modId or config.ModdingToolsInUserMode then return true end
return IsKindOf(self, "GedMultiSelectAdapter") or not self.inherited and not self.generated
end,
}),
},
}),
PlaceObj('ClassMethodDef', {
'name', "EditGeneratedSector",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
self.inherited = nil
self.generated = nil
ObjModified(self)
ged:SetUiStatus("editing_sector", "Editing sector...")
if g_SatelliteUI then
g_SatelliteUI:RebuildSectorGrid()
end
ged:SetUiStatus("editing_sector")
end,
}),
PlaceObj('PropertyDefText', {
'id', "Id",
'name', "",
'help', "",
'read_only', true,
'translate', false,
}),
PlaceObj('ClassConstDef', {
'name', "EditorView",
'type', "translate",
'value', T(153688941226, --[[ClassDef Satellite View SatelliteSector value]] "<if_any(inherited,generated)><color 128 128 128></if><Id><opt(u(display_name),' ','')><if(inherited)> [inherited]</if><if(generated)> [generated - empty]</if>"),
'untranslated', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Underground",
'id', "HideUnderground",
'name', "Hide underground",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return self.GroundSector end,
}),
PlaceObj('PropertyDefBool', {
'category', "Underground",
'id', "CanGoUp",
'name', "Can go overground",
'help', "Whether this underground sector has a travel connection to its overground sector.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.GroundSector end,
'default', true,
}),
PlaceObj('PropertyDefButtons', {
'category', "Underground",
'id', "underground_sector_buttons",
'buttons', {
PlaceObj('PropertyDefPropButton', {
'Name', "Add underground sector",
'FuncName', "AddUndergroundSector",
'IsHidden', function (self)
if IsKindOf(self, "GedMultiSelectAdapter") then return true end
if self.modId or config.ModdingToolsInUserMode then return true end
local campaign = GetParentTableOfKind(self, "CampaignPreset")
return not self.Id or
self.Id:ends_with("_Underground") or
(campaign and table.find(campaign.Sectors, "Id", self.Id .. "_Underground"))
end,
}),
PlaceObj('PropertyDefPropButton', {
'Name', "Select underground sector",
'FuncName', "SelectUndergroundSector",
'IsHidden', function (self)
if IsKindOf(self, "GedMultiSelectAdapter") then return true end
if self.modId or config.ModdingToolsInUserMode then return true end
local campaign = GetParentTableOfKind(self, "CampaignPreset")
return not self.Id or
self.Id:ends_with("_Underground") or
not (campaign and table.find(campaign.Sectors, "Id", self.Id .. "_Underground"))
end,
}),
PlaceObj('PropertyDefPropButton', {
'Name', "Remove sector",
'FuncName', "RemoveSector",
'IsHidden', function (self)
if self.modId or config.ModdingToolsInUserMode then return true end
return IsKindOf(self, "GedMultiSelectAdapter") or not self.Id or self.inherited or not self.Id:ends_with("_Underground")
end,
}),
},
}),
PlaceObj('ClassMethodDef', {
'name', "AddUndergroundSector",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
CreateRealTimeThread(function()
local id = self.Id .. "_Underground"
local sector = PlaceObject("SatelliteSector")
sector.GroundSector = self.Id
sector:SetId(id)
local sectors = GetParentTable(self)
local idx = table.find(sectors, "Id", self.Id) + 1
table.insert(sectors, idx, sector)
UpdateParentTable(sector, sectors)
ged:SetUiStatus("add_sector", "Adding sector...")
CreateSessionCampaignObject(sector, SatelliteSector, gv_Sectors, "Sectors")
if g_SatelliteUI then
g_SatelliteUI:RebuildSectorGrid()
end
ObjModified(sectors)
Sleep(100)
ged:SetSelection("root", { idx }, nil, "notify")
ged:SetUiStatus("add_sector")
end)
end,
}),
PlaceObj('ClassMethodDef', {
'name', "SelectUndergroundSector",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
CreateRealTimeThread(function()
ged:ResetFilter("root")
Sleep(100)
ged:SetSelection("root", { table.find(GetParentTable(self), "Id", self.Id .. "_Underground") }, nil, "notify")
end)
end,
}),
PlaceObj('ClassMethodDef', {
'name', "RemoveSector",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
CreateRealTimeThread(function()
local sectors = GetParentTable(self)
table.remove_value(sectors, self)
GetParentTableOfKind(self, "CampaignPreset"):PostLoad() -- rerun sector inheritance
if not table.find(sectors, "Id", self.Id) then
DeleteSessionCampaignObject(self, SatelliteSector, gv_Sectors)
end
ged:SetUiStatus("remove_sector", "Removing sector...")
if g_SatelliteUI then
g_SatelliteUI:RebuildSectorGrid()
end
ObjModified(sectors)
Sleep(100)
ged:SetSelection("root", { table.find(GetParentTable(self), "Id", self.Id:gsub("_Underground", "")) }, nil, "notify")
ged:SetUiStatus("remove_sector")
end)
end,
}),
PlaceObj('ClassMethodDef', {
'name', "GenerateDBCacheStatic",
'params', "root, prop_id, ged",
'code', function (self, root, prop_id, ged)
GenerateDynamicDBPathCache("save", ged)
end,
}),
PlaceObj('PropertyDefPoint', {
'id', "MapPosition",
'help', "delete me",
'dont_save', true,
'no_edit', true,
}),
PlaceObj('PropertyDefPoint', {
'id', "XMapPosition",
'no_edit', true,
}),
PlaceObj('PropertyDefPoint', {
'id', "IconMapPosition",
'dont_save', true,
'no_edit', true,
}),
PlaceObj('PropertyDefCombo', {
'id', "Map",
'name', "Map",
'items', function (self) return ListMaps() end,
}),
PlaceObj('PropertyDefNumber', {
'id', "MapTier",
'name', "Tier",
'help', "Used in the 'PlayerIsInSectorsOfTier' conditional effect to, for example, spawn loot on the map.",
'default', 0,
'scale', 10,
'step', 5,
'min', 0,
'max', 50,
}),
PlaceObj('PropertyDefText', {
'id', "Label1",
'name', "Label 1",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return config.ModdingToolsInUserMode end,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "modId",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "Label2",
'name', "Label 2",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return config.ModdingToolsInUserMode end,
'translate', false,
}),
PlaceObj('PropertyDefBool', {
'id', "RunLoyaltyLogic",
'name', "Run loyalty logic",
'help', "Whether this sector will grant/remove loyalty on conflict resolution",
'default', true,
}),
PlaceObj('PropertyDefText', {
'id', "GroundSector",
'help', "",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "template_key",
'help', "",
'read_only', true,
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "display_name",
'name', "Display name",
'context', "SatelliteSectorLocContext()",
}),
PlaceObj('PropertyDefCombo', {
'id', "Side",
'default', "enemy1",
'items', function (self) return Sides end,
}),
PlaceObj('PropertyDefBool', {
'id', "StickySide",
'name', "Sticky side",
'help', "Prevents changing the side of the sector unless it is forced from a conditinal effect or 'SatelliteSectorSetSide' with 'force' param.",
}),
PlaceObj('PropertyDefPresetId', {
'category', "Travel",
'id', "TerrainType",
'name', "Terrain type",
'help', "Terrain type modifies the travel time",
'extra_code', "no_edit = function(self) return self.GroundSector end",
'preset_class', "SectorTerrain",
'default', "Savanna",
}),
PlaceObj('PropertyDefCombo', {
'id', "WeatherZone",
'name', "Weather zone",
'help', "Weather Zone the sector belongs to. Sectors within the same Weather Zone have the same weather cycle.",
'default', "Default",
'items', function (self)
local campaignPreset
if self.modId then
local modItem = GetParentTableOfKind(self, "ModItemSector")
campaignPreset = modItem and CampaignPresets[modItem.campaignId]
else
campaignPreset = GetCurrentCampaignPreset()
end
return campaignPreset and WeatherZoneCombo(campaignPreset) or {}
end,
}),
PlaceObj('PropertyDefCombo', {
'category', "Travel",
'id', "Passability",
'extra_code', "no_edit = function(self) return self.GroundSector end",
'default', "Land",
'items', function (self) return {"Land", "Water", "Land and Water", "Blocked"} end,
}),
PlaceObj('PropertyDefCombo', {
'category', "City",
'id', "City",
'name', "Associated city",
'default', "none",
'items', function (self) return table.iappend({"none"}, table.map(GetCurrentCampaignPreset().Cities, "Id")) end,
}),
PlaceObj('PropertyDefBool', {
'category', "City",
'id', "ShowCity",
'name', "Show city name",
'help', "Whether to show the city name on the sector",
}),
PlaceObj('PropertyDefBool', {
'id', "reveal_allowed",
'help', "This sector can be revealed by the player, and traits on them are shown in the satellite view. At the start of the campaign mainland sectors are not visible.",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "never_autoresolve",
'name', "Never autoresolve",
'help', "Conflicts on this sector can never be autoresolved",
}),
PlaceObj('PropertyDefBool', {
'id', "discovered",
'name', "Discovered",
'help', "The player has been to this sector, or has started travelling to it via some method. In use only for underground sectors.",
'default', true,
}),
PlaceObj('PropertyDefNumber', {
'category', "Conflict",
'id', "AutoResolveDefenderBonus",
'name', "AutoResolve defender bonus",
'help', "Percent by which defender power is increased in this sector",
'default', 0,
'min', 0,
}),
PlaceObj('PropertyDefBool', {
'category', "Mine",
'id', "Mine",
}),
PlaceObj('PropertyDefNumber', {
'category', "Mine",
'id', "DailyIncome",
'help', "Profit per day at 100% loyalty",
'extra_code', "no_edit = function(self) return not self.Mine end",
'default', 1000,
'min', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "intel_progress",
'name', "Intel progress",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefBool', {
'category', "Mine",
'id', "Depletion",
'extra_code', "no_edit = function(self) return not self.Mine end",
}),
PlaceObj('PropertyDefNumber', {
'category', "Mine",
'id', "DepletionTime",
'help', "In how many days the mine will deplete. This should be randomized each game around this value.",
'extra_code', "no_edit = function(self) return not self.Mine end",
'default', 90,
'min', 1,
'max', 500,
}),
PlaceObj('PropertyDefNumber', {
'category', "Mine",
'id', "mine_work_days",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Mine",
'id', "mine_depleted",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Mine",
'id', "mine_enabled",
'no_edit', true,
'default', true,
}),
PlaceObj('PropertyDefTable', {
'category', "Mine",
'id', "income_mods",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'category', "Mine",
'id', "depletion_mods",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Hospital",
'id', "Hospital",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefBool', {
'category', "Hospital",
'id', "HospitalLocked",
'name', "Hospital locked",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefBool', {
'category', "Guardpost",
'id', "Guardpost",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefNumber', {
'category', "Guardpost",
'id', "PatrolRespawnTime",
'name', "Attack spawn (+24h preparation)",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'default', 172800,
'scale', "h",
'min', 0,
}),
PlaceObj('PropertyDefBool', {
'category', "Guardpost",
'id', "InitialSpawn",
'name', "Initial squad spawn",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
}),
PlaceObj('PropertyDefStringList', {
'category', "Guardpost",
'id', "TargetSectors",
'name', "Target sectors",
'help', "Target sectors for spawned enemy squads.",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'items', function (self) return GetCampaignSectorsCombo("") end,
}),
PlaceObj('PropertyDefPresetIdList', {
'category', "Guardpost",
'id', "ExtraDefenderSquads",
'name', "Extra defender squads",
'help', "Squads that will be spawned as extra defenders (4th shield)",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'preset_class', "EnemySquads",
}),
PlaceObj('PropertyDefPresetIdList', {
'category', "Guardpost",
'id', "EnemySquadsList",
'name', "Enemy squads list",
'help', "A random squad from the list will be chosen on guardpost spawn time",
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'preset_class', "EnemySquads",
}),
PlaceObj('PropertyDefPresetIdList', {
'category', "Guardpost",
'id', "StrongEnemySquadsList",
'name', "Strong enemy squads list",
'help', 'When the guardpost performs a "strong attack" it will swap the currently primed squad with one from this array.',
'extra_code', "no_edit = function(self) return not self.Guardpost end",
'preset_class', "EnemySquads",
}),
PlaceObj('PropertyDefBool', {
'category', "Militia",
'id', "Militia",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "MaxMilitia",
'extra_code', "no_edit = function(self) return not self.Militia end",
'default', 8,
'min', 1,
'max', 50,
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "MilitiaTrainingCost",
'name', "Training cost",
'extra_code', "no_edit = function(self) return not self.Militia end",
'default', 750,
'min', 1,
'max', 10000,
}),
PlaceObj('PropertyDefBool', {
'category', "Conflict",
'id', "ForceConflict",
'name', "Force conflict",
}),
PlaceObj('PropertyDefStringList', {
'category', "Conflict",
'id', "InitialSquads",
'name', "Initial squads",
'items', function (self) return table.keys(EnemySquadDefs, true) end,
}),
PlaceObj('PropertyDefCombo', {
'category', "Conflict",
'id', "CustomConflictDescr",
'name', "Custom conflict description",
'help', "The first time a conflict is initiated in this sector, this description preset will be shown.",
'items', function (self) return PresetGroupCombo("ConflictDescription", "Default") end,
}),
PlaceObj('PropertyDefBool', {
'category', "Militia",
'id', "militia_training",
'no_edit', true,
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "militia_training_progress",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "militia_squad_id",
'no_edit', true,
}),
PlaceObj('PropertyDefNumber', {
'category', "Militia",
'id', "militia_training_payed_cost",
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'category', "Operation",
'id', "training_stat",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefTable', {
'category', "Operation",
'id', "custom_operations",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'category', "Operation",
'id', "operations_temp_data",
'help', "Temp data for assigned mercs before the actual operation start/change. Valid only when the UI is opened in 'change' mode.",
'dont_save', true,
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'category', "Operation",
'id', "started_operations",
'help', "Started operations for the sector",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "Intel",
'default', true,
}),
PlaceObj('PropertyDefBool', {
'id', "intel_discovered",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "player_visited",
'help', "Marked as visited when a player squad reaches the sector's center on the satellite.",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "autoresolve_disabled",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "InterestingSector",
'name', "Interesting sector",
'help', "Will be listed as one after GatherIntel operation completes and will start voice responses if passed by.",
}),
PlaceObj('PropertyDefNumber', {
'id', "MinFlareCarriers",
'name', "Min flare carriers",
'help', "Minimum number of Roaming NPCs to carry a light during Night or Underground",
'default', 1,
'slider', true,
'min', 0,
'max', 20,
}),
PlaceObj('PropertyDefNumber', {
'id', "MaxFlareCarriers",
'name', "Max flare carriers",
'help', "Minimum number of Roaming NPCs to carry a light during Night or Underground",
'default', 3,
'slider', true,
'min', 0,
'max', 20,
'custom_min', function (self) return self.MinFlareCarriers end,
'custom_max', function (self) return 20 end,
'custom_lims', true,
}),
PlaceObj('PropertyDefBool', {
'id', "RAndRAllowed",
'name', "R&R allowed",
'help', "R&R operation is available in this sector",
}),
PlaceObj('PropertyDefBool', {
'id', "RepairShop",
'name', "Repair shop",
'help', "Allows Craft Ammo, Craft Explosives operations in this sector",
}),
PlaceObj('PropertyDefBool', {
'category', "Travel",
'id', "bidirectionalRoadApply",
'name', "Apply roads to adjacent sectors",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.modId end,
}),
PlaceObj('PropertyDefDirectionsSet', {
'category', "Travel",
'id', "Roads",
'name', "Roads",
'help', "Roads only improve the quality of travel and lack of a road doesn't prevent travel between sectors",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefBool', {
'category', "Travel",
'id', "ImpassableForEnemies",
'name', "Impassable for enemies",
'help', "Enemy squads can't pass through this sector",
}),
PlaceObj('PropertyDefBool', {
'category', "Diamond Briefcase",
'id', "ImpassableForDiamonds",
'name', "Impassable for diamonds",
'help', "Diamond shipments can't pass through this sector",
}),
PlaceObj('PropertyDefBool', {
'category', "Travel",
'id', "bidirectionalBlockApply",
'name', "Apply block travel to adjacent sectors",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.modId end,
}),
PlaceObj('PropertyDefDirectionsSet', {
'category', "Travel",
'id', "BlockTravel",
'name', "Block travel",
'help', "Blocks travel and adds ui indication for that in the satellite view (red/white line)",
}),
PlaceObj('PropertyDefDirectionsSet', {
'category', "Travel",
'id', "BlockTravelRiver",
'name', "Block travel - invisible",
'help', "Blocks travel without displaying it on the sat view",
'extra_code', "no_edit = function(self) return self.GroundSector end",
}),
PlaceObj('PropertyDefText', {
'id', "sector_data",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefNestedList', {
'id', "dead_units",
'help', "All dead units on the map before removing and converting them to bags. Used for adding their staff to the stash",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_inventory",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_repair_items",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_repair_items_queued",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_craft_ammo_items_queued",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefNestedList', {
'id', "sector_craft_explosive_items_queued",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('PropertyDefTable', {
'id', "conflict",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'id', "conflict_backup",
'no_edit', true,
}),
PlaceObj('PropertyDefNestedObj', {
'id', "guardpost_obj",
'no_edit', true,
'base_class', "GuardpostSessionObject",
}),
PlaceObj('PropertyDefUIImage', {
'id', "image",
'name', "Image",
'default', "UI/SatelliteView/SectorImages/_Highlands",
'image_preview_size', 200,
}),
PlaceObj('PropertyDefUIImage', {
'id', "override_loading_screen",
'no_edit', true,
'image_preview_size', 200,
}),
PlaceObj('PropertyDefNestedList', {
'category', "Events",
'id', "Events",
'base_class', "SectorEvent",
}),
PlaceObj('PropertyDefTable', {
'id', "ExecutedEvents",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Port",
'id', "Port",
'name', "Port",
}),
PlaceObj('PropertyDefBool', {
'category', "Port",
'id', "PortLocked",
'name', "Port locked",
}),
PlaceObj('PropertyDefBool', {
'category', "Port",
'id', "CanBeUsedForArrival",
'name', "Can be used for arrival",
}),
PlaceObj('PropertyDefNumber', {
'category', "Port",
'id', "BobbyRayDeliveryCostMultiplier",
'name', "Bobby Ray delivery cost multiplier",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.CanBeUsedForArrival end,
'default', 100,
'scale', "%",
}),
PlaceObj('PropertyDefUIImage', {
'category', "Port",
'id', "SectorImagePreview",
'name', "Sector image preview",
'no_edit', "BobbyRayDeliveryCostMultiplier.no_edit",
'default', "UI/PDA/ss_i1.png",
}),
PlaceObj('PropertyDefBool', {
'category', "Diamond Briefcase",
'id', "DBSourceSector",
'name', "Source sector",
'help', "Travelling squads carrying diamond shipments will spawn on this sector.",
}),
PlaceObj('PropertyDefBool', {
'category', "Diamond Briefcase",
'id', "DBDestinationSector",
'name', "Destination sector",
'help', "Travelling squads carrying diamond shipments will path to this sector.",
}),
PlaceObj('PropertyDefButtons', {
'category', "Diamond Briefcase",
'id', "DBRecalc",
'help', "You only need to run this once when applying multiple changes. It will take a while!",
'buttons', {
PlaceObj('PropertyDefPropButton', {
'Name', "Recalculate Diamond Routes",
'FuncName', "GenerateDBCacheStatic",
'IsHidden', function (self) return config.ModdingToolsInUserMode end,
}),
},
}),
PlaceObj('PropertyDefNumber', {
'category', "Port",
'id', "PricePerTile",
'name', "Price per tile",
}),
PlaceObj('ClassMethodDef', {
'name', "GetTravelPrice",
'params', "squad",
'code', function (self, squad)
local cost = self.PricePerTile or const.Satellite.DefaultPortPricePerTile
local discounts = false
local cityHere = gv_Cities[self.City]
if cityHere and cityHere.Loyalty > 0 then
local discount = Lerp(0, 50, cityHere.Loyalty, 100)
cost = cost - MulDivRound(cost, discount, 100)
if not discounts then discounts = {} end
discounts[#discounts + 1] = {
label = T(342530626078, "Loyalty"),
percent = discount
}
end
if IsKindOf(squad, "SatelliteSquad") then
for _, id in ipairs(squad.units) do
local unit = gv_UnitData[id]
if HasPerk(unit, "Negotiator") then
local discount = CharacterEffectDefs.Negotiator:ResolveValue("discountPercent")
if not discounts then discounts = {} end
discounts[#discounts + 1] = {
label = T{542222741234, "<Nick> <em>(<perkName>)</em>", Nick = unit.Nick, perkName = CharacterEffectDefs.Negotiator.DisplayName},
percent = discount,
}
cost = cost - MulDivRound(cost, discount, 100)
break
end
end
end
return cost, discounts
end,
}),
PlaceObj('PropertyDefBool', {
'id', "enabled_auto_deploy",
'no_edit', true,
'default', true,
}),
PlaceObj('PropertyDefChoice', {
'id', "awareness_sequence",
'name', "Awareness sequence",
'default', "Standard",
'items', function (self) return { "Standard", "Skip Setpiece", "Skip All" } end,
}),
PlaceObj('PropertyDefNumber', {
'id', "last_enter_campaign_time",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "last_own_campaign_time",
'no_edit', true,
'default', 0,
}),
PlaceObj('PropertyDefCombo', {
'category', "Music",
'id', "MusicCombat",
'name', "Music combat",
'help', "Music in turn based mode",
'default', "Battle_Easy",
'items', function (self) return PresetsCombo("RadioStationPreset") end,
}),
PlaceObj('PropertyDefCombo', {
'category', "Music",
'id', "MusicConflict",
'name', "Music conflict",
'help', "In real time exploration but the sector is still in conflict",
'default', "Village_Conflict",
'items', function (self) return PresetsCombo("RadioStationPreset") end,
}),
PlaceObj('PropertyDefCombo', {
'category', "Music",
'id', "MusicExploration",
'name', "Music exploration",
'help', "Real time exploration and there is no conflict in the sector",
'default', "Jungle_Exploration",
'items', function (self) return PresetsCombo("RadioStationPreset") end,
}),
PlaceObj('ClassConstDef', {
'name', "FilterClass",
'type', "text",
'value', "SatelliteSectorGedFilter",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "enemy_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "ally_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "underground_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "ally_and_militia_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefNestedList', {
'category', "Squads",
'id', "all_squads",
'dont_save', true,
'no_edit', true,
'base_class', "SatelliteSquad",
}),
PlaceObj('PropertyDefBool', {
'category', "Warning State",
'id', "warningStateEnabled",
'name', "Enable warning state",
'help', "If enabled the first time you are discovered by enemies you will enter a Warning State.\nA timer is set. Enemies become neutral until the timer expires. And effects can be executed.",
}),
PlaceObj('PropertyDefBool', {
'category', "Warning State",
'id', "warningReceived",
'name', "Warning received",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'category', "Warning State",
'id', "inWarningState",
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'category', "Warning State",
'id', "warningTimerText",
'name', "Warning timer text",
'help', "Text to display when the Warning State is active.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.warningStateEnabled end,
'default', T(888882045986, --[[ClassDef Satellite View SatelliteSector default]] "Exit the Area"),
}),
PlaceObj('PropertyDefNumber', {
'category', "Warning State",
'id', "warningStateTimer",
'name', "Warning state timer",
'help', "How long (sec) will the Warning State hold.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.warningStateEnabled end,
'default', 30000,
'scale', "sec",
'min', 0,
}),
PlaceObj('PropertyDefPresetIdList', {
'category', "Warning State",
'id', "warningBanters",
'name', "Warning banters",
'help', "List of banters from which to choose one to play when spotted by the nearest enemy.",
'no_edit', "expression",
'no_edit_expression', function (self, prop_meta) return not self.warningStateEnabled end,
'preset_class', "BanterDef",
}),
PlaceObj('PropertyDefChoice', {
'category', "Combat Tasks",
'id', "combatTaskGenerate",
'name', "When to generate",
'help', "When to generate Combat Tasks. Chances and cooldowns are independant and are always taken into account.",
'default', "always",
'items', function (self) return {"always", "afterFirstConflict", "never"} end,
}),
PlaceObj('PropertyDefNumber', {
'category', "Combat Tasks",
'id', "combatTaskAmount",
'name', "Maximum amount",
'help', "Maximum Combat Tasks that can be given.",
'default', 1,
'min', 0,
}),
PlaceObj('PropertyDefBool', {
'category', "Combat Tasks",
'id', "firstConflictWon",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "conflictLoyaltyGained",
'help', "Checks whether to give loyalty on Conflict Win. Resets on sector lost and sector defended.",
'no_edit', true,
}),
PlaceObj('ClassConstDef', {
'name', "generated",
}),
PlaceObj('ClassConstDef', {
'name', "inherited",
}),
PlaceObj('ClassMethodDef', {
'name', "IsReadOnly",
'comment', "for GED",
'code', function (self)
return self.generated or self.inherited or (config.ModdingToolsInUserMode and not self.modId)
end,
}),
})
PlaceObj('ClassDef', {
Comment = "Support class for filtering in the satellite sector editor",
DefParentClassList = {
"GedFilter",
},
group = "Satellite View",
id = "SatelliteSectorGedFilter",
PlaceObj('ClassMethodDef', {
'name', "FilterObject",
'params', "sector",
'code', function (self, sector)
if self.HideGenerated and (sector.inherited or sector.generated) then return false end
if self.Mine ~= "don't care" and self.Mine ~= sector.Mine then return false end
if self.Guardpost ~= "don't care" and self.Guardpost ~= sector.Guardpost then return false end
if self.City == "any" then
if sector.City == "none" then return false end
elseif self.City ~= "don't care" and self.City ~= sector.City then return false end
if self.Events ~= "don't care" and self.Events ~= (sector.Events and #sector.Events > 0) then return false end
if self.Region ~= "don't care" then
local region = sector.Map and MapData[sector.Map] and MapData[sector.Map].Region
if self.Region ~= region then return false end
end
if self.Port ~= "don't care" and self.Port ~= sector.Port then
return false
end
if self.Militia ~= "don't care" and self.Militia ~= sector.Militia then
return false
end
if self.Music then
local music_match
if sector.MusicCombat and string.match(sector.MusicCombat, self.Music) then
music_match = true
end
if sector.MusicConflict and string.match(sector.MusicConflict, self.Music) then
music_match = true
end
if sector.MusicExploration and string.match(sector.MusicExploration, self.Music) then
music_match = true
end
if not music_match then
return false
end
end
if self.Weather then
if not (sector.WeatherZone and string.match(string.lower(sector.WeatherZone), string.lower(self.Weather)) )then
return false
end
end
return true
end,
}),
PlaceObj('PropertyDefBool', {
'id', "HideGenerated",
'name', "Hide inherited/empty",
}),
PlaceObj('PropertyDefChoice', {
'id', "City",
'default', "don't care",
'items', function (self) return table.iappend({"don't care", "any", "none"}, table.map(GetCurrentCampaignPreset().Cities, "Id")) end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Mine",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Events",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Guardpost",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Region",
'default', "don't care",
'items', function (self) return PresetsCombo("GameStateDef", "region", "don't care") end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Port",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Militia",
'default', "don't care",
'items', function (self) return { true, false, "don't care" } end,
}),
PlaceObj('PropertyDefChoice', {
'id', "Music",
'items', function (self) return PresetsCombo("RadioStationPreset") end,
}),
PlaceObj('PropertyDefText', {
'id', "Weather",
'translate', false,
}),
})
PlaceObj('ClassDef', {
group = "Satellite View",
id = "SatelliteSquad",
PlaceObj('PropertyDefCombo', {
'id', "Side",
'default', "enemy1",
'items', function (self) return Sides end,
}),
PlaceObj('PropertyDefText', {
'id', "Name",
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "image",
'translate', false,
}),
PlaceObj('PropertyDefNumber', {
'id', "UniqueId",
}),
PlaceObj('PropertyDefCombo', {
'id', "CurrentSector",
'items', function (self) return GetCampaignSectorsCombo() end,
}),
PlaceObj('PropertyDefText', {
'id', "PreviousSector",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "PreviousLandSector",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefBool', {
'id', "Sleep",
}),
PlaceObj('PropertyDefBool', {
'id', "Retreat",
}),
PlaceObj('PropertyDefPoint', {
'id', "VisualPos",
}),
PlaceObj('PropertyDefPoint', {
'id', "XVisualPos",
}),
PlaceObj('PropertyDefTable', {
'id', "route",
}),
PlaceObj('PropertyDefTable', {
'id', "water_route",
}),
PlaceObj('PropertyDefBool', {
'id', "water_travel",
}),
PlaceObj('PropertyDefBool', {
'id', "returning_water_travel",
'help', "",
'no_edit', true,
}),
PlaceObj('PropertyDefNumber', {
'id', "water_travel_rest_timer",
'default', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "traversing_shortcut_start",
}),
PlaceObj('PropertyDefText', {
'id', "traversing_shortcut_start_sId",
}),
PlaceObj('PropertyDefBool', {
'id', "traversing_shortcut_water",
'help', "",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "uninterruptable_travel",
'help', "",
'no_edit', true,
}),
PlaceObj('PropertyDefNumber', {
'id', "joining_squad",
}),
PlaceObj('PropertyDefTable', {
'id', "units",
}),
PlaceObj('PropertyDefBool', {
'id', "militia",
'help', "Militia squad",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "arrival_squad",
'help', "Squad not on the map yet",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "diamond_briefcase",
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'id', "shipment_preset_id",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "guardpost",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "diamond_briefcase_dynamic",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "always_visible",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "villain",
'help', "Villain squad",
'no_edit', true,
}),
PlaceObj('PropertyDefBool', {
'id', "ref",
'help', "Used by UI in objects which pretend to be squads, because of duck typing it needs to be in the squad definition as well",
'dont_save', true,
'read_only', true,
'no_edit', true,
}),
PlaceObj('PropertyDefText', {
'id', "enemy_squad_def",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefNumber', {
'id', "wait_in_sector",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'id', "arrive_in_sector",
'no_edit', true,
}),
PlaceObj('PropertyDefTable', {
'id', "vrForActivity",
}),
PlaceObj('PropertyDefNestedList', {
'id', "squad_bag",
'no_edit', true,
'base_class', "InventoryItem",
}),
PlaceObj('ClassMethodDef', {
'name', "CancelTravel",
'code', function (self)
NetSyncEvent("SquadCancelTravel", self.UniqueId)
end,
}),
PlaceObj('PropertyDefText', {
'id', "on_reach_quest",
'no_edit', true,
'translate', false,
}),
PlaceObj('PropertyDefTable', {
'id', "on_reach_var",
'no_edit', true,
}),
})
PlaceObj('PresetDef', {
DefEditorIcon = "CommonAssets/UI/Icons/location marker pin.png",
DefEditorMenubar = "Scripting",
DefEditorMenubarSortKey = "4500",
DefEditorName = "Sector Operations",
DefGlobalMap = "SectorOperations",
DefHasParameters = true,
DefHasSortKey = true,
DefModItem = true,
DefModItemName = "Sector operation",
DefModItemSubmenu = "Campaign & Maps",
DefParentClassList = {
"Preset",
"CampaignSpecific",
},
group = "Satellite View",
id = "SectorOperation",
PlaceObj('PropertyDefBool', {
'id', "Custom",
'help', "Custom operations show only certain properties",
'default', true,
}),
PlaceObj('PropertyDefBool', {
'id', "CustomRepeat",
'name', "Repeat",
'help', "Operation reamains enabled on completion and can be performed again",
'extra_code', "no_edit = function(self) return not self.Custom end",
}),
PlaceObj('PropertyDefSet', {
'id', "operation_type",
'name', "Type",
'help', "Operation categories by action",
'items', function (self) return {"Healing"} end,
}),
PlaceObj('PropertyDefText', {
'id', "display_name",
'name', "Display name",
}),
PlaceObj('PropertyDefText', {
'id', "short_name",
'name', "Short Name",
'default', T(814680295449, --[[PresetDef SectorOperation default]] "Operation"),
}),
PlaceObj('PropertyDefText', {
'id', "sub_title",
'name', "Sub Title",
}),
PlaceObj('PropertyDefText', {
'id', "progress_sub_title",
'name', "Sub Title in Progress",
}),
PlaceObj('PropertyDefText', {
'id', "description",
'name', "Description",
}),
PlaceObj('PropertyDefText', {
'id', "log_msg_start",
'name', "LogMsgOnStart",
'help', "Log message on operation start",
'default', "",
}),
PlaceObj('PropertyDefUIImage', {
'id', "image",
'name', "Image",
}),
PlaceObj('PropertyDefUIImage', {
'id', "icon",
'name', "Icon",
'help', "Satellite view on-screen merc icon",
}),
PlaceObj('PropertyDefNestedList', {
'id', "Professions",
'base_class', "SectorOperationProfession",
'auto_expand', true,
}),
PlaceObj('PropertyDefBool', {
'id', "ShowInCombatBadge",
'help', "Show in Combat Badge",
'default', true,
}),
PlaceObj('PropertyDefBool', {
'id', "ShowPauseProgress",
'help', "Show saved operation progress when no mercs are attached",
}),
PlaceObj('PropertyDefText', {
'id', "error_msg",
'name', "ErrorMessage",
}),
PlaceObj('PropertyDefCombo', {
'id', "RequiredItem",
'name', "Required Item",
'items', function (self) return table.keys2(InventoryItemDefs, "sorted", "") end,
}),
PlaceObj('PropertyDefStringList', {
'id', "RequiredResources",
'item_default', "Money",
'items', function (self)
local items = table.imap(SectorOperationResouces, "id")
table.sort(items)
return items
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetSectorSlots",
'help', "Maximum merc slots per profession for this operation in the sector",
'params', "self, prof, sector",
'default', function (self, prof, sector)
return 1
end,
}),
PlaceObj('PropertyDefCombo', {
'id', "related_stat",
'name', "Associated Stat",
'help', "Stat which is used to advance the operation per tick (50 for no selected stat)",
'items', function (self) return UnitPropertiesStats:GetProperties() end,
}),
PlaceObj('PropertyDefCombo', {
'id', "related_stat_2",
'name', "Second Associated Stat",
'help', "Between the two stats - the one with higher value is counted",
'items', function (self) return UnitPropertiesStats:GetProperties() end,
}),
PlaceObj('PropertyDefCombo', {
'id', "min_requirement_stat",
'name', "Min Requirement Stat",
'help', "Given Stat at given value required for mercs to be able to perform the operation",
'items', function (self) return UnitPropertiesStats:GetProperties() end,
}),
PlaceObj('PropertyDefNumber', {
'id', "min_requirement_stat_value",
'name', "Min Requirement Value",
'help', "Min value of the stat required for mercs to be able to perform the operation",
'default', 0,
}),
PlaceObj('PropertyDefNumber', {
'id', "target_contribution",
'name', "Target Contribution",
'help', "Each tick the merc contributes his Associated Stat (or 50 if no stat is set) towards a value that has to reach Target Contribution to finish the Operation",
'default', 1000,
}),
PlaceObj('PropertyDefNumber', {
'id', "target_example",
'name', "Target Example Time",
'help', "The time (in hours) it would take for a full set of mercs with stat 100 to finish the operation.",
'dont_save', true,
'read_only', true,
'default', 1000,
}),
PlaceObj('ClassMethodDef', {
'name', "Gettarget_example",
'code', function (self)
return self.target_contribution / (4*self:GetSectorSlots()*100)
end,
}),
PlaceObj('PropertyDefNestedList', {
'id', "bonus_perks",
'name', "Bonus Perks",
'help', "Each perk provides additional contribution",
'base_class', "SectorOperationBonusPerk",
'auto_expand', true,
}),
PlaceObj('PropertyDefFunc', {
'id', "Tick",
'name', "Tick",
'params', "self, merc",
'default', function (self, merc)
local sector = merc:GetSector()
local progress_per_tick = self:ProgressPerTick(merc)
if CheatEnabled("FastActivity") then
progress_per_tick = progress_per_tick*100
end
self:ModifyProgress(progress_per_tick, sector)
self:CheckCompleted(merc, sector)
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "SectorMercsTick",
'name', "SectorMercsTick",
'params', "self, merc",
}),
PlaceObj('PropertyDefFunc', {
'id', "CheckCompleted",
'params', "self, merc, sector",
'default', function (self, merc, sector)
if self:ProgressCurrent(merc, sector) >= self:ProgressCompleteThreshold(merc, sector) then
self:Complete(sector)
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "Complete",
'params', "self, sector",
'default', function (self, sector)
local mercs = GetOperationProfessionals(sector.Id, self.id)
local merc_names = {}
for _, merc in ipairs(mercs) do
merc_names[#merc_names + 1] = merc.Nick
merc:SetCurrentOperation("Idle")
end
self:OnComplete(sector, mercs)
if next(merc_names) then
CombatLog("important", T{352089713704, "<em><mercs></em> finished <em><activity></em> in <SectorName(sector)>", mercs = ConcatListWithAnd(merc_names),activity = self.display_name, sector = sector})
end
Msg("OperationCompleted", self, mercs, sector)
end,
}),
PlaceObj('ClassConstDef', {
'name', "Documentation",
'type', "text",
'value', "Creates a new sector operation that could be accessed through the sector operation menu. Allows adding new quests along with setting up variables that are related to them.",
}),
PlaceObj('PropertyDefFunc', {
'id', "OnComplete",
'params', "self, sector, mercs",
'default', function (self, sector, mercs)
if self.Custom then
local ca = sector.custom_operations[self.id]
if not self.CustomRepeat then
ca.status = "completed"
else
ca.progress = 0
end
local script = ca.EffectsOnSuccess
if script then
ExecuteEffectList(script)
end
local loot_table = ca.LootTableId
if loot_table then
local apply = ca.GrantItemApply
local units= apply=="all" and mercs or {mercs[1]}
for _, unit in ipairs(units) do
local items = {}
local loot_tbl = LootDefs[loot_table]
if loot_tbl then
loot_tbl:GenerateLoot(self, {}, unit:Random(), items)
--self.GrantedItemsTextUI = GetItemsNamesText(items)
local squad = unit.Squad
local all_squad_mercs = gv_Squads[squad].units
AddItemsToSquadBag(unit.Squad, items)
if #items>0 then
unit:AddItemsToInventory(items)
end
if #items>0 then
--give to all mercs from the squad
for idx, merc in ipairs(all_squad_mercs) do
if #items<=0 then break end
local u = gv_UnitData[merc]
u:AddItemsToInventory(items)
end
end
if #items > 0 then
local stash = GetSectorInventory(sector.Id)
if stash then
AddItemsToInventory(stash, items, true)
end
end
if #items>0 then
CombatLog("important", T{825769344536, "Inventory full. <name> can not grant all items", name = unit:GetDisplayName()})
end
end
end
end
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "ProgressPerTick",
'name', "ProgressPerTick",
'params', "self, merc, prediction",
'default', function (self, merc, prediction)
if self.Custom then
local bonus = 0
local perks = self.bonus_perks
for _, bp in ipairs(self.bonus_perks or empty_table) do
if HasPerk(merc, bp.perk) then
bonus = bonus + bp.bonus
end
end
local _, val = self:GetRelatedStat(merc)
return (val or 50) + bonus
end
return 0
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "ProgressCompleteThreshold",
'params', "self, merc, sector, prediction",
'default', function (self, merc, sector, prediction)
if self.Custom then
return self.target_contribution
end
return 0
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "ProgressCurrent",
'params', "self, merc, sector, prediction",
'default', function (self, merc, sector, prediction)
return self.Custom and sector.custom_operations and sector.custom_operations[self.id] and sector.custom_operations[self.id].progress or -1
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "OnSetOperation",
'name', "OnSetOperation",
'params', "self, merc, arg",
}),
PlaceObj('PropertyDefFunc', {
'id', "OnRemoveOperation",
'name', "OnRemoveOperation",
'params', "self, merc",
}),
PlaceObj('PropertyDefFunc', {
'id', "OnMove",
'name', "OnMove",
'params', "self, merc,already_synced",
'default', function (self, merc,already_synced)
local operation_id = self.id
if operation_id== "Traveling" or operation_id == "Idle" or operation_id== "Arriving" then
return
end
local sector = merc:GetSector()
local mercs = GetOperationProfessionals(sector.Id, operation_id,false, merc.session_id)
if #mercs<=0 then
if already_synced then
local event_id = GetOperationEventId(merc, operation_id)
RemoveTimelineEvent(event_id)
NetSyncEvents.InterruptSectorOperation(sector.Id,operation_id)
else
NetSyncEvent("InterruptSectorOperation", sector.Id,operation_id)
end
Msg("OperationCompleted", SectorOperations[operation_id], mercs, sector)
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetOperationCost",
'params', "self, merc, profession, idx",
'default', function (self, merc, profession, idx)
return {}
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "FilterAvailable",
'params', "self, merc, profession",
'default', function (self, merc, profession)
return not self.min_requirement_stat or merc[self.min_requirement_stat] >= self.min_requirement_stat_value
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "CanPerformOperation",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, merc, profession",
'default', function (self, merc, profession)
return self:CanPerformOperationBase(merc, profession)
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "CanPerformOperationBase",
'no_edit', true,
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, merc, profession",
'default', function (self, merc, profession)
local cost = self:GetOperationCost(merc, profession)
if not CanPayOperation(cost, merc:GetSector()) then
return "OperationResourceError", {activity = self.display_name}
elseif merc:IsTravelling() then
return "OperationTravelError", {activity = self.display_name}
elseif self.RequiredItem and not merc:HasItem(self.RequiredItem) then
return "OperationMissingItemError", {activity = self.display_name, item = InventoryItemDefs[self.RequiredItem].DisplayName}
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "HasOperation",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, sector",
'default', function (self, sector)
if self.Custom then
return sector.custom_operations and sector.custom_operations[self.id] and
sector.custom_operations[self.id].status == "enabled"
end
return true
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "IsEnabled",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, sector",
'default', function (self, sector)
return true
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetDescription",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, merc",
'default', function (self, merc)
return self.description
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetTimelineEventDescription",
'params', "self, sector_id, eventcontext",
'default', function (self, sector_id, eventcontext)
local mercs
local professionId = self.Professions and self.Professions[1] and self.Professions[1].id
if eventcontext.mercs then
mercs = table.map(eventcontext.mercs, function(id) return gv_UnitData[id].Nick end)
else
mercs = GetOperationProfessionalsGroupedByProfession(sector_id, self.id)
mercs = table.map(professionId and mercs[professionId] or mercs, "Nick")
end
mercs = ConcatListWithAnd(mercs)
return T{366696912627, "<em><mercs></em> will finish <activityName>.", mercs = mercs, activityName = self.display_name}
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetAssignMessage",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, nameCombination, costTexts",
'default', function (self, nameCombination, costTexts)
costTexts = T(210127148759, "<newline>It will cost ") .. table.concat(costTexts, T(642697486575, ", ")) .. T(194271688304, ".")
return T{810287359580, "Do you want to assign mercs - <names> to this Operation? <costTexts>", names = nameCombination, costTexts = costTexts}
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "SectorOperationStats",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, sector, check_only",
'default', function (self, sector, check_only)
if self.Custom then
local lines = {}
if self.min_requirement_stat and self.min_requirement_stat_value then
local prop = table.find_value(UnitPropertiesStats:GetProperties(), "id", self.min_requirement_stat)
if check_only then return true end
lines[#lines + 1] = {text = T{300232421689, "Min Required <name>", name = prop.name}, value = T{139355455984, "<min_requirement_stat_value>",self}}
end
local progressVal = MulDivTrunc(self:ProgressCurrent(nil, sector) or 0, 100, self:ProgressCompleteThreshold(nil, sector))
if check_only then return true end
lines[#lines + 1] = {text = T(349715428104, "Current Progress"), value = T{257328164584, "<percent(value)>", value = progressVal}}
return lines, progressVal
end
return false, false
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetErrorMessage",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, merc",
'default', function (self, merc)
local genericError = self:CanPerformOperation(merc)
if genericError and self.error_msg then
return self.error_msg
end
if genericError == "OperationMissingItemError" then
return T{996660950207, "Missing required item <ItemName(RequiredItem)>.", self}
end
if genericError then
return Untranslated(genericError)
end
return false
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "ModifyProgress",
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, value, sector",
'default', function (self, value, sector)
if self.Custom then
local ac = sector.custom_operations and sector.custom_operations[self.id]
if ac then
ac.progress = ac.progress + value
end
end
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "BoostProgress",
'no_edit', true,
'extra_code', "no_edit = function(self) return self.Custom end",
'params', "self, perc, sector",
'default', function (self, perc, sector)
local progress = self:ProgressCompleteThreshold(nil,sector) * perc / 100
self:ModifyProgress(Min(progress, self:ProgressCompleteThreshold(nil, sector) - self:ProgressCurrent(nil, sector)), sector)
ObjModified(sector)
end,
}),
PlaceObj('PropertyDefFunc', {
'id', "GetRelatedStat",
'params', "self, merc, sector",
'default', function (self, merc, sector)
local stat1 = self.related_stat
local stat2 = self.related_stat_2
if stat1 or stat2 then
local stat = stat1
if not stat1 or (stat2 and merc[stat2] > merc[stat1]) then
stat = stat2
end
return stat, merc[stat]
end
end,
}),
})
PlaceObj('ClassDef', {
group = "Satellite View",
id = "SectorOperationBonusPerk",
PlaceObj('PropertyDefPresetId', {
'id', "perk",
'name', "Perk",
'help', "Mercs with this perk provide bonus contribution per tick",
'preset_class', "CharacterEffectCompositeDef",
'preset_filter', function (preset, obj, prop_meta)
return preset.object_class == "Perk"
end,
}),
PlaceObj('PropertyDefNumber', {
'id', "bonus",
'name', "Bonus",
'help', "Value of the bonus contribution per tick",
}),
})
PlaceObj('ClassDef', {
group = "Satellite View",
id = "SectorOperationProfession",
PlaceObj('PropertyDefText', {
'id', "id",
'name', "Id",
'help', "Profession",
'translate', false,
}),
PlaceObj('PropertyDefText', {
'id', "display_name",
'name', "Display Name",
'help', "Profession",
}),
PlaceObj('PropertyDefText', {
'id', "description",
'name', "Description",
'help', "Profession",
}),
PlaceObj('PropertyDefText', {
'id', "display_name_all_caps",
'name', "Display Name All Caps",
'help', "Profession",
}),
PlaceObj('PropertyDefText', {
'id', "display_name_plural",
'name', "Display Name Plural",
'help', "Profession",
}),
PlaceObj('PropertyDefText', {
'id', "display_name_plural_all_caps",
'name', "Display Name Plural All Caps",
'help', "Profession",
}),
})
|