Add 3d_armor support

master
rubenwardy 2016-03-31 16:35:19 +01:00
parent 88aea4acb7
commit 0db05b54ef
3 changed files with 27 additions and 4 deletions

View File

@ -1 +1,2 @@
ctf
3d_armor?

View File

@ -10,9 +10,15 @@ ctf.hud.register_part(function(player, name, tplayer)
end
if ctf.setting("colors.skins") and text_color and color then
player:set_properties({
textures = {"ctf_colors_skin_" .. text_color .. ".png"},
})
if minetest.global_exists("armor") then
-- TODO: how should support for skin mods be done?
armor.textures[name].skin = "ctf_colors_skin_" .. text_color .. ".png"
armor:update_player_visuals(player)
else
player:set_properties({
textures = {"ctf_colors_skin_" .. text_color .. ".png"}
})
end
end
if not ctf.hud:exists(player, "ctf:hud_team") then
@ -30,3 +36,19 @@ ctf.hud.register_part(function(player, name, tplayer)
ctf.hud:change(player, "ctf:hud_team", "number", color)
end
end)
--[[if minetest.global_exists("armor") and armor.get_player_skin then
print("3d_armor detected!")
local old = armor.get_player_skin
function armor.get_player_skin(self, name)
local player = ctf.player(name)
local team = ctf.team(player.team)
if team and team.data.color and ctf.flag_colors[team.data.color] then
print("Return ctf_colors_skin_" .. team.data.color .. ".png")
return "ctf_colors_skin_" .. team.data.color .. ".png"
end
print("ctf_colors -!- Reverting to default armor skin")
return old(self, name)
end
end]]

View File

@ -79,7 +79,7 @@ local old_is_protected = minetest.is_protected
local r = ctf.setting("flag.nobuild_radius")
local rs = r * r
function minetest.is_protected(pos, name)
if rs == 0 then
if r <= 0 or rs == 0 then
return old_is_protected(pos, name)
end