canton plazas are treated the same as waistworks

too using open Vivec mods, I forgot they existed as separate cells lmao
This commit is contained in:
Lilian Jónsdóttir 2020-10-15 00:40:25 -07:00
parent d643eae274
commit e8964622c4
6 changed files with 37 additions and 22 deletions

View file

@ -12,7 +12,7 @@ this.logString = this.modName:gsub("%s?%b()%s?", "")
-- for config -- for config
this.logLevels = {none = 0, small = 1, medium = 2, large = 3} this.logLevels = {none = 0, small = 1, medium = 2, large = 3}
this.waist = {neither = 0, exterior = 1, public = 2} this.canton = {neither = 0, exterior = 1, public = 2}
-- for runtime data -- for runtime data
this.publicHouseTypes = { this.publicHouseTypes = {
@ -20,7 +20,7 @@ this.publicHouseTypes = {
guildhalls = "Guildhalls", guildhalls = "Guildhalls",
temples = "Temples", temples = "Temples",
homes = "Homes", homes = "Homes",
cantonworks = "Cantonworks" cantons = "Cantons"
} }
-- }}} -- }}}
@ -97,7 +97,7 @@ this.pickPublicHouseType = function(cell)
elseif id:match("temple") then elseif id:match("temple") then
return this.publicHouseTypes.temples return this.publicHouseTypes.temples
elseif id:match("canalworks") or cell.id:match("waistworks") then elseif id:match("canalworks") or cell.id:match("waistworks") then
return this.publicHouseTypes.cantonworks return this.publicHouseTypes.cantons
elseif (id:match("house") and not id:match("trade")) or id:match("manor") or id:match("tower") then elseif (id:match("house") and not id:match("trade")) or id:match("manor") or id:match("tower") then
return this.publicHouseTypes.homes return this.publicHouseTypes.homes
else else
@ -121,9 +121,24 @@ this.checkModdedCell = function(cellId)
return id return id
end end
-- waistworks and plaza
this.isPublicCantonCell = function(cell)
-- (cell.id:lower():match("waistworks") or cell.id:lower():match(""))
local id = cell.id:lower()
-- hardcoded for now to avoid too many false positives
return id:match("waistworks") or
id:match("vivec, .* plaza") or -- vvardenfell
id:match("almas thirr, plaza") or -- mainland
id:match("molag mar, plaza") -- no-frills closed molag mar
end
-- any interior canton cell
this.isCantonWorksCell = function(cell) this.isCantonWorksCell = function(cell)
local id = cell.id:lower() local id = cell.id:lower()
return id:match("waistworks") or id:match("canalworks") or id:match("underworks") return this.isPublicCantonCell(cell) or
id:match("canalworks") or
id:match("underworks")
end end
this.isCantonCell = function(cell) this.isCantonCell = function(cell)

View file

@ -34,7 +34,7 @@ local defaultConfig = {
minimumTrespassDisposition = 50, -- if player's disposition with NPC is less than this value, interaction is disabled minimumTrespassDisposition = 50, -- if player's disposition with NPC is less than this value, interaction is disabled
-- door settings -- door settings
lockDoors = true, lockDoors = true,
waistWorks = common.waist.interior, cantonCells = common.canton.interior,
-- debug settings -- debug settings
logLevel = common.logLevels.none logLevel = common.logLevels.none
} }

View file

