Plot / door management userlist sorting (#1747)

* Plot / door management userlist sorting

This correctly sorts the nearby humans list in both mods, I have this
running on my 1051 server with no issues, @ebaydayz please advise if
this is not right, I've tested it pretty well and it is indeed selecting
the right person/UID

* Door/plot management fixes

As per @ebaydayz
This commit is contained in:
oiad
2016-08-22 09:19:52 +12:00
committed by ebaydayz
parent 8ef349e2bb
commit 6bdc3956fb
7 changed files with 104 additions and 73 deletions

View File

@@ -39,7 +39,6 @@ class DoorAccess
colorText[] = {1,1,1,1}; colorText[] = {1,1,1,1};
}; };
class ZupaButton_1 : ZSC_RscButtonMenuBlue class ZupaButton_1 : ZSC_RscButtonMenuBlue
{ {
idc = -1; idc = -1;

View File

@@ -12,6 +12,7 @@ class DoorManagement
h = 0.5 * safezoneH; h = 0.5 * safezoneH;
colorBackground[] = {0,0,0,0.8}; colorBackground[] = {0,0,0,0.8};
}; };
class RscListbox_7101: RscListbox class RscListbox_7101: RscListbox
{ {
idc = 7101; idc = 7101;
@@ -22,6 +23,7 @@ class DoorManagement
soundSelect[] = {"",0.1,1}; soundSelect[] = {"",0.1,1};
colorBackground[] = {0.1,0.1,0.1,0.8}; colorBackground[] = {0.1,0.1,0.1,0.8};
}; };
class RscListbox_7102: RscListbox class RscListbox_7102: RscListbox
{ {
idc = 7102; idc = 7102;
@@ -32,6 +34,7 @@ class DoorManagement
soundSelect[] = {"",0.1,1}; soundSelect[] = {"",0.1,1};
colorBackground[] = {0.1,0.1,0.1,0.8}; colorBackground[] = {0.1,0.1,0.1,0.8};
}; };
class RscShortcutButton_7104: ZSC_RscButtonMenuBlue class RscShortcutButton_7104: ZSC_RscButtonMenuBlue
{ {
idc = 7104; idc = 7104;
@@ -39,9 +42,9 @@ class DoorManagement
x = 0.33 * safezoneW + safezoneX; x = 0.33 * safezoneW + safezoneX;
y = 0.70 * safezoneH + safezoneY; y = 0.70 * safezoneH + safezoneY;
w = 0.08 * safezoneW; w = 0.08 * safezoneW;
//h = 0.06 * safezoneH; onButtonClick = "[lbData [7101,lbCurSel 7101]] call DoorAddFriend;";
onButtonClick = "[(lbCurSel 7101)] call DoorAddFriend;";
}; };
class RscShortcutButton_7105: ZSC_RscButtonMenuBlue class RscShortcutButton_7105: ZSC_RscButtonMenuBlue
{ {
idc = 7105; idc = 7105;
@@ -49,9 +52,9 @@ class DoorManagement
x = 0.47 * safezoneW + safezoneX; x = 0.47 * safezoneW + safezoneX;
y = 0.70 * safezoneH + safezoneY; y = 0.70 * safezoneH + safezoneY;
w = 0.08 * safezoneW; w = 0.08 * safezoneW;
//h = 0.06 * safezoneH;
onButtonClick = "[(lbCurSel 7102)] call DoorRemoveFriend;"; onButtonClick = "[(lbCurSel 7102)] call DoorRemoveFriend;";
}; };
class RscShortcutButton_7106: ZSC_RscButtonMenuBlue class RscShortcutButton_7106: ZSC_RscButtonMenuBlue
{ {
idc = 7106; idc = 7106;
@@ -59,9 +62,9 @@ class DoorManagement
x = 0.40 * safezoneW + safezoneX; x = 0.40 * safezoneW + safezoneX;
y = 0.74 * safezoneH + safezoneY; y = 0.74 * safezoneH + safezoneY;
w = 0.08 * safezoneW; w = 0.08 * safezoneW;
//h = 0.06 * safezoneH;
onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);"; onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);";
}; };
class RscText_7107: ZSC_RscTextT class RscText_7107: ZSC_RscTextT
{ {
idc = 7107; idc = 7107;
@@ -73,6 +76,7 @@ class DoorManagement
colorBackground[] = {0,0,0,0.8}; colorBackground[] = {0,0,0,0.8};
colorText[] = {1,1,1,1}; colorText[] = {1,1,1,1};
}; };
class RscText_7108: ZSC_RscTextT class RscText_7108: ZSC_RscTextT
{ {
idc = 7108; idc = 7108;
@@ -83,6 +87,7 @@ class DoorManagement
h = 0.03 * safezoneH; h = 0.03 * safezoneH;
colorText[] = {1,1,1,1}; colorText[] = {1,1,1,1};
}; };
class RscText_7103: ZSC_RscTextT class RscText_7103: ZSC_RscTextT
{ {
idc = 71103; idc = 71103;

View File

@@ -54,6 +54,7 @@ class PlotManagement
w = 0.08 * safezoneW; w = 0.08 * safezoneW;
onButtonClick = "'maintain' call MaintainPlot;"; onButtonClick = "'maintain' call MaintainPlot;";
}; };
class RscText_7012: ZSC_RscTextT class RscText_7012: ZSC_RscTextT
{ {
idc = 7012; idc = 7012;
@@ -90,7 +91,6 @@ class PlotManagement
colorText[] = {1,1,1,1}; colorText[] = {1,1,1,1};
}; };
class RscText_7008: ZSC_RscTextT class RscText_7008: ZSC_RscTextT
{ {
idc = -1; idc = -1;
@@ -101,6 +101,7 @@ class PlotManagement
h = 0.03 * safezoneH; h = 0.03 * safezoneH;
colorText[] = {1,1,1,1}; colorText[] = {1,1,1,1};
}; };
class RscText_7003: ZSC_RscTextT class RscText_7003: ZSC_RscTextT
{ {
idc = -1; idc = -1;
@@ -112,7 +113,6 @@ class PlotManagement
colorText[] = {1,1,1,1}; colorText[] = {1,1,1,1};
}; };
class RscListbox_7001: RscListbox class RscListbox_7001: RscListbox
{ {
idc = 7001; idc = 7001;
@@ -123,6 +123,7 @@ class PlotManagement
soundSelect[] = {"",0.1,1}; soundSelect[] = {"",0.1,1};
colorBackground[] = {0.1,0.1,0.1,0.8}; colorBackground[] = {0.1,0.1,0.1,0.8};
}; };
class RscListbox_7002: RscListbox class RscListbox_7002: RscListbox
{ {
idc = 7002; idc = 7002;
@@ -133,6 +134,7 @@ class PlotManagement
soundSelect[] = {"",0.1,1}; soundSelect[] = {"",0.1,1};
colorBackground[] = {0.1,0.1,0.1,0.8}; colorBackground[] = {0.1,0.1,0.1,0.8};
}; };
class RscShortcutButton_7004: ZSC_RscButtonMenuBlue class RscShortcutButton_7004: ZSC_RscButtonMenuBlue
{ {
idc = -1; idc = -1;
@@ -140,8 +142,9 @@ class PlotManagement
x = 0.33 * safezoneW + safezoneX; x = 0.33 * safezoneW + safezoneX;
y = 0.70 * safezoneH + safezoneY; y = 0.70 * safezoneH + safezoneY;
w = 0.08 * safezoneW; w = 0.08 * safezoneW;
onButtonClick = "[(lbCurSel 7001)] call PlotAddFriend;"; onButtonClick = "[lbData [7001,lbCurSel 7001]] call PlotAddFriend;";
}; };
class RscShortcutButton_7005: ZSC_RscButtonMenuBlue class RscShortcutButton_7005: ZSC_RscButtonMenuBlue
{ {
idc = -1; idc = -1;
@@ -151,6 +154,7 @@ class PlotManagement
w = 0.08 * safezoneW; w = 0.08 * safezoneW;
onButtonClick = "[(lbCurSel 7002)] call PlotRemoveFriend;"; onButtonClick = "[(lbCurSel 7002)] call PlotRemoveFriend;";
}; };
class RscShortcutButton_7006: ZSC_RscButtonMenuBlue class RscShortcutButton_7006: ZSC_RscButtonMenuBlue
{ {
idc = -1; idc = -1;
@@ -158,9 +162,7 @@ class PlotManagement
x = 0.40 * safezoneW + safezoneX; x = 0.40 * safezoneW + safezoneX;
y = 0.74 * safezoneH + safezoneY; y = 0.74 * safezoneH + safezoneY;
w = 0.08 * safezoneW; w = 0.08 * safezoneW;
onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);"; onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);";
}; };
}; };
}; };

