This repository has been archived by the owner on Aug 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85d0eda
commit b72072c
Showing
10 changed files
with
456 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
ctf.gui.register_tab("settings", "Settings", function(name, team) | ||
local color = "" | ||
if ctf.team(team).data.color then | ||
color = ctf.team(team).data.color | ||
end | ||
|
||
local result = "field[3,2;4,1;color;Team Color;" .. color .. "]" .. | ||
"button[4,6;2,1;save;Save]" | ||
|
||
|
||
if not ctf.can_mod(name,team) then | ||
result = "label[0.5,1;You do not own this team!" | ||
end | ||
|
||
minetest.show_formspec(name, "ctf:settings", | ||
"size[10,7]" .. | ||
ctf.gui.get_tabs(name, team) .. | ||
result | ||
) | ||
end) | ||
|
||
minetest.register_on_player_receive_fields(function(player, formname, fields) | ||
if formname ~= "ctf:settings" then | ||
return false | ||
end | ||
|
||
-- Settings page | ||
if fields.save then | ||
ctf.gui.show(name, "settings") | ||
|
||
if ctf.flag_colors[fields.color] then | ||
team.data.color = fields.color | ||
ctf.needs_save = true | ||
else | ||
local colors = "" | ||
for color, code in pairs(ctf.flag_colors) do | ||
if colors ~= "" then | ||
colors = colors .. ", " | ||
end | ||
colors = colors .. color | ||
end | ||
minetest.chat_send_player(name, "Color " .. fields.color .. | ||
" does not exist! Available: " .. colors) | ||
end | ||
|
||
return true | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ctf.hud.register_part(function(player, name, tplayer) | ||
local text_color = ctf.team(tplayer.team).data.color | ||
local color = ctf.flag_colors[text_color] | ||
if not color then | ||
color = "0x000000" | ||
end | ||
|
||
if ctf.setting("colors.nametag") then | ||
player:set_nametag_attributes({ color = "0xFF" .. string.sub(color, 3) }) | ||
end | ||
|
||
if ctf.setting("colors.skins") and text_color and color then | ||
player:set_properties({ | ||
textures = {"ctf_colors_skin_" .. text_color .. ".png"}, | ||
}) | ||
end | ||
|
||
if not ctf.hud:exists(player, "ctf:hud_team") then | ||
ctf.hud:add(player, "ctf:hud_team", { | ||
hud_elem_type = "text", | ||
position = {x = 1, y = 0}, | ||
scale = {x = 100, y = 100}, | ||
text = "Team " .. tplayer.team, | ||
number = color, | ||
offset = {x = -20, y = 20}, | ||
alignment = {x = -1, y = 0} | ||
}) | ||
else | ||
ctf.hud:change(player, "ctf:hud_team", "text", "Team " .. tplayer.team) | ||
ctf.hud:change(player, "ctf:hud_team", "number", color) | ||
end | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.