styyx-util 1.0
Utility Header for SKSE Plugin development
Loading...
Searching...
No Matches
st-cells.h
Go to the documentation of this file.
1#pragma once
2
3namespace StyyxUtil
4{
5 struct CellUtil
6 {
8 inline static const std::vector<std::string> is_a_dungeon {
9 "LocTypeDungeon", "LocSetCave", "LocSetCaveIce", "LocTypeDwarvenAutomatons",
10 "LocTypeAnimalDen", "LocTypeBanditCamp", "LocTypeDragonPriestLair", "LocTypeDraugrCrypt",
11 "LocTypeFalmerHive", "LocTypeForswornCamp", "LocTypeGiantCamp", "LocTypeHagravenNest",
12 "LocTypeVampireLair", "LocTypeWarlockLair", "LocTypeWerewolfLair"};
13
17 static bool IsDungeon(const RE::TESObjectCELL *a_cell)
18 {
19 if (!a_cell)
20 return false;
21 if (const auto loc = a_cell->GetLocation(); loc && loc->HasAnyKeywordByEditorID(is_a_dungeon) && a_cell->IsInteriorCell())
22 {
23 return true;
24 }
25 return false;
26 }
27
31 static bool IsJail(RE::TESObjectCELL *a_cell)
32 {
33 if (!a_cell)
34 return false;
35 const auto loc = a_cell->GetLocation();
36 if (const auto key = RE::TESForm::LookupByEditorID<RE::BGSKeyword>("LocTypeJail"); key && loc && loc->HasKeyword(key))
37 {
38 return true;
39 }
40 return false;
41 }
42
46 static std::vector<RE::Actor*> GetAllActorsInCell(RE::TESObjectCELL *a_cell)
47 {
48 std::vector<RE::Actor*> result;
49 if (!a_cell)
50 return result;
51
52 for (const auto& ref : a_cell->references)
53 {
54 if (!ref)
55 continue;
56 auto actor = ref->As<RE::Actor>();
57 if (!actor)
58 continue;
59 result.push_back(actor);
60 }
61 return result;
62 }
63
64 };
65}
Definition st-actor.h:7
Definition st-cells.h:6
static const std::vector< std::string > is_a_dungeon
A vector of what I consider dungeon Keywords.
Definition st-cells.h:8
static bool IsJail(RE::TESObjectCELL *a_cell)
Check if a cell is a Jail.
Definition st-cells.h:31
static bool IsDungeon(const RE::TESObjectCELL *a_cell)
Check if a cell is a dungeon.
Definition st-cells.h:17
static std::vector< RE::Actor * > GetAllActorsInCell(RE::TESObjectCELL *a_cell)
Get a vector of all actors in the specified cell.
Definition st-cells.h:46