slight refactoring
This commit is contained in:
parent
3994323d49
commit
6dfb1e4a86
|
@ -359,6 +359,22 @@ local function isCityCell(internalCellId, externalCellId)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function isIgnoredCell(cell)
|
||||||
|
log(common.logLevels.large, "%s is %s, %s is %s", cell.id, config.ignored[cell.id] and "ignored" or "not ignored",
|
||||||
|
cell.sourceMod, config.ignored[cell.sourceMod] and "ignored" or "not ignored")
|
||||||
|
|
||||||
|
-- don't do things in the wilderness
|
||||||
|
-- local wilderness = false
|
||||||
|
-- if not cell.name then wilderness = true end
|
||||||
|
|
||||||
|
return config.ignored[cell.id] or config.ignored[cell.sourceMod] -- or wilderness
|
||||||
|
end
|
||||||
|
|
||||||
|
local function isCantonCell(cellName)
|
||||||
|
for _, str in pairs(waistworks) do if cellName:match(str) then return true end end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local function fargothCheck()
|
local function fargothCheck()
|
||||||
local fargothJournal = tes3.getJournalIndex({id = "MS_Lookout"})
|
local fargothJournal = tes3.getJournalIndex({id = "MS_Lookout"})
|
||||||
if not fargothJournal then return false end
|
if not fargothJournal then return false end
|
||||||
|
@ -496,7 +512,7 @@ local function isPublicHouse(cell)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- todo: check cell contents to decide if it should be locked
|
-- doors that lead to ignored, exterior, canton, unoccupied, or public cells, and doors that aren't in cities
|
||||||
local function isIgnoredDoor(door, homeCellId)
|
local function isIgnoredDoor(door, homeCellId)
|
||||||
-- don't lock non-cell change doors
|
-- don't lock non-cell change doors
|
||||||
if not door.destination then
|
if not door.destination then
|
||||||
|
@ -519,35 +535,18 @@ local function isIgnoredDoor(door, homeCellId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
log(common.logLevels.large, "%s is %s, %s is %s (%sin a city, is %spublic, %soccupied)", --
|
log(common.logLevels.large, "%s is %s, (%sin a city, is %spublic, %soccupied)", --
|
||||||
door.destination.cell.id, config.ignored[door.destination.cell.id] and "ignored" or "not ignored", -- destination is ignored
|
door.destination.cell.id, isIgnoredCell(door.destination.cell) and "ignored" or "not ignored", -- destination is ignored
|
||||||
door.destination.cell.sourceMod, config.ignored[door.destination.cell.sourceMod] and "ignored" or "not ignored", -- destination mod is ignored
|
|
||||||
inCity and "" or "not ", leadsToPublicCell and "" or "not ", hasOccupants and "" or "un") -- in a city, is public, is ocupado
|
inCity and "" or "not ", leadsToPublicCell and "" or "not ", hasOccupants and "" or "un") -- in a city, is public, is ocupado
|
||||||
|
|
||||||
return config.ignored[door.destination.cell.id] or
|
return isIgnoredCell(door.destination.cell) or
|
||||||
config.ignored[door.destination.cell.sourceMod] or
|
|
||||||
not isInteriorCell(door.destination.cell) or
|
not isInteriorCell(door.destination.cell) or
|
||||||
|
isCantonCell(door.destination.cell.id) or
|
||||||
not inCity or
|
not inCity or
|
||||||
leadsToPublicCell or
|
leadsToPublicCell or
|
||||||
not hasOccupants
|
not hasOccupants
|
||||||
end
|
end
|
||||||
|
|
||||||
local function isIgnoredCell(cell)
|
|
||||||
log(common.logLevels.large, "%s is %s, %s is %s", cell.id, config.ignored[cell.id] and "ignored" or "not ignored",
|
|
||||||
cell.sourceMod, config.ignored[cell.sourceMod] and "ignored" or "not ignored")
|
|
||||||
|
|
||||||
-- don't do things in the wilderness
|
|
||||||
-- local wilderness = false
|
|
||||||
-- if not cell.name then wilderness = true end
|
|
||||||
|
|
||||||
return config.ignored[cell.id] or config.ignored[cell.sourceMod] -- or wilderness
|
|
||||||
end
|
|
||||||
|
|
||||||
local function isCantonCell(cellName)
|
|
||||||
for _, str in pairs(waistworks) do if cellName:match(str) then return true end end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- AT NIGHT
|
-- AT NIGHT
|
||||||
local function checkTime()
|
local function checkTime()
|
||||||
log(common.logLevels.large, "Current time is %s, things are closed between %s and %s",
|
log(common.logLevels.large, "Current time is %s, things are closed between %s and %s",
|
||||||
|
|
Loading…
Reference in a new issue