diff --git a/MWSE/mods/celediel/NPCsGoHome/functions/checks.lua b/MWSE/mods/celediel/NPCsGoHome/functions/checks.lua index fd2c32f..7370dc7 100644 --- a/MWSE/mods/celediel/NPCsGoHome/functions/checks.lua +++ b/MWSE/mods/celediel/NPCsGoHome/functions/checks.lua @@ -300,9 +300,9 @@ this.isIgnoredDoor = function(door, homeCellId) not hasOccupants end --- AT NIGHT this.isNight = function() - local atNight = tes3.worldController.hour.value >= config.closeTime or tes3.worldController.hour.value <= config.openTime + local atNight = tes3.worldController.hour.value >= config.closeTime or -- AT NIGHT + tes3.worldController.hour.value <= config.openTime log(common.logLevels.large, "Current time is %.2f (%snight), things are closed between %s and %s", tes3.worldController.hour.value, atNight and "" or "not ", config.closeTime, config.openTime) @@ -310,13 +310,13 @@ this.isNight = function() end -- inclement weather -this.isInclementWeather = function(cell) - if not cell.region then return false end - -- local index = cell.region.weather.index +this.isInclementWeather = function() + if not tes3.getCurrentWeather() then return false end + local index = tes3.getCurrentWeather().index local isBad = index >= config.worstWeather - log(common.logLevels.large, "Weather in %s: current:%s >= configured worst:%s == %s", cell.id, index, + log(common.logLevels.large, "Weather in %s: current:%s >= configured worst:%s == %s", tes3.getRegion().id, index, config.worstWeather, isBad) return isBad diff --git a/MWSE/mods/celediel/NPCsGoHome/functions/processors.lua b/MWSE/mods/celediel/NPCsGoHome/functions/processors.lua index 65ed588..ee961a9 100644 --- a/MWSE/mods/celediel/NPCsGoHome/functions/processors.lua +++ b/MWSE/mods/celediel/NPCsGoHome/functions/processors.lua @@ -119,7 +119,7 @@ end this.processNPCs = function(cell) local night = checks.isNight() - local badWeather = checks.isInclementWeather(cell) + local badWeather = checks.isInclementWeather() log(common.logLevels.small, "Looking for NPCs to process in cell:%s", cell.id) @@ -176,7 +176,7 @@ this.processSiltStriders = function(cell) for activator in cell:iterateReferences(tes3.objectType.activator) do log(common.logLevels.large, "Is %s a silt strider??", activator.object.id) if activator.object.id:match("siltstrider") then - if checks.isNight() or (checks.isInclementWeather(cell) and not config.keepBadWeatherNPCs) then + if checks.isNight() or (checks.isInclementWeather() and not config.keepBadWeatherNPCs) then if not activator.disabled then log(common.logLevels.medium, "Disabling silt strider %s!", activator.object.name) mwscript.disable({reference = activator}) @@ -200,7 +200,7 @@ end this.processPets = function(cell) if not config.disableNPCs then return end local night = checks.isNight() - local badWeather = checks.isInclementWeather(cell) + local badWeather = checks.isInclementWeather() log(common.logLevels.small, "Looking for NPC pets to process in cell:%s", cell.name)