diff --git a/depends.txt b/depends.txt index 331d858..e5122e9 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,3 @@ -default \ No newline at end of file +default +doc? +intllib? \ No newline at end of file diff --git a/init.lua b/init.lua index a8570c8..f4c9159 100644 --- a/init.lua +++ b/init.lua @@ -25,14 +25,38 @@ local function setting(stype, name, default, description) end end +local full_tank_desc = S("A tank containing compressed air.") +local full_tank_help = S("If you're underwater and you're running out of breath, wield this item and use it to replenish 5 bubbles on your breath bar. When fully charged this tank has %i uses before it becomes empty.") + +local empty_tank_desc = S("A compressed air tank, currently empty.") +local empty_tank_help = S("This tank can be recharged with compressed air by using it on a compressor block. When fully charged this tank has %i uses before it becomes empty.") + +local compressor_desc = S("A machine for filling air tanks with compressed air.") +local compressor_help = S("Place this machine somewhere that it has access to air (one of its adjacent nodes needs to have air in it). When you click on it with an empty or partly-empty compressed air tank the tank will be refilled.") + setting("int", "steel_uses", 30, "Number of uses for a steel air tank") setting("int", "copper_uses", 10, "Number of uses for a copper air tank") setting("int", "bronze_uses", (config.steel_uses + config.copper_uses)/2, "Number of uses for a bronze air tank") +local cardinal_dirs = {{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0},{x=0,y=0,z=1},{x=0,y=0,z=-1},} + local recharge_airtank = function(itemstack, user, pointed_thing, full_item) if pointed_thing.type ~= "node" then return itemstack end local node = minetest.get_node(pointed_thing.under) if minetest.get_item_group(node.name, "airtanks_compressor") > 0 then + + local has_air = false + for _, dir in pairs(cardinal_dirs) do + if minetest.get_node(vector.add(pointed_thing.under, dir)).name == "air" then + has_air = true + break + end + end + if not has_air then + minetest.sound_play("airtanks_compressor_fail", {pos = pointed_thing.under, gain = 0.5}) + return itemstack + end + if itemstack:get_name() == full_item then itemstack:set_wear(0) else @@ -74,6 +98,8 @@ end local function register_air_tank(name, desc, color, uses, material) minetest.register_craftitem("airtanks:empty_"..name.."_tank", { description = S("Empty @1", desc), + _doc_items_longdesc = empty_tank_desc, + _doc_items_usagehelp = string.format(empty_tank_help, uses), inventory_image = "airtanks_airtank.png^[multiply:"..color.."^airtanks_empty.png", wield_image = "airtanks_airtank.png^[multiply:"..color.."^airtanks_empty.png", stack_max = 99, @@ -89,6 +115,8 @@ local function register_air_tank(name, desc, color, uses, material) minetest.register_tool("airtanks:"..name.."_tank", { description = desc, + _doc_items_longdesc = full_tank_desc, + _doc_items_usagehelp = string.format(full_tank_help, uses), groups = {not_repaired_by_anvil = 1}, inventory_image = "airtanks_airtank.png^[multiply:"..color, wield_image = "airtanks_airtank.png^[multiply:"..color, @@ -127,6 +155,8 @@ end minetest.register_node("airtanks:compressor", { description = S("Air Compressor"), + _doc_items_longdesc = compressor_desc, + _doc_items_usagehelp = compressor_help, groups = {oddly_breakable_by_hand = 1, airtanks_compressor = 1}, sounds = sounds, tiles = { diff --git a/locale/template.pot b/locale/template.pot index 67331ff..3262128 100644 --- a/locale/template.pot +++ b/locale/template.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-03-26 01:50-0600\n" +"POT-Creation-Date: 2017-03-26 10:53-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,22 +17,56 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:54 -msgid "Empty @1" +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:28 +msgid "A tank containing compressed air." msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:95 -msgid "Steel Air Tank" +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:29 +#, lua-format +msgid "" +"If you're underwater and you're running out of breath, wield this item and " +"use it to replenish 5 bubbles on your breath bar. When fully charged this " +"tank has %i uses before it becomes empty." msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:96 -msgid "Copper Air Tank" +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:31 +msgid "A compressed air tank, currently empty." msgstr "" -#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:97 -msgid "Bronze Air Tank" +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:32 +#, lua-format +msgid "" +"This tank can be recharged with compressed air by using it on a compressor " +"block. When fully charged this tank has %i uses before it becomes empty." +msgstr "" + +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:34 +msgid "A machine for filling air tanks with compressed air." +msgstr "" + +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:35 +msgid "" +"Place this machine somewhere that it has access to air (one of its adjacent " +"nodes needs to have air in it). When you click on it with an empty or partly-" +"empty compressed air tank the tank will be refilled." msgstr "" #: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:100 +msgid "Empty @1" +msgstr "" + +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:145 +msgid "Steel Air Tank" +msgstr "" + +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:146 +msgid "Copper Air Tank" +msgstr "" + +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:147 +msgid "Bronze Air Tank" +msgstr "" + +#: C:\Users\Bryan\Downloads\minetest-0.4.15-win64\mods\airtanks\init.lua:157 msgid "Air Compressor" msgstr "" diff --git a/sounds/airtanks_compressor_fail.ogg b/sounds/airtanks_compressor_fail.ogg new file mode 100644 index 0000000..fe4b842 Binary files /dev/null and b/sounds/airtanks_compressor_fail.ogg differ diff --git a/sounds/license.txt b/sounds/license.txt index af0c419..0f1f055 100644 --- a/sounds/license.txt +++ b/sounds/license.txt @@ -1,2 +1,3 @@ airtanks_hiss - from https://www.freesound.org/people/josepharaoh99/sounds/367125/ by josepharaoh99 under the public domain via CC 0 -airtanks_comressor - from https://www.freesound.org/people/Cell31_Sound_Productions/sounds/376927/ by Cell31_Sound_Productions under CC BY 3.0 \ No newline at end of file +airtanks_comressor - from https://www.freesound.org/people/Cell31_Sound_Productions/sounds/376927/ by Cell31_Sound_Productions under CC BY 3.0 +airtanks_compressor_fail - from https://www.freesound.org/people/Cell31_Sound_Productions/sounds/383020/ by Cell31_Sound_Productions under CC BY 3.0 \ No newline at end of file