From 5d31d0ad972b863fd481def63a4de3732f2597c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Sun, 26 Jul 2020 01:05:30 -0700 Subject: [PATCH] less redundant logging and some refactoring --- MWSE/mods/celediel/MoreAttentiveGuards/combat.lua | 3 ++- MWSE/mods/celediel/MoreAttentiveGuards/common.lua | 6 +++--- MWSE/mods/celediel/MoreAttentiveGuards/main.lua | 2 +- MWSE/mods/celediel/MoreAttentiveGuards/mcm.lua | 6 +++++- MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua | 7 ++++--- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/MWSE/mods/celediel/MoreAttentiveGuards/combat.lua b/MWSE/mods/celediel/MoreAttentiveGuards/combat.lua index 4126d4c..a0d1e9c 100644 --- a/MWSE/mods/celediel/MoreAttentiveGuards/combat.lua +++ b/MWSE/mods/celediel/MoreAttentiveGuards/combat.lua @@ -23,7 +23,8 @@ local function alertGuards(aggressor, cell) log("Alerting %s, %s units away, to the combat!", npc.object.name, distance) if config.combatDialogue then - local response = common.guardDialogue(npc, table.choice(common.dialogues[config.language].join_combat), + local response = common.guardDialogue(npc.object.name, + table.choice(common.dialogues[config.language].join_combat), aggressor) log(response) end diff --git a/MWSE/mods/celediel/MoreAttentiveGuards/common.lua b/MWSE/mods/celediel/MoreAttentiveGuards/common.lua index f0c6161..56a041e 100644 --- a/MWSE/mods/celediel/MoreAttentiveGuards/common.lua +++ b/MWSE/mods/celediel/MoreAttentiveGuards/common.lua @@ -5,7 +5,8 @@ local this = {} this.modName = "More Attentive Guards" -- or something this.author = "Celediel" this.version = "1.0.3" -this.modInfo = [[Guards with some actual spacial awareness! +this.modInfo = [[Guards with some actual spatial awareness! + Guards who catch you sneaking will follow you for a bit of time, and will also come to the player's rescue if attacked unprovoked.]] this.dialogues = require("celediel.MoreAttentiveGuards.dialogues") @@ -43,9 +44,8 @@ this.guardDialogue = function(npc, str, target) targetOrPlayer = target.object.name end - local name = npc.object.name local message = string.format(str, targetOrPlayer) - local output = string.format("%s: %s", name, message) + local output = string.format("%s: %s", npc, message) tes3.messageBox(output) return output diff --git a/MWSE/mods/celediel/MoreAttentiveGuards/main.lua b/MWSE/mods/celediel/MoreAttentiveGuards/main.lua index 1ed65de..af8969f 100644 --- a/MWSE/mods/celediel/MoreAttentiveGuards/main.lua +++ b/MWSE/mods/celediel/MoreAttentiveGuards/main.lua @@ -8,7 +8,7 @@ local function onInitialized() -- in order for this to work, everything in returned table must be functions named onEventName for name, func in pairs(sneak) do event.register(name:gsub(eventPattern, string.lower), func) end for name, func in pairs(combat) do event.register(name:gsub(eventPattern, string.lower), func) end - common.log("%s initialized", common.modName) + common.log("Successfully initialized") end event.register("initialized", onInitialized) diff --git a/MWSE/mods/celediel/MoreAttentiveGuards/mcm.lua b/MWSE/mods/celediel/MoreAttentiveGuards/mcm.lua index bf871d8..f3fa9d2 100644 --- a/MWSE/mods/celediel/MoreAttentiveGuards/mcm.lua +++ b/MWSE/mods/celediel/MoreAttentiveGuards/mcm.lua @@ -28,7 +28,11 @@ local mainCategory = page:createCategory(common.modName) local generalCategory = mainCategory:createCategory("Common settings") -generalCategory:createDropdown({label = "Language", options = createLanguageOptions(), variable = createTableVar("language")}) +generalCategory:createDropdown({ + label = "Language", + options = createLanguageOptions(), + variable = createTableVar("language") +}) generalCategory:createYesNoButton({ label = "Debug mode", diff --git a/MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua b/MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua index 2a33831..11b30ec 100644 --- a/MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua +++ b/MWSE/mods/celediel/MoreAttentiveGuards/sneak.lua @@ -39,7 +39,7 @@ local function startDialogue() log("Dialogue roll = %s > %s", config.sneakDialogueChance, roll) if config.sneakDialogueChance > roll then - local response = common.guardDialogue(follower, dialogue, tes3.mobilePlayer) + local response = common.guardDialogue(follower.object.name, dialogue, tes3.mobilePlayer) log(response) end end @@ -72,7 +72,7 @@ local function stopFollowing(onTimer) -- send a dialogue to let player know guard doesn't care any more if onTimer then - local response = common.guardDialogue(follower, + local response = common.guardDialogue(follower.object.name, table.choice(common.dialogues[config.language].stop_following), tes3.mobilePlayer) log(response) @@ -119,7 +119,8 @@ local function startFollowing() end local function abortFollow() - local response = common.guardDialogue(follower, table.choice(common.dialogues[config.language].stop_sneaking), + local response = common.guardDialogue(follower.object.name, + table.choice(common.dialogues[config.language].stop_sneaking), tes3.mobilePlayer) log(response) stopFollowing(false)