diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2011-12-23 23:46:05 +0800 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-01-02 19:59:31 +0800 |
commit | 646fb10397e440ab67fb5a678bf034c53b050109 (patch) | |
tree | e0e949556849ed33ca43a2908099c183a0309d31 | |
parent | b7284a90a6bc4275c2c6acc316758bc838fe29d2 (diff) | |
download | manaserv-646fb10397e440ab67fb5a678bf034c53b050109.tar.gz manaserv-646fb10397e440ab67fb5a678bf034c53b050109.tar.bz2 manaserv-646fb10397e440ab67fb5a678bf034c53b050109.tar.xz manaserv-646fb10397e440ab67fb5a678bf034c53b050109.zip |
Made do_npc_close to be called by default after the end of the talk function
Reviewed-by: Bertram.
-rw-r--r-- | example/serverdata/scripts/maps/desert.lua | 1 | ||||
-rw-r--r-- | example/serverdata/scripts/npcs/banker.lua | 1 | ||||
-rw-r--r-- | example/serverdata/scripts/npcs/barber.lua | 4 | ||||
-rw-r--r-- | example/serverdata/scripts/npcs/debugger.lua | 1 | ||||
-rw-r--r-- | example/serverdata/scripts/npcs/emotemaker.lua | 1 | ||||
-rw-r--r-- | example/serverdata/scripts/npcs/healer.lua | 2 | ||||
-rw-r--r-- | example/serverdata/scripts/npcs/merchant.lua | 1 | ||||
-rw-r--r-- | example/serverdata/scripts/npcs/postman.lua | 1 | ||||
-rw-r--r-- | scripts/lua/libmana.lua | 7 |
9 files changed, 7 insertions, 12 deletions
diff --git a/example/serverdata/scripts/maps/desert.lua b/example/serverdata/scripts/maps/desert.lua index 8977b54f..753375ba 100644 --- a/example/serverdata/scripts/maps/desert.lua +++ b/example/serverdata/scripts/maps/desert.lua @@ -60,7 +60,6 @@ function Harmony(npc, ch, list) end do_message(npc, ch, "Have fun!") mana.effect_create(EMOTE_HAPPY, npc) - do_npc_close(npc, ch) -- Make Harmony disappear for a while... with a small earthquake effect! local shakeX = mana.posX(npc) local shakeY = mana.posY(npc) diff --git a/example/serverdata/scripts/npcs/banker.lua b/example/serverdata/scripts/npcs/banker.lua index bd11ba55..7a6e6b40 100644 --- a/example/serverdata/scripts/npcs/banker.lua +++ b/example/serverdata/scripts/npcs/banker.lua @@ -76,5 +76,4 @@ function Banker(npc, ch) end do_message(npc, ch, "Thank you. Come again!") - do_npc_close(npc, ch) end diff --git a/example/serverdata/scripts/npcs/barber.lua b/example/serverdata/scripts/npcs/barber.lua index 0ef0e50a..fbb2862c 100644 --- a/example/serverdata/scripts/npcs/barber.lua +++ b/example/serverdata/scripts/npcs/barber.lua @@ -47,8 +47,7 @@ function Barber(npc, ch, data) -- Nothing to show? Then we can return if #color_ids == 0 and #style_ids == 0 then - return -- Since we haven't shown any windows, we can safely - -- return without a do_npc_close + return end local result = 0 @@ -137,5 +136,4 @@ function Barber(npc, ch, data) -- Let's close up do_message(npc, ch, "Thank you. Come again!") - do_npc_close(npc, ch) end diff --git a/example/serverdata/scripts/npcs/debugger.lua b/example/serverdata/scripts/npcs/debugger.lua index 6bb86d0a..142c3fd8 100644 --- a/example/serverdata/scripts/npcs/debugger.lua +++ b/example/serverdata/scripts/npcs/debugger.lua @@ -96,6 +96,5 @@ function npc1_talk(npc, ch) end do_message(npc, ch, "See you later!") - do_npc_close(npc, ch) end diff --git a/example/serverdata/scripts/npcs/emotemaker.lua b/example/serverdata/scripts/npcs/emotemaker.lua index 2e68aa2c..83d2f56f 100644 --- a/example/serverdata/scripts/npcs/emotemaker.lua +++ b/example/serverdata/scripts/npcs/emotemaker.lua @@ -34,7 +34,6 @@ function emote_talk(npc, ch) elseif (v == 3) then emo_state = EMOTE_SURPRISE end - do_npc_close(npc, ch) end function emote_update(npc) diff --git a/example/serverdata/scripts/npcs/healer.lua b/example/serverdata/scripts/npcs/healer.lua index 96d29111..88335c23 100644 --- a/example/serverdata/scripts/npcs/healer.lua +++ b/example/serverdata/scripts/npcs/healer.lua @@ -18,6 +18,4 @@ function Healer(npc, ch) elseif c == 2 then mana.being_heal(ch, 100) end - - do_npc_close(npc, ch) end diff --git a/example/serverdata/scripts/npcs/merchant.lua b/example/serverdata/scripts/npcs/merchant.lua index 46f85545..3b80298b 100644 --- a/example/serverdata/scripts/npcs/merchant.lua +++ b/example/serverdata/scripts/npcs/merchant.lua @@ -95,5 +95,4 @@ function Merchant(npc, ch, buy_sell_table) end do_message(npc, ch, "See you later!") - do_npc_close(npc, ch) end diff --git a/example/serverdata/scripts/npcs/postman.lua b/example/serverdata/scripts/npcs/postman.lua index 68546bf8..712ea993 100644 --- a/example/serverdata/scripts/npcs/postman.lua +++ b/example/serverdata/scripts/npcs/postman.lua @@ -27,5 +27,4 @@ function post_talk(npc, ch) if answer == 2 then do_post(npc, ch) end - do_npc_close(npc, ch) end diff --git a/scripts/lua/libmana.lua b/scripts/lua/libmana.lua index f9f28575..d0d8666f 100644 --- a/scripts/lua/libmana.lua +++ b/scripts/lua/libmana.lua @@ -42,7 +42,12 @@ local timer -- Note: Cannot be called until map initialization has started. function create_npc(name, id, x, y, talkfunct, updatefunct) local npc = mana.npc_create(name, id, x, y) - if talkfunct then npc_talk_functs[npc] = talkfunct end + if talkfunct then + npc_talk_functs[npc] = function(npc, ch) + talkfunct(npc, ch) + do_npc_close(npc, ch) + end + end if updatefunct then npc_update_functs[npc] = updatefunct end return npc end |