Change quickslot saving on death to override InraidController for compat with Insurance Plus
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import type { DependencyContainer } from "tsyringe";
|
import type { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
|
import type { InraidController } from "@spt/controllers/InraidController";
|
||||||
import type { HideoutHelper } from "@spt/helpers/HideoutHelper";
|
import type { HideoutHelper } from "@spt/helpers/HideoutHelper";
|
||||||
import type { InRaidHelper } from "@spt/helpers/InRaidHelper";
|
|
||||||
import type { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
import type { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||||
import type { ItemHelper } from "@spt/helpers/ItemHelper";
|
import type { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
import type { IHideoutSingleProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutSingleProductionStartRequestData";
|
import type { IHideoutSingleProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutSingleProductionStartRequestData";
|
||||||
@@ -28,16 +28,16 @@ class UIFixes implements IPreSptLoadMod {
|
|||||||
|
|
||||||
// Keep quickbinds for items that aren't actually lost on death
|
// Keep quickbinds for items that aren't actually lost on death
|
||||||
container.afterResolution(
|
container.afterResolution(
|
||||||
"InRaidHelper",
|
"InraidController",
|
||||||
(_, inRaidHelper: InRaidHelper) => {
|
(_, inRaidController: InraidController) => {
|
||||||
const original = inRaidHelper.deleteInventory;
|
const original = inRaidController["performPostRaidActionsWhenDead"]; // protected, can only access by name
|
||||||
|
|
||||||
inRaidHelper.deleteInventory = (pmcData, sessionId) => {
|
inRaidController["performPostRaidActionsWhenDead"] = (postRaidSaveRequest, pmcData, sessionId) => {
|
||||||
// Copy the existing quickbinds
|
// Copy the existing quickbinds
|
||||||
const fastPanel = cloner.clone(pmcData.Inventory.fastPanel);
|
const fastPanel = cloner.clone(pmcData.Inventory.fastPanel);
|
||||||
|
|
||||||
// Nukes the inventory and the fastpanel
|
// Nukes the inventory and the fastpanel
|
||||||
original.call(inRaidHelper, pmcData, sessionId);
|
const result = original.call(inRaidController, postRaidSaveRequest, pmcData, sessionId);
|
||||||
|
|
||||||
// Restore the quickbinds for items that still exist
|
// Restore the quickbinds for items that still exist
|
||||||
try {
|
try {
|
||||||
@@ -49,6 +49,8 @@ class UIFixes implements IPreSptLoadMod {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(`UIFixes: Failed to restore quickbinds\n ${error}`);
|
this.logger.error(`UIFixes: Failed to restore quickbinds\n ${error}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
{ frequency: "Always" }
|
{ frequency: "Always" }
|
||||||
|
|||||||
Reference in New Issue
Block a user