From c47707205a94a7278c34cb87553db9824e4b9a37 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Sat, 25 Feb 2017 19:22:49 -0700 Subject: [PATCH] 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. --- .gitattributes | 17 +++ .gitignore | 47 +++++++ LICENSE | 21 ++++ README.txt | 16 +++ crate.lua | 59 +++++++++ depends.txt | 3 + description.txt | 1 + init.lua | 3 + intllib.lua | 45 +++++++ ironbound_chest.lua | 143 ++++++++++++++++++++++ locale/template.pot | 53 ++++++++ textures/LICENSE.txt | 13 ++ textures/castle_crate.png | Bin 0 -> 344 bytes textures/castle_crate_top.png | Bin 0 -> 395 bytes textures/castle_ironbound_chest_back.png | Bin 0 -> 522 bytes textures/castle_ironbound_chest_front.png | Bin 0 -> 537 bytes textures/castle_ironbound_chest_side.png | Bin 0 -> 374 bytes textures/castle_ironbound_chest_top.png | Bin 0 -> 522 bytes 18 files changed, 421 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.txt create mode 100644 crate.lua create mode 100644 depends.txt create mode 100644 description.txt create mode 100644 init.lua create mode 100644 intllib.lua create mode 100644 ironbound_chest.lua create mode 100644 locale/template.pot create mode 100644 textures/LICENSE.txt create mode 100644 textures/castle_crate.png create mode 100644 textures/castle_crate_top.png create mode 100644 textures/castle_ironbound_chest_back.png create mode 100644 textures/castle_ironbound_chest_front.png create mode 100644 textures/castle_ironbound_chest_side.png create mode 100644 textures/castle_ironbound_chest_top.png 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..2c7200f --- /dev/null +++ b/README.txt @@ -0,0 +1,16 @@ +=-=-=-=-=-=-=-=-=-= + +Castles Mod +by: Philipbenr And DanDuncombe + +=-=-=-=-=-=-=-=-=-= + +Licence: MIT + +see: LICENSE + +=-=-=-=-=-=-=-=-=-= + +This is a mod all about creating castles and castle dungeons. Many of the nodes are used for the outer-walls or dungeons. + +=-=-=-=-=-=-=-=-=-= diff --git a/crate.lua b/crate.lua new file mode 100644 index 0000000..e370b87 --- /dev/null +++ b/crate.lua @@ -0,0 +1,59 @@ +minetest.register_alias("darkage:box", "castle_storage:crate") +minetest.register_alias("castle:crate", "castle_storage:crate") + +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +minetest.register_node("castle_storage:crate", { + description = S("Crate"), + drawtype = "normal", + tiles = {"castle_crate_top.png","castle_crate_top.png","castle_crate.png","castle_crate.png","castle_crate.png","castle_crate.png"}, + groups = {choppy=3}, + sounds = default.node_sound_wood_defaults(), + paramtype = "light", + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[current_name;main;0,0;8,5;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", S("Crate")) + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", S("@1 moves stuff in crate at @2", player:get_player_name(), minetest.pos_to_string(pos))) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", S("@1 moves stuff to crate at @2", player:get_player_name(), minetest.pos_to_string(pos))) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", S("@1 takes stuff from locked chest at @2", player:get_player_name(), minetest.pos_to_string(pos))) + end, +}) + +minetest.register_craft({ + output = "castle_storage:crate", + recipe = { + {"default:wood", "default:wood", "default:wood"}, + {"default:wood", "default:steel_ingot", "default:wood"}, + } +}) + +-- Hopper compatibility +if minetest.get_modpath("hopper") and hopper ~= nil and hopper.add_container ~= nil then + hopper:add_container({ + {"top", "castle_storage:crate", "main"}, + {"side", "castle_storage:crate", "main"}, + {"bottom", "castle_storage:crate", "main"}, + }) +end \ No newline at end of file diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..9dd7d9b --- /dev/null +++ b/depends.txt @@ -0,0 +1,3 @@ +default +intllib? +hopper? diff --git a/description.txt b/description.txt new file mode 100644 index 0000000..bb901c6 --- /dev/null +++ b/description.txt @@ -0,0 +1 @@ +This mod contains storage containers one might find contained in a castle. diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..187af4f --- /dev/null +++ b/init.lua @@ -0,0 +1,3 @@ +local MP = minetest.get_modpath(minetest.get_current_modname()) +dofile(MP.."/crate.lua") +dofile(MP.."/ironbound_chest.lua") \ 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/ironbound_chest.lua b/ironbound_chest.lua new file mode 100644 index 0000000..c042244 --- /dev/null +++ b/ironbound_chest.lua @@ -0,0 +1,143 @@ +minetest.register_alias("castle:ironbound_chest", "castle_storage:ironbound_chest") + +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +local get_ironbound_chest_formspec = function(pos) + local spos = pos.x .. "," .. pos.y .. "," ..pos.z + local formspec = + "size[8,9]".. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[nodemeta:".. spos .. ";main;,0;8,4;]".. + "list[current_player;main;,5;8,4;]" + return formspec +end + +local function has_ironbound_chest_privilege(meta, player) + local name = "" + if player then + if minetest.check_player_privs(player, "protection_bypass") then + return true + end + name = player:get_player_name() + end + if name ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("castle_storage:ironbound_chest",{ + drawtype = "nodebox", + description = S("Ironbound Chest"), + tiles = {"castle_ironbound_chest_top.png", + "castle_ironbound_chest_top.png", + "castle_ironbound_chest_side.png", + "castle_ironbound_chest_side.png", + "castle_ironbound_chest_back.png", + "castle_ironbound_chest_front.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=2}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.3125, 0.5, -0.0625, 0.3125}, + {-0.5, -0.0625, -0.25, 0.5, 0, 0.25}, + {-0.5, 0, -0.1875,0.5, 0.0625, 0.1875}, + {-0.5, 0.0625, -0.0625, 0.5, 0.125, 0.0625}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.4, 0.5, 0.2, 0.4}, + + }, + }, + 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", S("Ironbound Chest (owned by @1)", meta:get_string("owner"))) + end, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", S("Ironbound Chest")) + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and has_ironbound_chest_privilege(meta, player) + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + if not has_ironbound_chest_privilege(meta, player) then + minetest.log("action", S("@1 tried to access a locked chest belonging to @2 at @3", + player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not has_ironbound_chest_privilege(meta, player) then + minetest.log("action", S("@1 tried to access a locked chest belonging to @2 at @3", + player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if not has_ironbound_chest_privilege(meta, player) then + minetest.log("action", S("@1 tried to access a locked chest belonging to @2 at @3", + player:get_player_name(), meta:get_string("owner"), minetest.pos_to_string(pos))) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", S("@1 moves stuff in locked chest at @2", player:get_player_name(), minetest.pos_to_string(pos))) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", S("@1 moves stuff to locked chest at @2", player:get_player_name(), minetest.pos_to_string(pos))) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", S("@1 takes stuff from locked chest at @2", player:get_player_name(), minetest.pos_to_string(pos))) + end, + on_rightclick = function(pos, node, clicker) + local meta = minetest.get_meta(pos) + if has_ironbound_chest_privilege(meta, clicker) then + minetest.show_formspec( + clicker:get_player_name(), + "castle_storage:ironbound_chest", + get_ironbound_chest_formspec(pos) + ) + end + end, + on_blast = function() end, +}) + +minetest.register_craft({ + output = "castle_storage:ironbound_chest", + recipe = { + {"default:wood", "default:steel_ingot","default:wood"}, + {"default:wood", "default:steel_ingot","default:wood"} + } +}) + +-- Hopper compatibility +if minetest.get_modpath("hopper") and hopper ~= nil and hopper.add_container ~= nil then + hopper:add_container({ + {"top", "castle_storage:ironbound_chest", "main"}, + {"side", "castle_storage:ironbound_chest", "main"}, + {"bottom", "castle_storage:ironbound_chest", "main"}, + }) +end \ No newline at end of file diff --git a/locale/template.pot b/locale/template.pot new file mode 100644 index 0000000..0753584 --- /dev/null +++ b/locale/template.pot @@ -0,0 +1,53 @@ +# 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 19:18-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" + +#: crate.lua:9 crate.lua:24 +msgid "Crate" +msgstr "" + +#: crate.lua:34 +msgid "@1 moves stuff in crate at @2" +msgstr "" + +#: crate.lua:37 +msgid "@1 moves stuff to crate at @2" +msgstr "" + +#: crate.lua:40 ironbound_chest.lua:113 +msgid "@1 takes stuff from locked chest at @2" +msgstr "" + +#: ironbound_chest.lua:35 ironbound_chest.lua:69 +msgid "Ironbound Chest" +msgstr "" + +#: ironbound_chest.lua:65 +msgid "Ironbound Chest (owned by @1)" +msgstr "" + +#: ironbound_chest.lua:82 ironbound_chest.lua:91 ironbound_chest.lua:100 +msgid "@1 tried to access a locked chest belonging to @2 at @3" +msgstr "" + +#: ironbound_chest.lua:107 +msgid "@1 moves stuff in locked chest at @2" +msgstr "" + +#: ironbound_chest.lua:110 +msgid "@1 moves stuff to locked chest at @2" +msgstr "" diff --git a/textures/LICENSE.txt b/textures/LICENSE.txt new file mode 100644 index 0000000..0d64b59 --- /dev/null +++ b/textures/LICENSE.txt @@ -0,0 +1,13 @@ +-------------------------------------------- + +16 px textures based on Castle mod +original textures by Philipner + +License Textures: Napiophelios - CC-BY-SA 3.0 + +-castle_ironbound_chest_back.png +-castle_ironbound_chest_front.png +-castle_ironbound_chest_side.png +-castle_ironbound_chest_top.png + +-------------------------------------------- diff --git a/textures/castle_crate.png b/textures/castle_crate.png new file mode 100644 index 0000000000000000000000000000000000000000..33669e87016dffaba214bc206ca4946646e9a824 GIT binary patch literal 344 zcmV-e0jK_nP))g1thq)xjDZ9ukcFv{vOw+or5@&U&>9nr<`*s8HSp&INE1j3c+z(E(01f`Vg6t$Jkt_&THm^r`SqD^J}{i0{HVS!YmTlHxhQ*;hR_; zgY2q8eF2B96LH>{=cRogP?Z4{JY)+aookaMvmdv=GVqgL5+`(N7V76=Buan`Y?NWl zM|C#V$>Cg}rX($KAb{*bj6zxBp~pV~phhZWL#?KS41ZXc@kEBUZE>rhKGY>#a*pqt qeN|vZjs4TxLR`MS@1gns_5KFf`fg5Y*ryHv0000#P`^aVzk|D4Xffv?~z7$1Dc(FklNX2}=0rT3J3?kzc; zPKU$cZT@%@q#>E$wcqd8_53DCLo$JM)6Atu0&WMstwZK^nSgNOedPMIjT+`fL_Puv;x+X=TcurtHFf#%6_hEhTu!xK{4hYH0+hPq;*J z68WPGShln=bI7``x<8bf&2n?zU!Ep@EUeB0B2-*zuZW$iRwy5qIu%|YEIw7UF3CLLPIzT9`2Mq7nag)P9{+W{zX9cWZ4gp*;K~31002ovPDHLkV1k{SwJZPt literal 0 HcmV?d00001 diff --git a/textures/castle_ironbound_chest_back.png b/textures/castle_ironbound_chest_back.png new file mode 100644 index 0000000000000000000000000000000000000000..29446db1cfd074455b4e731f3cdb370a99c26fb5 GIT binary patch literal 522 zcmV+l0`>igP)pD%t+sZY_=;i2S3|VUl8DpG!9-I{OwsKWkRTa0JraA7+kMsWTw*v{kK6-uuiIQN; z_35h?KQ960K;xWiP4>30KWBeExVbBvVs%%DT;jcd-PXC35(p+xDE@qo|GrPZufu6q z6Y|~@>P&VStw5!b3EYu}WL0i3g`$%7D`~QDMzhx6Q#w>Go&Y3ea&QXOb@$x+P zJoB%_hR9HgK?@5hrGT<5)6(y?aHb~FiI*e^uZyBMx7m-|@$cso3BT?gp9DckQ1Rw+ zNS&XrCdz?EYh7i*r(^y$m5-C2>bQv3PX){6T)Taf?}QM9U?K{|pSR)Pm+|+bzqC0} zS(ZR`7Q7D1L8TBb+?IyqTVLEy>M?4#c$B6o5D8R%ZW0F{S-9TM2c~Sd?sYg;@l+>R z&vq{ap~Hy`UX1BmSCDEIpqZNV(#mU>qX2{;Pl5Qa(twDA%2>-dj*+I^dX7>Ig?+!a zKq%lFM!4vkgEOL5K}yN}+sEcHmiLqXdTGWwwGD(3tLIiaVMrMnM{#p2z3lI==vSG*3xkW1{pUoMxRuIn1pC6lgWnvDYWm{Dw3 zhaw8+bJ#~Z@!>|nn9c$-Y06@pwoszHzyk*Oaj~YK4aBhVfC5oONVBcD4aI#P9G^gT zovL(eOtT2jancIzG?XE*9q`q8KoA3Twv@ivrJ}js_j!4XBi!T_n=j bd`$lbT70Y)@$hyR00000NkvXXu0mjfZsq&E literal 0 HcmV?d00001 diff --git a/textures/castle_ironbound_chest_side.png b/textures/castle_ironbound_chest_side.png new file mode 100644 index 0000000000000000000000000000000000000000..3a94f81f1dee8af9b3abffd08faccf1558a53d63 GIT binary patch literal 374 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbK}PJmB{Yg~|Pe6U+Wh&e+?*#M{x-&Bnmp*2u#Sh>Sh#One+oU9I)qYz!xeX$5f9GHm`==0vS$WxWv%{{J+})6;+h-Hmr0Bk(@{X>9 z&*oW+?+F{9aA-~9Wjqs;a!s&IMujDCQHft_m0`*GZ(IJB-hcl1T3W-lgYq-hywC{T zb1eIkbjggphHN2++x~kB7+#t&amuulevd0;s>3cWUMoMlZ0Gu?yRU3bOm}{=Xxf9) zkW)&_A6z{%wQ*%o>8o|~x}3IpvF*`2+TC!~A%*wXzh7UU=l}dN|NYOxyYgS&aa$RB SeE0|S5QC?ypUXO@geCw~?UD=t literal 0 HcmV?d00001 diff --git a/textures/castle_ironbound_chest_top.png b/textures/castle_ironbound_chest_top.png new file mode 100644 index 0000000000000000000000000000000000000000..29446db1cfd074455b4e731f3cdb370a99c26fb5 GIT binary patch literal 522 zcmV+l0`>igP)pD%t+sZY_=;i2S3|VUl8DpG!9-I{OwsKWkRTa0JraA7+kMsWTw*v{kK6-uuiIQN; z_35h?KQ960K;xWiP4>30KWBeExVbBvVs%%DT;jcd-PXC35(p+xDE@qo|GrPZufu6q z6Y|~@>P&VStw5!b3EYu}