Add checks for safe room before considering

main
AreiaAard 4 years ago
parent 6a11a45d96
commit 529b39d0fd

@ -11,7 +11,7 @@
save_state="y" save_state="y"
date_written="2021-04-11 21:00:00" date_written="2021-04-11 21:00:00"
requires="5.06" requires="5.06"
version="1.12" version="1.13"
> >
<description trim="y"> <description trim="y">
<![CDATA[ <![CDATA[
@ -522,6 +522,10 @@ function Consider.start()
Utility.print("Character state does not allow consider.") Utility.print("Character state does not allow consider.")
return return
end end
if (GMCPHandler.get_room_flags().safe) then
Utility.print("This is a safe room.")
return
end
SendNoEcho("echo {consider}") SendNoEcho("echo {consider}")
SendNoEcho("consider all") SendNoEcho("consider all")
SendNoEcho("echo {/consider}") SendNoEcho("echo {/consider}")
@ -662,20 +666,29 @@ function GMCPHandler.get_char_state()
return GMCPHandler.mapperRunning and GMCPHandler.CHAR_STATE.RUNNING or tonumber(gmcp("char.status.state")) return GMCPHandler.mapperRunning and GMCPHandler.CHAR_STATE.RUNNING or tonumber(gmcp("char.status.state"))
end end
function GMCPHandler.get_room_flags()
local flags = {}
for flag in GMCPHandler.prevRoom.details:gmatch("[^,]+") do
flags[flag] = true
end
return flags
end
function GMCPHandler.received_repop() function GMCPHandler.received_repop()
local state = GMCPHandler.get_char_state() local state = GMCPHandler.get_char_state()
if (Settings.config.autoConsider and (state == GMCPHandler.CHAR_STATE.ACTIVE if (Settings.config.autoConsider and (state == GMCPHandler.CHAR_STATE.ACTIVE
or state == GMCPHandler.CHAR_STATE.FIGHTING)) then or state == GMCPHandler.CHAR_STATE.FIGHTING) and not GMCPHandler.get_room_flags().safe) then
Consider.start() Consider.start()
end end
end end
function GMCPHandler.received_room(room) function GMCPHandler.received_room(room)
Consider.clear() Consider.clear()
if (Settings.config.autoConsider and GMCPHandler.get_char_state() ~= GMCPHandler.CHAR_STATE.RUNNING) then GMCPHandler.prevRoom = room
if (Settings.config.autoConsider and GMCPHandler.get_char_state() ~= GMCPHandler.CHAR_STATE.RUNNING
and not GMCPHandler.get_room_flags().safe) then
Consider.start() Consider.start()
end end
GMCPHandler.prevRoom = room
end end

Loading…
Cancel
Save