show message when entering public space/home of wandering NPC
This commit is contained in:
parent
b190918797
commit
fd6880f061
|
@ -19,6 +19,7 @@ local defaultConfig = {
|
||||||
waistWorks = true,
|
waistWorks = true,
|
||||||
moveNPCs = false,
|
moveNPCs = false,
|
||||||
homelessWanderersToPublicHouses = false,
|
homelessWanderersToPublicHouses = false,
|
||||||
|
showMessages = true,
|
||||||
logLevel = common.logLevels.none,
|
logLevel = common.logLevels.none,
|
||||||
factionIgnorePercentage = 0.66
|
factionIgnorePercentage = 0.66
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ local contextualNPCs = {"^AM_"}
|
||||||
|
|
||||||
-- {{{ helper functions
|
-- {{{ helper functions
|
||||||
local function log(level, ...) if config.logLevel >= level then common.log(...) end end
|
local function log(level, ...) if config.logLevel >= level then common.log(...) end end
|
||||||
|
local function message(...) if config.showMessages then tes3.messageBox(...) end end
|
||||||
|
|
||||||
local function checkModdedCell(cellId)
|
local function checkModdedCell(cellId)
|
||||||
local id
|
local id
|
||||||
|
@ -447,25 +448,26 @@ end
|
||||||
|
|
||||||
-- {{{ cell change checks
|
-- {{{ cell change checks
|
||||||
|
|
||||||
local function checkEnteredSpawnedNPCHome(cell)
|
local function checkEnteredNPCHome(cell)
|
||||||
local home = homedNPCS[cell.id]
|
local home = homes.byCell[cell.id]
|
||||||
if home then
|
if home then
|
||||||
local message = string.format("Entering home of %s, %s", home.name, home.homeName)
|
local msg = string.format("Entering home of %s, %s", home.name, home.homeName)
|
||||||
log(common.logLevels.medium, message)
|
log(common.logLevels.small, msg)
|
||||||
tes3.messageBox(message)
|
message(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkEnteredPublicHouse(cell, city)
|
local function checkEnteredPublicHouse(cell, city)
|
||||||
local type = pickPublicHouseType(cell.name)
|
local typeOfPub = pickPublicHouseType(cell.name)
|
||||||
|
|
||||||
|
local publicHouse = publicHouses[city] and (publicHouses[city][typeOfPub] and publicHouses[city][typeOfPub][cell.name])
|
||||||
|
|
||||||
local publicHouse = publicHouses[city] and (publicHouses[city][type] and publicHouses[city][type][cell.name])
|
|
||||||
if publicHouse then
|
if publicHouse then
|
||||||
local message = string.format("Entering public space %s, a%s %s in the town of %s. Talk to %s, %s for services.",
|
local msg = string.format("Entering public space %s, a%s %s in the town of %s. Talk to %s, %s for services.",
|
||||||
publicHouse.name, common.vowel(type), type:gsub("s$", ""), publicHouse.city, publicHouse.proprietor.object.name,
|
publicHouse.name, common.vowel(typeOfPub), typeOfPub:gsub("s$", ""), publicHouse.city,
|
||||||
publicHouse.proprietor.object.class)
|
publicHouse.proprietor.object.name, publicHouse.proprietor.object.class)
|
||||||
log(common.logLevels.small, message)
|
log(common.logLevels.small, msg)
|
||||||
tes3.messageBox(message)
|
message(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -712,22 +714,11 @@ end
|
||||||
|
|
||||||
local function onCellChanged(e)
|
local function onCellChanged(e)
|
||||||
updateCells()
|
updateCells()
|
||||||
updatePlayerTrespass(e.cell)
|
updatePlayerTrespass(e.cell, e.previousCell)
|
||||||
checkEnteredSpawnedNPCHome(e.cell)
|
checkEnteredNPCHome(e.cell)
|
||||||
if e.cell.name then -- exterior wilderness cells don't have name
|
if e.cell.name then -- exterior wilderness cells don't have name
|
||||||
checkEnteredPublicHouse(e.cell, common.split(e.cell.name, ",")[1])
|
checkEnteredPublicHouse(e.cell, common.split(e.cell.name, ",")[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
-- ! delete this
|
|
||||||
if config.logLevel == common.logLevels.none then
|
|
||||||
if (e.previousCell and e.previousCell.name and e.previousCell.name ~= e.cell.name) then
|
|
||||||
mwse.log("}\n[\"%s\"] = {", e.cell.id)
|
|
||||||
elseif not e.previousCell then
|
|
||||||
mwse.log("[\"%s\"] = {", e.cell.id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- ! ]]
|
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue