From 8deab4025606e2469dc6d28b141abfe586531d70 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 27 Apr 2017 14:00:57 +0100 Subject: [PATCH] protect/capture returns added --- bunny.lua | 9 +++------ chicken.lua | 9 +++------ cow.lua | 9 +++------ kitten.lua | 9 +++------ penguin.lua | 9 +++------ sheep.lua | 4 ++-- warthog.lua | 9 +++------ 7 files changed, 20 insertions(+), 38 deletions(-) diff --git a/bunny.lua b/bunny.lua index 1c882cd..66867ea 100644 --- a/bunny.lua +++ b/bunny.lua @@ -50,9 +50,9 @@ mobs:register_mob("mobs_animal:bunny", { on_rightclick = function(self, clicker) -- feed or tame - if mobs:feed_tame(self, clicker, 4, true, true) then - return - end + if mobs:feed_tame(self, clicker, 4, true, true) then return end + if mobs:protect(self, clicker) then return end + if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end -- Monty Python tribute local item = clicker:get_wielded_item() @@ -73,9 +73,6 @@ mobs:register_mob("mobs_animal:bunny", { return end - - mobs:protect(self, clicker) - mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) end, attack_type = "dogfight", diff --git a/chicken.lua b/chicken.lua index 6c57cd0..7ab6f41 100644 --- a/chicken.lua +++ b/chicken.lua @@ -52,12 +52,9 @@ mobs:register_mob("mobs_animal:chicken", { on_rightclick = function(self, clicker) - if mobs:feed_tame(self, clicker, 8, true, true) then - return - end - - mobs:protect(self, clicker) - mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) + if mobs:feed_tame(self, clicker, 8, true, true) then return end + if mobs:protect(self, clicker) then return end + if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end end, do_custom = function(self, dtime) diff --git a/cow.lua b/cow.lua index 44ef581..30c71f9 100644 --- a/cow.lua +++ b/cow.lua @@ -59,9 +59,9 @@ mobs:register_mob("mobs_animal:cow", { on_rightclick = function(self, clicker) -- feed or tame - if mobs:feed_tame(self, clicker, 8, true, true) then - return - end + if mobs:feed_tame(self, clicker, 8, true, true) then return end + if mobs:protect(self, clicker) then return end + if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end local tool = clicker:get_wielded_item() local name = clicker:get_player_name() @@ -96,9 +96,6 @@ 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 e2fb922..adea21b 100644 --- a/kitten.lua +++ b/kitten.lua @@ -45,12 +45,9 @@ mobs:register_mob("mobs_animal:kitten", { view_range = 8, on_rightclick = function(self, clicker) - if mobs:feed_tame(self, clicker, 4, true, true) then - return - end - - mobs:protect(self, clicker) - mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) + if mobs:feed_tame(self, clicker, 4, true, true) then return end + if mobs:protect(self, clicker) then return end + if mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) then return end end }) diff --git a/penguin.lua b/penguin.lua index b7748ed..278a6ff 100644 --- a/penguin.lua +++ b/penguin.lua @@ -50,12 +50,9 @@ mobs:register_mob("mobs_animal:penguin", { on_rightclick = function(self, clicker) -- feed or tame - if mobs:feed_tame(self, clicker, 4, false, true) then - return - end - - mobs:protect(self, clicker) - mobs:capture_mob(self, clicker, 5, 50, 80, false, nil) + if mobs:feed_tame(self, clicker, 4, false, true) then return end + if mobs:protect(self, clicker) then return end + if mobs:capture_mob(self, clicker, 5, 50, 80, false, nil) then return end end, }) diff --git a/sheep.lua b/sheep.lua index 8637ef7..4cd6506 100644 --- a/sheep.lua +++ b/sheep.lua @@ -168,10 +168,10 @@ for _, col in ipairs(all_colours) do end -- protect mod with mobs:protector item - mobs:protect(self, clicker) + if mobs:protect(self, clicker) then return end --are we capturing? - mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) + if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end end }) diff --git a/warthog.lua b/warthog.lua index 436e468..81daacf 100644 --- a/warthog.lua +++ b/warthog.lua @@ -48,12 +48,9 @@ mobs:register_mob("mobs_animal:pumba", { }, on_rightclick = function(self, clicker) - if mobs:feed_tame(self, clicker, 8, true, true) then - return - end - - mobs:protect(self, clicker) - mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) + if mobs:feed_tame(self, clicker, 8, true, true) then return end + if mobs:protect(self, clicker) then return end + if mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) then return end end, })