{ "id": "battle/append-extra-battle-slots", "title": "Append session killstreak aircraft and random-spawn vehicles to in-battle crew list", "file": "scripts/slotbar/crewslist.nut", "reason": "Dedicated servers append nuclear bombers, strike UCAVs, and RandomSpawnUnits filler slots to the battle crew list; appending activeBattle.extraBattleSlots when isInBattle is true exposes those slots to the respawn screen and slotbar.", "features": ["J-本地对局", "K-战局任务加载"], "edit": { "find": " let res = crewInfo.filter(@(v) v.country == curCountry)\r\n if (res.len() == 1)\r\n return res.map(\r\n @(countryInfo) countryInfo.__merge({\r\n crews = countryInfo.crews.map(@(crew) crew.__merge({idCountry = 0}))\r\n })\r\n )", "replace": " let appendWtoExtraBattleCrews = function(baseCrews) {\r\n let { ndbTryRead } = require(\"nestdb\")\r\n let wtoBattle = ndbTryRead([\"wto\", \"activeBattle\"])\r\n let extraSlots = wtoBattle?.extraBattleSlots\r\n if (extraSlots == null || extraSlots.len() == 0)\r\n return baseCrews\r\n if ((wtoBattle?.country ?? \"\") != \"\" && wtoBattle.country != curCountry)\r\n return baseCrews\r\n let merged = [].extend(baseCrews)\r\n foreach (idx, slot in extraSlots) {\r\n if (merged.len() >= 32)\r\n break\r\n let unitName = slot?.unitName ?? \"\"\r\n if (unitName == \"\")\r\n continue\r\n merged.append({\r\n id = -1 - idx\r\n idCountry = 0\r\n idInCountry = merged.len()\r\n country = curCountry\r\n aircraft = unitName\r\n isEmpty = 0\r\n trainedSpec = { [unitName] = 2 }\r\n trained = [unitName]\r\n skillPoints = 0\r\n lockedTillSec = 0\r\n isLocked = 0\r\n })\r\n }\r\n return merged\r\n }\r\n let res = crewInfo.filter(@(v) v.country == curCountry)\r\n if (res.len() == 1)\r\n return res.map(\r\n @(countryInfo) countryInfo.__merge({\r\n crews = appendWtoExtraBattleCrews(\r\n countryInfo.crews.map(@(crew) crew.__merge({idCountry = 0}))\r\n )\r\n })\r\n )" } }