0
0
Fork 0

Remove unneeded mobs:protect from code

This commit is contained in:
jordan4ibanez 2021-04-18 21:24:31 -04:00
parent 4d589dfb2a
commit 85e531bf10
13 changed files with 3 additions and 37 deletions

View File

@ -124,7 +124,6 @@ local strider = {
if wielditem:get_name() ~= controlitem then
if mobs:feed_tame(self, clicker, 1, true, true) then return end
end
if mobs:protect(self, clicker) then return end
if self.child then
return

View File

@ -521,19 +521,6 @@ Will return true when mob is fed with item it likes.
them up
Protecting Mobs
---------------
mobs:protect(self, clicker)
This function can be used to right-click any tamed mob with mobs:protector item,
this will protect the mob from harm inside of a protected area from other
players. Will return true when mob right-clicked with mobs:protector item.
'self' mob information
'clicker' player information
Riding Mobs
-----------

View File

@ -112,11 +112,6 @@ function mobs:spawn_child(pos, mob_type)
end
-- No-op in MCL2 (protecting mobs is not possible).
function mobs:protect(self, clicker)
return false
end
-- feeding, taming and breeding (thanks blert2112)
function mobs:feed_tame(self, clicker, feed_count, breed, tame)

View File

@ -69,7 +69,6 @@ mobs:register_mob("mobs_mc:chicken", {
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
end,
do_custom = function(self, dtime)

View File

@ -50,7 +50,6 @@ local cow_def = {
follow = mobs_mc.follow.cow,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if self.child then
return
@ -86,7 +85,6 @@ mooshroom_def.mesh = "mobs_mc_cow.b3d"
mooshroom_def.textures = { {"mobs_mc_mooshroom.png", "mobs_mc_mushroom_red.png"}, {"mobs_mc_mooshroom_brown.png", "mobs_mc_mushroom_brown.png" } }
mooshroom_def.on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if self.child then
return

View File

@ -281,10 +281,6 @@ local horse = {
return
end
if mobs:protect(self, clicker) then
return
end
-- Make sure tamed horse is mature and being clicked by owner only
if self.tamed and not self.child and self.owner == clicker:get_player_name() then
@ -355,7 +351,7 @@ local horse = {
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
end
end
end,

View File

@ -133,7 +133,6 @@ mobs:register_mob("mobs_mc:llama", {
-- Feed with anything else
if mobs:feed_tame(self, clicker, 1, false, true) then return end
end
if mobs:protect(self, clicker) then return end
-- Make sure tamed llama is mature and being clicked by owner only
if self.tamed and not self.child and self.owner == clicker:get_player_name() then
@ -182,7 +181,7 @@ mobs:register_mob("mobs_mc:llama", {
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
end
end
end,

View File

@ -121,7 +121,6 @@ cat.sounds = {
}
cat.on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 1, true, false) then return end
if mobs:protect(self, clicker) then return end
if self.child then return end

View File

@ -85,7 +85,6 @@ mobs:register_mob("mobs_mc:parrot", {
-- Feed to tame, but not breed
if mobs:feed_tame(self, clicker, 1, false, true) then return end
if mobs:protect(self, clicker) then return end
end,
})

View File

@ -95,7 +95,6 @@ mobs:register_mob("mobs_mc:pig", {
if wielditem:get_name() ~= mobs_mc.items.carrot_on_a_stick then
if mobs:feed_tame(self, clicker, 1, true, true) then return end
end
if mobs:protect(self, clicker) then return end
if self.child then
return

View File

@ -61,7 +61,6 @@ local rabbit = {
on_rightclick = function(self, clicker)
-- Feed, tame protect or capture
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
end,
do_custom = function(self)
-- Easter egg: Change texture if rabbit is named “Toast”

View File

@ -195,7 +195,6 @@ mobs:register_mob("mobs_mc:sheep", {
local item = clicker:get_wielded_item()
if mobs:feed_tame(self, clicker, 1, true, true) then return end
if mobs:protect(self, clicker) then return end
if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then
self.gotten = true

View File

@ -147,9 +147,7 @@ dog.specific_attack = nil
dog.on_rightclick = function(self, clicker)
local item = clicker:get_wielded_item()
if mobs:protect(self, clicker) then
return
elseif is_food(item:get_name()) then
if is_food(item:get_name()) then
-- Feed to increase health
local hp = self.health
local hp_add = 0