added door ignore list, and put chargen doors in by default
This commit is contained in:
parent
f0d9e9baea
commit
d73e537eda
4 changed files with 29 additions and 3 deletions
|
@ -7,6 +7,18 @@ local defaultConfig = {
|
||||||
needDoor = true,
|
needDoor = true,
|
||||||
debug = false,
|
debug = false,
|
||||||
ignoredCells = {},
|
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
|
local currentConfig
|
||||||
|
|
|
@ -32,7 +32,8 @@ local function pickSpot(cell)
|
||||||
for cellDoor in cell:iterateReferences(tes3.objectType.door) do
|
for cellDoor in cell:iterateReferences(tes3.objectType.door) do
|
||||||
if cellDoor.destination then -- only cell change doors
|
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
|
-- 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
|
for innerDoor in cellDoor.destination.cell:iterateReferences(tes3.objectType.door) do
|
||||||
if innerDoor.destination and innerDoor.destination.cell.id == cell.id then
|
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
|
-- 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
|
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
|
-- don't randomize locked doors, or: only randomize when a cell change event happens
|
||||||
if door.destination and not tes3.getLocked({reference = door}) then
|
if door.destination and not tes3.getLocked({reference = door}) then
|
||||||
local roll = math.random(0, 100)
|
local roll = math.random(0, 100)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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,
|
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
|
cell-change door is activated, its destination cell is randomized, according
|
||||||
to the below configuration values. A list of starting positions is built by
|
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
|
destination cells, finding doors that return to the original picked cell, and
|
||||||
using its destination position/orientation values. The player's position in
|
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
|
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
|
* Both
|
||||||
* Match destination cell
|
* Match destination cell
|
||||||
* Ignore list for cells
|
* Ignore list for cells
|
||||||
|
* Ignore list for doors
|
||||||
* Debug logging, to see my cool recursive functions at work
|
* Debug logging, to see my cool recursive functions at work
|
||||||
|
|
||||||
## Requirements ##
|
## Requirements ##
|
||||||
|
|
Loading…
Add table
Reference in a new issue