From 27e4da4a03f6554ede6be26c51f8dbae5ee31de0 Mon Sep 17 00:00:00 2001 From: Sokomine Date: Sat, 8 Jul 2023 02:45:34 +0200 Subject: [PATCH] renamed yl_speak_up.on_rightclick to yl_speak_up.mobs_on_rightclick to show that this is a function for mobs_redo --- interface_mobs_api.lua | 9 ++++++++- mobs.lua | 12 ++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/interface_mobs_api.lua b/interface_mobs_api.lua index 8660f24..d6ae7c3 100644 --- a/interface_mobs_api.lua +++ b/interface_mobs_api.lua @@ -4,12 +4,19 @@ -- Mob functions --### +-- TODO: mob_table is currently unused function yl_speak_up.init_mob_table() return false end -function yl_speak_up.on_rightclick(self, clicker) +-- React to right-clicking a mobs_redo mob: +-- * capture the mob with a lasso or net (if appropriate) +-- * protect the mob with a protector +-- * if none of the above applies: actually talk to the mob +-- This is so often needed (but also mobs_redo specific!) that we provide +-- an extra easy-to-call function here. +function yl_speak_up.mobs_on_rightclick(self, clicker) --local item = clicker:get_wielded_item() local name = clicker:get_player_name() diff --git a/mobs.lua b/mobs.lua index 0eb0011..c26258c 100644 --- a/mobs.lua +++ b/mobs.lua @@ -46,7 +46,7 @@ mobs:register_mob("yl_speak_up:human", { punch_end = 219, }, - on_rightclick = yl_speak_up.on_rightclick, + on_rightclick = yl_speak_up.mobs_on_rightclick, on_spawn = yl_speak_up.on_spawn, after_activate = yl_speak_up.after_activate }) @@ -101,7 +101,7 @@ mobs:register_mob("yl_speak_up:elf", { punch_end = 219, }, - on_rightclick = yl_speak_up.on_rightclick, + on_rightclick = yl_speak_up.mobs_on_rightclick, on_spawn = yl_speak_up.on_spawn, after_activate = yl_speak_up.after_activate }) @@ -156,7 +156,7 @@ mobs:register_mob("yl_speak_up:dwarf", { punch_end = 219, }, - on_rightclick = yl_speak_up.on_rightclick, + on_rightclick = yl_speak_up.mobs_on_rightclick, on_spawn = yl_speak_up.on_spawn, after_activate = yl_speak_up.after_activate }) @@ -211,7 +211,7 @@ mobs:register_mob("yl_speak_up:goblin", { punch_end = 219, }, - on_rightclick = yl_speak_up.on_rightclick, + on_rightclick = yl_speak_up.mobs_on_rightclick, on_spawn = yl_speak_up.on_spawn, after_activate = yl_speak_up.after_activate }) @@ -266,7 +266,7 @@ mobs:register_mob("yl_speak_up:orc", { punch_end = 219, }, - on_rightclick = yl_speak_up.on_rightclick, + on_rightclick = yl_speak_up.mobs_on_rightclick, on_spawn = yl_speak_up.on_spawn, after_activate = yl_speak_up.after_activate }) @@ -325,7 +325,7 @@ mobs:register_mob("yl_speak_up:npc", { punch_end = 219, }, - on_rightclick = yl_speak_up.on_rightclick, + on_rightclick = yl_speak_up.mobs_on_rightclick, on_spawn = yl_speak_up.on_spawn, after_activate = yl_speak_up.after_activate })