From 9ca1160ee83495ee06203f3fb84fe9cb2b4e4c15 Mon Sep 17 00:00:00 2001 From: "Tai @ Flex" Date: Sat, 20 Aug 2016 13:52:45 +0100 Subject: [PATCH] any mob can be fed, fix rightclick function override bug --- capturing.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/capturing.lua b/capturing.lua index e97b8f4..6be3482 100644 --- a/capturing.lua +++ b/capturing.lua @@ -5,8 +5,6 @@ -- TODO adda vivarium:fodder to feed animals in general -dofile(minetest.get_modpath("vivarium") .. "/bestiary.lua") - function chancer(hp,difficulty) return math.floor(1000/hp * hp/(hp*0.4) * difficulty) end @@ -47,13 +45,15 @@ function captivate(mobname,modset) lassochance.."...") mobs:capture_mob(self, clicker, handchance, netchance, lassochance, override, replacement) - rc_func(self,clicker) + if rc_func then + rc_func(self,clicker) + end end mobe.on_rightclick = capturefunction if modset.mobtype then mobe.type = modset.mobtype - if modset.follow and modset.mobtype ~= "monster" then + if modset.follow then mobe.follow = modset.follow end end @@ -69,8 +69,10 @@ end minetest.debug("--- Start Mob Captivator ---") -if bestiary then -for _,modset in pairs(bestiary) do +dofile(minetest.get_modpath("vivarium") .. "/bestiary.lua") + +if vivarium.bestiary then +for _,modset in pairs(vivarium.bestiary) do if minetest.get_modpath(modset.name) then if modset.beasts then