diff --git a/MWSE/mods/celediel/DoorRandomizer/config.lua b/MWSE/mods/celediel/DoorRandomizer/config.lua index 813ed3d..b528aff 100644 --- a/MWSE/mods/celediel/DoorRandomizer/config.lua +++ b/MWSE/mods/celediel/DoorRandomizer/config.lua @@ -7,6 +7,18 @@ local defaultConfig = { needDoor = true, debug = false, ignoredCells = {}, + -- some of these aren't cell change doors but whatever + ignoredDoors = { + ["chargen customs door"] = true, + ["chargendoorjournal"] = true, + ["chargen door hall"] = true, + ["chargen door captain"] = true, + ["chargen door exit"] = true, + ["chargen_ship_trapdoor"] = true, + ["chargen_shipdoor"] = true, + ["chargen exit door"] = true, + ["chargen_cabindoor"] = true + } } local currentConfig diff --git a/MWSE/mods/celediel/DoorRandomizer/main.lua b/MWSE/mods/celediel/DoorRandomizer/main.lua index 71169c5..e113021 100644 --- a/MWSE/mods/celediel/DoorRandomizer/main.lua +++ b/MWSE/mods/celediel/DoorRandomizer/main.lua @@ -32,7 +32,8 @@ local function pickSpot(cell) for cellDoor in cell:iterateReferences(tes3.objectType.door) do if cellDoor.destination then -- only cell change doors -- loop through doors in THAT cell to find the door that led us there in the first place - log("Looking through door %s in %s leading to %s", cellDoor.name or cellDoor.id, cell.id, cellDoor.destination.cell.id) + log("Looking through door %s in %s leading to %s", cellDoor.name or cellDoor.id, + cell.id, cellDoor.destination.cell.id) for innerDoor in cellDoor.destination.cell:iterateReferences(tes3.objectType.door) do if innerDoor.destination and innerDoor.destination.cell.id == cell.id then -- found the door, now add where that door puts a player to our table @@ -110,6 +111,11 @@ local function onActivate(e) local door = e.target + if config.ignoredDoors[string.lower(door.id)] then + log("Ignored door, not randomizing.") + return + end + -- don't randomize locked doors, or: only randomize when a cell change event happens if door.destination and not tes3.getLocked({reference = door}) then local roll = math.random(0, 100) diff --git a/MWSE/mods/celediel/DoorRandomizer/mcm.lua b/MWSE/mods/celediel/DoorRandomizer/mcm.lua index cc0ce92..6a49b7c 100644 --- a/MWSE/mods/celediel/DoorRandomizer/mcm.lua +++ b/MWSE/mods/celediel/DoorRandomizer/mcm.lua @@ -70,5 +70,12 @@ template:createExclusionsPage({ } }) -return template +template:createExclusionsPage({ + label = "Ignored doors", + description = "These doors will not be randomized.", + showAllBlocked = false, + variable = createTableVar("ignoredDoors"), + filters = {{label = "Doors", type = "Object", objectType = tes3.objectType.door}} +}) +return template diff --git a/README.md b/README.md index 8fabdd7..d7b2f82 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ I discovered that tes3.setDestination() was a thing, so I wrote this. When the game is started up, a list of all cells is built. Whenever an unlocked, cell-change door is activated, its destination cell is randomized, according to the below configuration values. A list of starting positions is built by -looking through each door in the chosen cell, and in each of those +looking through each door in the chosen cell, then in each of those destination cells, finding doors that return to the original picked cell, and using its destination position/orientation values. The player's position in the cell is chosen randomly from that list. If none are found, a default of @@ -27,6 +27,7 @@ the cell is chosen randomly from that list. If none are found, a default of * Both * Match destination cell * Ignore list for cells +* Ignore list for doors * Debug logging, to see my cool recursive functions at work ## Requirements ##