@ -80,7 +80,6 @@ this.isIgnoredCell = function(cell)
return config.ignored[cell.id:lower()] -- or config.ignored[cell.sourceMod:lower()] -- or wilderness return config.ignored[cell.id:lower()] -- or config.ignored[cell.sourceMod:lower()] -- or wilderness
end end
-- ! this one depends on tes3 ! --
this.fargothCheck = function() this.fargothCheck = function()
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
@ -195,12 +194,12 @@ this.isPublicHouse = function(cell)
return true return true
end end
-- if it's a waistworks cell, it's public, with no proprietor -- if it's a waistworks or plaza cell, it's public, with no proprietor
if config.waistWorks == common.waist.public and cell.id:match("waistworks") then if config.cantonCells == common.canton.public and common.isPublicCantonCell(cell) then
dataTables.createPublicHouseTableEntry(cell, nil, city, publicHouseName, dataTables.createPublicHouseTableEntry(cell, nil, city, publicHouseName,
cellEvaluators.calculateCellWorth(cell), cellEvaluators.calculateCellWorth(cell),
cellEvaluators.pickCellFaction(cell), cellEvaluators.pickCellFaction(cell),
common.publicHouseTypes.cantonworks) common.publicHouseTypes.cantons)
return true return true
end end
@ -344,11 +343,12 @@ end
-- travel agents, their steeds, and argonians stick around -- travel agents, their steeds, and argonians stick around
this.isBadWeatherNPC = function(npc) this.isBadWeatherNPC = function(npc)
log(common.logLevels.large, "[CHECKS] NPC Inclement Weather: %s is %s%s", npc.object.name, npc.object.race.id, local is = this.offersTravel(npc) or config.badWeatherClassRace[npc.object.race.id] or
this.offersTravel(npc) and ", travel agent" or "") config.badWeatherClassRace[npc.object.class.id]
log(common.logLevels.large, "[CHECKS] %s, %s%s is inclement weather NPC? %s", npc.object.name, npc.object.race.id,
this.offersTravel(npc) and ", travel agent" or "", is)
return this.offersTravel(npc) or config.badWeatherClassRace[npc.object.race.id] or return is
config.badWeatherClassRace[npc.object.class.id]
end end
return this return this

View file

@ -102,8 +102,8 @@ this.pickHomeForNPC = function(cell, npc)
-- if nothing was found, then we'll settle on Canton works cell, if the cell is a Canton -- if nothing was found, then we'll settle on Canton works cell, if the cell is a Canton
if common.isCantonCell(cell) then if common.isCantonCell(cell) then
if common.runtimeData.publicHouses.byType[city] and if common.runtimeData.publicHouses.byType[city] and
common.runtimeData.publicHouses.byType[city][common.publicHouseTypes.cantonworks] then common.runtimeData.publicHouses.byType[city][common.publicHouseTypes.cantons] then
local canton = table.choice(common.runtimeData.publicHouses.byType[city][common.publicHouseTypes.cantonworks]) local canton = table.choice(common.runtimeData.publicHouses.byType[city][common.publicHouseTypes.cantons])
log(common.logLevels.medium, "[HOUSING] Picking works %s, %s for %s", canton.city, canton.name, npc.object.name) log(common.logLevels.medium, "[HOUSING] Picking works %s, %s for %s", canton.city, canton.name, npc.object.name)
if canton then return dataTables.createHomedNPCTableEntry(npc, canton.cell, cell, false) end if canton then return dataTables.createHomedNPCTableEntry(npc, canton.cell, cell, false) end

View file

@ -74,7 +74,7 @@ local function applyChanges(cell)
-- Interior cell, except Canton cells, don't do anything -- Interior cell, except Canton cells, don't do anything
if checks.isInteriorCell(cell) and if checks.isInteriorCell(cell) and
not (config.waistWorks == common.waist.exterior and common.isCantonWorksCell(cell)) then return end not (config.cantonCells == common.canton.exterior and common.isCantonWorksCell(cell)) then return end
-- don't do anything to public houses -- don't do anything to public houses
if checks.isPublicHouse(cell) then return end if checks.isPublicHouse(cell) then return end

View file

@ -76,17 +76,17 @@ category:createSlider({
}) })
category:createDropdown({ category:createDropdown({
label = "Treat Canton waistworks as exteriors, public spaces, or neither", label = "Treat canton plaza and waistworks cells as exteriors, public spaces, or neither",
description = "If canton cells are treated as exterior, inside NPCs will be disabled, and doors will be locked.\n" .. description = "If canton cells are treated as exterior, inside NPCs will be disabled, and doors will be locked.\n" ..
"If they're treated as public spaces, inside NPCs won't be disabled, and homeless NPCs will be moved inside " .. "If they're treated as public spaces, inside NPCs won't be disabled, and homeless NPCs will be moved inside " ..
"(if configured to do so).\n\nIf neither, canton cells will be treated as any other.", "(if configured to do so).\n\nIf neither, canton cells will be treated as any other.",
options = { options = {
{label = "Neither", value = common.waist.neither}, {label = "Neither", value = common.canton.neither},
{label = "Exterior", value = common.waist.exterior}, {label = "Exterior", value = common.canton.exterior},
{label = "Public", value = common.waist.public} {label = "Public", value = common.canton.public}
}, },
defaultSetting = common.waist.neither, defaultSetting = common.canton.neither,
variable = createTableVar("waistWorks") variable = createTableVar("cantonCells")
}) })
category:createYesNoButton({ category:createYesNoButton({