From 4d589dfb2aa10cb664b4d3b3471960e6d648b92c Mon Sep 17 00:00:00 2001 From: jordan4ibanez Date: Sun, 18 Apr 2021 21:22:39 -0400 Subject: [PATCH] Remove literally unneeded mobs:capture_mob --- mods/ENTITIES/extra_mobs/strider.lua | 3 --- mods/ENTITIES/mcl_mobs/api.txt | 17 ----------------- .../api/mob_functions/backup_code_api.lua | 7 ------- .../mcl_mobs/api/mob_functions/interaction.lua | 9 +++++---- .../mcl_mobs/api/mob_functions/movement.lua | 11 +++++++---- mods/ENTITIES/mobs_mc/chicken.lua | 1 - mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 4 +--- mods/ENTITIES/mobs_mc/horse.lua | 5 +---- mods/ENTITIES/mobs_mc/llama.lua | 5 +---- mods/ENTITIES/mobs_mc/ocelot.lua | 1 - mods/ENTITIES/mobs_mc/parrot.lua | 1 - mods/ENTITIES/mobs_mc/pig.lua | 4 ---- mods/ENTITIES/mobs_mc/rabbit.lua | 1 - mods/ENTITIES/mobs_mc/sheep.lua | 1 - mods/ENTITIES/mobs_mc/wolf.lua | 2 -- 15 files changed, 15 insertions(+), 57 deletions(-) diff --git a/mods/ENTITIES/extra_mobs/strider.lua b/mods/ENTITIES/extra_mobs/strider.lua index 184716156..6796bdca2 100644 --- a/mods/ENTITIES/extra_mobs/strider.lua +++ b/mods/ENTITIES/extra_mobs/strider.lua @@ -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, } diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index eda74aeb4..0e4810b0f 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -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 }) diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/backup_code_api.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/backup_code_api.lua index 292a27ec0..d7b229147 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/backup_code_api.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/backup_code_api.lua @@ -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 diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua index b996867cf..490ae8518 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/interaction.lua @@ -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 @@ -32,8 +37,4 @@ mobs.create_mob_on_rightclick = function(on_rightclick) on_rightclick(self, clicker) end end -end - -mobs.feed_tame = function(self) - return nil end \ No newline at end of file diff --git a/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua b/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua index 1ff780951..f983734eb 100644 --- a/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua +++ b/mods/ENTITIES/mcl_mobs/api/mob_functions/movement.lua @@ -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) diff --git a/mods/ENTITIES/mobs_mc/chicken.lua b/mods/ENTITIES/mobs_mc/chicken.lua index 8be3019f6..3d7ba8606 100644 --- a/mods/ENTITIES/mobs_mc/chicken.lua +++ b/mods/ENTITIES/mobs_mc/chicken.lua @@ -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) diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index be4cceea3..9ad7b2a18 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -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, @@ -139,8 +138,7 @@ mooshroom_def.on_rightclick = function(self, clicker) pos.y = pos.y + 0.5 minetest.add_item(pos, {name = mobs_mc.items.mushroom_stew}) end - end - mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) + end end mobs:register_mob("mobs_mc:mooshroom", mooshroom_def) diff --git a/mods/ENTITIES/mobs_mc/horse.lua b/mods/ENTITIES/mobs_mc/horse.lua index 938a6b6ac..b9d79a075 100644 --- a/mods/ENTITIES/mobs_mc/horse.lua +++ b/mods/ENTITIES/mobs_mc/horse.lua @@ -355,10 +355,7 @@ 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, diff --git a/mods/ENTITIES/mobs_mc/llama.lua b/mods/ENTITIES/mobs_mc/llama.lua index 8ff82b502..5951f9dff 100644 --- a/mods/ENTITIES/mobs_mc/llama.lua +++ b/mods/ENTITIES/mobs_mc/llama.lua @@ -182,10 +182,7 @@ mobs:register_mob("mobs_mc:llama", { self.object:set_properties({stepheight = 1.1}) 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, diff --git a/mods/ENTITIES/mobs_mc/ocelot.lua b/mods/ENTITIES/mobs_mc/ocelot.lua index f3c8c87ae..139b68785 100644 --- a/mods/ENTITIES/mobs_mc/ocelot.lua +++ b/mods/ENTITIES/mobs_mc/ocelot.lua @@ -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 diff --git a/mods/ENTITIES/mobs_mc/parrot.lua b/mods/ENTITIES/mobs_mc/parrot.lua index 81d19d5d4..06a2dc18b 100644 --- a/mods/ENTITIES/mobs_mc/parrot.lua +++ b/mods/ENTITIES/mobs_mc/parrot.lua @@ -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, }) diff --git a/mods/ENTITIES/mobs_mc/pig.lua b/mods/ENTITIES/mobs_mc/pig.lua index b7cdf1afe..da7e686ad 100644 --- a/mods/ENTITIES/mobs_mc/pig.lua +++ b/mods/ENTITIES/mobs_mc/pig.lua @@ -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, diff --git a/mods/ENTITIES/mobs_mc/rabbit.lua b/mods/ENTITIES/mobs_mc/rabbit.lua index 74bdffcd8..0f67bb7d7 100644 --- a/mods/ENTITIES/mobs_mc/rabbit.lua +++ b/mods/ENTITIES/mobs_mc/rabbit.lua @@ -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” diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index d82df8cf9..8ba8aecd8 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -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. diff --git a/mods/ENTITIES/mobs_mc/wolf.lua b/mods/ENTITIES/mobs_mc/wolf.lua index b1c077d46..319a4f959 100644 --- a/mods/ENTITIES/mobs_mc/wolf.lua +++ b/mods/ENTITIES/mobs_mc/wolf.lua @@ -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