Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation for fishing along with [intllib] mod #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions bobber.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
-- Supports: 3d_armor, animal_clownfish, animal_fish_blue_white, animal_rat, flowers_plus, mobs, seaplants
-----------------------------------------------------------------------------------------------

-- 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

local PoLeWeaR = (65535/(30-(math.random(15, 29))))
local BooTSWear = (2000*(math.random(20, 29)))
-- Here's what you can catch
Expand Down Expand Up @@ -98,11 +107,11 @@ local FISHING_BOBBER_ENTITY={
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 MESSAGES == true then minetest.chat_send_player(player, S("You didn't catch anything."), false) end -- fish escaped
if not minetest.setting_getbool("creative_mode") 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 minetest.chat_send_player(player, "The bait is still there.", false) end -- bait still there
if MESSAGES == true then minetest.chat_send_player(player, S("The bait is still there."), false) end -- bait still there
end
end
-- make sound and remove bobber
Expand Down Expand Up @@ -130,12 +139,12 @@ local FISHING_BOBBER_ENTITY={
minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"})
if inv:room_for_item("main", {name=DRoP, count=1, wear=0, metadata=""}) then
inv:add_item("main", {name=DRoP, count=1, wear=0, metadata=""})
if MESSAGES == true then say(player, "You caught "..MeSSaGe, false) end -- caught Plant
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught Plant
end
if not minetest.setting_getbool("creative_mode") 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
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
end
end
end
Expand All @@ -145,7 +154,7 @@ local FISHING_BOBBER_ENTITY={
-- catch visible fish and invisible stuff
if self.object:get_hp() <= 300 then
if math.random(1, 100) < FISH_CHANCE then
local chance = math.random(1, 122) -- ><((((>
local chance = math.random(1, 122) -- ><((((º>
for i in pairs(CaTCH) do
local MoD = CaTCH[i][1]
local iTeM = CaTCH[i][2]
Expand All @@ -164,42 +173,42 @@ local FISHING_BOBBER_ENTITY={
MoD = "animal_fish_blue_white"
iTeM = "fish_blue_white"
WeaR = 0
MeSSaGe = "a Blue white fish."
MeSSaGe = S("a Blue white fish.")
obj:remove()
end
end
-- add (in)visible fish to inventory
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'
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught somethin'
end
if not minetest.setting_getbool("creative_mode") then
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?
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there?
end
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
if MESSAGES == true then say(player, S("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
if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped
end
end
if self.object:get_hp() > 300 and minetest.get_node(pos).name == "air" then
if MESSAGES == true then say(player, "You didn't catch anything.", false) end -- fish escaped
if MESSAGES == true then say(player, S("You didn't catch anything."), false) end -- fish escaped
if not minetest.setting_getbool("creative_mode") then
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
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
end
end
end
Expand Down Expand Up @@ -307,4 +316,4 @@ local FISHING_BOBBER_ENTITY={
end,
}

minetest.register_entity("fishing:bobber_entity", FISHING_BOBBER_ENTITY)
minetest.register_entity("fishing:bobber_entity", FISHING_BOBBER_ENTITY)
31 changes: 20 additions & 11 deletions bobber_shark.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
-- 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

-- 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)
Expand Down Expand Up @@ -54,7 +63,7 @@ local FISHING_BOBBER_ENTITY_SHARK={
-- 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
if MESSAGES == true then minetest.chat_send_player(player, S("Your fish escaped."), false) end -- fish escaped
minetest.sound_play("fishing_bobber1", {
pos = self.object:getpos(),
gain = 0.5,
Expand All @@ -79,12 +88,12 @@ local FISHING_BOBBER_ENTITY_SHARK={
minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"})
if inv:room_for_item("main", {name=DRoP, count=1, wear=0, metadata=""}) then
inv:add_item("main", {name=DRoP, count=1, wear=0, metadata=""})
if MESSAGES == true then say(player, "You caught "..MeSSaGe, false) end -- caught Plant
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught Plant
end
if not minetest.setting_getbool("creative_mode") then
if inv:room_for_item("main", {name="fishing:fish_raw", 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
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
end
end
end
Expand All @@ -93,7 +102,7 @@ local FISHING_BOBBER_ENTITY_SHARK={
--elseif minetest.get_node(pos).name == "air" then
if self.object:get_hp() <= 300 then
if math.random(1, 100) < SHARK_CHANCE then
local chance = math.random(1, 5) -- ><((((>
local chance = math.random(1, 5) -- ><((((º>
for i in pairs(CaTCH_BiG) do
local MoD = CaTCH_BiG[i][1]
local iTeM = CaTCH_BiG[i][2]
Expand All @@ -107,37 +116,37 @@ local FISHING_BOBBER_ENTITY_SHARK={
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'
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught somethin'
end
if not minetest.setting_getbool("creative_mode") then
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?
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there?
end
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
if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped
end
end
if self.object:get_hp() > 300 and minetest.get_node(pos).name == "air" then
if MESSAGES == true then say(player, "You didn't catch any fish.", false) end -- fish escaped
if MESSAGES == true then say(player, S("You didn't catch any fish."), false) end -- fish escaped
if not minetest.setting_getbool("creative_mode") then
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
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
end
end
end
end
--end
else
if MESSAGES == true then say(player, "Your fish escaped.", false) end -- fish escaped
if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped
end
minetest.sound_play("fishing_bobber1", {
pos = self.object:getpos(),
Expand Down Expand Up @@ -220,4 +229,4 @@ local FISHING_BOBBER_ENTITY_SHARK={
end,
}

minetest.register_entity("fishing:bobber_entity_shark", FISHING_BOBBER_ENTITY_SHARK)
minetest.register_entity("fishing:bobber_entity_shark", FISHING_BOBBER_ENTITY_SHARK)
25 changes: 17 additions & 8 deletions fishes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@
-- 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 = "Fish",
description = S("Fish"),
groups = {},
inventory_image = "fishing_fish.png",
on_use = minetest.item_eat(2),
Expand All @@ -16,7 +25,7 @@ minetest.register_craftitem("fishing:fish_raw", {
-- Roasted Fish
-----------------------------------------------------
minetest.register_craftitem("fishing:fish", {
description = "Roasted Fish",
description = S("Roasted Fish"),
groups = {},
inventory_image = "fishing_fish_cooked.png",
on_use = minetest.item_eat(4),
Expand All @@ -25,7 +34,7 @@ minetest.register_craftitem("fishing:fish_raw", {
-- Sushi
-----------------------------------------------------
minetest.register_craftitem("fishing:sushi", {
description = "Sushi (Hoso Maki)",
description = S("Sushi (Hoso Maki)"),
groups = {},
inventory_image = "fishing_sushi.png",
on_use = minetest.item_eat(8),
Expand All @@ -35,7 +44,7 @@ minetest.register_craftitem("fishing:fish_raw", {
-- Whatthef... it's a freakin' Shark!
-----------------------------------------------------------------------------------------------
minetest.register_craftitem("fishing:shark", {
description = "Shark",
description = S("Shark"),
groups = {},
inventory_image = "fishing_shark.png",
on_use = minetest.item_eat(4),
Expand All @@ -44,7 +53,7 @@ minetest.register_craftitem("fishing:shark", {
-- Roasted Shark
-----------------------------------------------------
minetest.register_craftitem("fishing:shark_cooked", {
description = "Roasted Shark",
description = S("Roasted Shark"),
groups = {},
inventory_image = "fishing_shark_cooked.png",
on_use = minetest.item_eat(8),
Expand All @@ -54,7 +63,7 @@ minetest.register_craftitem("fishing:shark", {
-- Pike
-----------------------------------------------------------------------------------------------
minetest.register_craftitem("fishing:pike", {
description = "Northern Pike",
description = S("Northern Pike"),
groups = {},
inventory_image = "fishing_pike.png",
on_use = minetest.item_eat(4),
Expand All @@ -63,8 +72,8 @@ minetest.register_craftitem("fishing:pike", {
-- Roasted Pike
-----------------------------------------------------
minetest.register_craftitem("fishing:pike_cooked", {
description = "Roasted Northern Pike",
description = S("Roasted Northern Pike"),
groups = {},
inventory_image = "fishing_pike_cooked.png",
on_use = minetest.item_eat(8),
})
})
27 changes: 18 additions & 9 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ local mname = "fishing"

-----------------------------------------------------------------------------------------------

-- 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

dofile(minetest.get_modpath("fishing").."/settings.txt")
dofile(minetest.get_modpath("fishing").."/bobber.lua")
dofile(minetest.get_modpath("fishing").."/bobber_shark.lua")
Expand All @@ -45,7 +54,7 @@ end

minetest.register_tool("fishing:pole", {

description = "Fishing Pole",
description = S("Fishing Pole"),
groups = {},
inventory_image = "fishing_pole.png",
wield_image = "fishing_pole.png^[transformFXR270",
Expand Down Expand Up @@ -117,7 +126,7 @@ minetest.register_tool("fishing:pole", {

if SIMPLE_DECO_FISHING_POLE == true then
minetest.register_node("fishing:pole_deco", {
description = "Fishing Pole",
description = S("Fishing Pole"),
inventory_image = "fishing_pole.png",
wield_image = "fishing_pole.png^[transformFXR270",
drawtype = "nodebox",
Expand Down Expand Up @@ -159,7 +168,7 @@ minetest.register_node("fishing:pole_deco", {

else
minetest.register_node("fishing:pole_deco", {
description = "Fishing Pole",
description = S("Fishing Pole"),
inventory_image = "fishing_pole.png",
wield_image = "fishing_pole.png^[transformFXR270",
drawtype = "nodebox",
Expand Down Expand Up @@ -229,7 +238,7 @@ end
if NEW_WORM_SOURCE == false then

minetest.register_node(":default:dirt", {
description = "Dirt",
description = S("Dirt"),
tiles = {"default_dirt.png"},
is_ground_content = true,
groups = {crumbly=3},
Expand Down Expand Up @@ -310,28 +319,28 @@ end

-- didn't change the hoes, just here because hoe_on_use is local
minetest.register_tool(":farming:hoe_wood", {
description = "Wooden Hoe",
description = S("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",
description = S("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",
description = S("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",
description = S("Bronze Hoe"),
inventory_image = "farming_tool_bronzehoe.png",
on_use = function(itemstack, user, pointed_thing)
return hoe_on_use(itemstack, user, pointed_thing, 220)
Expand All @@ -341,4 +350,4 @@ minetest.register_tool(":farming:hoe_bronze", {
end
-----------------------------------------------------------------------------------------------
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
Loading