diff --git a/mod_files/interface/translations/skyrimoutfitsystem_english.txt b/mod_files/interface/translations/skyrimoutfitsystem_english.txt index 99be5c7..f2e7f71 100644 Binary files a/mod_files/interface/translations/skyrimoutfitsystem_english.txt and b/mod_files/interface/translations/skyrimoutfitsystem_english.txt differ diff --git a/src/OutfitSystem.cpp b/src/OutfitSystem.cpp index 1d26a60..fe0b05c 100644 --- a/src/OutfitSystem.cpp +++ b/src/OutfitSystem.cpp @@ -623,7 +623,7 @@ service.setOutfitUsingLocation(type); } void SetLocationOutfit(VMClassRegistry* registry, UInt32 stackId, StaticFunctionTag*, UInt32 location, BSFixedString name) { - if (strcmp(name.data, "")) { + if (strcmp(name.data, "") == 0) { // Location outfit assignment is never allowed to be empty string. Use unset instead. return; } diff --git a/src/papyrus/skyoutsysautoswitchtrigger.psc b/src/papyrus/skyoutsysautoswitchtrigger.psc index d78143d..0eb1161 100644 --- a/src/papyrus/skyoutsysautoswitchtrigger.psc +++ b/src/papyrus/skyoutsysautoswitchtrigger.psc @@ -1,7 +1,18 @@ Scriptname SkyOutSysAutoSwitchTrigger extends ReferenceAlias +Auto State Listening Event OnLocationChange(Location akOldLoc, Location akNewLoc) - Debug.Notification("SOS: Running OnLocationChange") - Debug.Trace("SOS: Running OnLocationChange") - SkyrimOutfitSystemNativeFuncs.SetOutfitUsingLocation(akNewLoc) + ; Debug.Trace("SOS: Running OnLocationChange") + GoToState("Waiting") + Utility.Wait(10.0) + SkyrimOutfitSystemNativeFuncs.SetOutfitUsingLocation(Game.GetPlayer().GetCurrentLocation()) + SkyrimOutfitSystemNativeFuncs.RefreshArmorFor(Game.GetPlayer()) + GoToState("Listening") endEvent +EndState + +State Waiting +Event OnLocationChange(Location akOldLoc, Location akNewLoc) + ; Ignore changes while we're waiting +endEvent +EndState \ No newline at end of file diff --git a/src/papyrus/skyoutsysmcm.psc b/src/papyrus/skyoutsysmcm.psc index 0831c9d..d4c619a 100644 --- a/src/papyrus/skyoutsysmcm.psc +++ b/src/papyrus/skyoutsysmcm.psc @@ -163,9 +163,10 @@ EndFunction EndEvent Event OnMenuOpenST() String sState = GetState() - If StringUtil.Substring(sState, 0, 18) == "OPT_QuickslotEntry" - Int iQuickslotIndex = StringUtil.Substring(sState, 18) as Int - String[] sMenu = PrependStringToArray(_sOutfitNames, "$SkyOutSys_QuickslotEdit_Cancel") + If StringUtil.Substring(sState, 0, 19) == "OPT_AutoswitchEntry" + Int iQuickslotIndex = StringUtil.Substring(sState, 19) as Int + String[] sMenu = PrependStringToArray(_sOutfitNames, "$SkyOutSys_AutoswitchEdit_None") + sMenu = PrependStringToArray(sMenu, "$SkyOutSys_AutoswitchEdit_Cancel") SetMenuDialogOptions(sMenu) SetMenuDialogStartIndex(0) SetMenuDialogDefaultIndex(0) @@ -174,9 +175,28 @@ EndFunction EndEvent Event OnMenuAcceptST(Int aiIndex) String sState = GetState() + If StringUtil.Substring(sState, 0, 19) == "OPT_AutoswitchEntry" + aiIndex = aiIndex - 2 + If aiIndex == -2 ; user canceled + Return + EndIf + Int iAutoswitchIndex = StringUtil.Substring(sState, 19) as Int + If aiIndex == -1 ; user wants no outfit + SkyrimOutfitSystemNativeFuncs.UnsetLocationOutfit(iAutoswitchIndex) + Else ; set the requested outfit + String sOutfitName = _sOutfitNames[aiIndex] + SkyrimOutfitSystemNativeFuncs.SetLocationOutfit(iAutoswitchIndex, sOutfitName) + EndIf + SetMenuOptionValueST(SkyrimOutfitSystemNativeFuncs.GetLocationOutfit(iAutoswitchIndex)) + Return + EndIf EndEvent Event OnHighlightST() String sState = GetState() + If StringUtil.Substring(sState, 0, 19) == "OPT_AutoswitchEntry" + SetInfoText("$SkyOutSys_Desc_Autoswitch") + Return + EndIf If StringUtil.Substring(sState, 0, 16) == "OutfitList_Item_" SetInfoText("$SkyOutSys_MCMInfoText_Outfit") Return @@ -188,20 +208,45 @@ EndFunction EndEvent Event OnDefaultST() String sState = GetState() + If StringUtil.Substring(sState, 0, 19) == "OPT_AutoswitchEntry" + Int iAutoswitchIndex = StringUtil.Substring(sState, 19) as Int + Bool bDelete = ShowMessage("$SkyOutSys_Confirm_UnsetAutoswitch_Text", True, "$SkyOutSys_Confirm_UnsetAutoswitch_Yes", "$SkyOutSys_Confirm_UnsetAutoswitch_No") + If bDelete + SkyrimOutfitSystemNativeFuncs.UnsetLocationOutfit(iAutoswitchIndex) + SetMenuOptionValueST("") + EndIf + Return + EndIf EndEvent ;/EndBlock/; ;/Block/; ; Options Function ShowOptions() - SetCursorFillMode(TOP_TO_BOTTOM) - AddToggleOptionST("OPT_Enabled", "$Enabled", SkyrimOutfitSystemNativeFuncs.IsEnabled()) - AddEmptyOption() - ; - ; Quickslots: - ; - SkyOutSysQuickslotManager kQM = GetQuickslotManager() - AddHeaderOption("$SkyOutSys_MCMHeader_Quickslots") - AddToggleOptionST("OPT_QuickslotsEnabled", "$SkyOutSys_Text_EnableQuickslots", kQM.GetEnabled()) + ;/Block/; ; Left column + SetCursorFillMode(TOP_TO_BOTTOM) + SetCursorPosition(0) + AddToggleOptionST("OPT_Enabled", "$Enabled", SkyrimOutfitSystemNativeFuncs.IsEnabled()) + AddEmptyOption() + ; + ; Quickslots: + ; + SkyOutSysQuickslotManager kQM = GetQuickslotManager() + AddHeaderOption("$SkyOutSys_MCMHeader_Quickslots") + AddToggleOptionST("OPT_QuickslotsEnabled", "$SkyOutSys_Text_EnableQuickslots", kQM.GetEnabled()) + ;/EndBlock/; + ;/Block/; ; Right column + SetCursorPosition(1) + AddHeaderOption("$SkyOutSys_MCMHeader_Autoswitch") + Int iCount = SkyrimOutfitSystemNativeFuncs.GetAutoSwitchLocationCount() + AddToggleOptionST("OPT_AutoswitchEnabled", "$SkyOutSys_Text_EnableAutoswitch", SkyrimOutfitSystemNativeFuncs.GetLocationBasedAutoSwitchEnabled()) + Int iIterator = 0 + While iIterator < iCount + String sLocationOutfit = SkyrimOutfitSystemNativeFuncs.GetLocationOutfit(iIterator) + AddMenuOptionST("OPT_AutoswitchEntry" + iIterator, "$SkyOutSys_Text_Autoswitch" + iIterator, sLocationOutfit) + iIterator = iIterator + 1 + EndWhile + ;/EndBlock/; + EndFunction ; State OPT_Enabled @@ -221,6 +266,15 @@ EndFunction SetInfoText("$SkyOutSys_Desc_EnableQuickslots") EndEvent EndState + State OPT_AutoswitchEnabled + Event OnSelectST() + SkyrimOutfitSystemNativeFuncs.SetLocationBasedAutoSwitchEnabled(!SkyrimOutfitSystemNativeFuncs.GetLocationBasedAutoSwitchEnabled()) + SetToggleOptionValueST(SkyrimOutfitSystemNativeFuncs.GetLocationBasedAutoSwitchEnabled()) + EndEvent + Event OnHighlightST() + SetInfoText("$SkyOutSys_Desc_EnableAutoswitch") + EndEvent + EndState ;/EndBlock/; ;/Block/; ; Outfit editing