fix(tutorials): prevent crew training from reopening or trapping input
Record completion after the guided crew upgrade succeeds. Keep the guide dismissible and close it when its slot or menu target disappears. Compile the affected scripts with the stock queue flag bindings.
This commit is contained in:
1 parent
0c9340f883
commit
0881d62766
25 files changed
+169
-9
No files matched your search
@@ -0,0 +1 @@
|
||||
let needArrow = (stepData?.haveArrow ?? true) && blocksList.len() > 0
|
||||
@@ -0,0 +1,20 @@
|
||||
// An opted-in object-click step can close safely when there is nothing to click.
|
||||
{
|
||||
"id": "tutorials/cancel-guide-without-target",
|
||||
"title": "Dismiss opted-in guide steps when their UI target disappears",
|
||||
"features": [
|
||||
"A-Tutorials"
|
||||
],
|
||||
"variants": [
|
||||
{
|
||||
"written_for": "2.61.0.37",
|
||||
"file": "scripts/guitutorial.nut",
|
||||
"edits": [
|
||||
{
|
||||
"find": "find-missing-target.nut",
|
||||
"replace": "replace-missing-target.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
if ((stepData?.cancelOnMissingTarget ?? false) && blocksList.len() == 0) {
|
||||
this.canceled = true
|
||||
return this.goBack()
|
||||
}
|
||||
|
||||
let needArrow = (stepData?.haveArrow ?? true) && blocksList.len() > 0
|
||||
@@ -0,0 +1,4 @@
|
||||
gui_modal_tutor(steps, this)
|
||||
}
|
||||
|
||||
function toBattleTutor() {
|
||||
@@ -0,0 +1,5 @@
|
||||
function checkUpgradeCrewTutorial() {
|
||||
if (!isLoggedIn.get())
|
||||
return
|
||||
|
||||
if (!isAllCrewsMinLevel())
|
||||
@@ -0,0 +1 @@
|
||||
from "%scripts/user/newbieTutorialDisplay.nut" import needShowTutorial, reqFirstCountryChoice, saveShowedTutorial
|
||||
@@ -0,0 +1,2 @@
|
||||
obj = [@() curSlotExtraInfoObj.findObject("openCrewWnd")]
|
||||
text = loc("tutorials/upg_crew/select_crew")
|
||||
@@ -0,0 +1,2 @@
|
||||
obj = [curSlotExtraInfoObj]
|
||||
text = " ".concat(loc("tutorials/upg_crew/skill_points_info"), loc("tutorials/upg_crew/press_to_crew"))
|
||||
@@ -0,0 +1,2 @@
|
||||
local curSlotExtraInfoObj = curSlotObj.findObject("extra_info_content")
|
||||
if (!curSlotExtraInfoObj)
|
||||
@@ -0,0 +1,40 @@
|
||||
// The crew skill guide may be entered from the hangar while menus are reopening.
|
||||
{
|
||||
"id": "tutorials/guard-crew-training-intro",
|
||||
"title": "Keep the crew skill guide from reopening",
|
||||
"features": [
|
||||
"A-Tutorials"
|
||||
],
|
||||
"variants": [
|
||||
{
|
||||
"written_for": "2.61.0.37",
|
||||
"file": "scripts/mainmenu/instantactionhandler.nut",
|
||||
"edits": [
|
||||
{
|
||||
"find": "find-imports.nut",
|
||||
"replace": "replace-imports.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-entry.nut",
|
||||
"replace": "replace-entry.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-slot.nut",
|
||||
"replace": "replace-slot.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-slot-step.nut",
|
||||
"replace": "replace-slot-step.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-menu-step.nut",
|
||||
"replace": "replace-menu-step.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-allow-close.nut",
|
||||
"replace": "replace-allow-close.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
gui_modal_tutor(steps, this, true)
|
||||
}
|
||||
|
||||
function toBattleTutor() {
|
||||
@@ -0,0 +1,5 @@
|
||||
function checkUpgradeCrewTutorial() {
|
||||
if (!isLoggedIn.get() || this.guiScene.hasModalObject())
|
||||
return
|
||||
|
||||
if (loadLocalByAccount("tutor/upgradeCrewSkills", false) || !isAllCrewsMinLevel())
|
||||
@@ -0,0 +1,2 @@
|
||||
from "%scripts/user/newbieTutorialDisplay.nut" import needShowTutorial, reqFirstCountryChoice, saveShowedTutorial
|
||||
from "%scripts/clientState/localProfileDeprecated.nut" import loadLocalByAccount
|
||||
@@ -0,0 +1,3 @@
|
||||
obj = [@() checkObj(curSlotExtraInfoObj) ? curSlotExtraInfoObj.findObject("openCrewWnd") : null]
|
||||
cancelOnMissingTarget = true
|
||||
text = loc("tutorials/upg_crew/select_crew")
|
||||
@@ -0,0 +1,3 @@
|
||||
obj = [curSlotExtraInfoObj]
|
||||
cancelOnMissingTarget = true
|
||||
text = " ".concat(loc("tutorials/upg_crew/skill_points_info"), loc("tutorials/upg_crew/press_to_crew"))
|
||||
@@ -0,0 +1,2 @@
|
||||
local curSlotExtraInfoObj = curSlotObj.findObject("extra_info_content")
|
||||
if (!checkObj(curSlotExtraInfoObj))
|
||||
@@ -0,0 +1,4 @@
|
||||
gui_modal_tutor(steps, this)
|
||||
}
|
||||
|
||||
function canUpgradeCrewSpec(upgCrew) {
|
||||
@@ -0,0 +1,3 @@
|
||||
this.afterApplyAction = this.canUpgradeCrewSpec(this.crew) ? this.onUpgrCrewSpec1Tutorial
|
||||
: this.onUpgrCrewTutorFinalStep
|
||||
this.onApply() }, this)
|
||||
@@ -0,0 +1 @@
|
||||
from "%scripts/clientState/localProfileDeprecated.nut" import loadLocalByAccount, saveLocalByAccount
|
||||
@@ -0,0 +1,28 @@
|
||||
// Save the per-account completion flag from the existing successful upgrade callback.
|
||||
{
|
||||
"id": "tutorials/save-crew-training-completion",
|
||||
"title": "Save completion after the guided crew upgrade",
|
||||
"features": [
|
||||
"A-Tutorials"
|
||||
],
|
||||
"variants": [
|
||||
{
|
||||
"written_for": "2.61.0.37",
|
||||
"file": "scripts/crew/crewwndhandler.nut",
|
||||
"edits": [
|
||||
{
|
||||
"find": "find-imports.nut",
|
||||
"replace": "replace-imports.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-completion.nut",
|
||||
"replace": "replace-completion.nut"
|
||||
},
|
||||
{
|
||||
"find": "find-allow-close.nut",
|
||||
"replace": "replace-allow-close.nut"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
gui_modal_tutor(steps, this, true)
|
||||
}
|
||||
|
||||
function canUpgradeCrewSpec(upgCrew) {
|
||||
@@ -0,0 +1,8 @@
|
||||
let nextStep = this.canUpgradeCrewSpec(this.crew) ? this.onUpgrCrewSpec1Tutorial
|
||||
: this.onUpgrCrewTutorFinalStep
|
||||
this.afterApplyAction = function() {
|
||||
saveLocalByAccount("tutor/upgradeCrewSkills", true, @() save_profile(false))
|
||||
nextStep.call(this)
|
||||
}
|
||||
this.onApply()
|
||||
}, this)
|
||||
@@ -0,0 +1,2 @@
|
||||
from "%scripts/clientState/localProfileDeprecated.nut" import loadLocalByAccount, saveLocalByAccount
|
||||
from "chard" import save_profile
|
||||
Reference in new issue
Block a user