summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/mods/theme/scpt/misc.lua14
-rw-r--r--src/modules.c25
2 files changed, 25 insertions, 14 deletions
diff --git a/lib/mods/theme/scpt/misc.lua b/lib/mods/theme/scpt/misc.lua
index 6205678a..15f9e4eb 100644
--- a/lib/mods/theme/scpt/misc.lua
+++ b/lib/mods/theme/scpt/misc.lua
@@ -1,17 +1,3 @@
--- A not-too-scummy way of generating junk for ammo
-function food_vessel(object)
- if ((object.tval == 80) and (object.sval == 43)) or
- ((object.tval == 80) and (object.sval == 44)) then
- local obj = create_object(TV_JUNK, 3)
- obj.ident = bor(obj.ident, IDENT_MENTAL, IDENT_KNOWN)
- inven_carry(obj, FALSE)
- end_object(obj)
- return FALSE
- end
-end
-
-add_hook_script(HOOK_EAT, "food_vessel", "food_vessel")
-
-- functions to check for Map and Key of Thror before proceeding in Erebor
-- Thank you, Massimiliano Marangio :-)
add_hooks
diff --git a/src/modules.c b/src/modules.c
index 4d139397..72274003 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -600,6 +600,26 @@ static bool_ longbottom_leaf(void *data, void *in_, void *out_)
return FALSE;
}
+static bool_ food_vessel(void *data, void *in_, void *out)
+{
+ hook_eat_in *in = (hook_eat_in *) in_;
+
+ if (((in->o_ptr->tval == TV_FOOD) && (in->o_ptr->sval == 43)) ||
+ ((in->o_ptr->tval == TV_FOOD) && (in->o_ptr->sval == 44)))
+ {
+ object_type forge;
+
+ object_prep(&forge, lookup_kind(TV_JUNK, 3));
+
+ forge.ident |= IDENT_MENTAL | IDENT_KNOWN;
+ inven_carry(&forge, FALSE);
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
void init_hooks_module()
{
/*
@@ -642,6 +662,11 @@ void init_hooks_module()
"longbottom_leaf",
NULL);
+ add_hook_new(HOOK_EAT,
+ food_vessel,
+ "food_vessel",
+ NULL);
+
break;
}