1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-24 01:30:38 +01:00

Add tile image in class switches' parameters and tweak colors

- Refers to #216
This commit is contained in:
LeMagnesium 2015-08-17 10:53:13 +02:00
parent 26fae174b1
commit 2cd80bccf1
6 changed files with 22 additions and 9 deletions

View File

@ -10,7 +10,9 @@ pclasses.api.register_class("admin", {
on_assigned = function(pname)
minetest.chat_send_player(pname, "Hello admin.")
end,
switch_color = {r = 255, g = 00, b = 224}
switch_params = {
color = {r = 255, g = 00, b = 224}
}
})
pclasses.api.reserve_item("admin", "3d_armor:helmet_admin")

View File

@ -21,7 +21,10 @@ pclasses.api.register_class("hunter", {
on_unassigned = function(pname)
sprint.set_default_maxstamina(pname)
end,
switch_color = {r = 60, g = 75, b = 00}
switch_params = {
color = {r = 30, g = 170, b = 00},
tile = "default_wood.png"
}
})

View File

@ -16,7 +16,10 @@ pclasses.api.register_class("warrior", {
on_unassigned = function(pname)
sprint.set_default_maxstamina(pname)
end,
switch_color = {r = 00, g = 00, b = 114}
switch_params = {
color = {r = 06, g = 06, b = 30},
tile = "default_steel_block.png"
}
})
pclasses.api.reserve_item("warrior", "moreores:sword_mithril")

View File

@ -3,7 +3,10 @@
--
pclasses.api.register_class("adventurer", {
switch_color = { r = 142, g = 00, b = 00},
switch_params = {
color = { r = 142, g = 64, b = 00},
tile = "wool_white.png",
},
on_assigned = function(pname)
minetest.chat_send_player(pname, "You are now an adventurer")
end

View File

@ -14,7 +14,7 @@ function pclasses.api.register_class(cname, def)
cname .. ". Reason : no definition table.")
return
end
pclasses.register_class_switch(cname, def.switch_color)
pclasses.register_class_switch(cname, def.switch_params)
pclasses.classes[cname] = def
return true

View File

@ -61,16 +61,18 @@ local classes_items = {
["hunter"] = "throwing:bow_minotaur_horn_improved",
["warrior"] = "default:dungeon_master_s_blood_sword",
["admin"] = "maptools:pick_admin",
["adventurer"] = "unified_inventory:bag_large"
["adventurer"] = "unified_inventory:bag_large",
["wizard"] = "default:book"
}
function pclasses.register_class_switch(cname, color)
color = color or { r = 255, g = 255, b = 255 }
function pclasses.register_class_switch(cname, params)
local color = params.color or { r = 255, g = 255, b = 255 }
local txtcolor = string.format("#%02x%02x%02x", color.r, color.g, color.b)
local overlay = "pclasses_class_switch_orb_overlay.png"
print((params.tile or overlay))
minetest.register_node(":pclasses:class_switch_" .. cname, {
description = "Class switch orb (" .. cname .. ")",
tiles = {overlay .. "^[colorize:" .. txtcolor .. "^" .. overlay},
tiles = {(params.tile or overlay) .. "^[colorize:" .. txtcolor .. ":200"},
drawtype = "nodebox",
node_box = { type = "fixed", fixed = {
{-7/16, -8/16, -7/16, 7/16, -7/16, 7/16}, -- bottom plate