Remove literally unneeded mobs:capture_mob

This commit is contained in:
jordan4ibanez 2021-04-18 21:22:39 -04:00
parent 39985aa558
commit 4d589dfb2a
15 changed files with 15 additions and 57 deletions

View File

@ -190,9 +190,6 @@ local strider = {
inv:set_stack("main",self.driver:get_wield_index(), wielditem)
end
return
elseif not self.driver and clicker:get_wielded_item():get_name() ~= "" then
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end
end,
}

View File

@ -502,20 +502,6 @@ and damages any entity caught inside the blast radius. Protection will limit
node destruction but not entity damage.
mobs:capture_mob
----------------
mobs:capture_mob(...)
Does nothing and returns false.
This function is provided for compability with Mobs Redo for an attempt to
capture a mob.
Mobs cannot be captured in MineClone 2.
In Mobs Redo, this is generally called inside the on_rightclick section of the mob
api code, it provides a chance of capturing the mob. See Mobs Redo documentation
of parameters.
Feeding and Taming/Breeding
---------------------------
@ -781,8 +767,5 @@ mobs:register_mob("mob_horse:horse", {
inv:remove_item("main", "mobs:saddle")
end
end
-- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end
})

View File

@ -112,13 +112,6 @@ function mobs:spawn_child(pos, mob_type)
end
-- No-op in MCL2 (capturing mobs is not possible).
-- Provided for compability with Mobs Redo
function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, force_take, replacewith)
return false
end
-- No-op in MCL2 (protecting mobs is not possible).
function mobs:protect(self, clicker)
return false

View File

@ -1,5 +1,10 @@
mobs.feed_tame = function(self)
return nil
end
-- Code to execute before custom on_rightclick handling
local on_rightclick_prefix = function(self, clicker)
local item = clicker:get_wielded_item()
-- Name mob with nametag
@ -33,7 +38,3 @@ mobs.create_mob_on_rightclick = function(on_rightclick)
end
end
end
mobs.feed_tame = function(self)
return nil
end

View File

@ -11,6 +11,9 @@ local vector_multiply = vector.multiply
local minetest_yaw_to_dir = minetest.yaw_to_dir
local DEFAULT_JUMP_HEIGHT = 5
local DEFAULT_FLOAT_SPEED = 4
--this is a generic float function
@ -20,7 +23,7 @@ mobs.float = function(self)
local goal_velocity = {
x = 0,
y = 5,
y = DEFAULT_FLOAT_SPEED,
z = 0,
}
@ -102,7 +105,7 @@ mobs.jump = function(self, velocity)
end
--fallback velocity to allow modularity
velocity = velocity or 8
velocity = velocity or DEFAULT_JUMP_HEIGHT
self.object:add_velocity(vector_new(0,velocity,0))
end
@ -133,7 +136,7 @@ mobs.flop = function(self, velocity)
mobs.set_velocity(self, 0)
--fallback velocity to allow modularity
velocity = velocity or 8
velocity = velocity or DEFAULT_JUMP_HEIGHT
--create a random direction (2d yaw)
local dir = DOUBLE_PI * math_random()
@ -256,7 +259,7 @@ mobs.jump_move = function(self, velocity)
mobs.set_velocity(self,0)
--fallback velocity to allow modularity
jump_height = 8
jump_height = DEFAULT_JUMP_HEIGHT
local yaw = (self.yaw or 0)

View File

@ -70,7 +70,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
if mobs:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
end,
do_custom = function(self, dtime)

View File

@ -71,7 +71,6 @@ local cow_def = {
end
return
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end,
follow = mobs_mc.items.wheat,
view_range = 10,
@ -140,7 +139,6 @@ mooshroom_def.on_rightclick = function(self, clicker)
minetest.add_item(pos, {name = mobs_mc.items.mushroom_stew})
end
end
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end
mobs:register_mob("mobs_mc:mooshroom", mooshroom_def)

View File

@ -356,9 +356,6 @@ local horse = {
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
-- Used to capture horse
elseif not self.driver and iname ~= "" then
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end
end
end,

View File

@ -183,9 +183,6 @@ mobs:register_mob("mobs_mc:llama", {
mobs.attach(self, clicker)
end
-- Used to capture llama
elseif not self.driver and clicker:get_wielded_item():get_name() ~= "" then
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
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:capture_mob(self, clicker, 0, 60, 5, false, nil) then return end
if mobs:protect(self, clicker) then return end
if self.child then return end

View File

@ -86,7 +86,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
if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
end,
})

View File

@ -163,10 +163,6 @@ mobs:register_mob("mobs_mc:pig", {
inv:set_stack("main",self.driver:get_wield_index(), wielditem)
end
return
-- Capture pig
elseif not self.driver and clicker:get_wielded_item():get_name() ~= "" then
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end
end,

View File

@ -62,7 +62,6 @@ local rabbit = {
-- 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
if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
end,
do_custom = function(self)
-- Easter egg: Change texture if rabbit is named “Toast”

View File

@ -251,7 +251,6 @@ mobs:register_mob("mobs_mc:sheep", {
end
return
end
if mobs:capture_mob(self, clicker, 0, 5, 70, false, nil) then return end
end,
on_breed = function(parent1, parent2)
-- Breed sheep and choose a fur color for the child.

View File

@ -149,8 +149,6 @@ dog.on_rightclick = function(self, clicker)
if mobs:protect(self, clicker) then
return
elseif item:get_name() ~= "" and mobs:capture_mob(self, clicker, 0, 2, 80, false, nil) then
return
elseif is_food(item:get_name()) then
-- Feed to increase health
local hp = self.health