fishing-0.2.0
|
@ -0,0 +1,225 @@
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Bobber 0.1.6
|
||||
-- License (code & textures): WTFPL
|
||||
-- Contains code from: fishing (original), mobs, throwing, volcano
|
||||
-- Supports: 3d_armor, animal_clownfish, animal_fish_blue_white, animal_rat, flowers_plus, mobs, seaplants
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
local PoLeWeaR = (65535/(30-(math.random(15, 29))))
|
||||
local BooTSWear = (2000*(math.random(20, 29)))
|
||||
-- Here's what you can catch
|
||||
local CaTCH = {
|
||||
-- MoD iTeM WeaR MeSSaGe ("You caught "..) GeTBaiTBack NRMiN CHaNCe (../120)
|
||||
{"fishing", "fish_raw", 0, "a Fish.", false, 1, 60},
|
||||
{"animal_clownfish", "clownfish", 0, "a Clownfish.", false, 61, 10},
|
||||
{"animal_fish_blue_white", "fish_blue_white", 0, "a Blue white fish.", false, 71, 10},
|
||||
{"default", "stick", 0, "a Twig.", true, 81, 2},
|
||||
{"mobs", "rat", 0, "a Rat.", false, 83, 1},
|
||||
{"animal_rat", "rat", 0, "a Rat.", false, 84, 1},
|
||||
{"", "rat", 0, "a Rat.", false, 85, 1},
|
||||
{"flowers_plus", "seaweed", 0, "some Seaweed.", true, 86, 20},
|
||||
{"seaplants", "leavysnackgreen", 0, "a Leavy Snack.", true, 106, 10},
|
||||
{"farming", "string", 0, "a String.", true, 116, 2},
|
||||
{"fishing", "pole", PoLeWeaR, "an old Fishing Pole.", true, 118, 2},
|
||||
{"3d_armor", "boots_wood", BooTSWear, "some very old Boots.", true, 120, 1},
|
||||
}
|
||||
minetest.register_alias("flowers_plus:seaweed", "flowers:seaweed") -- exception
|
||||
|
||||
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,
|
||||
-- DESTROY BOBBER WHEN PUNCHING IT
|
||||
on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
local player = puncher:get_player_name()
|
||||
local inv = puncher:get_inventory()
|
||||
if MESSAGES == true then minetest.chat_send_player(player, "You didn't catch anything.", false) end -- fish escaped
|
||||
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then minetest.chat_send_player(player, "The bait is still there.", false) end -- bait still there
|
||||
end
|
||||
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()
|
||||
if item:get_name() == "fishing:pole" then
|
||||
local inv = clicker:get_inventory()
|
||||
--local room_fish = inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
|
||||
local say = minetest.chat_send_player
|
||||
local pos = self.object:getpos()
|
||||
if minetest.env:get_node(pos).name == "flowers:waterlily"
|
||||
or minetest.env:get_node(pos).name == "flowers:waterlily_225"
|
||||
or minetest.env:get_node(pos).name == "flowers:waterlily_45"
|
||||
or minetest.env:get_node(pos).name == "flowers:waterlily_675" then
|
||||
minetest.env:add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"})
|
||||
if inv:room_for_item("main", {name="flowers:waterlily", count=1, wear=WeaR, metadata=""}) then
|
||||
inv:add_item("main", {name="flowers:waterlily", count=1, wear=WeaR, metadata=""})
|
||||
if MESSAGES == true then say(player, "You caught a Waterlily", false) end -- caught Waterlily
|
||||
end
|
||||
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, "The bait is still there.", false) end -- bait still there
|
||||
end
|
||||
elseif self.object:get_hp() <= 300 then
|
||||
if math.random(1, 100) < FISH_CHANCE then
|
||||
local chance = math.random(1, 120) -- ><((((º>
|
||||
for i in pairs(CaTCH) do
|
||||
local MoD = CaTCH[i][1]
|
||||
local iTeM = CaTCH[i][2]
|
||||
local WeaR = CaTCH[i][3]
|
||||
local MeSSaGe = CaTCH[i][4]
|
||||
local GeTBaiTBack = CaTCH[i][5]
|
||||
local NRMiN = CaTCH[i][6]
|
||||
local CHaNCe = CaTCH[i][7]
|
||||
local NRMaX = NRMiN + CHaNCe - 1
|
||||
if chance <= NRMaX and chance >= NRMiN then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
if inv:room_for_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) then
|
||||
inv:add_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""})
|
||||
if MESSAGES == true then say(player, "You caught "..MeSSaGe, false) end -- caught somethin'
|
||||
end
|
||||
if GeTBaiTBack == true then
|
||||
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, "The bait is still there.", false) end -- bait still there?
|
||||
end
|
||||
end
|
||||
else
|
||||
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, "You caught a Fish.", false) end -- caught Fish
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else --if math.random(1, 100) > FISH_CHANCE then
|
||||
if MESSAGES == true then say(player, "Your fish escaped.", false) end -- fish escaped
|
||||
end
|
||||
else -- if self.object:get_hp() > 300 then
|
||||
if MESSAGES == true then say(player, "You didn't catch anything.", false) end -- fish escaped
|
||||
if math.random(1, 2) == 1 then
|
||||
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, "The bait is still there.", false) end -- bait still there
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
self.object:remove()
|
||||
end,
|
||||
-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
if BOBBER_CHECK_RADIUS > 0 then
|
||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, BOBBER_CHECK_RADIUS)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name == "fishing:bobber_entity" then
|
||||
if obj:get_luaentity() ~= self then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if math.random(1, 4) == 1 then
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi))
|
||||
end
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.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()
|
||||
end
|
||||
end
|
||||
local do_env_damage = function(self)
|
||||
self.object:set_hp(self.object:get_hp()-self.water_damage)
|
||||
if self.object:get_hp() == 600 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 595 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 590 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 585 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z})
|
||||
self.object:set_hp(self.object:get_hp()-(math.random(1, 275)))
|
||||
elseif self.object:get_hp() == 300 then
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
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, "default_snow.png")
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() == 295 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() == 290 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() == 285 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.1,z=pos.z})
|
||||
elseif self.object:get_hp() < 284 then
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/1440*math.pi))
|
||||
elseif self.object:get_hp() == 0 then
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
do_env_damage(self)
|
||||
end,
|
||||
}
|
||||
|
||||
minetest.register_entity("fishing:bobber_entity", FISHING_BOBBER_ENTITY)
|
|
@ -0,0 +1,179 @@
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Bobber Shark 0.0.4
|
||||
-- License (code & textures): WTFPL
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- Here's what you can catch if you use a fish as bait
|
||||
local CaTCH_BiG = {
|
||||
-- MoD iTeM WeaR MeSSaGe ("You caught "..) GeTBaiTBack NRMiN CHaNCe (../120)
|
||||
{"fishing", "shark", 0, "a small Shark.", false, 1, 2},
|
||||
{"fishing", "pike", 0, "a Northern Pike.", false, 3, 3}
|
||||
}
|
||||
|
||||
local FISHING_BOBBER_ENTITY_SHARK={
|
||||
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,
|
||||
-- DESTROY BOBBER WHEN PUNCHING IT
|
||||
on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
local player = puncher:get_player_name()
|
||||
if MESSAGES == true then minetest.chat_send_player(player, "Your fish escaped.", false) end -- fish escaped
|
||||
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 say = minetest.chat_send_player
|
||||
if item:get_name() == "fishing:pole" then
|
||||
local inv = clicker:get_inventory()
|
||||
local pos = self.object:getpos()
|
||||
if minetest.env:get_node(pos).name == "flowers:waterlily"
|
||||
or minetest.env:get_node(pos).name == "flowers:waterlily_225"
|
||||
or minetest.env:get_node(pos).name == "flowers:waterlily_45"
|
||||
or minetest.env:get_node(pos).name == "flowers:waterlily_675" then
|
||||
minetest.env:add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"})
|
||||
if inv:room_for_item("main", {name="flowers:waterlily", count=1, wear=WeaR, metadata=""}) then
|
||||
inv:add_item("main", {name="flowers:waterlily", count=1, wear=WeaR, metadata=""})
|
||||
if MESSAGES == true then say(player, "You caught a Waterlily", false) end -- caught Waterlily
|
||||
end
|
||||
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, "The bait is still there.", false) end -- bait still there
|
||||
end
|
||||
elseif self.object:get_hp() <= 300 then
|
||||
if math.random(1, 100) < SHARK_CHANCE then
|
||||
local chance = math.random(1, 6) -- ><((((º>
|
||||
for i in pairs(CaTCH_BiG) do
|
||||
local MoD = CaTCH_BiG[i][1]
|
||||
local iTeM = CaTCH_BiG[i][2]
|
||||
local WeaR = CaTCH_BiG[i][3]
|
||||
local MeSSaGe = CaTCH_BiG[i][4]
|
||||
local GeTBaiTBack = CaTCH_BiG[i][5]
|
||||
local NRMiN = CaTCH_BiG[i][6]
|
||||
local CHaNCe = CaTCH_BiG[i][7]
|
||||
local NRMaX = NRMiN + CHaNCe - 1
|
||||
if chance <= NRMaX and chance >= NRMiN then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
if inv:room_for_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) then
|
||||
inv:add_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""})
|
||||
if MESSAGES == true then say(player, "You caught "..MeSSaGe, false) end -- caught somethin'
|
||||
end
|
||||
if GeTBaiTBack == true then
|
||||
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, "The bait is still there.", false) end -- bait still there?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else --if math.random(1, 100) > FISH_CHANCE then
|
||||
if MESSAGES == true then say(player, "Your fish escaped.", false) end -- fish escaped
|
||||
end
|
||||
else
|
||||
if MESSAGES == true then say(player, "You didn't catch anything.", false) end -- fish escaped
|
||||
if math.random(1, 3) == 1 then
|
||||
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, "The bait is still there.", false) end -- bait still there
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if MESSAGES == true then say(player, "Your fish escaped.", false) end -- fish escaped
|
||||
end
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
self.object:remove()
|
||||
end,
|
||||
-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
if BOBBER_CHECK_RADIUS > 0 then
|
||||
local objs = minetest.env:get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, BOBBER_CHECK_RADIUS)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name == "fishing:bobber_entity_shark" then
|
||||
if obj:get_luaentity() ~= self then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if math.random(1, 4) == 1 then
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi))
|
||||
end
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.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()
|
||||
end
|
||||
end
|
||||
local do_env_damage = function(self)
|
||||
self.object:set_hp(self.object:get_hp()-self.water_damage)
|
||||
if self.object:get_hp() == 600 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 595 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 590 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 585 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z})
|
||||
self.object:set_hp(self.object:get_hp()-(math.random(1, 200)))
|
||||
elseif self.object:get_hp() == 300 then
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.7,
|
||||
})
|
||||
minetest.add_particlespawner(40, 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-0.2,z=pos.z}, -- position min, pos max
|
||||
{x=-3,y=-0.0625,z=-3}, {x=3,y=5,z=3}, -- velocity min, vel max
|
||||
{x=0,y=-9.8,z=0}, {x=0,y=-9.8,z=0},
|
||||
0.3, 2.4,
|
||||
0.25, 0.5, -- min size, max size
|
||||
false, "default_snow.png")
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.625,z=pos.z})
|
||||
elseif self.object:get_hp() == 295 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.425,z=pos.z})
|
||||
elseif self.object:get_hp() == 290 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() == 285 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() < 284 then
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/720*math.pi))
|
||||
elseif self.object:get_hp() == 0 then
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
do_env_damage(self)
|
||||
end,
|
||||
}
|
||||
|
||||
minetest.register_entity("fishing:bobber_entity_shark", FISHING_BOBBER_ENTITY_SHARK)
|
|
@ -0,0 +1,95 @@
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Recipes 0.0.6
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- License (code & textures): WTFPL
|
||||
-- Contains code from: animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
|
||||
-- Looked at code from:
|
||||
-- Dependencies: default, farming
|
||||
-- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing Pole
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- mc style
|
||||
minetest.register_craft({
|
||||
output = "fishing:pole",
|
||||
recipe = {
|
||||
{"", "", "default:stick" },
|
||||
{"", "default:stick", "farming:string"},
|
||||
{"default:stick", "", "farming:string"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "fishing:pole",
|
||||
recipe = {
|
||||
{"", "", "default:stick" },
|
||||
{"", "default:stick", "moreblocks:rope"},
|
||||
{"default:stick", "", "moreblocks:rope"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "fishing:pole",
|
||||
recipe = {
|
||||
{"", "", "default:stick" },
|
||||
{"", "default:stick", "ropes:rope" },
|
||||
{"default:stick", "", "ropes:rope" },
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Roasted Fish
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "fishing:fish",
|
||||
recipe = "fishing:fish_raw",
|
||||
cooktime = 2,
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Wheat Seed
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:seed_wheat",
|
||||
recipe = {"farming:wheat"},
|
||||
})
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Sushi
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "fishing:sushi",
|
||||
recipe = {"fishing:fish_raw","farming:seed_wheat","flowers:seaweed"},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "fishing:sushi",
|
||||
recipe = {"fishing:fish_raw","farming:seed_wheat","seaplants:leavysnackgreen"},
|
||||
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Roasted Shark
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "fishing:shark_cooked",
|
||||
recipe = "fishing:shark",
|
||||
cooktime = 2,
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Roasted Pike
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "fishing:pike_cooked",
|
||||
recipe = "fishing:pike",
|
||||
cooktime = 2,
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
default
|
||||
farming
|
|
@ -0,0 +1,70 @@
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Fishes 0.0.4
|
||||
-- License (code & textures): WTFPL
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fish
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:fish_raw", {
|
||||
description = "Fish",
|
||||
groups = {},
|
||||
inventory_image = "fishing_fish.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
-----------------------------------------------------
|
||||
-- Roasted Fish
|
||||
-----------------------------------------------------
|
||||
minetest.register_craftitem("fishing:fish", {
|
||||
description = "Roasted Fish",
|
||||
groups = {},
|
||||
inventory_image = "fishing_fish_cooked.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
-----------------------------------------------------
|
||||
-- Sushi
|
||||
-----------------------------------------------------
|
||||
minetest.register_craftitem("fishing:sushi", {
|
||||
description = "Sushi (Hoso Maki)",
|
||||
groups = {},
|
||||
inventory_image = "fishing_sushi.png",
|
||||
on_use = minetest.item_eat(8),
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Whatthef... it's a freakin' Shark!
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:shark", {
|
||||
description = "Shark",
|
||||
groups = {},
|
||||
inventory_image = "fishing_shark.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
-----------------------------------------------------
|
||||
-- Roasted Shark
|
||||
-----------------------------------------------------
|
||||
minetest.register_craftitem("fishing:shark_cooked", {
|
||||
description = "Roasted Shark",
|
||||
groups = {},
|
||||
inventory_image = "fishing_shark_cooked.png",
|
||||
on_use = minetest.item_eat(8),
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Pike
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:pike", {
|
||||
description = "Northern Pike",
|
||||
groups = {},
|
||||
inventory_image = "fishing_pike.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
-----------------------------------------------------
|
||||
-- Roasted Pike
|
||||
-----------------------------------------------------
|
||||
minetest.register_craftitem("fishing:pike_cooked", {
|
||||
description = "Roasted Northern Pike",
|
||||
groups = {},
|
||||
inventory_image = "fishing_pike_cooked.png",
|
||||
on_use = minetest.item_eat(8),
|
||||
})
|
|
@ -0,0 +1,336 @@
|
|||
-----------------------------------------------------------------------------------------------
|
||||
local title = "Fishing - Mossmanikin's version"
|
||||
local version = "0.2.0"
|
||||
local mname = "fishing"
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
|
||||
-- this version by Mossmanikin (https://forum.minetest.net/viewtopic.php?id=6480)
|
||||
-- License (code & textures): WTFPL
|
||||
-- Contains code from: animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
|
||||
-- Looked at code from: default, farming
|
||||
-- Dependencies: default
|
||||
-- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- todo: item wear done
|
||||
-- automatic re-baiting option done (but not optional)
|
||||
-- different types of fish, done, but not finished
|
||||
-- add sound done
|
||||
-- bobber done
|
||||
-- change rainworms filling inv & make 'em disappear done
|
||||
|
||||
-- placable fishing rod for decoration done
|
||||
-- make bobber move slowly while fish on hook done
|
||||
-- catch bigger fish with smaller done, but not finished
|
||||
-- change color of bobber when fish on hook done
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
dofile(minetest.get_modpath("fishing").."/settings.txt")
|
||||
dofile(minetest.get_modpath("fishing").."/bobber.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/bobber_shark.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/crafting.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/fishes.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/worm.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/trophies.lua")
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing Pole
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
local function rod_wear(itemstack, user, pointed_thing, uses)
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_tool("fishing:pole", {
|
||||
|
||||
description = "Fishing Pole",
|
||||
groups = {},
|
||||
inventory_image = "fishing_pole.png",
|
||||
wield_image = "fishing_pole.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.env:get_node(pt.under)
|
||||
if string.find(node.name, "default:water") then
|
||||
local player = user:get_player_name()
|
||||
local inv = user:get_inventory()
|
||||
if inv:get_stack("main", user:get_wield_index()+1):get_name() == "fishing:bait_worm" then
|
||||
inv:remove_item("main", "fishing:bait_worm")
|
||||
minetest.sound_play("fishing_bobber2", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
minetest.env:add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity")
|
||||
|
||||
if WEAR_OUT == true then
|
||||
return rod_wear(itemstack, user, pointed_thing, 30)
|
||||
else
|
||||
return {name="fishing:pole", count=1, wear=0, metadata=""}
|
||||
end
|
||||
end
|
||||
if inv:get_stack("main", user:get_wield_index()+1):get_name() == "fishing:fish_raw" then
|
||||
inv:remove_item("main", "fishing:fish_raw")
|
||||
minetest.sound_play("fishing_bobber2", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
minetest.env:add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity_shark")
|
||||
|
||||
if WEAR_OUT == true then
|
||||
return rod_wear(itemstack, user, pointed_thing, 30)
|
||||
else
|
||||
return {name="fishing:pole", count=1, wear=0, metadata=""}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pt = pointed_thing
|
||||
if minetest.get_node(pt.under).name~="default:water_source" and minetest.get_node(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.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
|
||||
local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
|
||||
minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="fishing:pole_deco", param2=direction})
|
||||
meta1:set_int("wear", wear)
|
||||
meta2:set_int("wear", wear)
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
if SIMPLE_DECO_FISHING_POLE == true then
|
||||
minetest.register_node("fishing:pole_deco", {
|
||||
description = "Fishing Pole",
|
||||
inventory_image = "fishing_pole.png",
|
||||
wield_image = "fishing_pole.png^[transformFXR270",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"fishing_pole_simple.png",
|
||||
"fishing_pole_simple.png",
|
||||
"fishing_pole_simple.png",
|
||||
"fishing_pole_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.env:get_meta(pos)
|
||||
local wear_out = meta:get_int("wear")
|
||||
digger:get_inventory():add_item("main", {name="fishing:pole", count=1, wear=wear_out, metadata=""})
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
else
|
||||
minetest.register_node("fishing:pole_deco", {
|
||||
description = "Fishing Pole",
|
||||
inventory_image = "fishing_pole.png",
|
||||
wield_image = "fishing_pole.png^[transformFXR270",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"fishing_pole_top.png",
|
||||
"fishing_pole_bottom.png",
|
||||
"fishing_pole_deco.png", -- right
|
||||
"fishing_pole_deco.png^[transformFX", -- left
|
||||
"fishing_pole_back.png",
|
||||
"fishing_pole_front.png"
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
-- { left , bottom , front , right , top , back }
|
||||
fixed = {
|
||||
{-1/32 , -1/16 , 14/16 , 1/32 , 6/16 , 15/16},
|
||||
{-1/32 , -3/16 , 13/16 , 1/32 , -1/16 , 14/16},
|
||||
{-1/32 , -4/16 , 12/16 , 1/32 , -3/16 , 13/16},
|
||||
{-1/32 , -5/16 , 11/16 , 1/32 , -4/16 , 12/16},
|
||||
{-1/32 , -6/16 , 9/16 , 1/32 , -5/16 , 11/16},
|
||||
{-1/32 , -5/16 , 9/16 , 1/32 , -4/16 , 10/16},
|
||||
-- stick
|
||||
{-1/32 , 6/16 , 12/16 , 1/32 , 7/16 , 15/16}, -- top
|
||||
{-1/32 , 5/16 , 11/16 , 1/32 , 7/16 , 12/16},
|
||||
{-1/32 , 5/16 , 10/16 , 1/32 , 6/16 , 11/16},
|
||||
{-1/32 , 4/16 , 9/16 , 1/32 , 6/16 , 10/16},
|
||||
{-1/32 , 3/16 , 8/16 , 1/32 , 5/16 , 9/16},
|
||||
{-1/32 , 2/16 , 7/16 , 1/32 , 4/16 , 8/16},
|
||||
{-1/32 , 1/16 , 6/16 , 1/32 , 3/16 , 7/16},
|
||||
{-1/32 , 0 , 5/16 , 1/32 , 2/16 , 6/16},
|
||||
{-1/32 , -2/16 , 4/16 , 1/32 , 1/16 , 5/16},
|
||||
{-1/32 , -3/16 , 3/16 , 1/32 , 0 , 4/16},
|
||||
{-1/32 , -5/16 , 2/16 , 1/32 , -1/16 , 3/16},
|
||||
{-1/32 , -7/16 , 1/16 , 1/32 , -3/16 , 2/16},
|
||||
{-1/32 , -1/2 , 0 , 1/32 , -5/16 , 1/16}, -- bottom
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/16 , -1/2 , 0 , 1/16 , 1/2 , 1 },
|
||||
}
|
||||
},
|
||||
groups = {
|
||||
snappy=3,
|
||||
flammable=2,
|
||||
not_in_creative_inventory=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.env:get_meta(pos)
|
||||
local wear_out = meta:get_int("wear")
|
||||
digger:get_inventory():add_item("main", {name="fishing:pole", count=1, wear=wear_out, metadata=""})
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
end
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- GETTING WORMS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- get worms from digging in dirt:
|
||||
if NEW_WORM_SOURCE == false then
|
||||
|
||||
minetest.register_node(":default:dirt", {
|
||||
description = "Dirt",
|
||||
tiles = {"default_dirt.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
||||
if math.random(1, 100) < WORM_CHANCE then
|
||||
local tool_in_use = digger:get_wielded_item():get_name()
|
||||
if tool_in_use == "" or tool_in_use == "default:dirt" then
|
||||
if WORM_IS_MOB == true then
|
||||
minetest.env:add_entity({x = pos.x, y = pos.y+0.4, z = pos.z}, "fishing:bait_worm_entity")
|
||||
else
|
||||
local inv = digger:get_inventory()
|
||||
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
else
|
||||
-- get worms from digging with hoes:
|
||||
|
||||
-- turns nodes with group soil=1 into soil
|
||||
local function hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
local pt = pointed_thing
|
||||
-- check if pointing at a node
|
||||
if not pt then
|
||||
return
|
||||
end
|
||||
if pt.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
local under = minetest.get_node(pt.under)
|
||||
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
||||
local above = minetest.get_node(p)
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if the node above the pointed thing is air
|
||||
if above.name ~= "air" then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if pointing at dirt
|
||||
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
-- turn the node into soil, play sound, get worm and wear out item
|
||||
minetest.set_node(pt.under, {name="farming:soil"})
|
||||
minetest.sound_play("default_dig_crumbly", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
|
||||
if math.random(1, 100) < WORM_CHANCE then
|
||||
if WORM_IS_MOB == true then
|
||||
minetest.env:add_entity({x=pt.under.x, y=pt.under.y+0.4, z=pt.under.z}, "fishing:bait_worm_entity")
|
||||
else
|
||||
local inv = user:get_inventory()
|
||||
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||
end
|
||||
end
|
||||
end
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
-- didn't change the hoes, just here because hoe_on_use is local
|
||||
minetest.register_tool(":farming:hoe_wood", {
|
||||
description = "Wooden Hoe",
|
||||
inventory_image = "farming_tool_woodhoe.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return hoe_on_use(itemstack, user, pointed_thing, 30)
|
||||
end,
|
||||
})
|
||||
minetest.register_tool(":farming:hoe_stone", {
|
||||
description = "Stone Hoe",
|
||||
inventory_image = "farming_tool_stonehoe.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return hoe_on_use(itemstack, user, pointed_thing, 90)
|
||||
end,
|
||||
})
|
||||
minetest.register_tool(":farming:hoe_steel", {
|
||||
description = "Steel Hoe",
|
||||
inventory_image = "farming_tool_steelhoe.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return hoe_on_use(itemstack, user, pointed_thing, 200)
|
||||
end,
|
||||
})
|
||||
minetest.register_tool(":farming:hoe_bronze", {
|
||||
description = "Bronze Hoe",
|
||||
inventory_image = "farming_tool_bronzehoe.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
return hoe_on_use(itemstack, user, pointed_thing, 220)
|
||||
end,
|
||||
})
|
||||
|
||||
end
|
||||
-----------------------------------------------------------------------------------------------
|
||||
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
|
||||
-----------------------------------------------------------------------------------------------
|
|
@ -0,0 +1,9 @@
|
|||
MESSAGES = true
|
||||
FISH_CHANCE = 70
|
||||
NEW_WORM_SOURCE = true
|
||||
WORM_IS_MOB = true
|
||||
WORM_CHANCE = 80
|
||||
WEAR_OUT = true
|
||||
BOBBER_CHECK_RADIUS = 5
|
||||
SIMPLE_DECO_FISHING_POLE = true
|
||||
SHARK_CHANCE = 30
|
|
@ -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/
|
After Width: | Height: | Size: 541 B |
After Width: | Height: | Size: 207 B |
After Width: | Height: | Size: 193 B |
After Width: | Height: | Size: 295 B |
After Width: | Height: | Size: 352 B |
After Width: | Height: | Size: 317 B |
After Width: | Height: | Size: 580 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 352 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 508 B |
After Width: | Height: | Size: 486 B |
After Width: | Height: | Size: 846 B |
After Width: | Height: | Size: 297 B |
After Width: | Height: | Size: 702 B |
After Width: | Height: | Size: 265 B |
After Width: | Height: | Size: 235 B |
After Width: | Height: | Size: 215 B |
After Width: | Height: | Size: 354 B |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 303 B |
After Width: | Height: | Size: 197 B |
After Width: | Height: | Size: 389 B |
After Width: | Height: | Size: 763 B |
After Width: | Height: | Size: 590 B |
After Width: | Height: | Size: 201 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 352 B |
After Width: | Height: | Size: 363 B |
After Width: | Height: | Size: 222 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 217 B |
After Width: | Height: | Size: 238 B |
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 391 B |
|
@ -0,0 +1,82 @@
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Trophies 0.0.2
|
||||
-- License (code & textures): WTFPL
|
||||
-- Contains code from: default
|
||||
-- Supports: animal_clownfish, animal_fish_blue_white
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
local TRoPHY = {
|
||||
-- MoD iTeM NaMe iCoN
|
||||
{"fishing", "fish_raw", "Fish", "fishing_fish.png"},
|
||||
{"fishing", "pike", "Northern Pike", "fishing_pike.png"},
|
||||
{"fishing", "shark", "Shark", "fishing_shark.png"},
|
||||
{"animal_clownfish", "clownfish", "Clownfish", "animal_clownfish_clownfish_item.png"},
|
||||
{"animal_fish_blue_white", "fish_blue_white", "Blue white fish", "animal_fish_blue_white_fish_blue_white_item.png"},
|
||||
}
|
||||
|
||||
local function has_trophy_privilege(meta, player)
|
||||
if player:get_player_name() ~= meta:get_string("owner") then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
for i in pairs(TRoPHY) do
|
||||
local MoD = TRoPHY[i][1]
|
||||
local iTeM = TRoPHY[i][2]
|
||||
local NaMe = TRoPHY[i][3]
|
||||
local iCoN = TRoPHY[i][4]
|
||||
minetest.register_node("fishing:trophy_"..iTeM, {
|
||||
description = NaMe.." Trophy",
|
||||
inventory_image = "default_chest_top.png^"..iCoN.."^fishing_trophy_label.png",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"default_chest_top.png", -- top
|
||||
"default_chest_top.png", -- bottom
|
||||
"default_chest_top.png", -- right
|
||||
"default_chest_top.png", -- left
|
||||
"default_chest_top.png", -- back
|
||||
"default_chest_top.png^"..iCoN.."^fishing_trophy_label.png", -- front
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = false,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
-- { left , bottom , front , right , top , back }
|
||||
{ -1/2 , -1/2 , 7/16 , 1/2 , 1/2 , 1/2 },
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{ -1/2 , -1/2 , 7/16 , 1/2 , 1/2 , 1/2 },
|
||||
}
|
||||
},
|
||||
groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("owner", placer:get_player_name() or "")
|
||||
meta:set_string("infotext", "This Huge "..NaMe.." was caught by the Famous Angler "..
|
||||
meta:get_string("owner").."!")
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", NaMe)
|
||||
meta:set_string("owner", "")
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
return has_trophy_privilege(meta, player)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "fishing:trophy_"..iTeM,
|
||||
recipe = {MoD..":"..iTeM, "default:sign_wall"},
|
||||
})
|
||||
|
||||
end
|
|
@ -0,0 +1,118 @@
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Worm 0.0.2
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- License (code & textures): WTFPL
|
||||
-- Contains code from: fishing (original), mobs
|
||||
-- Looked at code from: my_mobs
|
||||
-- Dependencies: default
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- WORM ITEM
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:bait_worm", {
|
||||
description = "Worm",
|
||||
groups = { fishing_bait=1 },
|
||||
inventory_image = "fishing_worm.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pt = pointed_thing
|
||||
minetest.env:add_entity({x=pt.under.x, y=pt.under.y+0.6, z=pt.under.z}, "fishing:bait_worm_entity")
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end,
|
||||
on_drop = function(itemstack, dropper, pos)
|
||||
minetest.env:add_entity({x = pos.x, y = pos.y, z = pos.z}, "fishing:bait_worm_entity")
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- WORM MOB
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_entity("fishing:bait_worm_entity", {
|
||||
hp_max = 300,
|
||||
damage_over_time = 1,
|
||||
collisionbox = {-3/16, -3/16, -3/16, 3/16, 3/16, 3/16},
|
||||
visual = "sprite",
|
||||
visual_size = {x=1/2, y=1/2},
|
||||
textures = { "fishing_worm.png", "fishing_worm.png"},
|
||||
view_range = 32,
|
||||
-- Don't punch this poor creature...
|
||||
on_punch = function(self, puncher)
|
||||
self.object:remove()
|
||||
end,
|
||||
-- ...softly take it into your hand.
|
||||
on_rightclick = function(self, clicker)
|
||||
if clicker:is_player() and clicker:get_inventory() then
|
||||
clicker:get_inventory():add_item("main", "fishing:bait_worm")
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
-- AI :D
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
local n = minetest.env:get_node({x=pos.x,y=pos.y-0.3,z=pos.z})
|
||||
-- despawn when no player in range
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if dist > self.view_range then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
-- move in world
|
||||
local look_whats_up = function(self)
|
||||
self.object:set_hp(self.object:get_hp()-self.damage_over_time) -- creature is getting older
|
||||
if n.name == "air" then -- fall when in air
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.5,z=pos.z})
|
||||
self.object:set_hp(self.object:get_hp()-75)
|
||||
|
||||
--if n.name == "snappy" then -- fall when leaves or similar
|
||||
elseif minetest.get_item_group(n.name, "snappy") ~= 0 then
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-32, 32))),y=pos.y-(0.001*(math.random(0, 64))),z=pos.z+(0.001*(math.random(-32, 32)))})
|
||||
|
||||
|
||||
elseif string.find(n.name, "default:water") then -- sink when in water
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.25,z=pos.z})
|
||||
self.object:set_hp(self.object:get_hp()-37)
|
||||
|
||||
elseif minetest.get_item_group(n.name, "soil") ~= 0 then
|
||||
if minetest.get_item_group(minetest.env:get_node({x=pos.x,y=pos.y-0.1,z=pos.z}).name, "soil") == 0 and self.object:get_hp() > 200 then
|
||||
self.object:set_hp(199)
|
||||
elseif self.object:get_hp() > 200 then -- leave dirt to see whats going on
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y+0.003,z=pos.z+(0.001*(math.random(-2, 2)))})
|
||||
elseif self.object:get_hp() < 199 then -- no rain here, let's get outa here
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y-0.001,z=pos.z+(0.001*(math.random(-2, 2)))})
|
||||
elseif self.object:get_hp() == 0 then
|
||||
self.object:remove()
|
||||
end
|
||||
else -- check if there's dirt anywhere (not finished)
|
||||
local check_group = minetest.get_item_group
|
||||
local goal_01 = check_group(minetest.env:get_node({x = pos.x + 1, y = pos.y-0.4, z = pos.z }).name, "soil")
|
||||
local goal_02 = check_group(minetest.env:get_node({x = pos.x, y = pos.y-0.4, z = pos.z + 1}).name, "soil")
|
||||
local goal_03 = check_group(minetest.env:get_node({x = pos.x - 1, y = pos.y-0.4, z = pos.z }).name, "soil")
|
||||
local goal_04 = check_group(minetest.env:get_node({x = pos.x, y = pos.y-0.4, z = pos.z - 1}).name, "soil")
|
||||
|
||||
local goal_1a = check_group(minetest.env:get_node({x = pos.x + 1, y = pos.y+0.6, z = pos.z }).name, "soil")
|
||||
local goal_2a = check_group(minetest.env:get_node({x = pos.x, y = pos.y+0.6, z = pos.z + 1}).name, "soil")
|
||||
local goal_3a = check_group(minetest.env:get_node({x = pos.x - 1, y = pos.y+0.6, z = pos.z }).name, "soil")
|
||||
local goal_4a = check_group(minetest.env:get_node({x = pos.x, y = pos.y+0.6, z = pos.z - 1}).name, "soil")
|
||||
-- if there's dirt nearby, go there
|
||||
if goal_01 ~= 0 or goal_1a ~= 0 then
|
||||
self.object:moveto({x=pos.x+0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})
|
||||
elseif goal_02 ~= 0 or goal_2a ~= 0 then
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z+0.002})
|
||||
elseif goal_03 ~= 0 or goal_3a ~= 0 then
|
||||
self.object:moveto({x=pos.x-0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})
|
||||
elseif goal_04 ~= 0 or goal_4a ~= 0 then
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z-0.002})
|
||||
else -- I'm lost, no dirt
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
|
||||
end
|
||||
end
|
||||
end
|
||||
look_whats_up(self)
|
||||
end,
|
||||
})
|