Skip to content

Commit 64b23dd

Browse files
committed
Check for missing archive
1 parent 422feb3 commit 64b23dd

3 files changed

Lines changed: 37 additions & 9 deletions

File tree

scripts/Overrides/WardrobeUIGameController.reds

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import EquipmentEx.{EquipmentEx, OutfitSystem, RequirementsPopup}
1+
import EquipmentEx.{EquipmentEx, OutfitSystem, ArchivePopup, RequirementsPopup}
22

33
@addField(WardrobeUIGameController)
44
private let m_wardrobePopup: ref<inkGameNotificationToken>;
@@ -13,7 +13,12 @@ protected cb func OnInitialize() -> Bool {
1313
this.m_wardrobePopup = RequirementsPopup.Show(this);
1414
this.m_wardrobePopup.RegisterListener(this, n"OnWardrobePopupClose");
1515
} else {
16-
this.SpawnFromExternal(this.GetRootCompoundWidget(), r"equipment_ex\\gui\\wardrobe.inkwidget", n"Root:EquipmentEx.WardrobeScreenController");
16+
let wardrobe = this.SpawnFromExternal(this.GetRootCompoundWidget(), r"equipment_ex\\gui\\wardrobe.inkwidget", n"Root:EquipmentEx.WardrobeScreenController");
17+
if !IsDefined(wardrobe) {
18+
this.m_wardrobePopup = ArchivePopup.Show(this);
19+
this.m_wardrobePopup.RegisterListener(this, n"OnWardrobePopupClose");
20+
return false;
21+
}
1722
}
1823
1924
this.m_introAnimProxy = new inkAnimProxy();

scripts/Overrides/gameuiInventoryGameController.reds

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import EquipmentEx.{EquipmentEx, OutfitSystem, RequirementsPopup}
1+
import EquipmentEx.{EquipmentEx, OutfitSystem, ArchivePopup, RequirementsPopup}
22

33
@addField(gameuiInventoryGameController)
44
private let m_outfitSystem: wref<OutfitSystem>;
@@ -81,8 +81,15 @@ protected func ShowWardrobeScreen() -> Bool {
8181
return false;
8282
}
8383
84-
let outfitManager = this.SpawnFromExternal(this.GetRootCompoundWidget(), r"equipment_ex\\gui\\wardrobe.inkwidget", n"Root:EquipmentEx.WardrobeScreenController") as inkCompoundWidget;
85-
outfitManager.SetName(n"wardrobe");
84+
let wardrobe = this.SpawnFromExternal(this.GetRootCompoundWidget(), r"equipment_ex\\gui\\wardrobe.inkwidget", n"Root:EquipmentEx.WardrobeScreenController") as inkCompoundWidget;
85+
86+
if !IsDefined(wardrobe) {
87+
this.m_wardrobePopup = ArchivePopup.Show(this);
88+
this.m_wardrobePopup.RegisterListener(this, n"OnWardrobePopupClose");
89+
return false;
90+
}
91+
92+
wardrobe.SetName(n"wardrobe");
8693
8794
let alphaAnim = new inkAnimTransparency();
8895
alphaAnim.SetStartTransparency(0.0);
@@ -94,7 +101,7 @@ protected func ShowWardrobeScreen() -> Bool {
94101
let animDef = new inkAnimDef();
95102
animDef.AddInterpolator(alphaAnim);
96103
97-
outfitManager.GetWidgetByPathName(n"wrapper/wrapper").PlayAnimation(animDef);
104+
wardrobe.GetWidgetByPathName(n"wrapper/wrapper").PlayAnimation(animDef);
98105
// animProxy.RegisterToCallback(inkanimEventType.OnFinish, this, n"OnWardrobeScreenShown");
99106
100107
this.m_wardrobeReady = true;
@@ -112,7 +119,7 @@ protected func ShowWardrobeScreen() -> Bool {
112119
113120
let evt = new DropQueueUpdatedEvent();
114121
evt.m_dropQueue = this.m_itemModeLogicController.m_itemDropQueue;
115-
outfitManager.GetController().QueueEvent(evt);
122+
wardrobe.GetController().QueueEvent(evt);
116123
117124
return true;
118125
}
@@ -129,7 +136,7 @@ protected func HideWardrobeScreen() -> Bool {
129136
return false;
130137
}
131138
132-
let outfitManager = this.GetChildWidgetByPath(n"wardrobe") as inkCompoundWidget;
139+
let wardrobe = this.GetChildWidgetByPath(n"wardrobe") as inkCompoundWidget;
133140
134141
this.m_wardrobeReady = false;
135142
@@ -143,7 +150,7 @@ protected func HideWardrobeScreen() -> Bool {
143150
let animDef = new inkAnimDef();
144151
animDef.AddInterpolator(alphaAnim);
145152
146-
let animProxy = outfitManager.GetWidgetByPathName(n"wrapper/wrapper").PlayAnimation(animDef);
153+
let animProxy = wardrobe.GetWidgetByPathName(n"wrapper/wrapper").PlayAnimation(animDef);
147154
animProxy.RegisterToCallback(inkanimEventType.OnFinish, this, n"OnWardrobeScreenHidden");
148155
149156
if Equals(this.m_mode, InventoryModes.Item) {

scripts/UI/ArchivePopup.reds

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module EquipmentEx
2+
3+
public class ArchivePopup {
4+
public static func Show(controller: ref<worlduiIGameController>) -> ref<inkGameNotificationToken> {
5+
return GenericMessageNotification.Show(
6+
controller,
7+
GetLocalizedText("LocKey#11447"),
8+
"Equipment-EX has detected an issue:\n" +
9+
"- archive/pc/mod/EquipmentEx.archive is missing\n\n" +
10+
"Possible solutions:\n" +
11+
"- Reinstall the mod from the original distribution\n" +
12+
"- If you installed it as REDmod, make sure mods are enabled\n",
13+
GenericMessageNotificationType.OK
14+
);
15+
}
16+
}

0 commit comments

Comments
 (0)