commit e704ea27b165681d16da53e5893ce16dff83fdc2 Author: FaceDeer Date: Sun Feb 12 13:01:46 2017 -0700 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd2946a --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + +.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..ece40fa --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,15 @@ +Copyright (C) 2017 FaceDeer + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. \ No newline at end of file diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..ea479c8 --- /dev/null +++ b/README.txt @@ -0,0 +1 @@ +This mod adds some simple building blocks that can be placed on top of liquid, making it easier to construct things on a body of water without needing to first build a piling from the ground underneath. \ No newline at end of file diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..b4ce92a --- /dev/null +++ b/depends.txt @@ -0,0 +1,4 @@ +default? +moretrees? +intllib? +doc? \ No newline at end of file diff --git a/description.txt b/description.txt new file mode 100644 index 0000000..772802e --- /dev/null +++ b/description.txt @@ -0,0 +1 @@ +A "floating" block that can be placed at the surface of a body of water without needing to build pilings first. \ No newline at end of file diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..f5426fb --- /dev/null +++ b/init.lua @@ -0,0 +1,116 @@ +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +local pontoons_override_logs = minetest.setting_getbool("pontoons_override_logs") +if pontoons_override_logs == nil then pontoons_override_logs = true end -- default true + +local pontoons_override_wood = minetest.setting_getbool("pontoons_override_wood") +if pontoons_override_wood == nil then pontoons_override_wood = true end -- default true + +local pontoons_wood_pontoons = minetest.setting_getbool("pontoons_wood_pontoons") -- default false + +local pontoons_steel_pontoons = minetest.setting_getbool("pontoons_steel_pontoons") +if pontoons_steel_pontoons == nil then pontoons_steel_pontoons = true end -- default true + +local default_modpath = minetest.get_modpath("default") + +if pontoons_override_logs or pontoons_override_wood then + local def_overrides = {} + + -- must override a registered node definition with a brand new one, + -- can't just twiddle with the parameters of the existing table for some reason + local override_def = function (node_name, old_def) + local new_def = {} + for param, value in pairs(old_def) do + new_def[param] = value + end + new_def.liquids_pointable = true + def_overrides[node_name] = new_def + end + + for node_name, node_def in pairs(minetest.registered_nodes) do + if pontoons_override_logs and minetest.get_item_group(node_name, "tree") > 0 then + override_def(node_name, node_def) + end + if pontoons_override_wood and minetest.get_item_group(node_name, "wood") > 0 then + override_def(node_name, node_def) + end + end + + for node_name, new_def in pairs(def_overrides) do + minetest.debug("overriding", node_name) + minetest.register_node(":" .. node_name, new_def) + end +end + +if pontoons_wood_pontoons then + local default_sound + local wood_burn_time + if default_modpath then + default_sound = default.node_sound_wood_defaults() + wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("group:wood")}}).time + end + if not wood_burn_time then wood_burn_time = 7 end + + minetest.register_node("pontoons:wood_pontoon", { + description = S("Wood Pontoon"), + _doc_items_longdesc = S("A hollow wooden block designed to be built on the surface of liquids."), + tiles = {"pontoon_wood.png"}, + paramtype2 = "facedir", + place_param2 = 0, + is_ground_content = false, + liquids_pointable = true, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, + sounds = default_sound, + }) + + minetest.register_craft({ + output = 'pontoons:wood_pontoon 4', + recipe = { + {"","group:wood",""}, + {"group:wood","","group:wood"}, + {"","group:wood",""}, + } + }) + + minetest.register_craft({ + type = "fuel", + recipe = "pontoons:wood_pontoon", + burntime = wood_burn_time, + }) + +end + +if pontoons_steel_pontoons then + local default_sound + if default_modpath then + if default.node_sound_metal_defaults ~= nil then + default_sound = default.node_sound_metal_defaults() + else + default_sound = default.node_sound_wood_defaults() + end + end + + minetest.register_node("pontoons:steel_pontoon", { + description = S("Steel Pontoon"), + _doc_items_longdesc = S("A hollow steel block designed to be built on the surface of liquids. Magma-safe."), + is_ground_content = false, + tiles = {"pontoon_steel.png"}, + liquids_pointable = true, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default_sound, + }) + + if default_modpath then + minetest.register_craft({ + output = 'pontoons:steel_pontoon', + recipe = { + {"","default:steel_ingot",""}, + {"default:steel_ingot","","default:steel_ingot"}, + {"","default:steel_ingot",""}, + } + }) + end +end \ No newline at end of file diff --git a/intllib.lua b/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/intllib.lua @@ -0,0 +1,45 @@ + +-- Fallback functions for when `intllib` is not installed. +-- Code released under Unlicense . + +-- Get the latest version of this file at: +-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua + +local function format(str, ...) + local args = { ... } + local function repl(escape, open, num, close) + if escape == "" then + local replacement = tostring(args[tonumber(num)]) + if open == "" then + replacement = replacement..close + end + return replacement + else + return "@"..open..num..close + end + end + return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) +end + +local gettext, ngettext +if minetest.get_modpath("intllib") then + if intllib.make_gettext_pair then + -- New method using gettext. + gettext, ngettext = intllib.make_gettext_pair() + else + -- Old method using text files. + gettext = intllib.Getter() + end +end + +-- Fill in missing functions. + +gettext = gettext or function(msgid, ...) + return format(msgid, ...) +end + +ngettext = ngettext or function(msgid, msgid_plural, n, ...) + return format(n==1 and msgid or msgid_plural, ...) +end + +return gettext, ngettext diff --git a/locale/template.pot b/locale/template.pot new file mode 100644 index 0000000..b66e0a6 --- /dev/null +++ b/locale/template.pot @@ -0,0 +1,35 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-02-12 12:54-0700\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: init.lua:57 +msgid "Wood Pontoon" +msgstr "" + +#: init.lua:58 +msgid "A hollow wooden block designed to be built on the surface of liquids." +msgstr "" + +#: init.lua:96 +msgid "Steel Pontoon" +msgstr "" + +#: init.lua:97 +msgid "" +"A hollow steel block designed to be built on the surface of liquids. Magma-" +"safe." +msgstr "" diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..8818902 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = pontoons \ No newline at end of file diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..2202c2a --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,18 @@ +#When enabled, all logs can now be built "floating" in liquids. Note that +#a log placed in lava will not last for long. +pontoons_override_logs (Logs float) bool true + +#When enabled, all wood blocks can now be built "floating" in liquids. +#Note that wood blocks placed in lava will not last for long. +pontoons_override_wood (Wood floats) bool true + +#Adds craftable wooden pontoon blocks that can be built on the +#surface of liquids. This is only really useful if wood floating +#is not enabled, so this feature is disabled by default. +pontoons_wood_pontoons (Wooden pontoons) bool false + +#Adds craftable steel pontoon blocks that can be built on the +#surface of liquids. These are are lava-resistant, and so are +#useful even when logs and wood are able to be built on liquid +#so they're enabled by default. +pontoons_steel_pontoons (Steel pontoons) bool true \ No newline at end of file diff --git a/textures/license.txt b/textures/license.txt new file mode 100644 index 0000000..167d897 --- /dev/null +++ b/textures/license.txt @@ -0,0 +1 @@ +Steel block and aspen wood base textures are Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) from the default Minetest subgame \ No newline at end of file diff --git a/textures/pontoon_steel.png b/textures/pontoon_steel.png new file mode 100644 index 0000000..b3b1917 Binary files /dev/null and b/textures/pontoon_steel.png differ diff --git a/textures/pontoon_wood.png b/textures/pontoon_wood.png new file mode 100644 index 0000000..55886c0 Binary files /dev/null and b/textures/pontoon_wood.png differ