From 01d8197d129cb3393dc2a87e6deae617a6516efd Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Wed, 15 Jun 2016 20:09:04 -0400 Subject: [PATCH] Remove redundant function fn_check_owner_friends Fn_check_access provides the same functionality and more. Removed folders that only contained a single file to clean things up. Also added epoch tag friendly code to vanilla player_updateGui for now. --- .../A_Plot_for_Life/plot_take_ownership.sqf | 6 +- .../actions/player_buildingDowngrade.sqf | 4 +- SQF/dayz_code/actions/player_upgrade.sqf | 4 +- SQF/dayz_code/actions/remove.sqf | 6 +- .../fn_check_owner_friends.sqf | 64 ----------------- SQF/dayz_code/compile/dze_buildChecks.sqf | 4 +- .../{doorManagement => }/fn_check_access.sqf | 2 +- SQF/dayz_code/compile/fn_damageActions.sqf | 10 +-- .../{A_Plot_for_Life => }/fn_find_plots.sqf | 8 ++- SQF/dayz_code/compile/fn_gearMenuChecks.sqf | 6 +- SQF/dayz_code/compile/fn_selfActions.sqf | 18 +++-- SQF/dayz_code/compile/player_updateGui.sqf | 68 ++++++++++++++++++- .../compile/player_updateGuiDark.sqf | 17 +++-- .../compile/player_updateGuiEpoch.sqf | 17 ++--- SQF/dayz_code/init/compiles.sqf | 5 +- 15 files changed, 121 insertions(+), 118 deletions(-) delete mode 100644 SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner_friends.sqf rename SQF/dayz_code/compile/{doorManagement => }/fn_check_access.sqf (98%) rename SQF/dayz_code/compile/{A_Plot_for_Life => }/fn_find_plots.sqf (72%) diff --git a/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf b/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf index 95db3a5e8..7aaaadc79 100644 --- a/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf +++ b/SQF/dayz_code/actions/A_Plot_for_Life/plot_take_ownership.sqf @@ -15,17 +15,17 @@ _changecount = 0; // Check is owner of the plot pole. -_isowner = [player, _plotpole] call FNC_check_owner_friends; +_isowner = [player, _plotpole] call FNC_check_access; _itemsExist = false; -if ((_isowner select 0 )) then { +if (_isowner select 0) then { _findNearestObjects = (position _plotpole) nearEntities _distance; { _object = _x; _classname = typeOf _object; if (_classname in DZE_plotTakeOwnershipItems)then { - _isowner = [player, _object] call FNC_check_owner_friends; + _isowner = [player, _object] call FNC_check_access; diag_log text "Plot Take Ownership: Object in DZE_plotTakeOwnershipItems"; if !( _isowner select 0 ) then{ diff --git a/SQF/dayz_code/actions/player_buildingDowngrade.sqf b/SQF/dayz_code/actions/player_buildingDowngrade.sqf index e67824ed8..99995acc8 100644 --- a/SQF/dayz_code/actions/player_buildingDowngrade.sqf +++ b/SQF/dayz_code/actions/player_buildingDowngrade.sqf @@ -27,9 +27,9 @@ if(_IsNearPlot == 0) then { _canBuildOnPlot = true; } else { if (DZE_permanentPlot) then { - _buildcheck = [player, _nearestPole] call FNC_check_owner_friends; + _buildcheck = [player, _nearestPole] call FNC_check_access; _isowner = _buildcheck select 0; - _isfriendly = _buildcheck select 1; + _isfriendly = ((_buildcheck select 1) or (_buildcheck select 3)); if (_isowner || _isfriendly) then { _canBuildOnPlot = true; }; diff --git a/SQF/dayz_code/actions/player_upgrade.sqf b/SQF/dayz_code/actions/player_upgrade.sqf index 4961c651d..a1c2f62c1 100644 --- a/SQF/dayz_code/actions/player_upgrade.sqf +++ b/SQF/dayz_code/actions/player_upgrade.sqf @@ -26,9 +26,9 @@ if(_IsNearPlot == 0) then { _canBuildOnPlot = true; } else { if (DZE_permanentPlot) then { - _buildcheck = [player, _nearestPole] call FNC_check_owner_friends; + _buildcheck = [player, _nearestPole] call FNC_check_access; _isowner = _buildcheck select 0; - _isfriendly = _buildcheck select 1; + _isfriendly = ((_buildcheck select 1) or (_buildcheck select 3)); if (_isowner || _isfriendly) then { _canBuildOnPlot = true; }; diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index 31e0be51f..dd87e505f 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -4,7 +4,7 @@ DZE_ActionInProgress = true; delete object from db with extra waiting by [VB]AWOL parameters: _obj */ -private ["_activatingPlayer","_obj","_playerUID","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_friendlies","_nearestPole","_ownerID","_refundpart","_isWreck","_findNearestPoles","_findNearestPole","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular"]; +private ["_activatingPlayer","_obj","_playerUID","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_ownerID","_refundpart","_isWreck","_findNearestPoles","_findNearestPole","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular"]; player removeAction s_player_deleteBuild; s_player_deleteBuild = 1; @@ -60,9 +60,9 @@ _nearestPole = _plotcheck select 2; if(_IsNearPlot >= 1) then { // Since there are plot poles nearby we need to check ownership && friend status - _buildcheck = [player, _nearestPole] call FNC_check_owner_friends; + _buildcheck = [player, _nearestPole] call FNC_check_access; _isowner = _buildcheck select 0; - _isfriendly = _buildcheck select 1; + _isfriendly = ((_buildcheck select 1) or (_buildcheck select 3)); if (!_isowner && !_isfriendly) then { _limit = round(_limit*2); }; diff --git a/SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner_friends.sqf b/SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner_friends.sqf deleted file mode 100644 index a60981c32..000000000 --- a/SQF/dayz_code/compile/A_Plot_for_Life/fn_check_owner_friends.sqf +++ /dev/null @@ -1,64 +0,0 @@ -/* - Check object's ownership and friends - Original concept by RimBlock (github.com/RimBlock) - - Parameters: - _this select 0: object - player calling this function - _this select 1: object - target to check ownership and friendlies of - - Returns: - _return select 0: bool - player is owner of target object - _return select 1: bool - player is friends with owner of target object -*/ - -private ["_player","_target","_playerUID","_targetOwner","_owner","_friendlies","_friendly","_findNearestPoles","_IsNearPlot","_pole","_friendUID","_ownerID","_friends"]; - -_player = _this select 0; -_target = _this select 1; -_owner = false; -_friendly = false; -_friendlies = []; -_targetOwner = "0"; - -if (DZE_permanentPlot) then { - _pole = _target; - _IsNearPlot = 0; - _findNearestPoles = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0]; - _IsNearPlot = count _findNearestPoles; - _pole = _findNearestPoles select 0; - - if (_IsNearPlot > 0) then { - _ownerID = _pole getVariable ["ownerPUID","0"]; - _friendlies = [_ownerID]; - _friends = _pole getVariable ["plotfriends", []]; - { - _friendUID = _x select 0; - _friendlies set [count _friendlies, _friendUID]; - } count _friends; - if (count DZE_PlotManagementAdmins > 0) then { - _friendlies = _friendlies + DZE_PlotManagementAdmins; - }; - }; - - _playerUID = [_player] call FNC_GetPlayerUID; - _targetOwner = _target getVariable ["ownerPUID","0"]; - - // Check if player is a plot friend - if (_playerUID in _friendlies) then { - _friendly = true; - }; -} else { - _playerUID = dayz_characterID; - _friendlies = _player getVariable ["friendlyTo",[]]; - _targetOwner = _target getVariable ["CharacterID","0"]; - - // Check if target object owner is a friend of player - if (_targetOwner in _friendlies) then { - _friendly = true; - }; -}; - -// Check if player is owner of target object -_owner = (_playerUID == _targetOwner); - -[_owner, _friendly] \ No newline at end of file diff --git a/SQF/dayz_code/compile/dze_buildChecks.sqf b/SQF/dayz_code/compile/dze_buildChecks.sqf index b6ff7934b..67a5386b1 100644 --- a/SQF/dayz_code/compile/dze_buildChecks.sqf +++ b/SQF/dayz_code/compile/dze_buildChecks.sqf @@ -42,9 +42,9 @@ if(_IsNearPlot == 0) then { _canBuild = true; } else { if (DZE_permanentPlot) then { - _buildcheck = [player, _nearestPole] call FNC_check_owner_friends; + _buildcheck = [player, _nearestPole] call FNC_check_access; _isowner = _buildcheck select 0; - _isfriendly = _buildcheck select 1; + _isfriendly = ((_buildcheck select 1) or (_buildcheck select 3)); if (_isowner || _isfriendly) then { _canBuild = true; }; diff --git a/SQF/dayz_code/compile/doorManagement/fn_check_access.sqf b/SQF/dayz_code/compile/fn_check_access.sqf similarity index 98% rename from SQF/dayz_code/compile/doorManagement/fn_check_access.sqf rename to SQF/dayz_code/compile/fn_check_access.sqf index 7445b2968..59ac7600c 100644 --- a/SQF/dayz_code/compile/doorManagement/fn_check_access.sqf +++ b/SQF/dayz_code/compile/fn_check_access.sqf @@ -136,7 +136,7 @@ if(_targetType == "DOOR") then { // RESULT [ _isOwner , _isFriendly -, _isPlotOwner +, _isPlotOwner // Same as _isOwner if _target is a PlotPole , _isPlotFriend , _isPlotAdmin , _isTargetFriend diff --git a/SQF/dayz_code/compile/fn_damageActions.sqf b/SQF/dayz_code/compile/fn_damageActions.sqf index 905cea48d..f7a38ed4a 100644 --- a/SQF/dayz_code/compile/fn_damageActions.sqf +++ b/SQF/dayz_code/compile/fn_damageActions.sqf @@ -8,7 +8,7 @@ if (DZE_ActionInProgress) exitWith {}; - [] call fnc_usec_damageActions; ************************************************************/ -private ["_menClose","_hasPatient","_vehicle","_inVehicle","_isClose","_assignedRole","_driver","_action","_turret","_weapons","_weaponName","_crew","_unconscious_crew","_patients","_vehType","_unit","_antibiotics","_bloodBags","_unconscious","_lowBlood","_injured","_hasSepsis","_inPain","_legsBroke","_armsBroke","_infected","_hasBandage","_hasSepsisBandage","_hasEpi","_hasMorphine","_hasSplint","_hasPainkillers","_hasEmptyBag","_hasTester","_hasAntibiotics","_hasBloodBag","_vehClose","_hasVehicle","_action1","_action2","_action3","_y","_playerMagazines"]; +private ["_menClose","_hasPatient","_vehicle","_inVehicle","_isClose","_assignedRole","_driver","_action","_turret","_weapons","_weaponName","_crew","_unconscious_crew","_patients","_vehType","_unit","_antibiotics","_bloodBags","_unconscious","_lowBlood","_injured","_hasSepsis","_inPain","_legsBroke","_armsBroke","_infected","_hasBandage","_hasSepsisBandage","_hasEpi","_hasMorphine","_hasSplint","_hasPainkillers","_hasEmptyBag","_hasTester","_hasAntibiotics","_hasBloodBag","_vehClose","_hasVehicle","_action1","_action2","_action3","_y","_playerMagazines","_isFriendly"]; _menClose = cursorTarget; _hasPatient = alive _menClose; @@ -211,12 +211,8 @@ if (isPlayer cursorTarget) then { }; if (_unit isKindOf "Man") then { // should only fire if cursor target is man and not vehicle - _charID = _unit getVariable ["CharacterID", "0"]; - if (DZE_permanentPlot) then { - _charID = [_unit] call FNC_GetPlayerUID; - }; - _friendlies = [player, _unit] call FNC_check_owner_friends; - if !(_charID in _friendlies) then { + _isFriendly = [player, _unit] call FNC_check_access; + if !(_isFriendly select 1) then { r_action = true; _action = _unit addAction ["Tag as friendly", "\z\addons\dayz_code\actions\player_tagFriendly.sqf", [], 0, false, true]; r_player_actions set [count r_player_actions,_action]; diff --git a/SQF/dayz_code/compile/A_Plot_for_Life/fn_find_plots.sqf b/SQF/dayz_code/compile/fn_find_plots.sqf similarity index 72% rename from SQF/dayz_code/compile/A_Plot_for_Life/fn_find_plots.sqf rename to SQF/dayz_code/compile/fn_find_plots.sqf index df6d22379..9594c77fc 100644 --- a/SQF/dayz_code/compile/A_Plot_for_Life/fn_find_plots.sqf +++ b/SQF/dayz_code/compile/fn_find_plots.sqf @@ -1,9 +1,9 @@ // Find Plots by RimBlock (http://epochmod.com/forum/index.php?/user/12612-rimblock/) -private ["_player","_ispole","_IsNearPlot","_nearestPole","_distance","_findNearestPoles","_findNearestPole","_friendly","_return"]; +private ["_player","_isPole","_IsNearPlot","_nearestPole","_distance","_findNearestPoles","_findNearestPole","_friendly","_return","_pos"]; _player = _this select 0; -_ispole = _this select 1; +_isPole = _this select 1; _IsNearPlot = 0; _nearestPole = ""; _findNearestPole = []; @@ -14,8 +14,10 @@ if(_isPole) then { _distance = DZE_PlotPole select 0; }; +_pos = [vehicle _player] call FNC_getPos; + // check for near plot -_findNearestPole = (position (vehicle _player)) nearEntities ["Plastic_Pole_EP1_DZ", _distance]; +_findNearestPole = _pos nearEntities ["Plastic_Pole_EP1_DZ", _distance]; _IsNearPlot = count (_findNearestPole); if (_IsNearPlot > 0) then{_nearestPole = _findNearestPole select 0;}else{_nearestPole = objNull;}; diff --git a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf index 59a9c3bbd..3dbd8fb4e 100644 --- a/SQF/dayz_code/compile/fn_gearMenuChecks.sqf +++ b/SQF/dayz_code/compile/fn_gearMenuChecks.sqf @@ -1,4 +1,4 @@ -private ["_cTarget","_dis","_display","_friendlies","_rcharID"]; +private ["_cTarget","_dis","_display","_friendlies","_rID"]; // players inside vehicle can always access its gear if ((vehicle player) == player) then { @@ -14,8 +14,8 @@ if ((vehicle player) == player) then { if (DZE_BackpackAntiTheft) then { _friendlies = player getVariable ["friendlies",[]]; - _rcharID = _cTarget getVariable ["CharacterID","0"]; - if ((!canbuild or isInTraderCity) && {_cTarget isKindOf "Man"} && {alive _cTarget} && {isPlayer _cTarget} && {!(_rcharID in _friendlies)} && {(player distance _cTarget) < 12}) then { + _rID = if (DZE_permanentPlot) then { [_cTarget] call FNC_GetPlayerUID } else { _cTarget getVariable ["CharacterID","0"] }; + if ((!canbuild or isInTraderCity) && {_cTarget isKindOf "Man"} && {alive _cTarget} && {isPlayer _cTarget} && {!(_rID in _friendlies)} && {(player distance _cTarget) < 12}) then { localize "STR_EPOCH_PLAYER_316" call dayz_rollingMessages; _display closeDisplay 1; }; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 2ae2bec3a..b1f705342 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -420,8 +420,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if(_isModular || _isModularDoor || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then { if(_hasToolbox && "ItemCrowbar" in _itemsPlayer) then { - _isowner = [player, _cursorTarget] call FNC_check_owner_friends; - If ((_isowner select 0) || (_isowner select 1)) then { + _isowner = [player, _cursorTarget] call FNC_check_access; + if ((_isowner select 0) or (_isowner select 1) or (_isowner select 2)) then { _player_deleteBuild = true; }; }; @@ -633,20 +633,18 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if ((_cursorTarget isKindOf "Plastic_Pole_EP1_DZ") && {_canDo && speed player <= 1}) then { if (DZE_permanentPlot) then { if (s_player_plotManagement < 0) then { - _isowner = [player, _cursorTarget] call FNC_check_owner_friends; - If ((_isowner select 0) || (_isowner select 1)) then { - s_player_plot_take_ownership = player addAction ["Take plot items ownership", "\z\addons\dayz_code\actions\A_Plot_for_Life\plot_take_ownership.sqf", "", 1, false]; - }; + _isowner = [player, _cursorTarget] call FNC_check_access; + if ((_isowner select 0) or (_isowner select 3) or (_isowner select 4)) then { s_player_plotManagement = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_MANAGEPLOT"], "\z\addons\dayz_code\actions\plotManagement\initPlotManagement.sqf", [], 5, false]; }; + }; } else { if (s_player_maintain_area < 0) then { s_player_maintain_area = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_MAINTAREA"], "\z\addons\dayz_code\actions\maintain_area.sqf", ["maintain",_cursorTarget], 5, false]; s_player_maintain_area_preview = player addAction [format["%1",localize "STR_EPOCH_ACTIONS_MAINTPREV"], "\z\addons\dayz_code\actions\maintain_area.sqf", ["preview",_cursorTarget], 5, false]; }; }; - _plotDistance = (DZE_PlotPole select 0); - _PlotsmarkersNear = count (_cursorTarget nearEntities ["Land_coneLight", _PlotDistance]); + _PlotsmarkersNear = count (_cursorTarget nearEntities ["Land_coneLight", DZE_PlotPole select 0]); if (s_player_plot_boundary_on < 0) then { If (_PlotsmarkersNear == 0 ) then{ s_player_plot_boundary_on = player addAction ["Show plot boundary", "\z\addons\dayz_code\actions\A_Plot_for_Life\object_showPlotRadius.sqf", "", 1, false]; @@ -660,8 +658,8 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if (DZE_permanentPlot) then { if (s_player_plot_take_ownership < 0) then { if (DZE_PlotOwnership) then { - _isowner = [player, _cursorTarget] call FNC_check_owner_friends; - If (_isowner select 0) then { + _isowner = [player, _cursorTarget] call FNC_check_access; + if (_isowner select 0) then { s_player_plot_take_ownership = player addAction ["Take plot items ownership", "\z\addons\dayz_code\actions\A_Plot_for_Life\plot_take_ownership.sqf", "", 1, false]; }; }; diff --git a/SQF/dayz_code/compile/player_updateGui.sqf b/SQF/dayz_code/compile/player_updateGui.sqf index e4a165176..d81693e1f 100644 --- a/SQF/dayz_code/compile/player_updateGui.sqf +++ b/SQF/dayz_code/compile/player_updateGui.sqf @@ -1,6 +1,7 @@ //private ["_display","_ctrlBloodOuter","_ctrlBlood","_ctrlBleed","_bloodVal","_ctrlFood","_ctrlThirst","_thirstVal","_foodVal","_ctrlTemp","_ctrlFoodBorder","_ctrlThirstBorder","_ctrlTempBorder","_tempVal","_array","_ctrlEar","_ctrlEye","_ctrlFracture","_visual","_audible","_uiNumber","_bloodText","_blood","_thirstLvl","_foodLvl","_tempImg","_bloodLvl","_tempLvl","_thirst","_food","_temp"]; -private ["_flash","_array","_bloodText","_tempImg","_uiNumber","_blood","_foodLvl","_thirstLvl","_audible","_visual","_bloodType","_rhFactor","_ctrlBloodType", "_bloodTestdone"]; +private ["_flash","_array","_bloodText","_tempImg","_uiNumber","_blood","_foodLvl","_thirstLvl","_audible","_visual","_bloodType","_rhFactor","_ctrlBloodType", "_bloodTestdone", +"_string","_humanityTarget","_distance","_size","_friendlies","_id","_rID","_rfriendlies","_rfriendlyTo","_color","_targetControl"]; _flash = { if (ctrlShown _this) then { @@ -208,5 +209,70 @@ else { _ctrlBleed ctrlShow false; }; +/* +Opt-in tag system with friend tagging +*/ +_string = ""; +_humanityTarget = cursorTarget; +if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTarget}) then { + + _distance = player distance _humanityTarget; + + if (_distance < DZE_HumanityTargetDistance) then { + + _size = (1-(floor(_distance/5)*0.1)) max 0.1; + + // Display name if player opt-in or if friend + _friendlies = player getVariable ["friendlies", []]; + if (DZE_permanentPlot) then { + _id = [player] call FNC_GetPlayerUID; + _rID = [_humanityTarget] call FNC_GetPlayerUID; + } else { + _id = player getVariable ["CharacterID","0"]; + _rID = _humanityTarget getVariable ["CharacterID","0"]; + }; + _rfriendlies = _humanityTarget getVariable ["friendlies", []]; + _rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []]; + + if ((_rID in _friendlies) && (_id in _rfriendlies)) then { + + if !(_id in _rfriendlyTo) then { + // diag_log format["IS FRIENDLY: %1", _player]; + _rfriendlyTo set [count _rfriendlyTo, _id]; + _humanityTarget setVariable ["friendlyTo", _rfriendlyTo, true]; + }; + + //
Humanity: %3 + + _color = "color='#339933'"; + _string = format["%1",(name _humanityTarget),_color,_size]; + + } else { + + // Humanity checks + _humanity = _humanityTarget getVariable ["humanity",0]; + + _color = "color='#ffffff'"; + if(_humanity < -5000) then { + _color = "color='#ff0000'"; + } else { + if(_humanity > 5000) then { + _color = "color='#3333ff'"; + }; + }; + if((_humanityTarget getVariable ["DZE_display_name", false]) || (DZE_ForceNameTagsInTrader && isInTraderCity)) then { + _string = format["%1",(name _humanityTarget),_color,_size]; + }; + }; + }; +}; + +// update gui if changed +if (dayz_humanitytarget != _string) then { + _targetControl = _display displayCtrl 1199; + _targetControl ctrlSetStructuredText (parseText _string); + dayz_humanitytarget = _string; +}; + _array = [_foodVal,_thirstVal]; _array diff --git a/SQF/dayz_code/compile/player_updateGuiDark.sqf b/SQF/dayz_code/compile/player_updateGuiDark.sqf index 48f8b36fb..74fb5019b 100644 --- a/SQF/dayz_code/compile/player_updateGuiDark.sqf +++ b/SQF/dayz_code/compile/player_updateGuiDark.sqf @@ -1,6 +1,6 @@ -private ["_flash","_display","_ctrlBlood","_ctrlBleed","_bloodVal","_humanityName","_ctrlFood","_ctrlThirst","_thirstVal","_foodVal","_ctrlTemp","_tempVal","_combatVal","_array","_ctrlEar","_ctrlEye","_ctrlCombat","_ctrlFracture","_visualText","_visual","_audibleText","_audible","_blood","_thirstLvl","_foodLvl","_tempImg","_thirst","_food","_temp","_bloodLvl","_tempLvl","_color","_string","_humanity","_size","_friendlies","_charID","_rcharID","_rfriendlies","_rfriendlyTo","_distance","_targetControl","_combattimeout","_timeleft"]; +private ["_flash","_display","_ctrlBlood","_ctrlBleed","_bloodVal","_humanityName","_ctrlFood","_ctrlThirst","_thirstVal","_foodVal","_ctrlTemp","_tempVal","_combatVal","_array","_ctrlEar","_ctrlEye","_ctrlCombat","_ctrlFracture","_visualText","_visual","_audibleText","_audible","_blood","_thirstLvl","_foodLvl","_tempImg","_thirst","_food","_temp","_bloodLvl","_tempLvl","_color","_string","_humanity","_size","_friendlies","_id","_rID","_rfriendlies","_rfriendlyTo","_distance","_targetControl","_combattimeout","_timeleft"]; _flash = { if (ctrlShown _this) then { @@ -158,17 +158,22 @@ if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTar // Display name if player opt-in or if friend _friendlies = player getVariable ["friendlies", []]; - _charID = player getVariable ["CharacterID", "0"]; + if (DZE_permanentPlot) then { + _id = [player] call FNC_GetPlayerUID; + _rID = [_humanityTarget] call FNC_GetPlayerUID; + } else { + _id = player getVariable ["CharacterID","0"]; + _rID = _humanityTarget getVariable ["CharacterID","0"]; + }; - _rcharID = _humanityTarget getVariable ["CharacterID", "0"]; _rfriendlies = _humanityTarget getVariable ["friendlies", []]; _rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []]; - if ((_rcharID in _friendlies) && (_charID in _rfriendlies)) then { + if ((_rID in _friendlies) && (_id in _rfriendlies)) then { - if !(_charID in _rfriendlyTo) then { + if !(_id in _rfriendlyTo) then { // diag_log format["IS FRIENDLY: %1", _player]; - _rfriendlyTo set [count _rfriendlyTo, _charID]; + _rfriendlyTo set [count _rfriendlyTo, _id]; _humanityTarget setVariable ["friendlyTo", _rfriendlyTo, true]; }; diff --git a/SQF/dayz_code/compile/player_updateGuiEpoch.sqf b/SQF/dayz_code/compile/player_updateGuiEpoch.sqf index 3685e8e22..40462bb08 100644 --- a/SQF/dayz_code/compile/player_updateGuiEpoch.sqf +++ b/SQF/dayz_code/compile/player_updateGuiEpoch.sqf @@ -1,6 +1,6 @@ -private ["_flash","_display","_ctrlBlood","_ctrlBleed","_bloodVal","_humanityName","_ctrlFood","_ctrlThirst","_thirstVal","_foodVal","_ctrlTemp","_tempVal","_combatVal","_array","_ctrlEar","_ctrlEye","_ctrlCombat","_ctrlFracture","_visualText","_visual","_audibleText","_audible","_blood","_thirstLvl","_foodLvl","_tempImg","_thirst","_food","_temp","_bloodLvl","_tempLvl","_color","_string","_humanity","_size","_friendlies","_charID","_rcharID","_rfriendlies","_rfriendlyTo","_distance","_targetControl"]; +private ["_flash","_display","_ctrlBlood","_ctrlBleed","_bloodVal","_humanityName","_ctrlFood","_ctrlThirst","_thirstVal","_foodVal","_ctrlTemp","_tempVal","_combatVal","_array","_ctrlEar","_ctrlEye","_ctrlCombat","_ctrlFracture","_visualText","_visual","_audibleText","_audible","_blood","_thirstLvl","_foodLvl","_tempImg","_thirst","_food","_temp","_bloodLvl","_tempLvl","_color","_string","_humanity","_size","_friendlies","_id","_rID","_rfriendlies","_rfriendlyTo","_distance","_targetControl"]; _flash = { if (ctrlShown _this) then { @@ -183,20 +183,21 @@ if (!isNull _humanityTarget && {isPlayer _humanityTarget} && {alive _humanityTar // Display name if player opt-in or if friend _friendlies = player getVariable ["friendlies", []]; - _charID = player getVariable ["CharacterID", "0"]; - _rcharID = _humanityTarget getVariable ["CharacterID", "0"]; if (DZE_permanentPlot) then { - _charID = [player] call FNC_GetPlayerUID; - _rcharID = [_humanityTarget] call FNC_GetPlayerUID; + _id = [player] call FNC_GetPlayerUID; + _rID = [_humanityTarget] call FNC_GetPlayerUID; + } else { + _id = player getVariable ["CharacterID","0"]; + _rID = _humanityTarget getVariable ["CharacterID","0"]; }; _rfriendlies = _humanityTarget getVariable ["friendlies", []]; _rfriendlyTo = _humanityTarget getVariable ["friendlyTo", []]; - if ((_rcharID in _friendlies) && (_charID in _rfriendlies)) then { + if ((_rID in _friendlies) && (_id in _rfriendlies)) then { - if !(_charID in _rfriendlyTo) then { + if !(_id in _rfriendlyTo) then { // diag_log format["IS FRIENDLY: %1", _player]; - _rfriendlyTo set [count _rfriendlyTo, _charID]; + _rfriendlyTo set [count _rfriendlyTo, _id]; _humanityTarget setVariable ["friendlyTo", _rfriendlyTo, true]; }; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 736a54bd6..04716b5d9 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -94,8 +94,7 @@ if (!isDedicated) then { DZE_build_vector_file = "\z\addons\dayz_code\compile\BuildVectors\build_vectors.sqf"; build_vectors = compile preprocessFileLineNumbers DZE_build_vector_file; fnc_SetPitchBankYaw = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\BuildVectors\fnc_SetPitchBankYaw.sqf"; - FNC_check_owner_friends = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\A_Plot_for_Life\fn_check_owner_friends.sqf"; - FNC_find_plots = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\A_Plot_for_Life\fn_find_plots.sqf"; + FNC_find_plots = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_find_plots.sqf"; player_buildVanilla = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_buildVanilla.sqf"; fn_buildCamera = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_buildCamera.sqf"; @@ -196,7 +195,7 @@ if (!isDedicated) then { DoorRemoveFriend = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\doorManagement\doorRemoveFriend.sqf"; player_manageDoor = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\doorManagement\initDoorManagement.sqf"; player_enterCode = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\doorManagement\player_enterCode.sqf"; - FNC_check_access = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\doorManagement\fn_check_access.sqf"; + FNC_check_access = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_check_access.sqf"; dayz_losChance = { private["_agent","_maxDis","_dis","_val","_maxExp","_myExp"];