fix(battle): present extra lineup slots as ordinary vehicles

The live game draws one vehicle from each RandomSpawnUnits group at
launch and shows it as a plain lineup vehicle (a 12.7 US lineup gets an
M1A1 12.0 and an ADATS 12.0, no dice), so the random_units state and the
patch that filled it are gone. The strike UCAV costs 750 spawn points,
the live game's value, now in tuning/battle.jsonc.
This commit is contained in:
N0VAN0M4LY committed 2026-11-28 07:28:48 +08:00
1 parent e3c5880023
commit 9f28a84cd3
12 files changed
+41 -94

No files matched your search

@@ -1,5 +1,5 @@
// Add the extra vehicles the local service chose for a LocalMP battle (nuclear carrier, strike UCAV,
// random tank / SPAA / naval aircraft) to the in-battle crew list.
// the RandomSpawnUnits tank / SPAA / naval aircraft) to the in-battle crew list.
// Why the client: online the battle server adds them to the player's crews; a LocalMP host has no
// battle server, and the in-battle crew list comes from the native get_crew_info.
// Without it: the lineup holds only the player's own vehicles.
@@ -1,7 +1,7 @@
// Lock the weapon preset the local service set for an extra LocalMP vehicle (the nuclear carrier's
// bomb, the RandomSpawnUnits forceWeapon).
// Why the client: online getForcedUnitWeapon finds the random vehicle's weapon through the room
// event, which a LocalMP host does not have, and the nuclear carrier comes from the server.
// bomb, the RandomSpawnUnits forceWeapon of a naval extra aircraft).
// Why the client: online the battle server sends the extra vehicles with their weapon; on a LocalMP
// host the local service chooses them, and getForcedUnitWeapon only knows mission and room data.
// Without it: the extra vehicles spawn with whatever preset the respawn screen picks.
{
"id": "battle/force-extra-slot-weapons",
@@ -1,6 +1,6 @@
function getForcedUnitWeapon(unit) {
// WTOffline: the extra slots the local service added to a LocalMP lineup carry their forced
// weapon (nuclear carrier, RandomSpawnUnits forceWeapon); online the room event resolves it.
// WTOffline: the extra vehicles the local service added to a LocalMP lineup carry their forced
// weapon (nuclear carrier, RandomSpawnUnits forceWeapon); online the battle server sends it.
foreach (wtoSlot in (require("nestdb").ndbTryRead(["wto", "activeBattle"])?.extraBattleSlots ?? []))
if (wtoSlot?.unitName == unit.name && (wtoSlot?.forceWeapon ?? "") != "")
return wtoSlot.forceWeapon
@@ -1,3 +0,0 @@
function getMyStateBlk() {
return get_user_custom_state(userIdInt64.get(), false)
}
@@ -1,22 +0,0 @@
// Fill the local player's random_units state with the options of each random vehicle group the
// local service drew for a LocalMP battle.
// Why the client: online the battle server writes it into the player's custom state; the stock
// slotbar reads it for the dice icon, the group name, the BR range and the list of options.
// Without it: the random vehicles look like plain lineup vehicles.
{
"id": "battle/populate-random-spawn-units-state",
"title": "Fill the random_units state of the local player in LocalMP",
"file": "scripts/miscustomrules/rulebase.nut",
"features": [
"K-补充载具"
],
"verified_on": [
"2.61.0.37"
],
"edits": [
{
"find": "find.nut",
"replace": "replace.nut"
}
]
}
@@ -1,21 +0,0 @@
function getMyStateBlk() {
let wtoUid = userIdInt64.get()
local wtoStateBlk = get_user_custom_state(wtoUid, false)
let { ndbTryRead } = require("nestdb")
let wtoRandom = ndbTryRead(["wto", "activeBattle"])?.randomUnits
if (wtoRandom == null || wtoRandom.len() == 0)
return wtoStateBlk
if (wtoStateBlk == null)
wtoStateBlk = get_user_custom_state(wtoUid, true) ?? DataBlock()
if (wtoStateBlk?.random_units == null) {
let wtoRuBlk = wtoStateBlk.addNewBlock("random_units")
foreach (wtoGroupName, wtoUnits in wtoRandom) {
if (wtoUnits == null || wtoUnits.len() == 0)
continue
let wtoGroupBlk = wtoRuBlk.addNewBlock(wtoGroupName)
foreach (wtoUnitName in wtoUnits)
wtoGroupBlk[wtoUnitName] = true
}
}
return wtoStateBlk
}