diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/depends.txt b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/depends.txt new file mode 100755 index 00000000..585cc7aa --- /dev/null +++ b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/depends.txt @@ -0,0 +1,2 @@ +default +3d_armor diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/init.lua b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/init.lua new file mode 100755 index 00000000..2820010c --- /dev/null +++ b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/init.lua @@ -0,0 +1,40 @@ +if ARMOR_MATERIALS.black_mithril then + -- Register helmets : + minetest.register_tool(":3d_armor:helmet_black_mithril_plated_armor_warrior", { + description = "Warrior's Black Mithril Plated Helmet", + inventory_image = "3d_armor_inv_helmet_black_mithril_plated_armor_warrior.png", + groups = {armor_head = 5, armor_heal = 0, armor_use = 250}, + wear = 0, + }) + -- Register chestplates : + minetest.register_tool(":3d_armor:chestplate_black_mithril_plated_armor_warrior", { + description = "Warrior's Black Mithril Plated Chestplate", + inventory_image = "3d_armor_inv_chestplate_black_mithril_plated_warrior.png", + groups = {armor_torso = 8, armor_heal = 0, armor_use = 250}, + wear = 0, + }) + -- Register leggings : + minetest.register_tool(":3d_armor:leggings_black_mithril_plated_armor_warrior", { + description = "Warrior's Black Mithril Plated Leggings", + inventory_image = "3d_armor_inv_leggings_black_mithril_plated_armor_warrior.png", + groups = {armor_legs = 8, armor_heal = 0, armor_use = 250}, + wear = 0, + }) + -- Register boots : + minetest.register_tool(":3d_armor:boots_black_mithril_plated_armor_warrior", { + description = "Warrior's Black Mithril Plated Boots", + inventory_image = "3d_armor_inv_boots_black_mithril_plated_armor_warrior.png", + groups = {armor_feet = 5, armor_heal = 0, armor_use = 250}, + wear = 0, + }) +end + +-- Black Mithril craft recipe +minetest.register_craft({ + output = "3d_armor:black_mithril", + recipe = { + {"nether:white", "mobs:dungeon_master_blood", "default:obsidian" }, + {"default:mithril_ingot", "mobs:dungeon_master_diamond", "default:mithril_ingot" }, + {"default:obsidian", "mobs:dungeon_master_blood", "nether:white" }, + } +}) diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_boots_black_mithril_plated_armor_warrior.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_boots_black_mithril_plated_armor_warrior.png new file mode 100755 index 00000000..771054cc Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_boots_black_mithril_plated_armor_warrior.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_boots_black_mithril_plated_armor_warrior_preview.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_boots_black_mithril_plated_armor_warrior_preview.png new file mode 100755 index 00000000..65913645 Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_boots_black_mithril_plated_armor_warrior_preview.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_chestplate_black_mithril_plated_armor_warrior.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_chestplate_black_mithril_plated_armor_warrior.png new file mode 100755 index 00000000..f378a002 Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_chestplate_black_mithril_plated_armor_warrior.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_chestplate_black_mithril_plated_armor_warrior_preview.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_chestplate_black_mithril_plated_armor_warrior_preview.png new file mode 100755 index 00000000..8faead76 Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_chestplate_black_mithril_plated_armor_warrior_preview.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_helmet_black_mithril_plated_armor_warrior.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_helmet_black_mithril_plated_armor_warrior.png new file mode 100755 index 00000000..10e886c6 Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_helmet_black_mithril_plated_armor_warrior.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_helmet_black_mithril_plated_armor_warrior_preview.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_helmet_black_mithril_plated_armor_warrior_preview.png new file mode 100755 index 00000000..c99b3db8 Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_helmet_black_mithril_plated_armor_warrior_preview.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_boots_black_mithril_plated_armor_warrior.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_boots_black_mithril_plated_armor_warrior.png new file mode 100755 index 00000000..109e55a5 Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_boots_black_mithril_plated_armor_warrior.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_chestplate_black_mithril_plated_armor_warrior.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_chestplate_black_mithril_plated_armor_warrior.png new file mode 100755 index 00000000..0d5a9fca Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_chestplate_black_mithril_plated_armor_warrior.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_helmet_black_mithril_plated_armor_warrior.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_helmet_black_mithril_plated_armor_warrior.png new file mode 100755 index 00000000..96e260a4 Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_helmet_black_mithril_plated_armor_warrior.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_leggings_black_mithril_plated_armor_warrior.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_leggings_black_mithril_plated_armor_warrior.png new file mode 100755 index 00000000..21f1d004 Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_inv_leggings_black_mithril_plated_armor_warrior.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_leggings_black_mithril_plated_armor_warrior.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_leggings_black_mithril_plated_armor_warrior.png new file mode 100755 index 00000000..3f25bebe Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_leggings_black_mithril_plated_armor_warrior.png differ diff --git a/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_leggings_black_mithril_plated_armor_warrior_preview.png b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_leggings_black_mithril_plated_armor_warrior_preview.png new file mode 100755 index 00000000..41fd645c Binary files /dev/null and b/mods/3d_armor_classes/black_mithril_plated_armor_warrior/textures/3d_armor_leggings_black_mithril_plated_armor_warrior_preview.png differ diff --git a/mods/automappercolors/init.lua b/mods/automappercolors/init.lua new file mode 100755 index 00000000..55143326 --- /dev/null +++ b/mods/automappercolors/init.lua @@ -0,0 +1,50 @@ +-- Automappercolors by gravgun +-- WTFPL + +function amc_dumpnodes() + local fd, err = io.open(minetest.get_worldpath()..'/amc_nodes.txt', 'wb') + if not fd then + return 0, err + end + local n = 0 + for name, def in pairs(minetest.registered_nodes) do + if def.drawtype ~= 'airlike' then + local tile = def.tiles or def.tile_images + if type(tile) == 'table' then + tile = tile[1] + if type(tile) == 'table' then + tile = tile.name + end + end + if tile ~= nil then + tile = (tile .. '^'):match('([a-zA-Z0-9\\._-]-)^') + fd:write(name .. ' ' .. tile .. '\n') + n = n + 1 + end + end + end + fd:close() + return n, "done" +end + +minetest.register_chatcommand("amcdumpnodes", { + params = "", + description = "", + func = function(plname, param) + local n, msg = amc_dumpnodes() + if n == 0 then + minetest.chat_send_player(plname, 'io.open: ' .. msg) + else + minetest.chat_send_player(plname, n .. " nodes dumped.") + end + end, +}) + +minetest.after(1, function(args) + amc_dumpnodes() + if minetest.setting_getbool("log_mods") then + minetest.log("action", "[automappercolors] nodes dumped") + end +end) + + diff --git a/mods/automappercolors/process.py b/mods/automappercolors/process.py new file mode 100755 index 00000000..7d84806c --- /dev/null +++ b/mods/automappercolors/process.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python2 +# Automappercolors by gravgun +# WTFPL +# Note: running this in Pypy has been tested to be ~3x faster + +from __future__ import print_function +import sys, os, re +from PIL import Image + +predefined = { + #"^default:water_([a-z]+)": {'r': 39, 'g': 66, 'b': 106, 'a': 128, 't': 224}, + #"^default:river_water_([a-z]+)": {'r': 39, 'g': 66, 'b': 106, 'a': 128, 't': 224}, + #"^default:lava_([a-z]+)": {'r': 255, 'g': 100, 'b': 0}, + "^default:([a-z_]*)glass": {'a': 64, 't': 16}, + "^default:torch": {'r': 255, 'g': 255} +} + +predef_compiled = {} +for k in predefined: + predef_compiled[re.compile(k)] = predefined[k] + +if len(sys.argv) <= 2: + print("Usage: %s " % sys.argv[0]) +else: + pngpaths = {} + for root, dirs, files in os.walk(sys.argv[2]): + for dir in dirs: + if dir[0] == ".": # No dotdirs + dirs.remove(dir) + for file in files: + pngpaths[file] = os.path.join(root, file) + out = open(os.path.join(sys.argv[1], "colors.txt"), 'w') + f = open(os.path.join(sys.argv[1], "amc_nodes.txt"), 'r') + for line in f: + ldata = line.split(' ') + if len(ldata) == 2: + nodename = ldata[0] + tex = ldata[1][:-1] # Strip newline char + try: + a_override = None + t_override = None + compute = True + ccumul = [0, 0, 0, 0] + for k in predef_compiled: + if k.match(nodename) is not None: + v = predef_compiled[k] + if 'r' in v: + ccumul[0] = v['r'] + compute = False + if 'g' in v: + ccumul[1] = v['g'] + compute = False + if 'b' in v: + ccumul[2] = v['b'] + compute = False + if 'a' in v: + a_override = v['a'] + if 't' in v: + t_override = v['t'] + + if compute: + inp = Image.open(pngpaths[tex]) + # Flaky PILlow bug causing unclosed fp loss during convert + # resulting in a Too many files open IOError + inpfp = inp.fp + inp2 = inp.convert('RGBA') + ind = inp2.load() + inpfp.close() + pixcount = 0 + for x in range(inp.size[0]): + for y in range(inp.size[1]): + pxl = ind[x, y] + ccumul[0] += (pxl[0]*pxl[3])/255 + ccumul[1] += (pxl[1]*pxl[3])/255 + ccumul[2] += (pxl[2]*pxl[3])/255 + ccumul[3] += pxl[3] + if ccumul[3] > 0: + for i in range(3): + ccumul[i] /= ccumul[3]/255 + if a_override is None: + a = ccumul[3]/(inp.size[0]*inp.size[1]) + else: + a = a_override + if t_override is None: + t = 255-a + else: + t = t_override + + if t != 0: + out.write("%s %d %d %d %d %d\n" % (nodename, ccumul[0], ccumul[1], ccumul[2], a, t)) + elif a != 255: + out.write("%s %d %d %d %d\n" % (nodename, ccumul[0], ccumul[1], ccumul[2], a)) + else: + out.write("%s %d %d %d\n" % (nodename, ccumul[0], ccumul[1], ccumul[2])) + except KeyError: + print("Skip texture %s for %s" % (tex, nodename)) + out.close() + f.close() \ No newline at end of file diff --git a/mods/dumpnodes/init.lua b/mods/dumpnodes/init.lua deleted file mode 100755 index 10b7ba9e..00000000 --- a/mods/dumpnodes/init.lua +++ /dev/null @@ -1,50 +0,0 @@ -local function nd_get_tiles(nd) - if nd.tiles then - return nd.tiles - elseif nd.tile_images then - return nd.tile_images - end - return nil -end - -minetest.register_chatcommand("dumpnodes", { - params = "", - description = "", - privs = {server = true}, - func = function(plname, param) - local n = 0 - local ntbl = {} - for nn, nd in pairs(minetest.registered_nodes) do - local prefix, name = nn:match('(.*):(.*)') - if prefix == nil or name == nil or prefix == '' or name == '' then - -- nothing - else - if ntbl[prefix] == nil then - ntbl[prefix] = {} - end - ntbl[prefix][name] = nd - end - end - local out, err = io.open('nodes.txt', 'wb') - if not out then - return minetest.chat_send_player(plname, 'io.open: ' .. err) - end - for prefix, i in pairs(ntbl) do - out:write('# ' .. prefix .. '\n') - for name, nd in pairs(i) do - if nd.drawtype ~= 'airlike' and nd_get_tiles(nd) ~= nil then - local tl = nd_get_tiles(nd)[1] - if type(tl) == 'table' then - tl = tl.name - end - tl = (tl .. '^'):match('(.-)^') - out:write(prefix .. ':' .. name .. ' ' .. tl .. '\n') - n = n + 1 - end - end - out:write('\n') - end - out:close() - minetest.chat_send_player(plname, n .. " nodes dumped.") - end, -}) diff --git a/worlds/minetestforfun/world.mt b/worlds/minetestforfun/world.mt index b9f72c55..87fa5d17 100755 --- a/worlds/minetestforfun/world.mt +++ b/worlds/minetestforfun/world.mt @@ -20,7 +20,7 @@ load_mod_worldedit_gui = true load_mod_worldedit_infinity = true load_mod_worldedit_limited = true load_mod_worldedit_shortcommands = true -load_mod_dumpnodes = true +load_mod_automappercolors = true load_mod_mapfix = true load_mod_worldedge = true load_mod_maze = true