From dba6340fd9d5856428d4a80f8eae3497b1e971ca Mon Sep 17 00:00:00 2001 From: Ekdohibs Date: Sat, 28 Jan 2017 21:41:39 +0100 Subject: [PATCH] Import walls & xpanes --- mods/nodes/depends.txt | 2 + mods/nodes/init.lua | 1 + mods/walls/README.txt | 7 + mods/walls/depends.txt | 1 + mods/walls/init.lua | 27 ++++ mods/walls/license.txt | 14 ++ mods/xpanes/README.txt | 21 +++ mods/xpanes/depends.txt | 1 + mods/xpanes/init.lua | 155 ++++++++++++++++++++++ mods/xpanes/license.txt | 64 +++++++++ mods/xpanes/textures/default_glass.png | Bin 0 -> 158 bytes mods/xpanes/textures/xpanes_bar.png | Bin 0 -> 180 bytes mods/xpanes/textures/xpanes_bar_top.png | Bin 0 -> 3516 bytes mods/xpanes/textures/xpanes_pane_half.png | Bin 0 -> 83 bytes mods/xpanes/textures/xpanes_space.png | Bin 0 -> 149 bytes mods/xpanes/textures/xpanes_white.png | Bin 0 -> 3496 bytes 16 files changed, 293 insertions(+) create mode 100644 mods/nodes/depends.txt create mode 100644 mods/walls/README.txt create mode 100644 mods/walls/depends.txt create mode 100644 mods/walls/init.lua create mode 100644 mods/walls/license.txt create mode 100644 mods/xpanes/README.txt create mode 100644 mods/xpanes/depends.txt create mode 100644 mods/xpanes/init.lua create mode 100644 mods/xpanes/license.txt create mode 100644 mods/xpanes/textures/default_glass.png create mode 100644 mods/xpanes/textures/xpanes_bar.png create mode 100644 mods/xpanes/textures/xpanes_bar_top.png create mode 100644 mods/xpanes/textures/xpanes_pane_half.png create mode 100644 mods/xpanes/textures/xpanes_space.png create mode 100644 mods/xpanes/textures/xpanes_white.png diff --git a/mods/nodes/depends.txt b/mods/nodes/depends.txt new file mode 100644 index 0000000..9a6c92b --- /dev/null +++ b/mods/nodes/depends.txt @@ -0,0 +1,2 @@ +walls +screwdriver diff --git a/mods/nodes/init.lua b/mods/nodes/init.lua index 81addb7..4b37502 100644 --- a/mods/nodes/init.lua +++ b/mods/nodes/init.lua @@ -104,6 +104,7 @@ for _, v in pairs(nodes) do }) if v[2] then make_stair_slab(v[1], {node = 1}, "", "") + walls.register("nodes:" .. v[1] .. "_wall", v[1] .. "Wall", v[1] .. ".png", nil) -- default.node_sound_stone_defaults()) end end diff --git a/mods/walls/README.txt b/mods/walls/README.txt new file mode 100644 index 0000000..0389174 --- /dev/null +++ b/mods/walls/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: walls +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Auke Kok (LGPL 2.1) diff --git a/mods/walls/depends.txt b/mods/walls/depends.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/mods/walls/depends.txt @@ -0,0 +1 @@ + diff --git a/mods/walls/init.lua b/mods/walls/init.lua new file mode 100644 index 0000000..30d50ef --- /dev/null +++ b/mods/walls/init.lua @@ -0,0 +1,27 @@ +walls = {} + +walls.register = function(wall_name, wall_desc, wall_texture, wall_sounds) + -- inventory node, and pole-type wall start item + minetest.register_node(wall_name, { + description = wall_desc, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}}, + -- connect_bottom = + connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}}, + connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}}, + connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, + connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, + }, + connects_to = { "group:wall", "group:node" }, + paramtype = "light", + is_ground_content = false, + tiles = { wall_texture, }, + walkable = true, + groups = { node = 1, wall = 1 }, + sounds = wall_sounds, + }) + +end + diff --git a/mods/walls/license.txt b/mods/walls/license.txt new file mode 100644 index 0000000..ccfaf1c --- /dev/null +++ b/mods/walls/license.txt @@ -0,0 +1,14 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2015 Auke Kok + +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: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html diff --git a/mods/xpanes/README.txt b/mods/xpanes/README.txt new file mode 100644 index 0000000..bcbc129 --- /dev/null +++ b/mods/xpanes/README.txt @@ -0,0 +1,21 @@ +Minetest Game mod: xpanes +========================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by xyz (MIT) +BlockMen (MIT) +sofar (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +xyz (CC BY-SA 3.0): + All textures not mentioned below. + +Gambit (CC BY-SA 3.0): + xpanes_bar.png + +paramat (CC BY-SA 3.0): + xpanes_bar_top.png diff --git a/mods/xpanes/depends.txt b/mods/xpanes/depends.txt new file mode 100644 index 0000000..3a2d9d5 --- /dev/null +++ b/mods/xpanes/depends.txt @@ -0,0 +1 @@ +nodes diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua new file mode 100644 index 0000000..cc3d234 --- /dev/null +++ b/mods/xpanes/init.lua @@ -0,0 +1,155 @@ + +local function is_pane(pos) + return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0 +end + +local function connects_dir(pos, name, dir) + local aside = vector.add(pos, minetest.facedir_to_dir(dir)) + if is_pane(aside) then + return true + end + + local connects_to = minetest.registered_nodes[name].connects_to + if not connects_to then + return false + end + local list = minetest.find_nodes_in_area(aside, aside, connects_to) + + if #list > 0 then + return true + end + + return false +end + +local function swap(pos, node, name, param2) + if node.name == name and node.param2 == param2 then + return + end + + minetest.set_node(pos, {name = name, param2 = param2}) +end + +local function update_pane(pos) + if not is_pane(pos) then + return + end + local node = minetest.get_node(pos) + local name = node.name + if name:sub(-5) == "_flat" then + name = name:sub(1, -6) + end + + local any = node.param2 + local c = {} + local count = 0 + for dir = 0, 3 do + c[dir] = connects_dir(pos, name, dir) + if c[dir] then + any = dir + count = count + 1 + end + end + + if count == 0 then + swap(pos, node, name .. "_flat", any) + elseif count == 1 then + swap(pos, node, name .. "_flat", (any + 1) % 4) + elseif count == 2 then + if (c[0] and c[2]) or (c[1] and c[3]) then + swap(pos, node, name .. "_flat", (any + 1) % 4) + else + swap(pos, node, name, 0) + end + else + swap(pos, node, name, 0) + end +end + +minetest.register_on_placenode(function(pos, node) + if minetest.get_item_group(node, "pane") then + update_pane(pos) + end + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) + +minetest.register_on_dignode(function(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) + +xpanes = {} +function xpanes.register_pane(name, def) + local flatgroups = table.copy(def.groups) + flatgroups.pane = 1 + minetest.register_node(":xpanes:" .. name .. "_flat", { + description = def.description, + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + inventory_image = def.inventory_image, + wield_image = def.wield_image, + paramtype2 = "facedir", + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = flatgroups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + selection_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connect_sides = { "left", "right" }, + }) + + local groups = table.copy(def.groups) + groups.pane = 1 + groups.not_in_creative_inventory = 1 + minetest.register_node(":xpanes:" .. name, { + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + description = def.description, + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = groups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "connected", + fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}}, + connect_front = {{-1/32, -1/2, -1/2, 1/32, 1/2, -1/32}}, + connect_left = {{-1/2, -1/2, -1/32, -1/32, 1/2, 1/32}}, + connect_back = {{-1/32, -1/2, 1/32, 1/32, 1/2, 1/2}}, + connect_right = {{1/32, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connects_to = {"group:pane", "group:node"}, + }) +end + +xpanes.register_pane("pane", { + description = "Glass Pane", + textures = {"default_glass.png","xpanes_pane_half.png","xpanes_white.png"}, + inventory_image = "default_glass.png", + wield_image = "default_glass.png", + --sounds = default.node_sound_glass_defaults(), + groups = {node = 1}, +}) + +xpanes.register_pane("bar", { + description = "Iron bar", + textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_bar_top.png"}, + inventory_image = "xpanes_bar.png", + wield_image = "xpanes_bar.png", + --sounds = default.node_sound_metal_defaults(), + groups = {node = 1}, +}) diff --git a/mods/xpanes/license.txt b/mods/xpanes/license.txt new file mode 100644 index 0000000..dff7227 --- /dev/null +++ b/mods/xpanes/license.txt @@ -0,0 +1,64 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 xyz +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2016 Auke Kok +Copyright (C) 2014-2016 Various Minetest developers and contributors + +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. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 xyz +Copyright (C) 2013-2016 Gambit +Copyright (C) 2016 paramat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/xpanes/textures/default_glass.png b/mods/xpanes/textures/default_glass.png new file mode 100644 index 0000000000000000000000000000000000000000..da2540287cfe24c451c14b424792ac431db80bda GIT binary patch literal 158 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPHV5AX?b1=0r&JidSb!L37ZnDlEWpQgtL4-c?CyjJZrexV8FbY+1RCb;|2u|E+z(! XG~Uzum2I_v1~YiN`njxgN@xNAOHwsn literal 0 HcmV?d00001 diff --git a/mods/xpanes/textures/xpanes_bar_top.png b/mods/xpanes/textures/xpanes_bar_top.png new file mode 100644 index 0000000000000000000000000000000000000000..887518aa2aa038594626d0583cb5ecf70de269b8 GIT binary patch literal 3516 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCnnvn2oAJB1(c1%M}WW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!8A_bVx6rr0WloBA5~7C5J7WO`H;r3P2|g(O#HCtIc{+1qj1R9FEG$W1LtRH(?! z$t$+1uvG$^YXxM3g!Ppaz)DK8ZIvQ?0~DO|i&7O#^i1>&bX_Yl%Z!xlxD;%PQqrt~ zT-=~W0C~1b86_nJR{Hwo<>h+i#(Mch>H3D2mX`VkM*2oZxO-9i^u0dZ`ye;a9*kN-QW%d0*JyB& z6apkE9!*`N!9`LCkfeAtbq%fH;zBf_QuBbVrgC8Oh~a;O1F&hu7T^=&nw6DRTwE-$ z!|)JLgfYq6-G!lpRn`N@;VkfoEM{Qf76xHPhFNnYfP(BLp1!W^54hQdg{}Vy^NIq6 zq&!_5LpZJ{|M)+jvE$!WWe)|b-O?=&VpKF4w%m~U_&H|6fVg?3oVGw3ym^DWND9B#o z>FdgVhfPFS!u;;lEal|A)B0#0OT+;F#3CNtp~CgJYD@<);T3K0RZlm9-{yN literal 0 HcmV?d00001 diff --git a/mods/xpanes/textures/xpanes_white.png b/mods/xpanes/textures/xpanes_white.png new file mode 100644 index 0000000000000000000000000000000000000000..a2f4b636ba2f083d9cc01d5d12ff70deb0df8783 GIT binary patch literal 3496 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn-?zVCJm~i6{w5ELSKf%1_J8NmVGR zEJ#&It;kGcV5qqDc6x5#6AhlW|HWOlOxq02jw=c**?CZ|KAyv~{!Gs5aO3*0RTo%~ z6y`i;55D^F&+p?L^$#C;SgM$wSAE{0JvC%U(xZ>NUcJ&>cJ+8|dB6OVhm{PQ0}W1< zzOFp&e?s!to~OCDS5A0s?fmo(e_ucUE3+f}Wbg28S6+D9(PrDiUA&z6=U?u!Uzd6` z=FUC+g}Hw>&R=ixBSvbM%CSh}NT>N0vz|8XEcR*J^Hp-ijZgnAe$~k5g}V9FcpY?K z&%yf8ds^4L3y(wls{Mj4Y<}~kS*$%{#&qlT@$vDla_=sff9hZHUh;4EAK8~1gsSW( z__usA{uku;OO5~iM7_NCHqZZ5{8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