From 907e8bf6a64215a516fdf16869dd81248aeaa2f6 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 17 Mar 2017 16:53:18 -0400 Subject: update digilines, technic, unified inventory, and switched castles to the new modpack form --- castle_lighting/LICENSE | 21 ++ castle_lighting/README.txt | 23 ++ castle_lighting/brasier.lua | 267 +++++++++++++++++++++ castle_lighting/depends.txt | 6 + castle_lighting/description.txt | 1 + castle_lighting/init.lua | 100 ++++++++ castle_lighting/intllib.lua | 45 ++++ castle_lighting/locale/template.pot | 52 ++++ castle_lighting/mod.conf | 1 + castle_lighting/screenshot.png | Bin 0 -> 39320 bytes castle_lighting/textures/LICENSE.txt | 17 ++ .../textures/castle_brasier_bed_mask.png | Bin 0 -> 497 bytes castle_lighting/textures/castle_chandelier.png | Bin 0 -> 360 bytes .../textures/castle_chandelier_chain.png | Bin 0 -> 169 bytes .../textures/castle_chandelier_wield.png | Bin 0 -> 316 bytes castle_lighting/textures/castle_coal_bed.png | Bin 0 -> 771 bytes castle_lighting/textures/castle_steel.png | Bin 0 -> 214 bytes castle_lighting/textures/castle_street_light.png | Bin 0 -> 465 bytes 18 files changed, 533 insertions(+) create mode 100644 castle_lighting/LICENSE create mode 100644 castle_lighting/README.txt create mode 100644 castle_lighting/brasier.lua create mode 100644 castle_lighting/depends.txt create mode 100644 castle_lighting/description.txt create mode 100644 castle_lighting/init.lua create mode 100644 castle_lighting/intllib.lua create mode 100644 castle_lighting/locale/template.pot create mode 100644 castle_lighting/mod.conf create mode 100644 castle_lighting/screenshot.png create mode 100644 castle_lighting/textures/LICENSE.txt create mode 100644 castle_lighting/textures/castle_brasier_bed_mask.png create mode 100644 castle_lighting/textures/castle_chandelier.png create mode 100644 castle_lighting/textures/castle_chandelier_chain.png create mode 100644 castle_lighting/textures/castle_chandelier_wield.png create mode 100644 castle_lighting/textures/castle_coal_bed.png create mode 100644 castle_lighting/textures/castle_steel.png create mode 100644 castle_lighting/textures/castle_street_light.png (limited to 'castle_lighting') diff --git a/castle_lighting/LICENSE b/castle_lighting/LICENSE new file mode 100644 index 0000000..456d091 --- /dev/null +++ b/castle_lighting/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/castle_lighting/README.txt b/castle_lighting/README.txt new file mode 100644 index 0000000..90fb450 --- /dev/null +++ b/castle_lighting/README.txt @@ -0,0 +1,23 @@ +=-=-=-=-=-=-=-=-=-= + +Castles Mod +by: Philipbenr And DanDuncombe + +=-=-=-=-=-=-=-=-=-= + +Licence: MIT + +see: LICENSE + +=-=-=-=-=-=-=-=-=-= + +This mod contains medieval lighting sources suitable for a castle. It includes: + +* Small chandelier and hanging chain +* Lantern box +* Steel floor brasier +* Stone pedestal/column brasier. + +If the castle_masonry mod is installed, brasiers will be generated for all enabled material types. + +Brasiers require fuel to generate a flame. \ No newline at end of file diff --git a/castle_lighting/brasier.lua b/castle_lighting/brasier.lua new file mode 100644 index 0000000..b461e52 --- /dev/null +++ b/castle_lighting/brasier.lua @@ -0,0 +1,267 @@ +if not minetest.get_modpath("fire") then return end + +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +local brasier_longdesc = S("A brasier for producing copious amounts of light and heat.") +local brasier_usagehelp = S("To ignite the brasier place a flammable fuel in its inventory slot. A lump of coal will burn for about half an hour.") + +local brasier_nodebox = { + type = "fixed", + fixed = { + {-0.25, 0, -0.25, 0.25, 0.125, 0.25}, -- base + {-0.375, 0.125, -0.375, 0.375, 0.25, 0.375}, -- mid + {-0.5, 0.25, -0.5, 0.5, 0.375, 0.5}, -- plat + {-0.5, 0.375, 0.375, 0.5, 0.5, 0.5}, -- edge + {-0.5, 0.375, -0.5, 0.5, 0.5, -0.375}, -- edge + {0.375, 0.375, -0.375, 0.5, 0.5, 0.375}, -- edge + {-0.5, 0.375, -0.375, -0.375, 0.5, 0.375}, -- edge + {0.25, -0.5, -0.375, 0.375, 0.125, -0.25}, -- leg + {-0.375, -0.5, 0.25, -0.25, 0.125, 0.375}, -- leg + {0.25, -0.5, 0.25, 0.375, 0.125, 0.375}, -- leg + {-0.375, -0.5, -0.375, -0.25, 0.125, -0.25}, -- leg + {-0.125, -0.0625, -0.125, 0.125, 0, 0.125}, -- bottom_knob + } +} +local brasier_selection_box = { + type = "fixed", + fixed = { + {-0.375, -0.5, -0.375, 0.375, 0.25, 0.375}, -- mid + {-0.5, 0.25, -0.5, 0.5, 0.5, 0.5}, -- plat + } +} + +local brasier_burn = function(pos) + local pos_above = {x=pos.x, y=pos.y+1, z=pos.z} + local node_above = minetest.get_node(pos_above) + local timer = minetest.get_node_timer(pos) + + if timer:is_started() and node_above.name == "fire:permanent_flame" then return end -- already burning, don't burn a new thing. + + local inv = minetest.get_inventory({type="node", pos=pos}) + local item = inv:get_stack("fuel", 1) + local fuel_burned = minetest.get_craft_result({method="fuel", width=1, items={item:peek_item(1)}}).time + + if fuel_burned > 0 and (node_above.name == "air" or node_above.name == "fire:permanent_flame") then + item:set_count(item:get_count() - 1) + inv:set_stack("fuel", 1, item) + + timer:start(fuel_burned * 60) -- one minute of flame per second of burn time, for balance. + + if node_above.name == "air" then + minetest.set_node(pos_above, {name = "fire:permanent_flame"}) + end + else + if node_above.name == "fire:permanent_flame" then + minetest.set_node(pos_above, {name = "air"}) + end + end +end + +local brasier_on_construct = function(pos) + local inv = minetest.get_meta(pos):get_inventory() + inv:set_size("fuel", 1) + + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "size[8,5.3]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[current_name;fuel;3.5,0;1,1;]" .. + "list[current_player;main;0,1.15;8,1;]" .. + "list[current_player;main;0,2.38;8,3;8]" .. + "listring[current_name;main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,1.15) + ) +end + +local brasier_on_destruct = function(pos, oldnode) + local pos_above = {x=pos.x, y=pos.y+1, z=pos.z} + local node_above = minetest.get_node(pos_above) + if node_above.name == "fire:permanent_flame" then + minetest.set_node(pos_above, {name = "air"}) + end +end + +local brasier_can_dig = function(pos, player) + local inv = minetest.get_meta(pos):get_inventory() + return inv:is_empty("fuel") +end + +-- Only allow fuel items to be placed in fuel +local brasier_allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if listname == "fuel" then + if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then + return stack:get_count() + else + return 0 + end + end + return 0 +end + +minetest.register_node("castle_lighting:brasier_floor", { + description = S("Floor Brasier"), + _doc_items_longdesc = brasier_longdesc, + _doc_items_usagehelp = brasier_usagehelp, + tiles = { + "castle_steel.png^(castle_coal_bed.png^[mask:castle_brasier_bed_mask.png)", + "castle_steel.png", + "castle_steel.png", + "castle_steel.png", + "castle_steel.png", + "castle_steel.png", + }, + drawtype = "nodebox", + groups = {cracky=2}, + paramtype = "light", + node_box = brasier_nodebox, + selection_box = brasier_selection_box, + + on_construct = brasier_on_construct, + on_destruct = brasier_on_destruct, + can_dig = brasier_can_dig, + allow_metadata_inventory_put = brasier_allow_metadata_inventory_put, + on_metadata_inventory_put = brasier_burn, + on_timer = brasier_burn, +}) + + +minetest.register_craft({ + output = "castle_lighting:brasier_floor", + recipe = { + {"default:steel_ingot", "default:torch", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + } +}) + +if minetest.get_modpath("hopper") and hopper ~= nil and hopper.add_container ~= nil then + hopper:add_container({ + {"top", "castle_lighting:brasier_floor", "fuel"}, + {"bottom", "castle_lighting:brasier_floor", "fuel"}, + {"side", "castle_lighting:brasier_floor", "fuel"}, + }) +end + +------------------------------------------------------------------------------------------------------ +-- Masonry brasiers + +local materials +if minetest.get_modpath("castle_masonry") then + materials = castle_masonry.materials +else + materials = {{name="stonebrick", desc=S("Stonebrick"), tile="default_stone_brick.png", craft_material="default:stonebrick"}} +end + +local get_material_properties = function(material) + local composition_def + local burn_time + if material.composition_material ~= nil then + composition_def = minetest.registered_nodes[material.composition_material] + burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack(material.composition_material)}}).time + else + composition_def = minetest.registered_nodes[material.craft_material] + burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack(material.craft_materia)}}).time + end + + local tiles = material.tile + if tiles == nil then + tiles = composition_def.tile + elseif type(tiles) == "string" then + tiles = {tiles} + end + + -- Apply bed of coals to the texture. + if table.getn(tiles) == 1 then + tiles = {tiles[1].."^(castle_coal_bed.png^[mask:castle_brasier_bed_mask.png)", tiles[1], tiles[1], tiles[1], tiles[1], tiles[1]} + else + tiles[1] = tiles[1].."^(castle_coal_bed.png^[mask:castle_brasier_bed_mask.png)" + end + + local desc = material.desc + if desc == nil then + desc = composition_def.description + end + + return composition_def, burn_time, tiles, desc +end + +local pillar_brasier_nodebox = { + type = "fixed", + fixed = { + {-0.375, 0.125, -0.375, 0.375, 0.25, 0.375}, -- mid + {-0.5, 0.25, -0.5, 0.5, 0.375, 0.5}, -- plat + {-0.5, 0.375, 0.375, 0.5, 0.5, 0.5}, -- edge + {-0.5, 0.375, -0.5, 0.5, 0.5, -0.375}, -- edge + {0.375, 0.375, -0.375, 0.5, 0.5, 0.375}, -- edge + {-0.5, 0.375, -0.375, -0.375, 0.5, 0.375}, -- edge + {-0.25,-0.5,-0.25,0.25,0.125,0.25}, -- support + } +} + +local pillar_brasier_selection_box = { + type = "fixed", + fixed = { + {-0.375, 0.125, -0.375, 0.375, 0.25, 0.375}, -- mid + {-0.5, 0.25, -0.5, 0.5, 0.5, 0.5}, -- plat + {-0.25,-0.5,-0.25,0.25,0.125,0.25}, -- support + } +} + +castle_lighting.register_pillar_brasier = function(material) + local composition_def, burn_time, tile, desc = get_material_properties(material) + if burn_time > 0 or composition_def.groups.puts_out_fire then return end -- No wooden brasiers, snow brasiers, or ice brasiers, alas. + + local crossbrace_connectable_groups = {} + for group, val in pairs(composition_def.groups) do + crossbrace_connectable_groups[group] = val + end + crossbrace_connectable_groups.crossbrace_connectable = 1 + + local mod_name = minetest.get_current_modname() + + minetest.register_node(mod_name..":"..material.name.."_pillar_brasier", { + drawtype = "nodebox", + description = S("@1 Brasier", desc), + _doc_items_longdesc = brasier_longdesc, + _doc_items_usagehelp = brasier_usagehelp, + tiles = tile, + paramtype = "light", + paramtype2 = "facedir", + groups = crossbrace_connectable_groups, + sounds = composition_def.sounds, + + node_box = pillar_brasier_nodebox, + selection_box = pillar_brasier_selection_box, + + on_construct = brasier_on_construct, + on_destruct = brasier_on_destruct, + can_dig = brasier_can_dig, + allow_metadata_inventory_put = brasier_allow_metadata_inventory_put, + on_metadata_inventory_put = brasier_burn, + on_timer = brasier_burn, + }) + + minetest.register_craft({ + output = mod_name..":"..material.name.."_pillar_brasier 5", + recipe = { + {material.craft_material,"default:torch",material.craft_material}, + {material.craft_material,material.craft_material,material.craft_material}, + }, + }) + + if minetest.get_modpath("hopper") and hopper ~= nil and hopper.add_container ~= nil then + hopper:add_container({ + {"top", mod_name..":"..material.name.."_pillar_brasier", "fuel"}, + {"bottom", mod_name..":"..material.name.."_pillar_brasier", "fuel"}, + {"side", mod_name..":"..material.name.."_pillar_brasier", "fuel"}, + }) + end +end + +for _, material in pairs(materials) do + castle_lighting.register_pillar_brasier(material) +end diff --git a/castle_lighting/depends.txt b/castle_lighting/depends.txt new file mode 100644 index 0000000..ad94907 --- /dev/null +++ b/castle_lighting/depends.txt @@ -0,0 +1,6 @@ +default +intllib? +fire? +castle_masonry? +hopper? +doc? \ No newline at end of file diff --git a/castle_lighting/description.txt b/castle_lighting/description.txt new file mode 100644 index 0000000..aae3f9b --- /dev/null +++ b/castle_lighting/description.txt @@ -0,0 +1 @@ +This mod contains medieval castle lighting solutions diff --git a/castle_lighting/init.lua b/castle_lighting/init.lua new file mode 100644 index 0000000..34eb1c3 --- /dev/null +++ b/castle_lighting/init.lua @@ -0,0 +1,100 @@ +minetest.register_alias("darkage:lamp", "castle_lighting:light") +minetest.register_alias("castle:street_light", "castle_lighting:light") +minetest.register_alias("castle:light", "castle_lighting:light") +minetest.register_alias("castle:chandelier", "castle_lighting:chandelier") +minetest.register_alias("castle:chandelier_chain", "castle_lighting:chandelier_chain") + +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +castle_lighting = {} + +dofile(MP.."/brasier.lua") + +minetest.register_node("castle_lighting:light",{ + drawtype = "glasslike", + description = S("Light Block"), + sunlight_propagates = true, + light_source = 14, + tiles = {"castle_street_light.png"}, + groups = {cracky=2}, + sounds = default.node_sound_glass_defaults(), + paramtype = "light", +}) + +minetest.register_craft({ + output = "castle_lighting:light", + recipe = { + {"default:stick", "default:glass", "default:stick"}, + {"default:glass", "default:torch", "default:glass"}, + {"default:stick", "default:glass", "default:stick"}, + } +}) + +minetest.register_node( "castle_lighting:chandelier", { + drawtype = "plantlike", + description = S("Chandelier"), + paramtype = "light", + wield_image = "castle_chandelier_wield.png", + inventory_image = "castle_chandelier_wield.png", + groups = {cracky=2}, + sounds = default.node_sound_glass_defaults(), + sunlight_propagates = true, + light_source = 14, + tiles = { + { + name = "castle_chandelier.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.0 + }, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {0.35,-0.375,0.35,-0.35,0.5,-0.35}, + + }, + }, +}) + +minetest.register_craft({ + output = "castle_lighting:chandelier", + recipe = { + {"", "", ""}, + {"", "default:steel_ingot", ""}, + {"default:torch","default:torch","default:torch"}, + } +}) + +minetest.register_node( "castle_lighting:chandelier_chain", { + drawtype = "plantlike", + description = S("Chandelier Chain"), + paramtype = "light", + wield_image = "castle_chandelier_chain.png", + inventory_image = "castle_chandelier_chain.png", + groups = {cracky=2}, + sounds = default.node_sound_glass_defaults(), + sunlight_propagates = true, + tiles = {"castle_chandelier_chain.png"}, + selection_box = { + type = "fixed", + fixed = { + {0.1,-0.5,0.1,-0.1,0.5,-0.1}, + + }, + }, +}) + +minetest.register_craft({ + output = "castle_lighting:chandelier_chain 4", + recipe = { + {"", "default:steel_ingot", ""}, + {"", "", ""}, + {"","default:steel_ingot",""}, + } +}) \ No newline at end of file diff --git a/castle_lighting/intllib.lua b/castle_lighting/intllib.lua new file mode 100644 index 0000000..6669d72 --- /dev/null +++ b/castle_lighting/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/castle_lighting/locale/template.pot b/castle_lighting/locale/template.pot new file mode 100644 index 0000000..e7f0768 --- /dev/null +++ b/castle_lighting/locale/template.pot @@ -0,0 +1,52 @@ +# 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-03-01 23:52-0700\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: brasier.lua:7 +msgid "A brasier for producing copious amounts of light and heat." +msgstr "" + +#: brasier.lua:8 +msgid "" +"To ignite the brasier place a flammable fuel in its inventory slot. A lump " +"of coal will burn for about half an hour." +msgstr "" + +#: brasier.lua:107 +msgid "Floor Brasier" +msgstr "" + +#: brasier.lua:156 +msgid "Stonebrick" +msgstr "" + +#: brasier.lua:228 +msgid "@1 Brasier" +msgstr "" + +#: init.lua:17 +msgid "Light Block" +msgstr "" + +#: init.lua:37 +msgid "Chandelier" +msgstr "" + +#: init.lua:76 +msgid "Chandelier Chain" +msgstr "" diff --git a/castle_lighting/mod.conf b/castle_lighting/mod.conf new file mode 100644 index 0000000..b894c97 --- /dev/null +++ b/castle_lighting/mod.conf @@ -0,0 +1 @@ +name = castle_lighting diff --git a/castle_lighting/screenshot.png b/castle_lighting/screenshot.png new file mode 100644 index 0000000..354f4a2 Binary files /dev/null and b/castle_lighting/screenshot.png differ diff --git a/castle_lighting/textures/LICENSE.txt b/castle_lighting/textures/LICENSE.txt new file mode 100644 index 0000000..7d7ed99 --- /dev/null +++ b/castle_lighting/textures/LICENSE.txt @@ -0,0 +1,17 @@ +License Textures: Philipner - CC-BY-SA 3.0 + +-castle_chandelier.png +-castle_chandelier_chain.png +-castle_chandelier_wield.png + + +-------------------------------------------- + +16 px textures based on Castle mod +original textures by Philipner + +License Textures: Napiophelios - CC-BY-SA 3.0 + +-castle_street_light.png + +-------------------------------------------- diff --git a/castle_lighting/textures/castle_brasier_bed_mask.png b/castle_lighting/textures/castle_brasier_bed_mask.png new file mode 100644 index 0000000..2c30c88 Binary files /dev/null and b/castle_lighting/textures/castle_brasier_bed_mask.png differ diff --git a/castle_lighting/textures/castle_chandelier.png b/castle_lighting/textures/castle_chandelier.png new file mode 100644 index 0000000..fbc0039 Binary files /dev/null and b/castle_lighting/textures/castle_chandelier.png differ diff --git a/castle_lighting/textures/castle_chandelier_chain.png b/castle_lighting/textures/castle_chandelier_chain.png new file mode 100644 index 0000000..47a526a Binary files /dev/null and b/castle_lighting/textures/castle_chandelier_chain.png differ diff --git a/castle_lighting/textures/castle_chandelier_wield.png b/castle_lighting/textures/castle_chandelier_wield.png new file mode 100644 index 0000000..59dae96 Binary files /dev/null and b/castle_lighting/textures/castle_chandelier_wield.png differ diff --git a/castle_lighting/textures/castle_coal_bed.png b/castle_lighting/textures/castle_coal_bed.png new file mode 100644 index 0000000..e263bcd Binary files /dev/null and b/castle_lighting/textures/castle_coal_bed.png differ diff --git a/castle_lighting/textures/castle_steel.png b/castle_lighting/textures/castle_steel.png new file mode 100644 index 0000000..28ecd60 Binary files /dev/null and b/castle_lighting/textures/castle_steel.png differ diff --git a/castle_lighting/textures/castle_street_light.png b/castle_lighting/textures/castle_street_light.png new file mode 100644 index 0000000..dc3f72e Binary files /dev/null and b/castle_lighting/textures/castle_street_light.png differ -- cgit v1.2.3