From e3a3f97974a34e115ec6399a9051ed160f728a9f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 1 Feb 2017 15:20:28 +0100 Subject: [PATCH] Move fishing stuff to mcl_fishing --- mods/mcl_core/crafting.lua | 32 ---- mods/mcl_core/craftitems.lua | 16 -- mods/mcl_core/tools.lua | 91 ------------ mods/mcl_fishing/depends.txt | 1 + mods/mcl_fishing/description.txt | 1 + mods/mcl_fishing/init.lua | 139 ++++++++++++++++++ mods/mcl_fishing/mod.conf | 1 + .../textures/mcl_fishing_fish_cooked.png} | Bin .../textures/mcl_fishing_fish_raw.png} | Bin .../textures/mcl_fishing_fishing_rod.png} | Bin 10 files changed, 142 insertions(+), 139 deletions(-) create mode 100644 mods/mcl_fishing/depends.txt create mode 100644 mods/mcl_fishing/description.txt create mode 100644 mods/mcl_fishing/init.lua create mode 100644 mods/mcl_fishing/mod.conf rename mods/{mcl_core/textures/default_fish_cooked.png => mcl_fishing/textures/mcl_fishing_fish_cooked.png} (100%) rename mods/{mcl_core/textures/default_fish.png => mcl_fishing/textures/mcl_fishing_fish_raw.png} (100%) rename mods/{mcl_core/textures/default_tool_fishing_pole.png => mcl_fishing/textures/mcl_fishing_fishing_rod.png} (100%) diff --git a/mods/mcl_core/crafting.lua b/mods/mcl_core/crafting.lua index a75e85f8..0e703c5a 100644 --- a/mods/mcl_core/crafting.lua +++ b/mods/mcl_core/crafting.lua @@ -422,25 +422,6 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = "mcl_core:fishing_rod", - recipe = { - {'','','mcl_core:stick'}, - {'','mcl_core:stick','mcl_core:string'}, - {'mcl_core:stick','','mcl_core:string'}, - } -}) -minetest.register_craft({ - output = "mcl_core:fishing_rod", - recipe = { - {'mcl_core:stick', '', ''}, - {'mcl_core:string', 'mcl_core:stick', ''}, - {'mcl_core:string','','mcl_core:stick'}, - } -}) - - - minetest.register_craft({ output = 'mcl_core:rail 16', recipe = { @@ -847,13 +828,6 @@ minetest.register_craft({ cooktime = 10, }) -minetest.register_craft({ - type = "cooking", - output = "mcl_core:fish", - recipe = "mcl_core:fish_raw", - cooktime = 10, -}) - minetest.register_craft({ type = "cooking", output = "mcl_core:charcoal_lump", @@ -1000,12 +974,6 @@ minetest.register_craft({ burntime = 15, }) -minetest.register_craft({ - type = "fuel", - recipe = "mcl_core:fishing_rod", - burntime = 15, -}) - minetest.register_craft({ type = "fuel", recipe = "mcl_core:pick_wood", diff --git a/mods/mcl_core/craftitems.lua b/mods/mcl_core/craftitems.lua index 4f826596..e31abac9 100644 --- a/mods/mcl_core/craftitems.lua +++ b/mods/mcl_core/craftitems.lua @@ -125,22 +125,6 @@ minetest.register_craftitem("mcl_core:glowstone_dust", { groups = { craftitem=1 }, }) -minetest.register_craftitem("mcl_core:fish_raw", { - description = "Raw Fish", - inventory_image = "default_fish.png", - on_use = minetest.item_eat(2), - stack_max = 64, - groups = { food=1, eatable = 2 }, -}) - -minetest.register_craftitem("mcl_core:fish", { - description = "Cooked Fish", - inventory_image = "default_fish_cooked.png", - on_use = minetest.item_eat(4), - stack_max = 64, - groups = { food=1, eatable=4 }, -}) - minetest.register_craftitem("mcl_core:sugar", { description = "Sugar", inventory_image = "default_sugar.png", diff --git a/mods/mcl_core/tools.lua b/mods/mcl_core/tools.lua index 9c4a4e80..7ea3f71f 100644 --- a/mods/mcl_core/tools.lua +++ b/mods/mcl_core/tools.lua @@ -339,97 +339,6 @@ minetest.register_tool("mcl_core:flint_and_steel", { end, }) --- Fishing Pole -minetest.register_tool("mcl_core:pole", { - description = "Fishing Rod", - groups = { tool=1 }, - inventory_image = "default_tool_fishing_pole.png", - stack_max = 1, - liquids_pointable = true, - on_use = function (itemstack, user, pointed_thing) - if pointed_thing and pointed_thing.under then - local node = minetest.get_node(pointed_thing.under) - if string.find(node.name, "mcl_core:water") then - local itemname - local itemcount = 1 - local r = math.random(1, 100) - if r <= 85 then - -- Fish - r = math.random(1, 100) - if r <= 60 then - itemname = "mcl_core:fish" - elseif r <= 85 then - itemname = "mcl_core:fish" - --itemname = "mcl_core:salmon" - elseif r <= 87 then - itemname = "mcl_core:fish" - --itemname = "mcl_core:clownfish" - else - itemname = "mcl_core:fish" - --itemname = "mcl_core:pufferfish" - end - elseif r <= 95 then - -- Junk - r = math.random(1, 83) - if r <= 10 then - itemname = "mcl_core:bowl" - elseif r <= 12 then - -- TODO: Damaged - itemname = "mcl_core:pole" - elseif r <= 22 then - itemname = "mcl_mobitems:leather" - elseif r <= 32 then - itemname = "3d_armor:boots_leather" - elseif r <= 42 then - itemname = "mcl_mobitems:rotten_flesh" - elseif r <= 47 then - itemname = "mcl_core:stick" - elseif r <= 52 then - itemname = "mcl_core:string" - elseif r <= 62 then - itemname = "mcl_potions:glass_bottle" - --TODO itemname = "mcl_potions:bottle_water" - elseif r <= 72 then - itemname = "mcl_core:bone" - elseif r <= 73 then - itemname = "mcl_dye:black" - itemcount = 10 - else - -- TODO: Tripwire hook - itemname = "mcl_core:string" - end - else - -- Treasure - r = math.random(1, 6) - if r == 1 then - -- TODO: Enchanted and damaged - itemname = "throwing:bow" - elseif r == 2 then - -- TODO: Enchanted book - itemname = "mcl_core:book" - elseif r == 3 then - -- TODO: Enchanted and damaged - itemname = "mcl_core:pole" - elseif r == 4 then - itemname = "mobs:naming_tag" - elseif r == 5 then - itemname = "mcl_mobitems:saddle" - elseif r == 6 then - itemname = "mcl_flowers:waterlily" - end - end - local inv = user:get_inventory() - if inv:room_for_item("main", {name=itemname, count=1, wear=0, metadata=""}) then - inv:add_item("main", {name=itemname, count=1, wear=0, metadata=""}) - end - itemstack:add_wear(66000/65) -- 65 uses - return itemstack - end - end - return nil - end, -}) - --Shears minetest.register_tool("mcl_core:shears", { description = "Shears", diff --git a/mods/mcl_fishing/depends.txt b/mods/mcl_fishing/depends.txt new file mode 100644 index 00000000..315237e0 --- /dev/null +++ b/mods/mcl_fishing/depends.txt @@ -0,0 +1 @@ +mcl_core diff --git a/mods/mcl_fishing/description.txt b/mods/mcl_fishing/description.txt new file mode 100644 index 00000000..1befeab1 --- /dev/null +++ b/mods/mcl_fishing/description.txt @@ -0,0 +1 @@ +Adds fish and fishing poles to go fishing. diff --git a/mods/mcl_fishing/init.lua b/mods/mcl_fishing/init.lua new file mode 100644 index 00000000..a6b80c6d --- /dev/null +++ b/mods/mcl_fishing/init.lua @@ -0,0 +1,139 @@ +-- Fishing Rod +minetest.register_tool("mcl_fishing:fishing_rod", { + description = "Fishing Rod", + groups = { tool=1 }, + inventory_image = "mcl_fishing_fishing_rod.png", + stack_max = 1, + liquids_pointable = true, + on_use = function (itemstack, user, pointed_thing) + if pointed_thing and pointed_thing.under then + local node = minetest.get_node(pointed_thing.under) + if string.find(node.name, "mcl_core:water") then + local itemname + local itemcount = 1 + local r = math.random(1, 100) + if r <= 85 then + -- Fish + r = math.random(1, 100) + if r <= 60 then + itemname = "mcl_fishing:fish_raw" + elseif r <= 85 then + itemname = "mcl_fishing:fish_raw" + --itemname = "mcl_core:salmon" + elseif r <= 87 then + itemname = "mcl_fishing:fish_raw" + --itemname = "mcl_core:clownfish" + else + itemname = "mcl_fishing:fish_raw" + --itemname = "mcl_core:pufferfish" + end + elseif r <= 95 then + -- Junk + r = math.random(1, 83) + if r <= 10 then + itemname = "mcl_fishing:bowl" + elseif r <= 12 then + -- TODO: Damaged + itemname = "mcl_fishing:fishing_rod" + elseif r <= 22 then + itemname = "mcl_mobitems:leather" + elseif r <= 32 then + itemname = "3d_armor:boots_leather" + elseif r <= 42 then + itemname = "mcl_mobitems:rotten_flesh" + elseif r <= 47 then + itemname = "mcl_core:stick" + elseif r <= 52 then + itemname = "mcl_core:string" + elseif r <= 62 then + itemname = "mcl_potions:glass_bottle" + --TODO itemname = "mcl_potions:bottle_water" + elseif r <= 72 then + itemname = "mcl_core:bone" + elseif r <= 73 then + itemname = "mcl_dye:black" + itemcount = 10 + else + -- TODO: Tripwire hook + itemname = "mcl_core:string" + end + else + -- Treasure + r = math.random(1, 6) + if r == 1 then + -- TODO: Enchanted and damaged + itemname = "throwing:bow" + elseif r == 2 then + -- TODO: Enchanted book + itemname = "mcl_core:book" + elseif r == 3 then + -- TODO: Enchanted and damaged + itemname = "mcl_fishing:fishing_rod" + elseif r == 4 then + itemname = "mobs:naming_tag" + elseif r == 5 then + itemname = "mcl_mobitems:saddle" + elseif r == 6 then + itemname = "mcl_flowers:waterlily" + end + end + local inv = user:get_inventory() + if inv:room_for_item("main", {name=itemname, count=1, wear=0, metadata=""}) then + inv:add_item("main", {name=itemname, count=1, wear=0, metadata=""}) + end + itemstack:add_wear(66000/65) -- 65 uses + return itemstack + end + end + return nil + end, +}) + +minetest.register_craft({ + output = "mcl_fishing:fishing_rod", + recipe = { + {'','','mcl_core:stick'}, + {'','mcl_core:stick','mcl_core:string'}, + {'mcl_core:stick','','mcl_core:string'}, + } +}) +minetest.register_craft({ + output = "mcl_fishing:fishing_rod", + recipe = { + {'mcl_core:stick', '', ''}, + {'mcl_core:string', 'mcl_core:stick', ''}, + {'mcl_core:string','','mcl_core:stick'}, + } +}) + +minetest.register_craft({ + type = "fuel", + recipe = "mcl_fishing:fishing_rod", + burntime = 15, +}) + + +-- Fish +minetest.register_craftitem("mcl_fishing:fish_raw", { + description = "Raw Fish", + inventory_image = "mcl_fishing_fish_raw.png", + on_use = minetest.item_eat(2), + stack_max = 64, + groups = { food=2, eatable = 2 }, +}) + +minetest.register_craftitem("mcl_fishing:fish_cooked", { + description = "Cooked Fish", + inventory_image = "mcl_fishing_fish_cooked.png", + on_use = minetest.item_eat(5), + stack_max = 64, + groups = { food=2, eatable=5 }, +}) + +minetest.register_craft({ + type = "cooking", + output = "mcl_fishing:fish_cooked", + recipe = "mcl_fishing:fish_raw", + cooktime = 10, +}) + diff --git a/mods/mcl_fishing/mod.conf b/mods/mcl_fishing/mod.conf new file mode 100644 index 00000000..3a02c5cf --- /dev/null +++ b/mods/mcl_fishing/mod.conf @@ -0,0 +1 @@ +name = mcl_fishing diff --git a/mods/mcl_core/textures/default_fish_cooked.png b/mods/mcl_fishing/textures/mcl_fishing_fish_cooked.png similarity index 100% rename from mods/mcl_core/textures/default_fish_cooked.png rename to mods/mcl_fishing/textures/mcl_fishing_fish_cooked.png diff --git a/mods/mcl_core/textures/default_fish.png b/mods/mcl_fishing/textures/mcl_fishing_fish_raw.png similarity index 100% rename from mods/mcl_core/textures/default_fish.png rename to mods/mcl_fishing/textures/mcl_fishing_fish_raw.png diff --git a/mods/mcl_core/textures/default_tool_fishing_pole.png b/mods/mcl_fishing/textures/mcl_fishing_fishing_rod.png similarity index 100% rename from mods/mcl_core/textures/default_tool_fishing_pole.png rename to mods/mcl_fishing/textures/mcl_fishing_fishing_rod.png