From 465063bdf50bdf30b110bb2c37ab114fb68e4662 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sat, 9 Jun 2012 17:56:15 +0200 Subject: Lua: Move the "monster asked for help" help to C --- lib/mods/theme/scpt/help.lua | 10 ---------- lib/scpt/help.lua | 10 ---------- src/defines.h | 1 + src/help.c | 15 ++++++++++++++- src/q_shroom.c | 2 +- 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/lib/mods/theme/scpt/help.lua b/lib/mods/theme/scpt/help.lua index 6a153933..e17d1723 100644 --- a/lib/mods/theme/scpt/help.lua +++ b/lib/mods/theme/scpt/help.lua @@ -5,13 +5,3 @@ -----------------------Here comes the definition of help----------------------- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- - -ingame_help -{ - ["callback"] = "monster_chat", - ["desc"] = - { - "Somebody is speaking to you it seems. You can talk back with the Y key.", - "This can lead to quests. You can also give items to 'monsters' with the y key.", - } -} diff --git a/lib/scpt/help.lua b/lib/scpt/help.lua index 6a153933..e17d1723 100644 --- a/lib/scpt/help.lua +++ b/lib/scpt/help.lua @@ -5,13 +5,3 @@ -----------------------Here comes the definition of help----------------------- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- - -ingame_help -{ - ["callback"] = "monster_chat", - ["desc"] = - { - "Somebody is speaking to you it seems. You can talk back with the Y key.", - "This can lead to quests. You can also give items to 'monsters' with the y key.", - } -} diff --git a/src/defines.h b/src/defines.h index 44537732..8a340a4c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -4513,6 +4513,7 @@ #define HOOK_APPLY_MAGIC 66 #define HOOK_PLAYER_EXP 67 #define HOOK_BIRTH 68 +#define HOOK_MON_ASK_HELP 69 #define HOOK_LEARN_ABILITY 70 #define HOOK_MOVED 71 #define HOOK_GAME_START 72 diff --git a/src/help.c b/src/help.c index a19b7b27..6d196060 100644 --- a/src/help.c +++ b/src/help.c @@ -14,7 +14,7 @@ #include "angband.h" #define DESC_MAX 14 -#define TRIGGERED_HELP_MAX 18 +#define TRIGGERED_HELP_MAX 19 #define HELP_VOID_JUMPGATE 0 #define HELP_FOUNTAIN 1 @@ -34,6 +34,7 @@ #define HELP_20TH_LEVEL 15 #define HELP_ID_SPELL_ITM 16 #define HELP_MELEE_SKILLS 17 +#define HELP_MON_ASK_HELP 18 /** * Game started? @@ -402,6 +403,10 @@ static bool_ trigger_melee_skills(void *in, void *out) { return (game_started && (get_melee_skills() > 1)); } +static bool_ trigger_always(void *in, void *out) { + return TRUE; +} + /** * Trigger-based help items */ @@ -584,6 +589,14 @@ static triggered_help_type triggered_help[TRIGGERED_HELP_MAX] = "and select the switch melee type option.", NULL } + }, + { HELP_MON_ASK_HELP, + HOOK_MON_ASK_HELP, + trigger_always, + { "Somebody is speaking to you it seems. You can talk back with the Y key.", + "This can lead to quests. You can also give items to 'monsters' with the y key.", + NULL + } } }; diff --git a/src/q_shroom.c b/src/q_shroom.c index b6e26cdf..4d4d7494 100644 --- a/src/q_shroom.c +++ b/src/q_shroom.c @@ -196,7 +196,7 @@ bool_ quest_shroom_speak_hook(char *fmt) m_name = get_next_arg_str(fmt); msg_format("%^s asks your help.", m_name); - exec_lua("ingame_help('monster_chat')"); + process_hooks_new(HOOK_MON_ASK_HELP, NULL, NULL); } else { -- cgit v1.2.3