From 7215a670a833793d1507f8bc966ea779121802f5 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Tue, 8 Nov 2016 16:11:49 +0000 Subject: [PATCH] added ability to protect tamed animals --- bunny.lua | 1 + chicken.lua | 1 + cow.lua | 6 ++++-- kitten.lua | 1 + sheep.lua | 3 +++ warthog.lua | 1 + 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bunny.lua b/bunny.lua index 0481991..e2de354 100644 --- a/bunny.lua +++ b/bunny.lua @@ -73,6 +73,7 @@ mobs:register_mob("mobs_animal:bunny", { return end + mobs:protect(self, clicker) mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) end, diff --git a/chicken.lua b/chicken.lua index 6b3a2bf..ad2f722 100644 --- a/chicken.lua +++ b/chicken.lua @@ -56,6 +56,7 @@ mobs:register_mob("mobs_animal:chicken", { return end + mobs:protect(self, clicker) mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) end, diff --git a/cow.lua b/cow.lua index 02e6f0b..301a5f1 100644 --- a/cow.lua +++ b/cow.lua @@ -59,6 +59,7 @@ mobs:register_mob("mobs_animal:cow", { end local tool = clicker:get_wielded_item() + local name = clicker:get_player_name() -- milk cow with empty bucket if tool:get_name() == "bucket:bucket_empty" then @@ -69,8 +70,8 @@ mobs:register_mob("mobs_animal:cow", { end if self.gotten == true then - minetest.chat_send_player(clicker:get_player_name(), - S("Cow already milked!")) + minetest.chat_send_player(name, + S("Cow already milked!")) return end @@ -91,6 +92,7 @@ mobs:register_mob("mobs_animal:cow", { return end + mobs:protect(self, clicker) mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) end, }) diff --git a/kitten.lua b/kitten.lua index 90a94d9..08b86d2 100644 --- a/kitten.lua +++ b/kitten.lua @@ -48,6 +48,7 @@ mobs:register_mob("mobs_animal:kitten", { return end + mobs:protect(self, clicker) mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) end }) diff --git a/sheep.lua b/sheep.lua index 465321c..20ce8e0 100644 --- a/sheep.lua +++ b/sheep.lua @@ -165,6 +165,9 @@ for _, col in pairs(all_colours) do return end + -- protect mod with mobs:protector item + mobs:protect(self, clicker) + --are we capturing? mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) end diff --git a/warthog.lua b/warthog.lua index e9cfbb6..75c0713 100644 --- a/warthog.lua +++ b/warthog.lua @@ -51,6 +51,7 @@ mobs:register_mob("mobs_animal:pumba", { return end + mobs:protect(self, clicker) mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) end, })