Fix some bugs

- HUD healthbars should no longer be off
- renaming and re-colouring your party should no longer rename everyone's nametag to the leader's
master
fishyWET 2017-10-13 10:25:22 +08:00
parent fac8eaebdf
commit 77b35edd2d
2 changed files with 42 additions and 13 deletions

View File

@ -535,6 +535,7 @@ minetest.register_chatcommand("p", {
return
end
if party.check_tag(name, param2) == true then
party.send_notice(name, "Party name selected already exists. Please choose another one.")
return
end
-- if not, apply rename
@ -550,9 +551,9 @@ minetest.register_chatcommand("p", {
local names = players:get_player_name()
local csquad = mod_storage:get_string(names.."_squad")
if mod_storage:get_string(names.."_party") == cparty and csquad == "" then
players:set_nametag_attributes({text = minetest.colorize(tcolour, "["..param2.."]").." "..name})
players:set_nametag_attributes({text = minetest.colorize(tcolour, "["..param2.."]").." "..names})
elseif mod_storage:get_string(names.."_party") == cparty and csquad ~= "" then
players:set_nametag_attributes({text = minetest.colorize(tcolour, "["..param2.."-"..csquad.."]").." "..name})
players:set_nametag_attributes({text = minetest.colorize(tcolour, "["..param2.."-"..csquad.."]").." "..names})
end
end
@ -573,9 +574,9 @@ minetest.register_chatcommand("p", {
local names = players:get_player_name()
local csquad = mod_storage:get_string(names.."_squad")
if mod_storage:get_string(names.."_party") == cparty and csquad == "" then
players:set_nametag_attributes({text = minetest.colorize(tcolour, "["..cparty_l.."]").." "..name})
players:set_nametag_attributes({text = minetest.colorize(tcolour, "["..cparty_l.."]").." "..names})
elseif mod_storage:get_string(names.."_party") == cparty and csquad ~= "" then
players:set_nametag_attributes({text = minetest.colorize(tcolour, "["..cparty_l.."-"..csquad.."]").." "..name})
players:set_nametag_attributes({text = minetest.colorize(tcolour, "["..cparty_l.."-"..csquad.."]").." "..names})
end
end
@ -662,7 +663,35 @@ minetest.register_chatcommand("p", {
mod_storage:set_string(param2.."_title",param3)
party.send_notice(name, "Player "..param2.."'s title has been set to "..param3)
end
end
end
elseif param1 == "diplo" then
-- check if player is in party
-- if so send list of allies
-- send list of enemies
if param2 ~= nil and param3 ~= nil then
-- check if player is leader
if party.check(name, 3) == true then
return
end
-- check if party actually exists
if party.check_tag(name, param2) ~= true then
party.send_notice(name, "Party does not exist! Case sensitive!")
return
end
-------------------------------------------------------------------------------------------------
if param3 == "ally" then
elseif param3 == "war" then
elseif param3 == "neutral" then
end
end
-- /p kick
elseif param1 == "kick" and param2 ~= nil then

View File

@ -65,8 +65,8 @@ squad.load_hud_self = function(name)
text = "party_heart_background.png",
number = 0,
size = {x=22, y=22},
position = { x = 0.01, y = 0.8 },
offset = { x = 0, y = 50 + (i*-50) },
position = { x = 0.01, y = 0.87 + (i*-0.07) },
offset = { x = 0, y = 0 },
direction = 0,
})
ids_hp[name.."_"..cparty.."_hp_"..csquad.."_"..i] = player:hud_add({
@ -74,29 +74,29 @@ squad.load_hud_self = function(name)
text = "party_heart.png",
number = 0,
size = {x=22, y=22},
position = { x = 0.01, y = 0.8 },
offset = { x = 0, y = 50 + (i*-50) },
position = { x = 0.01, y = 0.87 + (i*-0.07) },
offset = { x = 0, y = 0 },
direction = 0,
})
ids_hptag[name.."_"..cparty.."_hptag_"..csquad.."_"..i] = player:hud_add({
hud_elem_type = "text",
position = { x = 0.01 , y = 0.8 },
position = { x = 0.01 , y = 0.87 + (i*-0.07) },
alignment = 0,
name = "text",
number = 0xFFFFFF,
text = "",
alignment = {x=1,y=0},
offset = { x = 5, y = 46.5 + (i*-37.5) },
offset = { x = 5, y = 9 },
})
ids_tag[name.."_"..cparty.."_tag_"..csquad.."_"..i] = player:hud_add({
hud_elem_type = "text",
position = { x = 0.01 , y = 0.8 },
position = { x = 0.01 , y = 0.87 + (i*-0.07) },
alignment = 0,
name = "text",
number = 0x00FF00,
text = "",
alignment = {x=1,y=0},
offset = { x = 0, y = 29.5 + (i*-37.5) },
offset = { x = 0, y = -8 },
})
end