From 2c0ec2974884386d9b332c6004758e64ab8ce709 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sun, 8 Apr 2012 18:19:19 +0200 Subject: Lua: Library quest: Move HOOK_MONSTER_DEATH code to C --- lib/mods/theme/scpt/library.lua | 20 +------------------- lib/scpt/library.lua | 20 +------------------- 2 files changed, 2 insertions(+), 38 deletions(-) (limited to 'lib') diff --git a/lib/mods/theme/scpt/library.lua b/lib/mods/theme/scpt/library.lua index 1f7e7d49..5ba5ed4c 100644 --- a/lib/mods/theme/scpt/library.lua +++ b/lib/mods/theme/scpt/library.lua @@ -104,25 +104,7 @@ add_quest return quest_library_stair_hook() end, [HOOK_MONSTER_DEATH] = function() - -- if they're in the quest and haven't won, continue - if (player.inside_quest ~= LIBRARY_QUEST) or (quest(LIBRARY_QUEST).status == QUEST_STATUS_COMPLETED) then - return FALSE - end - - i = 1 - count = -1 - while i <= m_max do - local monster = m_list[i] - if (monster.r_idx > 0) and (monster.status <= MSTATUS_ENEMY) then - count = count + 1 - end - i = i + 1 - end - - if count == 0 then - quest(LIBRARY_QUEST).status = QUEST_STATUS_COMPLETED - msg_print(TERM_YELLOW, "The library is safe now.") - end + return quest_library_monster_death_hook() end, }, } diff --git a/lib/scpt/library.lua b/lib/scpt/library.lua index 6368409d..2ee8c7d3 100644 --- a/lib/scpt/library.lua +++ b/lib/scpt/library.lua @@ -101,25 +101,7 @@ add_quest return quest_library_stair_hook() end, [HOOK_MONSTER_DEATH] = function() - -- if they're in the quest and haven't won, continue - if (player.inside_quest ~= LIBRARY_QUEST) or (quest(LIBRARY_QUEST).status == QUEST_STATUS_COMPLETED) then - return FALSE - end - - i = 1 - count = -1 - while i <= m_max do - local monster = m_list[i] - if (monster.r_idx > 0) and (monster.status <= MSTATUS_ENEMY) then - count = count + 1 - end - i = i + 1 - end - - if count == 0 then - quest(LIBRARY_QUEST).status = QUEST_STATUS_COMPLETED - msg_print(TERM_YELLOW, "The library is safe now.") - end + return quest_library_monster_death_hook() end, }, } -- cgit v1.2.3