Update groups, add player name on group message

This commit is contained in:
A Man
2020-05-13 16:12:31 +02:00
parent 11ac55acd6
commit 396d0313b3
8 changed files with 68 additions and 64 deletions

View File

@@ -2,7 +2,7 @@ private "_group";
_group = []; _group = [];
{ {
if (damage _x < 1 && isPlayer _x) then { if (damage _x < 1 && {isPlayer _x}) then {
_group set [count _group,_x]; _group set [count _group,_x];
}; };
} count (units group _this); } count (units group _this);

View File

@@ -14,7 +14,7 @@ while {true} do {
8 cutText ["","PLAIN"]; 8 cutText ["","PLAIN"];
localize "STR_EPOCH_LOST_RADIO_CONTACT" call dayz_rollingMessages; localize "STR_EPOCH_LOST_RADIO_CONTACT" call dayz_rollingMessages;
} else { } else {
if (_inGroup && scriptDone dayz_groupTags) then { if (_inGroup && {scriptDone dayz_groupTags}) then {
dayz_groupTags = execVM "\z\addons\dayz_code\groups\groupTags.sqf"; dayz_groupTags = execVM "\z\addons\dayz_code\groups\groupTags.sqf";
}; };
@@ -30,15 +30,15 @@ while {true} do {
if (visibleMap or !isNull (uiNamespace getVariable["BIS_RscMiniMap",displayNull])) then { if (visibleMap or !isNull (uiNamespace getVariable["BIS_RscMiniMap",displayNull])) then {
_hasGPS = "ItemGPS" in items player; _hasGPS = "ItemGPS" in items player;
_markBody = (dayz_markBody == 1 or (dayz_markBody == 2 && _hasGPS)); _markBody = (dayz_markBody == 1 or (dayz_markBody == 2 && {_hasGPS}));
_markGroup = (dayz_markGroup == 1 or (dayz_markGroup == 2 && _hasGPS)); _markGroup = (dayz_markGroup == 1 or (dayz_markGroup == 2 && {_hasGPS}));
_markSelf = (dayz_markSelf == 1 or (dayz_markSelf == 2 && _hasGPS)); _markSelf = (dayz_markSelf == 1 or (dayz_markSelf == 2 && {_hasGPS}));
_index = 0; _index = 0;
{ {
_self = _x == player; _self = _x == player;
_vehicle = vehicle _x; _vehicle = vehicle _x;
if ((_self or _markGroup) && (!_self or _markSelf) && (effectiveCommander _vehicle == _x)) then { if ((_self or _markGroup) && {!_self or _markSelf} && {effectiveCommander _vehicle == _x}) then {
_pos = [_x] call FNC_GetPos; _pos = [_x] call FNC_GetPos;
deleteMarkerLocal format["groupMember%1",_index]; deleteMarkerLocal format["groupMember%1",_index];
_marker = createMarkerLocal [format["groupMember%1",_index],_pos]; _marker = createMarkerLocal [format["groupMember%1",_index],_pos];

View File

@@ -1,5 +1,5 @@
#define DRAW_TAGS (!visibleMap && count units group player > 1) //Use && cameraView != "GROUP" if tactical view is allowed (blocked by default) #define DRAW_TAGS (!visibleMap && {count units group player > 1}) //Use && cameraView != "GROUP" if tactical view is allowed (blocked by default)
private ["_display","_distance","_group","_icon","_index","_pos","_scale","_screen","_text"]; private ["_display","_distance","_group","_icon","_index","_pos","_scale","_screen","_text","_refresh"];
disableSerialization; disableSerialization;
_refresh = { _refresh = {
@@ -11,12 +11,12 @@ _refresh = {
_pos = [_x] call FNC_GetPos; _pos = [_x] call FNC_GetPos;
_distance = _pos distance player; _distance = _pos distance player;
_icon = _display displayCtrl (100 + _index); _icon = _display displayCtrl (100 + _index);
if (_distance > 1 && _distance < 2500 && vehicle _x != vehicle player) then { if (_distance > 1 && {_distance < 2500} && {vehicle _x != vehicle player}) then {
_pos set [2,(_pos select 2) + 1.5]; _pos set [2,(_pos select 2) + 1.5];
_screen = worldToScreen _pos; _screen = worldToScreen _pos;
_text = composeText [image "\ca\ui\data\igui_side_unknown_ca.paa"," ",if (dayz_groupNameTags) then {name _x} else {""}]; _text = composeText [image "\ca\ui\data\igui_side_unknown_ca.paa"," ",if (dayz_groupNameTags) then {name _x} else {""}];
if (count _screen > 1) then { if (count _screen > 1) then {
_scale = if (_distance < 200) then {.3} else {1 min ((1 - (_distance - 3) / 15) max .3)}; _scale = [1 min ((1 - (_distance - 3) / 15) max .3),.3] select (_distance < 200);
_icon ctrlSetStructuredText _text; _icon ctrlSetStructuredText _text;
_icon ctrlSetPosition [(_screen select 0),(_screen select 1),.99,.65]; _icon ctrlSetPosition [(_screen select 0),(_screen select 1),.99,.65];
_icon ctrlSetScale _scale; _icon ctrlSetScale _scale;

View File

@@ -4,14 +4,14 @@ _add = _this select 0;
_uid = _this select 1; _uid = _this select 1;
if (typeName _add == "SCALAR") exitWith { if (typeName _add == "SCALAR") exitWith {
switch _add do { call {
case -1: { //Promote if (_add == -1) exitWith { //Promote
(group player) selectLeader _uid; (group player) selectLeader _uid;
}; };
case 1: { if (_add == 1) exitWith {
systemChat format[localize "STR_EPOCH_PLAYER_JOINED",_uid]; systemChat format[localize "STR_EPOCH_PLAYER_JOINED",_uid];
}; };
case 2: { if (_add == 2) exitWith {
if (_uid == getPlayerUID player) then { if (_uid == getPlayerUID player) then {
localize "STR_EPOCH_GROUP_KICKED" call dayz_rollingMessages; localize "STR_EPOCH_GROUP_KICKED" call dayz_rollingMessages;
terminate dayz_groupTags; terminate dayz_groupTags;
@@ -20,14 +20,14 @@ if (typeName _add == "SCALAR") exitWith {
systemChat format[localize "STR_EPOCH_PLAYER_KICKED",name (_uid call dayz_getPlayer)]; systemChat format[localize "STR_EPOCH_PLAYER_KICKED",name (_uid call dayz_getPlayer)];
}; };
}; };
case 3: { if (_add == 3) exitWith {
systemChat format[localize "STR_EPOCH_PLAYER_LEFT",_uid]; systemChat format[localize "STR_EPOCH_PLAYER_LEFT",_uid];
if (count (player call dayz_filterGroup) == 1) then { if (count (player call dayz_filterGroup) == 1) then {
terminate dayz_groupTags; terminate dayz_groupTags;
8 cutText ["","PLAIN"]; 8 cutText ["","PLAIN"];
}; };
}; };
case 4: { if (_add == 4) exitWith {
localize "STR_EPOCH_GROUP_DISBANDED" call dayz_rollingMessages; localize "STR_EPOCH_GROUP_DISBANDED" call dayz_rollingMessages;
terminate dayz_groupTags; terminate dayz_groupTags;
8 cutText ["","PLAIN"]; 8 cutText ["","PLAIN"];
@@ -40,8 +40,12 @@ if (_add) then {
_inviter = _uid select 0; _inviter = _uid select 0;
_recipient = _uid select 1; _recipient = _uid select 1;
dayz_activeInvites set [count dayz_activeInvites,_uid]; dayz_activeInvites set [count dayz_activeInvites,_uid];
if (!isDedicated && {_recipient == getPlayerUID player} && {!dayz_requireRadio or {dayz_requireRadio && "ItemRadio" in items player}}) then { if (!isDedicated && {_recipient == getPlayerUID player} && {!dayz_requireRadio or {dayz_requireRadio && {"ItemRadio" in items player}}}) then {
localize "STR_EPOCH_INVITE_NEW" call dayz_rollingMessages; private "_name";
_name = toString(_uid select 2);
format[localize "STR_EPOCH_INVITE_NEW",_name] call dayz_rollingMessages;
}; };
} else { } else {
// Remove all invites to this player // Remove all invites to this player
@@ -60,7 +64,7 @@ if (isServer) then {
PVDZ_groupInvite = _this; PVDZ_groupInvite = _this;
{ {
_unit = getPlayerUID _x; _unit = getPlayerUID _x;
if (_unit != "" && ((!_add && _unit != _recipient) or (_add && _unit != _inviter))) then { if (_unit != "" && {(!_add && {_unit != _recipient}) or (_add && {_unit != _inviter})}) then {
// Don't use regular PV because JIP clients don't need it (dayz_activeInvites is synced to them in server_playerLogin) // Don't use regular PV because JIP clients don't need it (dayz_activeInvites is synced to them in server_playerLogin)
owner _x publicVariableClient "PVDZ_groupInvite"; owner _x publicVariableClient "PVDZ_groupInvite";
}; };

View File

@@ -8,7 +8,7 @@ if (count (units group player) > 1) then {
_savedGroup = (PVCDZ_plr_Login select 10) - [getPlayerUID player]; _savedGroup = (PVCDZ_plr_Login select 10) - [getPlayerUID player];
if (count _savedGroup > 0 && {!dayz_requireRadio or {dayz_requireRadio && "ItemRadio" in items player}}) then { if (count _savedGroup > 0 && {!dayz_requireRadio or {dayz_requireRadio && {"ItemRadio" in items player}}}) then {
{ {
//Only auto join player into group if leader is in their savedGroup //Only auto join player into group if leader is in their savedGroup
_leader = leader _x; _leader = leader _x;

View File

@@ -20,7 +20,7 @@ if (_hasInvite) exitWith {
systemChat localize "STR_EPOCH_INVITE_PENDING"; systemChat localize "STR_EPOCH_INVITE_PENDING";
}; };
_invite = [getPlayerUID player,_uid]; _invite = [getPlayerUID player,_uid,toArray(name player)];
//Update locally with change //Update locally with change
dayz_activeInvites set [count dayz_activeInvites,_invite]; dayz_activeInvites set [count dayz_activeInvites,_invite];

View File

@@ -1,6 +1,6 @@
if (!isNull findDisplay 80000) exitWith {}; if (!isNull findDisplay 80000) exitWith {};
private ["_disbandButton","_display","_group","_index","_inviteButton","_inviter","_inviterUID","_kickButton","_leader","_leaveButton","_myGroup","_newCount","_playerList","_promoteButton","_uid"]; private ["_disbandButton","_display","_group","_index","_inviteButton","_inviter","_inviterUID","_kickButton","_leader","_leaveButton","_myGroup","_newCount","_playerList","_promoteButton","_uid","_joinButton","_rejectButton","_inviteText","_hasInvite"];
disableSerialization; disableSerialization;
createDialog "DZ_GroupDialog"; createDialog "DZ_GroupDialog";
_display = findDisplay 80000; _display = findDisplay 80000;
@@ -24,7 +24,7 @@ while {!isNull findDisplay 80000} do {
_leader = leader _group; _leader = leader _group;
lbClear _myGroup; lbClear _myGroup;
{ {
if (alive _x && isPlayer _x) then { if (alive _x && {isPlayer _x}) then {
_index = _myGroup lbAdd (name _x); _index = _myGroup lbAdd (name _x);
_myGroup lbSetData [_index,getPlayerUID _x]; _myGroup lbSetData [_index,getPlayerUID _x];
_myGroup lbSetPicture [_index, if (_x == _leader) then {"\ca\ui\data\icon_unit_teamleader_ca.paa"} else {"\ca\ui\data\map_bush_ca.paa"}]; _myGroup lbSetPicture [_index, if (_x == _leader) then {"\ca\ui\data\icon_unit_teamleader_ca.paa"} else {"\ca\ui\data\map_bush_ca.paa"}];
@@ -38,7 +38,7 @@ while {!isNull findDisplay 80000} do {
} else { } else {
_leaveButton ctrlShow false; _leaveButton ctrlShow false;
}; };
if (player == _leader && scriptDone dayz_groupDisbandThread) then { if (player == _leader && {scriptDone dayz_groupDisbandThread}) then {
_disbandButton ctrlShow true; _disbandButton ctrlShow true;
} else { } else {
_disbandButton ctrlShow false; _disbandButton ctrlShow false;
@@ -71,7 +71,7 @@ while {!isNull findDisplay 80000} do {
//Refresh player list //Refresh player list
lbClear _playerList; lbClear _playerList;
{ {
if (isPlayer _x && _x != player) then { if (isPlayer _x && {_x != player}) then {
_index = _playerList lbAdd (name _x); _index = _playerList lbAdd (name _x);
_playerList lbSetData [_index, getPlayerUID _x]; _playerList lbSetData [_index, getPlayerUID _x];
_playerList lbSetPicture [_index, if (count (units group _x) > 1) then {"\ca\ui\data\ui_task_failed_ca.paa"} else {"\ca\ui\data\ui_task_done_ca.paa"}]; _playerList lbSetPicture [_index, if (count (units group _x) > 1) then {"\ca\ui\data\ui_task_failed_ca.paa"} else {"\ca\ui\data\ui_task_done_ca.paa"}];

View File

@@ -2,8 +2,8 @@ private ["_event","_groupUIDs","_kickedUID","_name","_newGroup","_player","_play
_event = _this select 0; _event = _this select 0;
_player = _this select 1; _player = _this select 1;
_kickedUID = if (count _this > 2) then {_this select 2} else {"0"}; _kickedUID = ["0",_this select 2] select (count _this > 2);
_name = if (alive _player) then {name _player} else {"unknown"}; _name = ["unknown",name _player] select (alive _player);
_playerUID = getPlayerUID _player; _playerUID = getPlayerUID _player;
if (_event < 3) then { if (_event < 3) then {
@@ -22,29 +22,29 @@ if (_event == -1) exitWith {
_groupUIDs = []; _groupUIDs = [];
{ {
if (damage _x < 1 && isPlayer _x) then { if (damage _x < 1 && {isPlayer _x}) then {
_groupUIDs set [count _groupUIDs,getPlayerUID _x]; _groupUIDs set [count _groupUIDs,getPlayerUID _x];
}; };
} count (units group _player); } count (units group _player);
_newGroup = []; _newGroup = [];
_newGroup = switch _event do { _newGroup = call {
//Join //Join
case 1: {_groupUIDs}; if (_event == 1) exitwith {_groupUIDs};
//Kick (target was already kicked from group) //Kick (target was already kicked from group)
case 2: { if (_event == 2) exitwith {
_name = _kickedUID; _name = _kickedUID;
format["CHILD:204:%1:%2:%3:",_name,dayZ_instance,[]] call server_hiveWrite; format["CHILD:204:%1:%2:%3:",_name,dayZ_instance,[]] call server_hiveWrite;
_groupUIDs _groupUIDs
}; };
//Leave //Leave
case 3: { if (_event == 3) exitwith {
dayz_groupLeft = true; dayz_groupLeft = true;
(owner _player) publicVariableClient "dayz_groupLeft"; (owner _player) publicVariableClient "dayz_groupLeft";
(_groupUIDs - [_playerUID]) (_groupUIDs - [_playerUID])
}; };
//Disband //Disband
case 4: { if (_event == 4) exitwith {
_name = 0; //Not needed _name = 0; //Not needed
dayz_groupDisbanded = true; dayz_groupDisbanded = true;
(owner _player) publicVariableClient "dayz_groupDisbanded"; (owner _player) publicVariableClient "dayz_groupDisbanded";
@@ -54,7 +54,7 @@ _newGroup = switch _event do {
//Update all group members' saved group in DB //Update all group members' saved group in DB
{ {
_save = if (_event == 3 && _x == _playerUID) then {[]} else {_newGroup}; _save = [_newGroup,[]] select (_event == 3 && {_x == _playerUID});
format["CHILD:204:%1:%2:%3:",_x,dayZ_instance,_save] call server_hiveWrite; format["CHILD:204:%1:%2:%3:",_x,dayZ_instance,_save] call server_hiveWrite;
} count _groupUIDs; } count _groupUIDs;