View File

@@ -1,17 +1,24 @@
private ["_pos","_plots","_inList","_friends","_toAdd"]; private ["_inList","_toAdd","_friends","_friendUID","_friendName","_userList"];
disableSerialization;
_userList = (findDisplay 711195) displayCtrl 7101;
_friendUID = _this select 0;
_friendName = _userList lbText (lbCurSel _userList);
if (_friendUID == "") exitWith {};
_pos = _this select 0;
if (_pos < 0) exitWith {};
_toAdd = (Humans select _pos);
_friends = TheDoor getVariable ["doorfriends",[]]; _friends = TheDoor getVariable ["doorfriends",[]];
_toAdd = [_friendUID,toArray _friendName];
_inList = false; _inList = false;
{
if((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; }; { if ((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; }; false } count _friends;
} forEach _friends; if (_inList) exitWith { systemChat localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST"; };
if(_inList) exitWith { localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST" call dayz_rollingMessages; }; if ((count _friends) == DZE_doorManagementMaxFriends) exitWith { systemChat format[localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_FRIENDLIMIT", DZE_doorManagementMaxFriends]; };
if(count _friends >= DZE_doorManagementMaxFriends) exitWith { format[localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_FRIENDLIMIT", DZE_doorManagementMaxFriends] call dayz_rollingMessages; };
_friends set [count _friends, _toAdd]; _friends set [(count _friends), _toAdd];
TheDoor setVariable ["doorfriends", _friends, true]; TheDoor setVariable ["doorfriends", _friends, true];
PVDZ_veh_Save = [TheDoor,"gear"]; PVDZ_veh_Save = [TheDoor,"gear"];
if (isServer) then { if (isServer) then {
PVDZ_veh_Save call server_updateObject; PVDZ_veh_Save call server_updateObject;

View File

@@ -1,14 +1,19 @@
private ["_closePeople","_friendUID","_friendName"]; private ["_closePeople","_friendUID","_friendName","_userList"];
disableSerialization;
_userList = (findDisplay 711195) displayCtrl 7101;
lbClear _userList;
_closePeople = if (DZE_doorManagementMustBeClose) then { player nearEntities ["CAManBase", 10] } else { playableUnits };
lbClear 7101;
_closePeople = player nearEntities ["CAManBase", 10];
if (!DZE_doorManagementMustBeClose) then {_closePeople = playableUnits};
Humans = [];
{ {
if (isPlayer _x) then { if (isPlayer _x) then {
_friendUID = [_x] call FNC_GetPlayerUID; _friendUID = [_x] call FNC_GetPlayerUID;
_friendName = name _x; _friendName = name _x;
Humans set [count Humans, [_friendUID,toArray _friendName]]; _userList lbAdd _friendName;
lbAdd [7101, _friendName]; _userList lbSetData [(lbSize _userList) -1,_friendUID];
}; };
} forEach _closePeople; } forEach _closePeople;
lbSort _userList;

View File

@@ -1,26 +1,33 @@
private ["_pos","_plots","_thePlot","_inList","_toAdd","_friends"]; private ["_plots","_thePlot","_inList","_toAdd","_friends","_friendUID","_friendName","_userList"];
disableSerialization;
_pos = _this select 0; _userList = (findDisplay 711194) displayCtrl 7001;
if (_pos < 0) exitWith {};
_friendUID = _this select 0;
_friendName = _userList lbText (lbCurSel _userList);
if (_friendUID == "") exitWith {};
_toAdd = (Humans select _pos);
_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15]; _plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15];
_thePlot = _plots select 0; _thePlot = _plots select 0;
_friends = _thePlot getVariable ["plotfriends",[]]; _friends = _thePlot getVariable ["plotfriends",[]];
_toAdd = [_friendUID,toArray _friendName];
_inList = false; _inList = false;
{ if ((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; }; } count _friends; { if ((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; }; false } count _friends;
if (_inList) exitWith {localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST" call dayz_rollingMessages}; if (_inList) exitWith { systemChat localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST"; };
if ((count _friends) == DZE_MaxPlotFriends) exitWith { format[localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_FRIENDLIMIT", DZE_MaxPlotFriends] call dayz_rollingMessages;}; if ((count _friends) == DZE_MaxPlotFriends) exitWith { systemChat format[localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_FRIENDLIMIT", DZE_MaxPlotFriends]; };
_friends set [(count _friends), _toAdd]; _friends set [(count _friends), _toAdd];
_thePlot setVariable ["plotfriends", _friends, true]; _thePlot setVariable ["plotfriends", _friends, true];
PVDZ_veh_Save = [_thePlot,"gear"]; PVDZ_veh_Save = [_thePlot,"gear"];
if (isServer) then { if (isServer) then {
PVDZ_veh_Save call server_updateObject; PVDZ_veh_Save call server_updateObject;
} else { } else {
publicVariableServer "PVDZ_veh_Save"; publicVariableServer "PVDZ_veh_Save";
}; };
call PlotGetFriends; call PlotGetFriends;
call PlotNearbyHumans; call PlotNearbyHumans;

View File

@@ -1,13 +1,19 @@
private ["_closePeople","_friendUID","_friendName"]; private ["_closePeople","_friendUID","_friendName","_userList"];
disableSerialization;
_userList = (findDisplay 711194) displayCtrl 7001;
lbClear _userList;
_closePeople = if (DZE_plotManagementMustBeClose) then { player nearEntities ["CAManBase", 10] } else { playableUnits };
lbClear 7001;
if (!DZE_plotManagementMustBeClose) then {_closePeople = playableUnits;} else {_closePeople = player nearEntities ["CAManBase", 10];};
Humans = [];
{ {
if (isPlayer _x) then { if (isPlayer _x) then {
_friendUID = [_x] call FNC_GetPlayerUID; _friendUID = [_x] call FNC_GetPlayerUID;
_friendName = name _x; _friendName = name _x;
Humans = Humans + [[_friendUID,toArray _friendName]]; _userList lbAdd _friendName;
lbAdd [7001, _friendName]; _userList lbSetData [(lbSize _userList) -1,_friendUID];
}; };
} forEach _closePeople; } forEach _closePeople;
lbSort _userList;