forked from MineClone5/MineClone5
Remove unneeded mobs:protect from code
This commit is contained in:
parent
4d589dfb2a
commit
85e531bf10
|
@ -124,7 +124,6 @@ local strider = {
|
||||||
if wielditem:get_name() ~= controlitem then
|
if wielditem:get_name() ~= controlitem then
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
end
|
end
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
return
|
return
|
||||||
|
|
|
@ -521,19 +521,6 @@ Will return true when mob is fed with item it likes.
|
||||||
them up
|
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
|
Riding Mobs
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|
|
@ -112,11 +112,6 @@ function mobs:spawn_child(pos, mob_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- No-op in MCL2 (protecting mobs is not possible).
|
|
||||||
function mobs:protect(self, clicker)
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- feeding, taming and breeding (thanks blert2112)
|
-- feeding, taming and breeding (thanks blert2112)
|
||||||
function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
function mobs:feed_tame(self, clicker, feed_count, breed, tame)
|
||||||
|
|
|
@ -69,7 +69,6 @@ mobs:register_mob("mobs_mc:chicken", {
|
||||||
|
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
do_custom = function(self, dtime)
|
do_custom = function(self, dtime)
|
||||||
|
|
|
@ -50,7 +50,6 @@ local cow_def = {
|
||||||
follow = mobs_mc.follow.cow,
|
follow = mobs_mc.follow.cow,
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
return
|
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.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)
|
mooshroom_def.on_rightclick = function(self, clicker)
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
return
|
return
|
||||||
|
|
|
@ -281,10 +281,6 @@ local horse = {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if mobs:protect(self, clicker) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Make sure tamed horse is mature and being clicked by owner only
|
-- 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
|
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})
|
self.object:set_properties({stepheight = 1.1})
|
||||||
mobs.attach(self, clicker)
|
mobs.attach(self, clicker)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -133,7 +133,6 @@ mobs:register_mob("mobs_mc:llama", {
|
||||||
-- Feed with anything else
|
-- Feed with anything else
|
||||||
if mobs:feed_tame(self, clicker, 1, false, true) then return end
|
if mobs:feed_tame(self, clicker, 1, false, true) then return end
|
||||||
end
|
end
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
|
|
||||||
-- Make sure tamed llama is mature and being clicked by owner only
|
-- 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
|
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})
|
self.object:set_properties({stepheight = 1.1})
|
||||||
mobs.attach(self, clicker)
|
mobs.attach(self, clicker)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,6 @@ cat.sounds = {
|
||||||
}
|
}
|
||||||
cat.on_rightclick = function(self, clicker)
|
cat.on_rightclick = function(self, clicker)
|
||||||
if mobs:feed_tame(self, clicker, 1, true, false) then return end
|
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
|
if self.child then return end
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,6 @@ mobs:register_mob("mobs_mc:parrot", {
|
||||||
|
|
||||||
-- Feed to tame, but not breed
|
-- Feed to tame, but not breed
|
||||||
if mobs:feed_tame(self, clicker, 1, false, true) then return end
|
if mobs:feed_tame(self, clicker, 1, false, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -95,7 +95,6 @@ mobs:register_mob("mobs_mc:pig", {
|
||||||
if wielditem:get_name() ~= mobs_mc.items.carrot_on_a_stick then
|
if wielditem:get_name() ~= mobs_mc.items.carrot_on_a_stick then
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
end
|
end
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
return
|
return
|
||||||
|
|
|
@ -61,7 +61,6 @@ local rabbit = {
|
||||||
on_rightclick = function(self, clicker)
|
on_rightclick = function(self, clicker)
|
||||||
-- Feed, tame protect or capture
|
-- Feed, tame protect or capture
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
||||||
if mobs:protect(self, clicker) then return end
|
|
||||||
end,
|
end,
|
||||||
do_custom = function(self)
|
do_custom = function(self)
|
||||||
-- Easter egg: Change texture if rabbit is named “Toast”
|
-- Easter egg: Change texture if rabbit is named “Toast”
|
||||||
|
|
|
@ -195,7 +195,6 @@ mobs:register_mob("mobs_mc:sheep", {
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
|
|
||||||
if mobs:feed_tame(self, clicker, 1, true, true) then return end
|
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
|
if item:get_name() == mobs_mc.items.shears and not self.gotten and not self.child then
|
||||||
self.gotten = true
|
self.gotten = true
|
||||||
|
|
|
@ -147,9 +147,7 @@ dog.specific_attack = nil
|
||||||
dog.on_rightclick = function(self, clicker)
|
dog.on_rightclick = function(self, clicker)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
|
|
||||||
if mobs:protect(self, clicker) then
|
if is_food(item:get_name()) then
|
||||||
return
|
|
||||||
elseif is_food(item:get_name()) then
|
|
||||||
-- Feed to increase health
|
-- Feed to increase health
|
||||||
local hp = self.health
|
local hp = self.health
|
||||||
local hp_add = 0
|
local hp_add = 0
|
||||||
|
|
Loading…
Reference in New Issue