feat(battle): wire Nuclear Escalation launch and airfield cooldowns
Connect Air Realistic sub-mode 103 (Nuclear Escalation) mission launch settings and LocalMP respawn/airfield-cooldown handling: - Server: support mode-level maxRespawns (UNLIMITED_RESPAWNS = -2) and per-mode missionRuleKeys so Nuclear Escalation forwards customHUD, stage thresholds, useSpawnDelay, afterRespawnDelaySec, and battle display flags from the stock missions; reject queues when no candidate mode is eligible for the lineup; disable spares and emit wtoUnlimitedRespawns for unlimited-respawn modes. - Native: keep slots usable when wtoUnlimitedRespawns is set and emit wtoLocalMpAirfieldSpawn with the unit name and spawn base ID when the local player actually enters pilot control. - GUI patches: track confirmed LocalMP airfield departures in scripts/respawn/respawnbases.nut and feed the computed per-base delays into scripts/respawn/respawn.nut slot countdowns and spawn checks. Stage-unlocked dedicated event aircraft allocation by faction and room BR is not yet wired and remains pending research. Verified with root and launcher typechecks, check-patches and check-gui on 2.61.0.37 and 2.61.0.58, and native wto_ws.dll build; pending in-game verification.
This commit is contained in:
1 parent
646be7afb9
commit
f1ec034994
24 files changed
+240
-24
No files matched your search
@@ -0,0 +1,9 @@
|
||||
function getPerBaseRespawnDelays(respawnBasesList, unitName) {
|
||||
local baseDelays = {}
|
||||
if ((get_current_mission_info_cached()?.afterRespawnDelaySec ?? 0) <= 0)
|
||||
return baseDelays
|
||||
foreach (spawn in respawnBasesList)
|
||||
if (isPerBaseDelayRow(spawn))
|
||||
baseDelays[spawn.id] <- get_slot_delay(unitName, spawn.id)
|
||||
return baseDelays
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
function onEventLoadingStateChange(_p) {
|
||||
if (!isInFlight())
|
||||
this.resetSelectedBase()
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Track successful departures by aircraft and airfield for the stock respawn base list.
|
||||
// The LocalMP host has the actual spawn result. The local matching service only starts the mission.
|
||||
// The stock delay getters read a flight server snapshot, so the LocalMP departure event supplies it.
|
||||
{
|
||||
"id": "battle/track-local-airfield-departures",
|
||||
"title": "Track LocalMP departures for airfield respawn delays",
|
||||
"features": ["K-Spawn score and respawns"],
|
||||
"variants": [
|
||||
{
|
||||
"written_for": "2.61.0.58",
|
||||
"file": "scripts/respawn/respawnbases.nut",
|
||||
"edits": [
|
||||
{ "find": "find-delays.nut", "replace": "replace-delays.nut" },
|
||||
{ "find": "find-loading.nut", "replace": "replace-loading.nut" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
wtoAirfieldDepartures = {}
|
||||
|
||||
function hasLocalRespawnDelays() {
|
||||
return this.wtoAirfieldDepartures.len() > 0
|
||||
}
|
||||
|
||||
function getLocalRespawnDelay(unitName, spawn) {
|
||||
if (unitName == null || spawn == null || !isPerBaseDelayRow(spawn))
|
||||
return null
|
||||
let departedAt = this.wtoAirfieldDepartures?[unitName]?[spawn.id]
|
||||
if (departedAt == null)
|
||||
return null
|
||||
let delay = get_current_mission_info_cached()?.afterRespawnDelaySec ?? 0
|
||||
let elapsed = (require("dagor.time").get_time_msec() - departedAt) / 1000
|
||||
return max(0, delay - elapsed.tointeger())
|
||||
}
|
||||
|
||||
function getPerBaseRespawnDelays(respawnBasesList, unitName) {
|
||||
local baseDelays = {}
|
||||
if ((get_current_mission_info_cached()?.afterRespawnDelaySec ?? 0) <= 0)
|
||||
return baseDelays
|
||||
foreach (spawn in respawnBasesList)
|
||||
if (isPerBaseDelayRow(spawn))
|
||||
baseDelays[spawn.id] <- this.getLocalRespawnDelay(unitName, spawn) ?? get_slot_delay(unitName, spawn.id)
|
||||
return baseDelays
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
function onLocalAirfieldSpawn(event) {
|
||||
let { unitName, baseId } = event
|
||||
let departures = this.wtoAirfieldDepartures?[unitName] ?? {}
|
||||
departures[baseId] <- require("dagor.time").get_time_msec()
|
||||
this.wtoAirfieldDepartures[unitName] <- departures
|
||||
}
|
||||
|
||||
function onEventHudEventManagerReset(_p) {
|
||||
let { g_hud_event_manager } = require("%scripts/hud/hudEventManager.nut")
|
||||
g_hud_event_manager.subscribe("wtoLocalMpAirfieldSpawn", this.onLocalAirfieldSpawn, this)
|
||||
}
|
||||
|
||||
function onEventLoadingStateChange(_p) {
|
||||
if (!isInFlight()) {
|
||||
this.resetSelectedBase()
|
||||
this.wtoAirfieldDepartures.clear()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
let crewId = crew.idInCountry
|
||||
let syncRecvTime = getSpawnDelayTimesRecvTime()
|
||||
let prevState = this.lastRespawnBaseLockState
|
||||
@@ -0,0 +1,22 @@
|
||||
let respawnBaseId = this.curRespawnBase?.id ?? 0
|
||||
let syncRecvTime = getSpawnDelayTimesRecvTime()
|
||||
foreach (crew in crews) {
|
||||
let idInCountry = crew.idInCountry
|
||||
let cacheKey = $"{idInCountry}_{respawnBaseId}"
|
||||
let curSlotDelay = get_slot_delay_by_slot(idInCountry, respawnBaseId)
|
||||
local slotDelayChanged = false
|
||||
if (!(cacheKey in this.slotDelayDataCached)) {
|
||||
this.slotDelayDataCached[cacheKey] <- {
|
||||
slotDelay = curSlotDelay
|
||||
updateTime = curSlotDelay >= 0 ? syncRecvTime : 0
|
||||
}
|
||||
slotDelayChanged = curSlotDelay >= 0
|
||||
}
|
||||
else {
|
||||
let slotDelayData = this.slotDelayDataCached[cacheKey]
|
||||
if (slotDelayData.slotDelay != curSlotDelay) {
|
||||
slotDelayData.slotDelay = curSlotDelay
|
||||
slotDelayData.updateTime = syncRecvTime
|
||||
slotDelayChanged = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
let slotDelay = this.getInterpolatedSlotDelay(crew.idInCountry, this.curRespawnBase.id)
|
||||
if (slotDelay > 0) {
|
||||
@@ -0,0 +1,19 @@
|
||||
// Feed LocalMP airfield delays into the stock slot countdown and base lock refresh.
|
||||
// The local matching service does not receive the flight server's per-slot delay snapshots.
|
||||
// The spawn button and base list need the host departure times to apply the same delay.
|
||||
{
|
||||
"id": "battle/use-local-airfield-respawn-delay",
|
||||
"title": "Use LocalMP airfield delays in the respawn screen",
|
||||
"features": ["K-Spawn score and respawns"],
|
||||
"variants": [
|
||||
{
|
||||
"written_for": "2.61.0.58",
|
||||
"file": "scripts/respawn/respawn.nut",
|
||||
"edits": [
|
||||
{ "find": "find-spawn-check.nut", "replace": "replace-spawn-check.nut" },
|
||||
{ "find": "find-slot-delay.nut", "replace": "replace-slot-delay.nut" },
|
||||
{ "find": "find-base-refresh.nut", "replace": "replace-base-refresh.nut" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
let crewId = crew.idInCountry
|
||||
let wtoHasDelays = "hasLocalRespawnDelays" in respawnBases && respawnBases.hasLocalRespawnDelays()
|
||||
let syncRecvTime = wtoHasDelays ? (get_time_msec() / 1000).tointeger() : getSpawnDelayTimesRecvTime()
|
||||
let prevState = this.lastRespawnBaseLockState
|
||||
@@ -0,0 +1,27 @@
|
||||
let respawnBaseId = this.curRespawnBase?.id ?? 0
|
||||
let syncRecvTime = getSpawnDelayTimesRecvTime()
|
||||
let wtoHasDelays = "hasLocalRespawnDelays" in respawnBases && respawnBases.hasLocalRespawnDelays()
|
||||
foreach (crew in crews) {
|
||||
let idInCountry = crew.idInCountry
|
||||
let cacheKey = $"{idInCountry}_{respawnBaseId}"
|
||||
let wtoDelay = wtoHasDelays
|
||||
? respawnBases.getLocalRespawnDelay(getCrewUnit(crew)?.name, this.curRespawnBase)
|
||||
: null
|
||||
let curSlotDelay = wtoDelay ?? get_slot_delay_by_slot(idInCountry, respawnBaseId)
|
||||
let slotRecvTime = wtoDelay == null ? syncRecvTime : get_time_msec()
|
||||
local slotDelayChanged = false
|
||||
if (!(cacheKey in this.slotDelayDataCached)) {
|
||||
this.slotDelayDataCached[cacheKey] <- {
|
||||
slotDelay = curSlotDelay
|
||||
updateTime = curSlotDelay >= 0 ? slotRecvTime : 0
|
||||
}
|
||||
slotDelayChanged = curSlotDelay >= 0
|
||||
}
|
||||
else {
|
||||
let slotDelayData = this.slotDelayDataCached[cacheKey]
|
||||
if (slotDelayData.slotDelay != curSlotDelay) {
|
||||
slotDelayData.slotDelay = curSlotDelay
|
||||
slotDelayData.updateTime = slotRecvTime
|
||||
slotDelayChanged = true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
let wtoDelay = "getLocalRespawnDelay" in respawnBases
|
||||
? respawnBases.getLocalRespawnDelay(unit.name, this.curRespawnBase)
|
||||
: null
|
||||
let slotDelay = wtoDelay ?? this.getInterpolatedSlotDelay(crew.idInCountry, this.curRespawnBase.id)
|
||||
if (slotDelay > 0) {
|
||||
@@ -1,10 +1,11 @@
|
||||
// In-battle award events (native/wto-net/src/local_mp_awards.c): the stock InBattleReward HUD event
|
||||
// and the facts sent to the local server for awards.
|
||||
// Without it: no reward banners and no battle awards in LocalMP battles.
|
||||
// and the facts sent to the local server for awards. Also reports confirmed airfield departures
|
||||
// for the LocalMP respawn UI, which otherwise expects the flight server to send cooldown records.
|
||||
{
|
||||
"module": "local_mp_awards",
|
||||
"features": [
|
||||
"L-Battle awards"
|
||||
"L-Battle awards",
|
||||
"K-Spawn score and respawns"
|
||||
],
|
||||
"requires": [
|
||||
"local_mp_core"
|
||||
|
||||
Reference in new issue
Block a user