diff --git a/README.md b/README.md index 750ed9a..09097f7 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -# fishing minetest fishing mod + + +-- original by 4aiman https://github.com/4aiman/fishing diff --git a/amorce.lua b/amorce.lua new file mode 100644 index 0000000..e34343f --- /dev/null +++ b/amorce.lua @@ -0,0 +1,19 @@ + + + + + + + +-- amorce + +minetest.register_craftitem("fishing:amorce", { + description = "Amorce", + inventory_image = "fishing_amorce.png", +}) + +minetest.register_craft({ + type = "shapeless", + output = "fishing:amorce", + recipe = {"farming:flour", "farming:corn", "food:egg", "bucket:bucket_water"} +}) diff --git a/baits.lua b/baits.lua new file mode 100644 index 0000000..52e2d21 --- /dev/null +++ b/baits.lua @@ -0,0 +1,20 @@ + + + +--bait_corn +minetest.register_craftitem("fishing:bait_corn", { + description = "Bait corn", + inventory_image = "fishing_bait_corn.png", +}) + +fishing_setting.baits["fishing:bait_corn"] = { ["bait"] = "fishing:bait_corn", ["bobber"] = "fishing:bobber_entity" } + + + +--bait_pain +minetest.register_craftitem("fishing:bait_pain", { + description = "Bait pain", + inventory_image = "fishing_bait_corn.png", +}) + +fishing_setting.baits["fishing:bait_pain"] = { ["bait"] = "fishing:bait_pain", ["bobber"] = "fishing:bobber_entity" } diff --git a/bobber.lua b/bobber.lua new file mode 100644 index 0000000..41911da --- /dev/null +++ b/bobber.lua @@ -0,0 +1,218 @@ + + +minetest.register_alias("flowers_plus:seaweed", "flowers:seaweed") -- exception + + +-- bobber +minetest.register_node("fishing:bobber_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { +-- { left, bottom, front, right, top , back} + {-8/16, -8/16, 0, 8/16, 8/16, 0}, -- feathers + {-2/16, -8/16, -2/16, 2/16, -4/16, 2/16}, -- bobber + } + }, + tiles = { + "fishing_bobber_top.png", + "fishing_bobber_bottom.png", + "fishing_bobber.png", + "fishing_bobber.png", + "fishing_bobber.png", + "fishing_bobber.png^[transformFX" + }, -- + groups = {not_in_creative_inventory=1}, +}) + + +local FISHING_BOBBER_ENTITY={ + hp_max = 605, + water_damage = 1, + physical = true, + timer = 0, + env_damage_timer = 0, + visual = "wielditem", + visual_size = {x=1/3, y=1/3, z=1/3}, + textures = {"fishing:bobber_box"}, + -- {left ,bottom, front, right, top , back} + collisionbox = {-2/16, -4/16, -2/16, 2/16, 0/16, 2/16}, + view_range = 7, + randomtime = 50, + chance = 0, + amorce = false, + prize = "", + +-- DESTROY BOBBER WHEN PUNCHING IT + on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir) + if not puncher:is_player() then return end + local player = puncher:get_player_name() + if player ~= self.object.owner then return end + if MESSAGES == true then minetest.chat_send_player(player, fishing_setting.S("You didn't prizes anything."), false) end -- fish escaped + if not fishing_setting.is_creative_mode then + local inv = puncher:get_inventory() + if inv:room_for_item("main", {name="fishing:bait_corn", count=1, wear=0, metadata=""}) then + inv:add_item("main", {name="fishing:bait_corn", count=1, wear=0, metadata=""}) + if MESSAGES == true then minetest.chat_send_player(player, fishing_setting.S("The bait is still there."), false) end -- bait still there + end + end + -- make sound and remove bobber + minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, }) + self.object:remove() + end, + + + + +-- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE) + on_rightclick = function (self, clicker) + local item = clicker:get_wielded_item() + local player = clicker:get_player_name() + local inv = clicker:get_inventory() + local pos = self.object:getpos() + local item_name = item:get_name() + if string.find(item_name, "fishing:pole_") ~= nil then + +--############################################################################################################## + if self.prize ~= "" then + local name = self.prize[1]..":"..self.prize[2] + local desc = self.prize[4] + print("You caught "..name.." "..desc) + minetest.chat_send_player(player, "You caught "..desc, false) + if inv:room_for_item("main", {name=name, count=1, wear=0, metadata=""}) then + local used + if self.prize[3] == "random" then + used = (2000*(math.random(20, 29))) + elseif self.prize[3] == "randomtools" then + used = (65535/(30-(math.random(15, 29)))) + else + used = 0 + end + inv:add_item("main", {name=name, count=1, wear=used, metadata=""}) + else + minetest.spawn_item(clicker:getpos(), name) + end + end + + -- weither player has fishing pole or not + minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, }) + self.object:remove() + + +--############################################################################################################## + + + + elseif item:get_name() == "fishing:amorce" then + + + if not fishing_setting.is_creative_mode then + inv:remove_item("main", "fishing:amorce") + end + self.amorce = true + --addparticle + minetest.add_particlespawner(30, 0.5, -- for how long (?) -- Particles on splash + {x=pos.x,y=pos.y-0.0625,z=pos.z}, {x=pos.x,y=pos.y,z=pos.z}, -- position min, pos max + {x=-2,y=-0.0625,z=-2}, {x=2,y=3,z=2}, -- velocity min, vel max + {x=0,y=-9.8,z=0}, {x=0,y=-9.8,z=0}, + 0.3, 1.2, + 0.25, 0.5, -- min size, max size + false, "fishing_particle_amorce.png") + -- add sound + minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(), gain = 0.2, }) + --inc hp + print("amorce") + end + end, + + + + + +-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE + on_step = function(self, dtime) + local pos = self.object:getpos() + + if self.owner == nil then self.object:remove(); return end + local player = minetest.get_player_by_name(self.owner) + if not player then self.object:remove(); return end + --remove if nobody in radius + local p = player:getpos() + local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5 + if dist > self.view_range then + minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,}) + self.object:remove() + return + end + + --rotate bobber + if math.random(1, 4) == 1 then + self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi)) + end + + --################### + self.timer = self.timer + 1 + if self.timer < self.randomtime then + if self.prize ~= "" then + local n = math.random(1,3) + if n == 1 then + if self.old_pos2 == true then + pos.y = pos.y-0.0325 + self.object:moveto(pos, false) + self.old_pos2 = false + else + pos.y = pos.y+0.0325 + self.object:moveto(pos, false) + self.old_pos2 = true + end + end + end + return + end + + self.timer = 0 + self.object:moveto(self.old_pos, false) + self.randomtime = math.random(2,12)*10 + --self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z}) + --print("randomtime:"..tostring(self.randomtime)) + if math.random(1, 100) > FISH_CHANCE then + self.prize = "" + return + end + + local c = 0 + if self.amorce then + c = 20 + end + + + local chance = math.random(1, 100)+c + print(" chance: " .. tostring(chance) .. " randomtime: "..tostring(self.randomtime)) + if chance == 1 then + local r = math.random(1, 100) + if r < 10 then + self.prize = fishing_setting.prizes.tresor[math.random(1,#fishing_setting.prizes.tresor)] + else + self.prize = "" + end + elseif chance < 10 then + self.prize = "" + elseif chance < 40 then + self.prize = fishing_setting.prizes.loose[math.random(1,#fishing_setting.prizes.loose)] + else + self.prize = fishing_setting.prizes.fish[math.random(1,#fishing_setting.prizes.fish)] + end + + self.amorce = false + if self.prize ~= nil then + pos.y = self.old_pos.y-0.1 + self.object:moveto(pos, false) + minetest.sound_play("fishing_bobber1", {pos=pos,gain = 0.5,}) + print("prize: "..tostring(self.prize[1])..":"..tostring(self.prize[2])) + end + end, +} + + +minetest.register_entity("fishing:bobber_entity", FISHING_BOBBER_ENTITY) + diff --git a/chatcommands.lua b/chatcommands.lua new file mode 100644 index 0000000..b08d173 --- /dev/null +++ b/chatcommands.lua @@ -0,0 +1,75 @@ + + + + --FIXME server set fishing enable|disable treasure +minetest.register_chatcommand("fishing_enable", { + params = "", + description = "display trophie of treasure from the water", + privs = {server=true}, + func = function(name, param) + if param == "true" then + fishing_setting.enable = true + minetest.chat_send_player(name, "treasure is enabled") + elseif param == "false" then + fishing_setting.enable = false + minetest.chat_send_player(name, "treasure is disabled") + else + minetest.chat_send_player(name, "unknow param ".. tostring(param)) + minetest.chat_send_player(name, "command is /fishing_enable ") + end + + + end +}) + + + + + +--[[ --FIXME server set fishing random timer +minetest.register_chatcommand("fishing_stimer", { + params = "", + description = "display trophie of treasure from the water", + privs = {server=true}, + func = function(name, param) + minetest.chat_send_player(name, "treasure is " .. treasure) + + end +}) +]] + + +--[[ --FIXME server set fishing config +minetest.register_chatcommand("fishing_setting", { + params = "", + description = "display trophie of treasure from the water", + privs = {server=true}, + func = function(name, param) + minetest.chat_send_player(name, "") + + end +}) +]] + + + +minetest.register_chatcommand("fishing_trophies", { + params = "", + description = "display trophie of treasure from the water", + privs = {}, + func = function(name, param) + --FIXME fixed treasure + local tresure = "nothing" + minetest.chat_send_player(name, "treasure is " .. treasure) + + end +}) + + + +--[[ +minetest.register_on_joinplayer(function(player) + local name = player:get_player_name() + +end) +]] diff --git a/crafting.lua b/crafting.lua new file mode 100644 index 0000000..61882b2 --- /dev/null +++ b/crafting.lua @@ -0,0 +1,75 @@ + +----------------------------------------------------------------------------------------------- +-- Fishing Pole +----------------------------------------------------------------------------------------------- +minetest.register_craft({ + output = "fishing:pole_wood", + recipe = { + {"", "", "group:stick" }, + {"", "group:stick", "farming:string"}, + {"group:stick", "", "farming:string"}, + } +}) + +if minetest.get_modpath("moreblocks") ~= nil then +minetest.register_craft({ + output = "fishing:pole_wood", + recipe = { + {"", "", "group:stick" }, + {"", "group:stick", "moreblocks:rope" }, + {"group:stick", "", "moreblocks:rope" }, + } +}) +end + +if minetest.get_modpath("ropes") ~= nil then + minetest.register_craft({ + output = "fishing:pole_wood", + recipe = { + {"", "", "group:stick" }, + {"", "group:stick", "ropes:rope" }, + {"group:stick", "", "ropes:rope" }, + } + }) +end + +-- Mithril Fishing Pole +if minetest.get_modpath("moreores") ~= nil and minetest.get_modpath("mobs") ~= nil then +minetest.register_craft({ + output = "fishing:pole_perfect", + recipe = { + {"", "", "moreores:mithril_ingot" }, + {"", "moreores:mithril_ingot", "mobs:spider_cobweb" }, + {"moreores:mithril_ingot", "", "mobs:spider_cobweb" }, + } +}) +end + + +----------------------------------------------------------------------------------------------- +-- Fishing bait +----------------------------------------------------------------------------------------------- +--bait corn +minetest.register_craft({ + output = "fishing:bait_corn 9", + recipe = { + {"", "farming:corn", ""}, + } +}) + +--bait pain +minetest.register_craft({ + output = "fishing:bait_pain 9", + recipe = { + {"", "farming:bread", ""}, + } +}) + + +----------------------------------------------------------------------------------------------- +-- Fishing bobber +----------------------------------------------------------------------------------------------- +--bobber + + + diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..d77ba25 --- /dev/null +++ b/depends.txt @@ -0,0 +1,2 @@ +default +farming diff --git a/fishes.lua b/fishes.lua new file mode 100644 index 0000000..62c167b --- /dev/null +++ b/fishes.lua @@ -0,0 +1,79 @@ +------------------------------------------------------------------------------------------- +-- Fishing - Mossmanikin's version - Fishes 0.0.4 +-- License (code & textures): WTFPL +----------------------------------------------------------------------------------------------- + +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + +----------------------------------------------------------------------------------------------- +-- Fish +----------------------------------------------------------------------------------------------- +minetest.register_craftitem("fishing:fish_raw", { + description = S("Fish"), + groups = {}, + inventory_image = "fishing_fish.png", + on_use = minetest.item_eat(2), +}) + ----------------------------------------------------- + -- Roasted Fish + ----------------------------------------------------- + minetest.register_craftitem("fishing:fish", { + description = S("Roasted Fish"), + groups = {}, + inventory_image = "fishing_fish_cooked.png", + on_use = minetest.item_eat(4), + }) + ----------------------------------------------------- + -- Sushi + ----------------------------------------------------- + minetest.register_craftitem("fishing:sushi", { + description = S("Sushi (Hoso Maki)"), + groups = {}, + inventory_image = "fishing_sushi.png", + on_use = minetest.item_eat(6), + }) + +----------------------------------------------------------------------------------------------- +-- Whatthef... it's a freakin' Shark! +----------------------------------------------------------------------------------------------- +minetest.register_craftitem("fishing:shark", { + description = S("Shark"), + groups = {}, + inventory_image = "fishing_shark.png", + on_use = minetest.item_eat(2), +}) + ----------------------------------------------------- + -- Roasted Shark + ----------------------------------------------------- + minetest.register_craftitem("fishing:shark_cooked", { + description = S("Roasted Shark"), + groups = {}, + inventory_image = "fishing_shark_cooked.png", + on_use = minetest.item_eat(6), + }) + +----------------------------------------------------------------------------------------------- +-- Pike +----------------------------------------------------------------------------------------------- +minetest.register_craftitem("fishing:pike", { + description = S("Northern Pike"), + groups = {}, + inventory_image = "fishing_pike.png", + on_use = minetest.item_eat(2), +}) + ----------------------------------------------------- + -- Roasted Pike + ----------------------------------------------------- + minetest.register_craftitem("fishing:pike_cooked", { + description = S("Roasted Northern Pike"), + groups = {}, + inventory_image = "fishing_pike_cooked.png", + on_use = minetest.item_eat(6), + }) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..9ece440 --- /dev/null +++ b/init.lua @@ -0,0 +1,61 @@ +print("loading [fishing] mod") +fishing_setting = {} + + +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + fishing_setting.S = intllib.Getter(minetest.get_current_modname()) +else + fishing_setting.S = function ( s ) return s end +end + + + +fishing_setting.file = minetest.get_worldpath() .. "/fishing_config.txt" +fishing_setting.is_creative_mode = minetest.setting_getbool("creative_mode") +fishing_setting.setting = {} +fishing_setting.random_timer = 3600 +fishing_setting.prizes = {} + +--for random object +random_objects = {} + +fishing_setting.baits = {} +local path = minetest.get_modpath("fishing").."/" +dofile(path .."settings.txt") +dofile(path .."crafting.lua") +dofile(path .."baits.lua") +dofile(path .."prizes.lua") +dofile(path .."amorce.lua") +dofile(path .."bobber.lua") +--dofile(path .."bobber_shark.lua") +dofile(path .."fishes.lua") +dofile(path .."trophies.lua") +dofile(path .."poles.lua") + + + +-- timer +fishing_setting.timer = 0 +minetest.register_globalstep(function(dtime) + if fishing_setting.enable == false then return end + fishing_setting.timer = fishing_setting.timer - dtime +-- if fishing.new_object then + -- new object is item, time to catch is timer + -- fishing_setting.timer = fishing_setting.random_timer +-- end +-- if timer == 300 then + --you have 5min for catch item +-- end + if fishing_setting.timer < 0 then + for _, player in ipairs(minetest.get_connected_players()) do + local name = player:get_player_name() + --FIXME display message + end + --get random object + fishing_setting.timer = fishing_setting.random_timer + end +end) + + + diff --git a/locale/de.txt b/locale/de.txt new file mode 100644 index 0000000..0e1ea57 --- /dev/null +++ b/locale/de.txt @@ -0,0 +1,56 @@ +# Translation by Xanthin + +### bobber.lua ### +You caught a Fish. = Du hast einen Fisch gefangen. +You caught a Clownfish. = Du hast einen Clownfisch gefangen. +You caught a Blue white fish. = Du hast einen blau-weissen Fisch gefangen. +You caught a Twig. = Du hast einen Zweig gefangen. +You caught a Rat. = Du hast eine Ratte gefangen. +You caught some Seaweed. = Du hast etwas Seetang gefangen. +You caught a Green Kelp. = Du hast etwas gruenen Kelp gefangen. +You caught a String. = Du hast eine Schnur gefangen. +You caught an old Fishing Pole. = Du hast eine alte Angelrute gefangen. +You caught some very old Boots. = Du hast ein Paar sehr alte Schuhe gefangen. +You caught a Waterlily. = Du hast eine Seerose gefangen. +You didn't catch anything. = Du hast nichts gefangen. +The bait is still there. = Der Koeder ist noch vorhanden. +Your fish escaped. = Dein Fisch ist entkommen. + +### bobber_shark.lua ### +You caught a small Shark. = Du hast einen kleinen Hai gefangen. +You caught a Northern Pike. = Du hast einen Hecht gefangen. +You didn't catch any fish. = Du hast keinen Fisch gefangen. + +### crafting.lua ### +### fishes.lua ### +Fish = Fisch +Roasted Fish = Gebratener Fisch +Sushi (Hoso Maki) = Sushi (Hoso Maki) +Shark = Hai +Roasted Shark = Gebratener Hai +Northern Pike = Hecht +Roasted Northern Pike = Gebratener Hecht + +### init.lua ### +Fishing Pole = Angelrute +Dirt = Erde +Wooden Hoe = Holzhacke +Stone Hoe = Steinhacke +Steel Hoe = Stahlhacke +Bronze Hoe = Bronzehacke + +### trophies.lua ### +Fish Trophy = Fisch-Trophaee +Northern Pike Trophy = Hecht-Trophaee +Shark Trophy = Hai-Trophaee +Clownfish Trophy = Clownfisch-Trophaee +Blue white fish Trophy = Blau-weisser-Fisch-Trophaee +Trophy = Trophaee +This Huge Fish was caught by the Famous Angler %s ! = Dieser riesige Fisch wurde vom beruehmten Angler %s gefangen! +This Huge Northern Pike was caught by the Famous Angler %s ! = Dieser riesige Hecht wurde vom beruehmten Angler %s gefangen! +This Huge Shark was caught by the Famous Angler %s ! = Dieser riesige Hai wurde vom beruehmten Angler %s gefangen! +This Huge Clownfish was caught by the Famous Angler %s ! = Dieser riesige Clownfisch wurde vom beruehmten Angler %s gefangen! +This Huge Blue white fish was caught by the Famous Angler %s ! = Dieser riesige blau-weisse Fisch wurde vom beruehmten Angler %s gefangen! + +### worms.lua ### +Worm = Wurm diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..3ed36dc --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,56 @@ +# Template + +### bobber.lua ### +You caught a Fish. = +You caught a Clownfish. = +You caught a Blue white fish. = +You caught a Twig. = +You caught a Rat. = +You caught some Seaweed. = +You caught a Green Kelp. = +You caught a String. = +You caught an old Fishing Pole. = +You caught some very old Boots. = +You caught a Waterlily. = +You didn't catch anything. = +The bait is still there. = +Your fish escaped. = + +### bobber_shark.lua ### +You caught small Shark. = +You caught a Northern Pike. = +You didn't catch any fish. = + +### crafting.lua ### +### fishes.lua ### +Fish = +Roasted Fish = +Sushi (Hoso Maki) = +Shark = +Roasted Shark = +Northern Pike = +Roasted Northern Pike = + +### init.lua ### +Fishing Pole = +Dirt = +Wooden Hoe = +Stone Hoe = +Steel Hoe = +Bronze Hoe = + +### trophies.lua ### +Fish Trophy = +Northern Pike Trophy = +Shark Trophy = +Clownfish Trophy = +Blue white fish Trophy = +Trophy = +This Huge Fish was caught by the Famous Angler %s ! = +This Huge Northern Pike was caught by the Famous Angler %s ! = +This Huge Shark was caught by the Famous Angler %s ! = +This Huge Clownfish was caught by the Famous Angler %s ! = +This Huge Blue white fish was caught by the Famous Angler %s ! = + +### worms.lua ### +Worm = diff --git a/poles.lua b/poles.lua new file mode 100644 index 0000000..3ca99ab --- /dev/null +++ b/poles.lua @@ -0,0 +1,153 @@ +----------------------------------------------------------------------------------------------- +-- Fishing Pole +----------------------------------------------------------------------------------------------- + +local function rod_wear(itemstack, user, pointed_thing, uses) + itemstack:add_wear(65535/(uses-1)) + return itemstack +end + + +fishing_setting.poles = {} +fishing_setting.poles.wood = {["name"] = "wood", ["max_use"] = 30, ["desc"] = fishing_setting.S("Fishing Pole") } +fishing_setting.poles.perfect = {["name"] = "perfect", ["max_use"] = 1500, ["desc"] = fishing_setting.S("Perfect Fishing Pole") } + + +for _,pole in pairs(fishing_setting.poles) do + minetest.register_tool("fishing:pole_".. pole.name, { + description = pole.desc, + groups = {}, + inventory_image = "fishing_pole_".. pole.name ..".png", + wield_image = "fishing_pole_".. pole.name ..".png^[transformFXR270", + stack_max = 1, + liquids_pointable = true, + + on_use = function (itemstack, user, pointed_thing) + if pointed_thing and pointed_thing.under then + local pt = pointed_thing + local node = minetest.get_node(pt.under) + if string.find(node.name, "default:water") == nil then return nil end + local player = user:get_player_name() + local inv = user:get_inventory() + local bait = inv:get_stack("main", user:get_wield_index()+1 ):get_name() + if fishing_setting.baits[bait] == nil then return nil end + + + local bobbers = {} + local objs = minetest.get_objects_inside_radius(pt.under, 3) + for m, obj in pairs(objs) do + if obj:get_luaentity() ~= nil and string.find(obj:get_luaentity().name, "fishing:bobber") ~= nil then + bobbers[m] = obj + end + end + + local nodes = {} + local i = 1 + for _,k in pairs({ 1, 0, -1}) do + for _,l in pairs({ -1, 0, 1}) do + if string.find(minetest.get_node({x=pt.under.x+l, y=pt.under.y, z=pt.under.z+k}).name, "default:water") ~= nil + and minetest.get_node({x=pt.under.x+l, y=pt.under.y+1, z=pt.under.z+k}).name == "air" then + local empty = true + for o, obj in pairs(bobbers) do + local p = obj:getpos() + local dist = ((p.x-pt.under.x)^2 + (p.y-pt.under.y)^2 + (p.z-pt.under.z)^2)^0.5 + if dist < 2 then + empty = false + break + end + end + if empty then + nodes[i] = {x=pt.under.x+l, y=pt.under.y, z=pt.under.z+k} + i = i+1 + end + end + end + end + --if water == -3 nodes + if #nodes < 1 then return nil end + local new_pos = nodes[math.random(1, #nodes)] + new_pos.y=new_pos.y+(45/64) + local ent = minetest.add_entity({interval = 1,x=new_pos.x, y=new_pos.y, z=new_pos.z}, fishing_setting.baits[bait].bobber) + if not ent then return nil end + local luaentity = ent:get_luaentity() + luaentity.owner = player + luaentity.prize = "" + luaentity.old_pos = new_pos + luaentity.old_pos2 = true + if not fishing_setting.is_creative_mode then + inv:remove_item("main", bait) + end + minetest.sound_play("fishing_bobber2", {pos = new_pos, gain = 0.5}) + + if WEAR_OUT == true and not fishing_setting.is_creative_mode then + return rod_wear(itemstack, user, pointed_thing, pole.max_use) + else + return {name="fishing:pole_".. pole.name, count=1, wear=0, metadata=""} + end + end + return nil + end, + + + on_place = function(itemstack, placer, pointed_thing) + local pt = pointed_thing + local pt_under_name = minetest.get_node(pt.under).name + if pt_under_name ~= "default:water_source" and pt_under_name ~= "default:water_flowing" then + local wear = itemstack:get_wear() + --print (wear) + local direction = minetest.dir_to_facedir(placer:get_look_dir()) + --local meta1 = minetest.get_meta(pt.under) + local meta = minetest.get_meta(pt.above) + minetest.set_node(pt.above, {name="fishing:pole_".. pole.name .."_deco", param2=direction}) + --meta1:set_int("wear", wear) + meta:set_int("wear", wear) + if not fishing_setting.is_creative_mode then + itemstack:take_item() + end + end + return itemstack + end, + }) + + + + + minetest.register_node("fishing:pole_".. pole.name .."_deco", { + description = pole.desc, + inventory_image = "fishing_pole_".. pole.name ..".png", + wield_image = "fishing_pole.png^[transformFXR270", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = { + "fishing_pole_".. pole.name .."_simple.png", + "fishing_pole_".. pole.name .."_simple.png", + "fishing_pole_".. pole.name .."_simple.png", + "fishing_pole_".. pole.name .."_simple.png^[transformFX", + }, + groups = { snappy=3, flammable=2, not_in_creative_inventory=1 }, + node_box = { + type = "fixed", + fixed = { + { 0 , -1/2 , 0 , 0 , 1/2 , 1 }, + } + }, + selection_box = { + type = "fixed", + fixed = { + {-1/16 , -1/2 , 0 , 1/16 , 1/2 , 1 }, + } + }, + sounds = default.node_sound_wood_defaults(), + on_dig = function(pos, node, digger) + if digger:is_player() and digger:get_inventory() then + local meta = minetest.get_meta(pos) + local wear_out = meta:get_int("wear") + digger:get_inventory():add_item("main", {name="fishing:pole_".. pole.name, count=1, wear=wear_out, metadata=""}) + end + minetest.remove_node(pos) + end, + }) + +end + diff --git a/prizes.lua b/prizes.lua new file mode 100644 index 0000000..45328eb --- /dev/null +++ b/prizes.lua @@ -0,0 +1,28 @@ + + + + + +fishing_setting.prizes.fish = { + {"fishing", "fish_raw", 0, "a Fish.", 1, 60} + } + + +-- Here's what you can prizes +fishing_setting.prizes.loose = { +-- MoD iTeM WeaR MeSSaGe ("You caught "..) NRMiN CHaNCe (../120) + {"default", "stick", 0, "a Twig.", 81, 2}, + {"mobs", "rat", 0, "a Rat.", 83, 1}, + {"flowers_plus", "seaweed", 0, "some Seaweed.", 86, 20}, + {"seaplants", "kelpgreen", 0, "a Green Kelp.", 106, 10}, + {"farming", "string", 0, "a String.", 116, 2}, + {"trunks", "twig_1", 0, "a Twig.", 121, 2} +} + + +fishing_setting.prizes.tresor = { + {"fishing", "pole_wood", "randomtools", "an old Fishing Pole.", 118, 2}, + {"3d_armor", "boots_wood", "random", "some very old Boots.", 120, 1} +} + + diff --git a/random_object.lua b/random_object.lua new file mode 100644 index 0000000..beb51a2 --- /dev/null +++ b/random_object.lua @@ -0,0 +1,3 @@ + + +random_objects = {} diff --git a/settings.txt b/settings.txt new file mode 100644 index 0000000..259d822 --- /dev/null +++ b/settings.txt @@ -0,0 +1,9 @@ +MESSAGES = true +FISH_CHANCE = 60 +NEW_WORM_SOURCE = true +WORM_IS_MOB = true +WORM_CHANCE = 66 +WEAR_OUT = true +BOBBER_CHECK_RADIUS = 5 +SIMPLE_DECO_FISHING_POLE = true +SHARK_CHANCE = 30 diff --git a/sounds/SoundLicense.txt b/sounds/SoundLicense.txt new file mode 100644 index 0000000..49017e9 --- /dev/null +++ b/sounds/SoundLicense.txt @@ -0,0 +1,4 @@ +These sounds are used for the Mod for Minetest; Fishing - Mossmanikin's version. +The included sounds are http://creativecommons.org/licenses/by-nc-sa/3.0/ + +--"fishing_bobber1" & "fishing_bobber2" sampled from "01260 water swimming splashing 1.wav", Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/ \ No newline at end of file diff --git a/sounds/fishing_bobber1.ogg b/sounds/fishing_bobber1.ogg new file mode 100644 index 0000000..6c86a0c Binary files /dev/null and b/sounds/fishing_bobber1.ogg differ diff --git a/sounds/fishing_bobber2.ogg b/sounds/fishing_bobber2.ogg new file mode 100644 index 0000000..932cf0b Binary files /dev/null and b/sounds/fishing_bobber2.ogg differ diff --git a/textures/alternates/fishing_bobber.png b/textures/alternates/fishing_bobber.png new file mode 100644 index 0000000..e741dd0 Binary files /dev/null and b/textures/alternates/fishing_bobber.png differ diff --git a/textures/alternates/fishing_bobber_bottom.png b/textures/alternates/fishing_bobber_bottom.png new file mode 100644 index 0000000..e3404aa Binary files /dev/null and b/textures/alternates/fishing_bobber_bottom.png differ diff --git a/textures/alternates/fishing_bobber_top.png b/textures/alternates/fishing_bobber_top.png new file mode 100644 index 0000000..b4b4a4e Binary files /dev/null and b/textures/alternates/fishing_bobber_top.png differ diff --git a/textures/alternates/fishing_pole.png b/textures/alternates/fishing_pole.png new file mode 100644 index 0000000..4625a09 Binary files /dev/null and b/textures/alternates/fishing_pole.png differ diff --git a/textures/animal_clownfish_clownfish_item.png b/textures/animal_clownfish_clownfish_item.png new file mode 100644 index 0000000..69f0fcc Binary files /dev/null and b/textures/animal_clownfish_clownfish_item.png differ diff --git a/textures/animal_fish_blue_white_fish_blue_white_item.png b/textures/animal_fish_blue_white_fish_blue_white_item.png new file mode 100644 index 0000000..5f8224e Binary files /dev/null and b/textures/animal_fish_blue_white_fish_blue_white_item.png differ diff --git a/textures/fishing_amorce.png b/textures/fishing_amorce.png new file mode 100644 index 0000000..b72550f Binary files /dev/null and b/textures/fishing_amorce.png differ diff --git a/textures/fishing_bait_corn.png b/textures/fishing_bait_corn.png new file mode 100644 index 0000000..46c2c80 Binary files /dev/null and b/textures/fishing_bait_corn.png differ diff --git a/textures/fishing_bobber.png b/textures/fishing_bobber.png new file mode 100644 index 0000000..42bfe69 Binary files /dev/null and b/textures/fishing_bobber.png differ diff --git a/textures/fishing_bobber_bottom.png b/textures/fishing_bobber_bottom.png new file mode 100644 index 0000000..32a54f7 Binary files /dev/null and b/textures/fishing_bobber_bottom.png differ diff --git a/textures/fishing_bobber_feather_1.png b/textures/fishing_bobber_feather_1.png new file mode 100644 index 0000000..9eff3f8 Binary files /dev/null and b/textures/fishing_bobber_feather_1.png differ diff --git a/textures/fishing_bobber_top.png b/textures/fishing_bobber_top.png new file mode 100644 index 0000000..039620b Binary files /dev/null and b/textures/fishing_bobber_top.png differ diff --git a/textures/fishing_deco_pike.png b/textures/fishing_deco_pike.png new file mode 100644 index 0000000..fc6079e Binary files /dev/null and b/textures/fishing_deco_pike.png differ diff --git a/textures/fishing_fish.png b/textures/fishing_fish.png new file mode 100644 index 0000000..1cf74ac Binary files /dev/null and b/textures/fishing_fish.png differ diff --git a/textures/fishing_fish_cooked.png b/textures/fishing_fish_cooked.png new file mode 100644 index 0000000..709d8f2 Binary files /dev/null and b/textures/fishing_fish_cooked.png differ diff --git a/textures/fishing_particle_amorce.png b/textures/fishing_particle_amorce.png new file mode 100644 index 0000000..f861b3a Binary files /dev/null and b/textures/fishing_particle_amorce.png differ diff --git a/textures/fishing_pike.png b/textures/fishing_pike.png new file mode 100644 index 0000000..5c7885f Binary files /dev/null and b/textures/fishing_pike.png differ diff --git a/textures/fishing_pike_cooked.png b/textures/fishing_pike_cooked.png new file mode 100644 index 0000000..7d66e7c Binary files /dev/null and b/textures/fishing_pike_cooked.png differ diff --git a/textures/fishing_pole_perfect.png b/textures/fishing_pole_perfect.png new file mode 100644 index 0000000..f8da2cb Binary files /dev/null and b/textures/fishing_pole_perfect.png differ diff --git a/textures/fishing_pole_perfect_back.png b/textures/fishing_pole_perfect_back.png new file mode 100644 index 0000000..10039be Binary files /dev/null and b/textures/fishing_pole_perfect_back.png differ diff --git a/textures/fishing_pole_perfect_bottom.png b/textures/fishing_pole_perfect_bottom.png new file mode 100644 index 0000000..569b047 Binary files /dev/null and b/textures/fishing_pole_perfect_bottom.png differ diff --git a/textures/fishing_pole_perfect_front.png b/textures/fishing_pole_perfect_front.png new file mode 100644 index 0000000..600d1a1 Binary files /dev/null and b/textures/fishing_pole_perfect_front.png differ diff --git a/textures/fishing_pole_perfect_simple.png b/textures/fishing_pole_perfect_simple.png new file mode 100644 index 0000000..c6c433a Binary files /dev/null and b/textures/fishing_pole_perfect_simple.png differ diff --git a/textures/fishing_pole_perfect_top.png b/textures/fishing_pole_perfect_top.png new file mode 100644 index 0000000..177e5d1 Binary files /dev/null and b/textures/fishing_pole_perfect_top.png differ diff --git a/textures/fishing_pole_wood.png b/textures/fishing_pole_wood.png new file mode 100644 index 0000000..bbb196b Binary files /dev/null and b/textures/fishing_pole_wood.png differ diff --git a/textures/fishing_pole_wood_back.png b/textures/fishing_pole_wood_back.png new file mode 100644 index 0000000..7b58478 Binary files /dev/null and b/textures/fishing_pole_wood_back.png differ diff --git a/textures/fishing_pole_wood_bottom.png b/textures/fishing_pole_wood_bottom.png new file mode 100644 index 0000000..6f52ca8 Binary files /dev/null and b/textures/fishing_pole_wood_bottom.png differ diff --git a/textures/fishing_pole_wood_deco.png b/textures/fishing_pole_wood_deco.png new file mode 100644 index 0000000..9224988 Binary files /dev/null and b/textures/fishing_pole_wood_deco.png differ diff --git a/textures/fishing_pole_wood_front.png b/textures/fishing_pole_wood_front.png new file mode 100644 index 0000000..e8aa3d6 Binary files /dev/null and b/textures/fishing_pole_wood_front.png differ diff --git a/textures/fishing_pole_wood_simple.png b/textures/fishing_pole_wood_simple.png new file mode 100644 index 0000000..afa5b19 Binary files /dev/null and b/textures/fishing_pole_wood_simple.png differ diff --git a/textures/fishing_pole_wood_top.png b/textures/fishing_pole_wood_top.png new file mode 100644 index 0000000..1408eac Binary files /dev/null and b/textures/fishing_pole_wood_top.png differ diff --git a/textures/fishing_shark.png b/textures/fishing_shark.png new file mode 100644 index 0000000..62a1b9e Binary files /dev/null and b/textures/fishing_shark.png differ diff --git a/textures/fishing_shark_cooked.png b/textures/fishing_shark_cooked.png new file mode 100644 index 0000000..b6142ce Binary files /dev/null and b/textures/fishing_shark_cooked.png differ diff --git a/textures/fishing_sushi.png b/textures/fishing_sushi.png new file mode 100644 index 0000000..c64ceca Binary files /dev/null and b/textures/fishing_sushi.png differ diff --git a/textures/fishing_trophy_label.png b/textures/fishing_trophy_label.png new file mode 100644 index 0000000..3c8326b Binary files /dev/null and b/textures/fishing_trophy_label.png differ diff --git a/textures/fishing_worm.png b/textures/fishing_worm.png new file mode 100644 index 0000000..7a4d8d1 Binary files /dev/null and b/textures/fishing_worm.png differ diff --git a/textures/not_in_use/fishing_bobber_feather_1.png b/textures/not_in_use/fishing_bobber_feather_1.png new file mode 100644 index 0000000..9eff3f8 Binary files /dev/null and b/textures/not_in_use/fishing_bobber_feather_1.png differ diff --git a/textures/not_in_use/fishing_bobber_feather_2.png b/textures/not_in_use/fishing_bobber_feather_2.png new file mode 100644 index 0000000..9f710c3 Binary files /dev/null and b/textures/not_in_use/fishing_bobber_feather_2.png differ diff --git a/textures/not_in_use/fishing_bobber_ready.png b/textures/not_in_use/fishing_bobber_ready.png new file mode 100644 index 0000000..2a37b4e Binary files /dev/null and b/textures/not_in_use/fishing_bobber_ready.png differ diff --git a/textures/not_in_use/fishing_pole_on_use.png b/textures/not_in_use/fishing_pole_on_use.png new file mode 100644 index 0000000..96327c7 Binary files /dev/null and b/textures/not_in_use/fishing_pole_on_use.png differ diff --git a/textures/old/fishing_bobber_alternate_old.png b/textures/old/fishing_bobber_alternate_old.png new file mode 100644 index 0000000..5779a71 Binary files /dev/null and b/textures/old/fishing_bobber_alternate_old.png differ diff --git a/textures/old/fishing_bobber_old.png b/textures/old/fishing_bobber_old.png new file mode 100644 index 0000000..d86bf1c Binary files /dev/null and b/textures/old/fishing_bobber_old.png differ diff --git a/textures/old/fishing_pole_wield.png b/textures/old/fishing_pole_wield.png new file mode 100644 index 0000000..cb0dcc9 Binary files /dev/null and b/textures/old/fishing_pole_wield.png differ diff --git a/textures/old/fishing_shark_old6.png b/textures/old/fishing_shark_old6.png new file mode 100644 index 0000000..c8b3c1f Binary files /dev/null and b/textures/old/fishing_shark_old6.png differ diff --git a/trophies.lua b/trophies.lua new file mode 100644 index 0000000..e69de29 diff --git a/worms.lua b/worms.lua new file mode 100644 index 0000000..e69de29