Files
WT-Offline/gui-patches/battle/quit-local-host-to-debriefing/replace.nut
T

32 lines
937 B
Plaintext

function sendDisconnectMessage() {
broadcastEvent("PlayerQuitMission")
if (is_multiplayer() && !is_mplayer_host()) {
leave_mp_session()
this.onResumeRaw()
}
else
this.quitToDebriefing()
}
function quitToDebriefing() {
disableOrders()
quit_to_debriefing()
interrupt_multiplayer(true)
// The LocalMP debriefing can still show this log after the host has stopped.
if (require("nestdb").ndbTryRead(["wto", "activeBattle"]) == null)
HudBattleLog.reset()
this.onResumeRaw()
}
function onQuitMission(_obj) {
if (is_offline_version() && !ludeo?.is_running())
return restart_mission()
if (is_replay_playing()) {
this.quitToDebriefing()
}
else if (get_mission_status() == MISSION_STATUS_RUNNING) {
local text = ""
if (is_mplayer_host() && get_game_mode() != GM_DOMINATION)
text = loc("flightmenu/questionQuitMissionHost")