commit 043dc16dc6f23c71afc63b4cf4d0d27e335079af Author: FaceDeer Date: Sat Feb 25 14:33:39 2017 -0700 Initial commit This was split out of the venerable Castle mod, https://github.com/minetest-mods/castle, which has been maintained by a long line of distinguished modders. 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 b/LICENSE new file mode 100644 index 0000000..456d091 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Minetest Mods Team + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..de76871 --- /dev/null +++ b/README.txt @@ -0,0 +1,10 @@ +=-=-=-=-=-=-=-=-=-= + +Tapestries Mod +by: Philipbenr And DanDuncombe + +=-=-=-=-=-=-=-=-=-= + +Licence: MIT + +see: LICENSE diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..fe7e3d9 --- /dev/null +++ b/depends.txt @@ -0,0 +1,3 @@ +default +unifieddyes +intllib? diff --git a/description.txt b/description.txt new file mode 100644 index 0000000..29d4bd2 --- /dev/null +++ b/description.txt @@ -0,0 +1 @@ +This is a mod for creating medieval tapestries, as found in castles diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..03e318d --- /dev/null +++ b/init.lua @@ -0,0 +1,205 @@ +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +local tapestry = {} + +minetest.register_alias("castle:tapestry_top", "castle_tapestries:tapestry_top") +minetest.register_alias("castle:tapestry", "castle_tapestries:tapestry") +minetest.register_alias("castle:tapestry_long", "castle_tapestries:tapestry_long") +minetest.register_alias("castle:tapestry_very_long", "castle_tapestries:tapestry_very_long") + +minetest.register_node("castle_tapestries:tapestry_top", { + drawtype = "nodebox", + description = S("Tapestry Top"), + tiles = {"default_wood.png"}, + sunlight_propagates = true, + groups = {flammable=3,oddly_breakable_by_hand=3}, + sounds = default.node_sound_defaults(), + paramtype = "light", + paramtype2 = "facedir", + node_box = { + type = "fixed", + fixed = { + {-0.6,-0.5,0.375,0.6,-0.375,0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.6,-0.5,0.375,0.6,-0.375,0.5}, + }, + }, +}) + +minetest.register_craft({ + type = "shapeless", + output = 'castle_tapestries:tapestry_top', + recipe = {'default:stick'}, +}) + +tapestry.colours = { + "white", + "grey", + "black", + "red", + "yellow", + "green", + "cyan", + "blue", + "magenta", + "orange", + "violet", + "dark_grey", + "dark_green", + "pink", + "brown", +} + +-- Regular-length tapestry + +minetest.register_node("castle_tapestries:tapestry", { + drawtype = "mesh", + mesh = "castle_tapestry.obj", + description = S("Tapestry"), + tiles = {"castle_tapestry.png"}, + inventory_image = "castle_tapestry_inv.png", + groups = {oddly_breakable_by_hand=3,flammable=3, ud_param2_colorable = 1}, + sounds = default.node_sound_defaults(), + paramtype = "light", + paramtype2 = "colorwallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + selection_box = { + type = "wallmounted", + wall_side = {-0.5,-0.5,0.4375,0.5,1.5,0.5}, + }, + after_place_node = unifieddyes.fix_rotation_nsew, + after_dig_node = unifieddyes.after_dig_node, + on_rotate = unifieddyes.fix_after_screwdriver_nsew +}) + +-- Crafting from wool and a stick + +minetest.register_craft({ + type = "shapeless", + output = 'castle_tapestries:tapestry', + recipe = {'wool:white', 'default:stick'}, +}) + +-- Long tapestry + +minetest.register_node("castle_tapestries:tapestry_long", { + drawtype = "mesh", + mesh = "castle_tapestry_long.obj", + description = S("Tapestry (Long)"), + tiles = {"castle_tapestry.png"}, + inventory_image = "castle_tapestry_long_inv.png", + groups = {oddly_breakable_by_hand=3,flammable=3, ud_param2_colorable = 1}, + sounds = default.node_sound_defaults(), + paramtype = "light", + paramtype2 = "colorwallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + selection_box = { + type = "wallmounted", + wall_side = {-0.5,-0.5,0.4375,0.5,2.5,0.5}, + }, + after_place_node = unifieddyes.fix_rotation_nsew, + after_dig_node = unifieddyes.after_dig_node, + on_rotate = unifieddyes.fix_after_screwdriver_nsew +}) + +-- Crafting from normal tapestry and wool + +minetest.register_craft({ + type = "shapeless", + output = 'castle_tapestries:tapestry_long', + recipe = {'wool:white', 'castle_tapestries:tapestry'}, +}) + +-- Very long tapestry + +minetest.register_node("castle_tapestries:tapestry_very_long", { + drawtype = "mesh", + mesh = "castle_tapestry_very_long.obj", + description = S("Tapestry (Very Long)"), + tiles = {"castle_tapestry.png"}, + inventory_image = "castle_tapestry_very_long_inv.png", + groups = {oddly_breakable_by_hand=3,flammable=3, ud_param2_colorable = 1}, + sounds = default.node_sound_defaults(), + paramtype = "light", + paramtype2 = "colorwallmounted", + palette = "unifieddyes_palette_colorwallmounted.png", + selection_box = { + type = "wallmounted", + wall_side = {-0.5,-0.5,0.4375,0.5,3.5,0.5}, + }, + after_place_node = unifieddyes.fix_rotation_nsew, + after_dig_node = unifieddyes.after_dig_node, + on_rotate = unifieddyes.fix_after_screwdriver_nsew +}) + +-- Crafting from long tapestry and wool + +minetest.register_craft({ + type = "shapeless", + output = 'castle_tapestries:tapestry_very_long', + recipe = {'wool:white', 'castle_tapestries:tapestry_long'}, +}) + +-- Convert static tapestries to param2 color + +local old_static_tapestries = {} + +for _, color in ipairs(tapestry.colours) do + table.insert(old_static_tapestries, "castle:tapestry_"..color) + table.insert(old_static_tapestries, "castle:long_tapestry_"..color) + table.insert(old_static_tapestries, "castle:very_long_tapestry_"..color) +end + +minetest.register_lbm({ + name = "castle_tapestries:convert_tapestries", + label = "Convert tapestries to use param2 color", + run_at_every_load = false, + nodenames = old_static_tapestries, + action = function(pos, node) + local oldname = node.name + local color = string.sub(oldname, string.find(oldname, "_", -12) + 1) + + if color == "red" then + color = "medium_red" + elseif color == "cyan" then + color = "medium_cyan" + elseif color == "blue" then + color = "medium_blue" + elseif color == "magenta" then + color = "medium_magenta" + end + + local paletteidx, _ = unifieddyes.getpaletteidx("unifieddyes:"..color, "wallmounted") + + local old_fdir = math.floor(node.param2 % 32) + local new_fdir = 3 + + if old_fdir == 0 then + new_fdir = 3 + elseif old_fdir == 1 then + new_fdir = 4 + elseif old_fdir == 2 then + new_fdir = 2 + elseif old_fdir == 3 then + new_fdir = 5 + end + + local param2 = paletteidx + new_fdir + local newname = "castle_tapestries:tapestry" + if string.find(oldname, ":long") then + newname = "castle_tapestries:tapestry_long" + elseif string.find(oldname, ":very_long") then + newname = "castle_tapestries:tapestry_very_long" + end + + minetest.set_node(pos, { name = newname, param2 = param2 }) + local meta = minetest.get_meta(pos) + meta:set_string("dye", "unifieddyes:"..color) + end +}) 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..0a0745a --- /dev/null +++ b/locale/template.pot @@ -0,0 +1,33 @@ +# 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-25 14:32-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:14 +msgid "Tapestry Top" +msgstr "" + +#: init.lua:64 +msgid "Tapestry" +msgstr "" + +#: init.lua:94 +msgid "Tapestry (Long)" +msgstr "" + +#: init.lua:124 +msgid "Tapestry (Very Long)" +msgstr "" diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..6d86a0d --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = castle_tapestries diff --git a/models/LICENSE.txt b/models/LICENSE.txt new file mode 100644 index 0000000..7c019e6 --- /dev/null +++ b/models/LICENSE.txt @@ -0,0 +1,10 @@ +License Textures: Stuart Jones - WTFPL + +-castle_crossbow_bolt_inv.png +-castle_crossbow_bolt_uv.png +-castle_crossbow_hit.png + +Licence Models: Stuart Jones - CC-BY-SA 3.0 + +-castle_crossbow_bolt.b3d +-castle_crossbow_bolt.blend \ No newline at end of file diff --git a/textures/castle_tapestry.png b/textures/castle_tapestry.png new file mode 100644 index 0000000..e807340 Binary files /dev/null and b/textures/castle_tapestry.png differ diff --git a/textures/castle_tapestry_inv.png b/textures/castle_tapestry_inv.png new file mode 100644 index 0000000..99c1b2e Binary files /dev/null and b/textures/castle_tapestry_inv.png differ diff --git a/textures/castle_tapestry_long_inv.png b/textures/castle_tapestry_long_inv.png new file mode 100644 index 0000000..ce04c40 Binary files /dev/null and b/textures/castle_tapestry_long_inv.png differ diff --git a/textures/castle_tapestry_very_long_inv.png b/textures/castle_tapestry_very_long_inv.png new file mode 100644 index 0000000..6fcca22 Binary files /dev/null and b/textures/castle_tapestry_very_long_inv.png differ