Skip to content

Commit 09b3081

Browse files
committed
Add worldspace support for conditional swaps
1 parent 258acc9 commit 09b3081

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/ConditionalData.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ bool ConditionalInput::IsValid(RE::FormID a_formID) const
4848
}
4949
case RE::FormType::Cell:
5050
return currentCell == form;
51+
case RE::FormType::WorldSpace:
52+
{
53+
const auto worldspace = form->As<RE::TESWorldSpace>();
54+
return currentWorldspace && (currentWorldspace == worldspace || currentWorldspace->parentWorld == worldspace);
55+
}
5156
default:
5257
break;
5358
}

src/ConditionalData.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct ConditionalInput
3131
ref(a_ref),
3232
base(a_form),
3333
currentCell(a_ref->GetSaveParentCell()),
34+
currentWorldspace(a_ref->GetWorldspace()),
3435
currentLocation(a_ref->GetCurrentLocation()),
3536
currentRegionList(currentCell ? currentCell->GetRegionList(false) : nullptr)
3637
{}
@@ -45,6 +46,7 @@ struct ConditionalInput
4546
const RE::TESObjectREFR* ref;
4647
const RE::TESForm* base;
4748
RE::TESObjectCELL* currentCell;
49+
RE::TESWorldSpace* currentWorldspace;
4850
RE::BGSLocation* currentLocation;
4951
RE::TESRegionList* currentRegionList;
5052
};

0 commit comments

Comments
 (0)