Begin the 'Black Mithril Plated Armor' for Warriors and
Add the 'automappercolors' mod wich is the base of the colors.txt auto-generated update the 'world.mt' file for activated this mod --- Remove the dumpnodes mod wich is now useless
2
mods/3d_armor_classes/black_mithril_plated_armor_warrior/depends.txt
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
default
|
||||||
|
3d_armor
|
40
mods/3d_armor_classes/black_mithril_plated_armor_warrior/init.lua
Executable file
@ -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" },
|
||||||
|
}
|
||||||
|
})
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 415 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 669 B |
After Width: | Height: | Size: 776 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 186 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
50
mods/automappercolors/init.lua
Executable file
@ -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)
|
||||||
|
|
||||||
|
|
98
mods/automappercolors/process.py
Executable file
@ -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 <world path> <minetest data root path>" % 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()
|
@ -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,
|
|
||||||
})
|
|
@ -20,7 +20,7 @@ load_mod_worldedit_gui = true
|
|||||||
load_mod_worldedit_infinity = true
|
load_mod_worldedit_infinity = true
|
||||||
load_mod_worldedit_limited = true
|
load_mod_worldedit_limited = true
|
||||||
load_mod_worldedit_shortcommands = true
|
load_mod_worldedit_shortcommands = true
|
||||||
load_mod_dumpnodes = true
|
load_mod_automappercolors = true
|
||||||
load_mod_mapfix = true
|
load_mod_mapfix = true
|
||||||
load_mod_worldedge = true
|
load_mod_worldedge = true
|
||||||
load_mod_maze = true
|
load_mod_maze = true
|
||||||
|