From 95b758c3bae0add7fdadebf0e8ae42356c33cfa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Thu, 15 Oct 2020 00:40:25 -0700 Subject: [PATCH] canton plazas are treated the same as waistworks too much using open Vivec mods, I forgot they existed as separate cells lmao --- MWSE/mods/celediel/NPCsGoHome/common.lua | 23 +++++++++++++++---- MWSE/mods/celediel/NPCsGoHome/config.lua | 2 +- .../celediel/NPCsGoHome/functions/checks.lua | 16 ++++++------- .../celediel/NPCsGoHome/functions/housing.lua | 4 ++-- MWSE/mods/celediel/NPCsGoHome/main.lua | 2 +- MWSE/mods/celediel/NPCsGoHome/mcm.lua | 12 +++++----- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/MWSE/mods/celediel/NPCsGoHome/common.lua b/MWSE/mods/celediel/NPCsGoHome/common.lua index f15ed5e..ea30e04 100644 --- a/MWSE/mods/celediel/NPCsGoHome/common.lua +++ b/MWSE/mods/celediel/NPCsGoHome/common.lua @@ -12,7 +12,7 @@ this.logString = this.modName:gsub("%s?%b()%s?", "") -- for config 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 this.publicHouseTypes = { @@ -20,7 +20,7 @@ this.publicHouseTypes = { guildhalls = "Guildhalls", temples = "Temples", homes = "Homes", - cantonworks = "Cantonworks" + cantons = "Cantons" } -- }}} @@ -97,7 +97,7 @@ this.pickPublicHouseType = function(cell) elseif id:match("temple") then return this.publicHouseTypes.temples 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 return this.publicHouseTypes.homes else @@ -121,9 +121,24 @@ this.checkModdedCell = function(cellId) return id 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) 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 this.isCantonCell = function(cell) diff --git a/MWSE/mods/celediel/NPCsGoHome/config.lua b/MWSE/mods/celediel/NPCsGoHome/config.lua index f073bbc..3814939 100644 --- a/MWSE/mods/celediel/NPCsGoHome/config.lua +++ b/MWSE/mods/celediel/NPCsGoHome/config.lua @@ -34,7 +34,7 @@ local defaultConfig = { minimumTrespassDisposition = 50, -- if player's disposition with NPC is less than this value, interaction is disabled -- door settings lockDoors = true, - waistWorks = common.waist.interior, + cantonCells = common.canton.interior, -- debug settings logLevel = common.logLevels.none } diff --git a/MWSE/mods/celediel/NPCsGoHome/functions/checks.lua b/MWSE/mods/celediel/NPCsGoHome/functions/checks.lua index fe48129..fea5f27 100644 --- a/MWSE/mods/celediel/NPCsGoHome/functions/checks.lua +++ b/MWSE/mods/celediel/NPCsGoHome/functions/checks.lua @@ -80,7 +80,6 @@ this.isIgnoredCell = function(cell) return config.ignored[cell.id:lower()] -- or config.ignored[cell.sourceMod:lower()] -- or wilderness end --- ! this one depends on tes3 ! -- this.fargothCheck = function() local fargothJournal = tes3.getJournalIndex({id = "MS_Lookout"}) if not fargothJournal then return false end @@ -195,12 +194,12 @@ this.isPublicHouse = function(cell) return true end - -- if it's a waistworks cell, it's public, with no proprietor - if config.waistWorks == common.waist.public and cell.id:match("waistworks") then + -- if it's a waistworks or plaza cell, it's public, with no proprietor + if config.cantonCells == common.canton.public and common.isPublicCantonCell(cell) then dataTables.createPublicHouseTableEntry(cell, nil, city, publicHouseName, cellEvaluators.calculateCellWorth(cell), cellEvaluators.pickCellFaction(cell), - common.publicHouseTypes.cantonworks) + common.publicHouseTypes.cantons) return true end @@ -344,11 +343,12 @@ end -- travel agents, their steeds, and argonians stick around this.isBadWeatherNPC = function(npc) - log(common.logLevels.large, "[CHECKS] NPC Inclement Weather: %s is %s%s", npc.object.name, npc.object.race.id, - this.offersTravel(npc) and ", travel agent" or "") + local is = this.offersTravel(npc) or config.badWeatherClassRace[npc.object.race.id] 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 - config.badWeatherClassRace[npc.object.class.id] + return is end return this diff --git a/MWSE/mods/celediel/NPCsGoHome/functions/housing.lua b/MWSE/mods/celediel/NPCsGoHome/functions/housing.lua index b6929b4..4aae10b 100644 --- a/MWSE/mods/celediel/NPCsGoHome/functions/housing.lua +++ b/MWSE/mods/celediel/NPCsGoHome/functions/housing.lua @@ -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 common.isCantonCell(cell) then if common.runtimeData.publicHouses.byType[city] and - common.runtimeData.publicHouses.byType[city][common.publicHouseTypes.cantonworks] then - local canton = table.choice(common.runtimeData.publicHouses.byType[city][common.publicHouseTypes.cantonworks]) + common.runtimeData.publicHouses.byType[city][common.publicHouseTypes.cantons] then + 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) if canton then return dataTables.createHomedNPCTableEntry(npc, canton.cell, cell, false) end diff --git a/MWSE/mods/celediel/NPCsGoHome/main.lua b/MWSE/mods/celediel/NPCsGoHome/main.lua index d358485..d36087e 100644 --- a/MWSE/mods/celediel/NPCsGoHome/main.lua +++ b/MWSE/mods/celediel/NPCsGoHome/main.lua @@ -74,7 +74,7 @@ local function applyChanges(cell) -- Interior cell, except Canton cells, don't do anything 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 if checks.isPublicHouse(cell) then return end diff --git a/MWSE/mods/celediel/NPCsGoHome/mcm.lua b/MWSE/mods/celediel/NPCsGoHome/mcm.lua index fd86c19..6083600 100644 --- a/MWSE/mods/celediel/NPCsGoHome/mcm.lua +++ b/MWSE/mods/celediel/NPCsGoHome/mcm.lua @@ -76,17 +76,17 @@ category:createSlider({ }) 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" .. "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.", options = { - {label = "Neither", value = common.waist.neither}, - {label = "Exterior", value = common.waist.exterior}, - {label = "Public", value = common.waist.public} + {label = "Neither", value = common.canton.neither}, + {label = "Exterior", value = common.canton.exterior}, + {label = "Public", value = common.canton.public} }, - defaultSetting = common.waist.neither, - variable = createTableVar("waistWorks") + defaultSetting = common.canton.neither, + variable = createTableVar("cantonCells") }) category:createYesNoButton({