diff --git a/mods/ENTITIES/extra_mobs/cod.lua b/mods/ENTITIES/extra_mobs/cod.lua index fd0a40621..9813d67e7 100644 --- a/mods/ENTITIES/extra_mobs/cod.lua +++ b/mods/ENTITIES/extra_mobs/cod.lua @@ -30,26 +30,26 @@ local S = minetest.get_translator("extra_mobs") --################### local cod = { - type = "animal", - spawn_class = "water", - can_despawn = true, - passive = true, - hp_min = 3, - hp_max = 3, - xp_min = 1, - xp_max = 3, - armor = 100, + type = "animal", + spawn_class = "water", + can_despawn = true, + passive = true, + hp_min = 3, + hp_max = 3, + xp_min = 1, + xp_max = 3, + armor = 100, rotate = 270, - tilt_swim = true, - collisionbox = {-0.3, 0.0, -0.3, 0.3, 0.79, 0.3}, - visual = "mesh", - mesh = "extra_mobs_cod.b3d", - textures = { - {"extra_mobs_cod.png"} - }, - sounds = { - }, - animation = { + tilt_swim = true, + collisionbox = {-0.3, 0.0, -0.3, 0.3, 0.79, 0.3}, + visual = "mesh", + mesh = "extra_mobs_cod.b3d", + textures = { + {"extra_mobs_cod.png"} + }, + sounds = { + }, + animation = { stand_start = 1, stand_end = 20, walk_start = 1, @@ -57,45 +57,52 @@ local cod = { run_start = 1, run_end = 20, }, - drops = { + drops = { {name = "mcl_fishing:fish_raw", chance = 1, min = 1, max = 1,}, - {name = "mcl_dye:white", + {name = "mcl_dye:white", chance = 20, min = 1, max = 1,}, }, - visual_size = {x=3, y=3}, - makes_footstep_sound = false, - swim = true, - breathes_in_water = true, - jump = false, - view_range = 16, - runaway = true, - fear_height = 4, - do_custom = function(self) - self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0)) - if minetest.get_item_group(self.standing_in, "water") ~= 0 then - if self.object:get_velocity().y < 2.5 then - self.object:add_velocity({ x = 0 , y = math.random(-.002, .002) , z = 0 }) - end - end - for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 10)) do - local lp = object:get_pos() - local s = self.object:get_pos() - local vec = { - x = lp.x - s.x, - y = lp.y - s.y, - z = lp.z - s.z - } - if object and not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "extra_mobs:cod" then - self.state = "runaway" - self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0}) - end - end - end + visual_size = {x=3, y=3}, + makes_footstep_sound = false, + swim = true, + breathes_in_water = true, + jump = false, + view_range = 16, + runaway = true, + fear_height = 4, + do_custom = function(self) + self.object:set_bone_position("body", vector.new(0,1,0), vector.new(degrees(dir_to_pitch(self.object:get_velocity())) * -1 + 90,0,0)) + if minetest.get_item_group(self.standing_in, "water") ~= 0 then + if self.object:get_velocity().y < 2.5 then + self.object:add_velocity({ x = 0 , y = math.random(-.002, .002) , z = 0 }) + end + end + for _,object in pairs(minetest.get_objects_inside_radius(self.object:get_pos(), 10)) do + local lp = object:get_pos() + local s = self.object:get_pos() + local vec = { + x = lp.x - s.x, + y = lp.y - s.y, + z = lp.z - s.z + } + if object and not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "extra_mobs:cod" then + self.state = "runaway" + self.object:set_rotation({x=0,y=(atan(vec.z / vec.x) + 3 * pi / 2) - self.rotate,z=0}) + end + end + end, + on_rightclick = function(self, clicker) + if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then + self.object:remove() + clicker:set_wielded_item("mcl_fishing:bucket_cod") + awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing") + end + end } mobs:register_mob("extra_mobs:cod", cod) diff --git a/mods/ENTITIES/extra_mobs/salmon.lua b/mods/ENTITIES/extra_mobs/salmon.lua index ba3503b60..7ef9a8d36 100644 --- a/mods/ENTITIES/extra_mobs/salmon.lua +++ b/mods/ENTITIES/extra_mobs/salmon.lua @@ -10,26 +10,26 @@ local S = minetest.get_translator("extra_mobs") --################### local salmon = { - type = "animal", - spawn_class = "water", - can_despawn = true, - passive = true, - hp_min = 3, - hp_max = 3, - xp_min = 1, - xp_max = 3, - armor = 100, - rotate = 270, - tilt_swim = true, - collisionbox = {-0.4, 0.0, -0.4, 0.4, 0.79, 0.4}, - visual = "mesh", - mesh = "extra_mobs_salmon.b3d", - textures = { - {"extra_mobs_salmon.png"} - }, - sounds = { - }, - animation = { + type = "animal", + spawn_class = "water", + can_despawn = true, + passive = true, + hp_min = 3, + hp_max = 3, + xp_min = 1, + xp_max = 3, + armor = 100, + rotate = 270, + tilt_swim = true, + collisionbox = {-0.4, 0.0, -0.4, 0.4, 0.79, 0.4}, + visual = "mesh", + mesh = "extra_mobs_salmon.b3d", + textures = { + {"extra_mobs_salmon.png"} + }, + sounds = { + }, + animation = { stand_start = 1, stand_end = 20, walk_start = 1, @@ -37,24 +37,31 @@ local salmon = { run_start = 1, run_end = 20, }, - drops = { + drops = { {name = "mcl_fishing:salmon_raw", chance = 1, min = 1, max = 1,}, - {name = "mcl_dye:white", + {name = "mcl_dye:white", chance = 20, min = 1, max = 1,}, }, - visual_size = {x=3, y=3}, - makes_footstep_sound = false, - swim = true, - breathes_in_water = true, - jump = false, - view_range = 16, - runaway = true, - fear_height = 4, + visual_size = {x=3, y=3}, + makes_footstep_sound = false, + swim = true, + breathes_in_water = true, + jump = false, + view_range = 16, + runaway = true, + fear_height = 4, + on_rightclick = function(self, clicker) + if clicker:get_wielded_item():get_name() == "mcl_buckets:bucket_water" then + self.object:remove() + clicker:set_wielded_item("mcl_fishing:bucket_salmon") + awards.unlock(clicker:get_player_name(), "mcl:tacticalFishing") + end + end } mobs:register_mob("extra_mobs:salmon", salmon) diff --git a/mods/ENTITIES/extra_mobs/textures/cod_bucket.png b/mods/ENTITIES/extra_mobs/textures/cod_bucket1.png similarity index 100% rename from mods/ENTITIES/extra_mobs/textures/cod_bucket.png rename to mods/ENTITIES/extra_mobs/textures/cod_bucket1.png diff --git a/mods/HUD/mcl_achievements/init.lua b/mods/HUD/mcl_achievements/init.lua index 7b3b2fc1c..761888d16 100644 --- a/mods/HUD/mcl_achievements/init.lua +++ b/mods/HUD/mcl_achievements/init.lua @@ -253,6 +253,13 @@ awards.register_achievement("mcl:fishyBusiness", { icon = "mcl_armor_inv_chestplate_netherite.png", })]]-- +-- Triggered in extra_mobs +awards.register_achievement("mcl:tacticalFishing", { + title = S("Tactical Fishing"), + description = S("Catch a fish... without a fishing rod!"), + icon = "pufferfish_bucket.png", +}) + -- NON-PC ACHIEVEMENTS (XBox, Pocket Edition, etc.) if non_pc_achievements then diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 2c2ba6982..7a5c7d701 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -512,3 +512,25 @@ minetest.register_on_item_eat(function (hp_change, replace_with_item, itemstack, end end ) + +-- Fish Buckets +fish_names = {"cod", "salmon"} + +for _, fish in ipairs(fish_names) do + mcl_buckets.register_liquid({ + bucketname = "mcl_fishing:bucket_" .. fish, + source_place = function(pos) + minetest.add_entity(pos, "extra_mobs:" .. fish) + return "mcl_core:water_source" + end, + source_take = {"extra_mobs:" .. fish}, + inventory_image = fish .. "_bucket.png", + name = S("Bucket of @1", S(fish)), + longdesc = S("This bucket is filled with water and @1.", S(fish)), + usagehelp = S("Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.", S(fish), S(fish)), + tt_help = S("Places a water source and a @1 fish.", S(fish)), + extra_check = function(pos, placer) + return true, true + end, + }) +end diff --git a/mods/ITEMS/mcl_fishing/locale/template.txt b/mods/ITEMS/mcl_fishing/locale/template.txt index a1544666b..200f5e145 100644 --- a/mods/ITEMS/mcl_fishing/locale/template.txt +++ b/mods/ITEMS/mcl_fishing/locale/template.txt @@ -16,3 +16,9 @@ Pufferfish= Pufferfish are a common species of fish and can be obtained by fishing. They can technically be eaten, but they are very bad for humans. Eating a pufferfish only restores 1 hunger point and will poison you very badly (which drains your health non-fatally) and causes serious food poisoning (which increases your hunger).= Catches fish in water= Very poisonous= +cod= +salmon= +Bucket of @1= +This bucket is filled with water and @1.= +Place it to empty the bucket and place a @1. Obtain by right clicking on a @2 fish with a bucket of water.= +Places a water source and a @1 fish.= diff --git a/mods/ITEMS/mcl_fishing/textures/cod_bucket.png b/mods/ITEMS/mcl_fishing/textures/cod_bucket.png new file mode 100644 index 000000000..582207cb0 Binary files /dev/null and b/mods/ITEMS/mcl_fishing/textures/cod_bucket.png differ diff --git a/mods/ITEMS/mcl_fishing/textures/pufferfish_bucket.png b/mods/ITEMS/mcl_fishing/textures/pufferfish_bucket.png new file mode 100644 index 000000000..2c88bac35 Binary files /dev/null and b/mods/ITEMS/mcl_fishing/textures/pufferfish_bucket.png differ diff --git a/mods/ITEMS/mcl_fishing/textures/salmon_bucket.png b/mods/ITEMS/mcl_fishing/textures/salmon_bucket.png new file mode 100644 index 000000000..b9ac22fd9 Binary files /dev/null and b/mods/ITEMS/mcl_fishing/textures/salmon_bucket.png differ diff --git a/mods/ITEMS/mcl_fishing/textures/tropical_fish_bucket.png b/mods/ITEMS/mcl_fishing/textures/tropical_fish_bucket.png new file mode 100644 index 000000000..edf7dd244 Binary files /dev/null and b/mods/ITEMS/mcl_fishing/textures/tropical_fish_bucket.png differ