mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 09:10:27 +03:00
Update remove/deconstruct, add helpers
Removing and Deconstructing Objects - Now adds colored helpers to modular objects. - Green: Refund one kit. - Blue: Refund entire recipe of parts (multiple items). - Red: No refund will be given. Either because the object is too damaged, or the refund feature is disabled. - If the object has a door open while selected, no helper will display/float in the open door space. - The gear panel will only open if a refund is available. - If a lit fire barrel is removed, the flame will now be extinguished. - If a plot pole is removed, plot boundary helpers will now be deleted. - Refunds for non-modular objects are handled by their respective config settings. - Removed non-lockable storage objects will now refund their contents. - The corresponding storage kit will be refunded. - If there is room outdoors, backpacks will be arranged in a neat circle close to the refund point. - If the spawn point is too close to a building, backpacks will spawn at the player's location. - Helpers will now appear on wrecked/ruined modular objects. - Helper color arrays were changed to helper transparency values only, to make it easier (and safer) for server owners. Upgrading, Downgrading, Maintaining and Packing Objects - Now includes colored helper spheres for improved player experience. - Reapply damage to upgraded/downgraded object if necessary. Changes made by @Victor-the-Cleaner
This commit is contained in:
157
SQF/dayz_code/compile/fn_displayHelpers.sqf
Normal file
157
SQF/dayz_code/compile/fn_displayHelpers.sqf
Normal file
@@ -0,0 +1,157 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Display Helpers on buildable/removable objects
|
||||
//
|
||||
// Author: Victor the Cleaner
|
||||
// Date: August 2021
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// - Display helper spheres on the selected object when removing, deconstructing,
|
||||
// upgrading, downgrading, maintaining, and packing.
|
||||
// - Call this function first by passing the object, and optional texture, e.g.:
|
||||
//
|
||||
// [_object] call fn_displayHelpers; // create helpers
|
||||
// [_object, DZE_removeTexture] call fn_displayHelpers; // create helpers
|
||||
//
|
||||
// - And then a second time following the looped animation cycle, but without a parameter.
|
||||
//
|
||||
// [] call fn_displayHelpers; // delete helpers
|
||||
//
|
||||
// - Helper texture values are defined in configVariables.sqf
|
||||
// - DZE_removeTexture = green | DZE_deconstructTexture = blue | DZE_NoRefundTexture = red
|
||||
// - If no texture is passed, it will default to green.
|
||||
// - If no identical object types are nearby, then do not display green helpers.
|
||||
// - Use DZE_displayOnlyIfNearby to enable/disable. Does not affect blue & green helpers.
|
||||
// - If the object's door is open during selection, no helper will display at that position.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if (DZE_displayHelpers) then {
|
||||
|
||||
if (isNil "HelperArray") then {HelperArray = []};
|
||||
|
||||
local _p = count _this;
|
||||
|
||||
if (_p > 0) then {
|
||||
|
||||
local _obj = _this select 0; // selected object
|
||||
local _objType = typeOf _obj; // object's class name
|
||||
local _green = [0, format["#(argb,8,8,3)color(0,1,0,%1,ca)", (DZE_removeTransparency max 0.1)]]; // reformat with transparency
|
||||
local _helperTexture = DZE_removeTexture; // default: green
|
||||
|
||||
if (_p == 2) then {
|
||||
_helperTexture = _this select 1; // specified texture
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// If no identical objects are nearby, then do not display green helpers
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
local _cancel = false;
|
||||
|
||||
if (DZE_displayOnlyIfNearby && [_helperTexture, DZE_removeTexture] call BIS_fnc_areEqual) then { // if only green required
|
||||
|
||||
local _radius = getNumber (configFile >> "HelperVectors" >> _objType >> "radius"); // get object's scan radius
|
||||
|
||||
if (_radius == 0) then {
|
||||
_radius = getNumber (configFile >> "SnapBuilding" >> _objType >> "radius"); // check here too
|
||||
};
|
||||
|
||||
local _objects = _obj nearObjects [_objType, _radius]; // get nearby objects
|
||||
|
||||
if (count _objects == 1) then { // if no identical objects are near
|
||||
_cancel = true; // do not display helpers
|
||||
};
|
||||
};
|
||||
if (_cancel) exitWith {};
|
||||
|
||||
local _helperSize = DZE_helperSizeDefault; // see configVariables.sqf
|
||||
local _helperClass = "";
|
||||
local _points = []; // vector array
|
||||
|
||||
_points = getArray (configFile >> "HelperVectors" >> _objType >> "points"); // get helper vector array
|
||||
|
||||
local _size = getNumber (configFile >> "HelperVectors" >> _objType >> "size"); // get size
|
||||
if (_size != 0) then {
|
||||
_helperSize = _size; // overwrite default size if it exists
|
||||
};
|
||||
|
||||
if (count _points > 0) then { // found helper vector
|
||||
|
||||
if (_objType in ["Concrete_Bunker_DZ","Concrete_Bunker_Locked_DZ","Door_DZ"]) exitWith{}; // exclude from helper removal
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Prevent floating helper
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// "DoorL" for MetalGate_DZ,
|
||||
// Land_DZE_WoodOpenTopGarageDoor,
|
||||
// Land_DZE_WoodOpenTopGarageLocked,
|
||||
// CinderGarageOpenTop_DZ,
|
||||
// CinderGarageOpenTopLocked_DZ
|
||||
// "dvere1" for Wooden_shed_DZ, Wooden_shed2_DZ
|
||||
// "open" for StorageShed_DZ, StorageShed2_DZ (Land_Shed_M01)
|
||||
// "Open_inner" for Metal_Drawbridge_DZ, Metal_DrawbridgeLocked_DZ
|
||||
// "Open_door" for default
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
local _resize = false;
|
||||
local _door = "Open_door";
|
||||
local _doorL = ["MetalGate_DZ","Land_DZE_WoodOpenTopGarageDoor","Land_DZE_WoodOpenTopGarageLocked","CinderGarageOpenTop_DZ","CinderGarageOpenTopLocked_DZ"];
|
||||
local _open = ["StorageShed_DZ","StorageShed2_DZ"];
|
||||
local _dvere1 = ["OutHouse_DZ"];
|
||||
local _custom1 = ["Wooden_shed_DZ","Wooden_shed2_DZ"];
|
||||
local _custom2 = ["Metal_Drawbridge_DZ","Metal_DrawbridgeLocked_DZ"];
|
||||
|
||||
call {
|
||||
if (_objType in _doorL) exitWith {_door = "doorl"};
|
||||
if (_objType in _open) exitWith {_door = "open"};
|
||||
if (_objType in _dvere1) exitWith {_door = "dvere1"};
|
||||
};
|
||||
call {
|
||||
if (_objType in _custom1 && _obj animationPhase "dvere1" < 1) exitWith {_resize = true}; // door is open
|
||||
if (_objType in _custom2 && _obj animationPhase "Open_inner" < 1) exitWith {_resize = true}; // door is open
|
||||
if (_obj animationPhase _door > 0) exitWith {_resize = true}; // door is open
|
||||
};
|
||||
if (_resize) then {
|
||||
_points resize (count _points) - 1; // do not display center helper
|
||||
};
|
||||
} else { // if no vector array exists
|
||||
_points = getArray (ConfigFile >> "SnapBuilding" >> _objType >> "points"); // try snapping points array
|
||||
};
|
||||
|
||||
{
|
||||
if (_helperSize == _x select 0) exitWith {
|
||||
_helperClass = _x select 1;
|
||||
}; // get helper class
|
||||
} count DZE_helperSize;
|
||||
|
||||
{
|
||||
local _helperObj = _helperClass createVehicleLocal [0,0,0]; // create helper object
|
||||
_helperObj setObjectTexture _helperTexture; // set colour
|
||||
|
||||
local _offset = +_x; // copy position array
|
||||
_offset resize 3; // truncate if necessary
|
||||
|
||||
local _pos = _obj modelToWorld _offset; // translate
|
||||
|
||||
if (surfaceIsWater _pos) then { // adjust for land and sea
|
||||
_pos set [2, (getPosASL _obj select 2) + (_offset select 2)];
|
||||
_helperObj setPosASL _pos;
|
||||
} else {
|
||||
_helperObj setPosATL _pos;
|
||||
};
|
||||
|
||||
HelperArray set [count HelperArray, _helperObj]; // record list of helpers
|
||||
} count _points; // if no vectors were found, do nothing
|
||||
|
||||
} else {
|
||||
|
||||
{deleteVehicle _x;} count HelperArray; // delete helpers
|
||||
HelperArray = [];
|
||||
};
|
||||
};
|
||||
@@ -219,14 +219,14 @@ if (_isPZombie) then {
|
||||
};
|
||||
|
||||
// Increase distance only if AIR, SHIP or TANK
|
||||
local _allowedDistance = [4, 8] select ((_cursorTarget isKindOf "Air") || {_cursorTarget isKindOf "Ship"} || {_cursorTarget isKindOf "Tank"});
|
||||
local _typeOfCursorTarget = typeOf _cursorTarget;
|
||||
local _allowedDistance = [5, 9] select ((_typeOfCursorTarget in DZE_largeObjects) || {_cursorTarget isKindOf "Air" || {_cursorTarget isKindOf "Ship" || {_cursorTarget isKindOf "Tank"}}});
|
||||
local _distance = floor((player distance _cursorTarget) * 100) / 100; // truncate to 2 decimal places for stationary objects
|
||||
local _isVehicle = _cursorTarget isKindOf "AllVehicles";
|
||||
if (_isVehicle) then {_distance = floor(player distance _cursorTarget)}; // truncate to 0 decimal places for jittery vehicles
|
||||
local _noChange = ((_cursorTarget == DZE_prevTarget) && (_distance == DZE_prevDistance));
|
||||
|
||||
if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo && (_distance <= _allowedDistance)) then {
|
||||
local _typeOfCursorTarget = typeOf _cursorTarget;
|
||||
local _isBicycle = _cursorTarget isKindOf "Bicycle";
|
||||
local _isDestructable = _cursorTarget isKindOf "BuiltItems";
|
||||
local _isGenerator = _typeOfCursorTarget == "Generator_DZ";
|
||||
@@ -259,8 +259,8 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
};
|
||||
|
||||
local _isDog = (_cursorTarget isKindOf "Pastor" || _cursorTarget isKindOf "Fin");
|
||||
local _isModular = _cursorTarget isKindOf "ModularItems";
|
||||
local _isModularDoor = _typeOfCursorTarget in ["Land_DZE_WoodDoor","Land_DZE_LargeWoodDoor","Land_DZE_GarageWoodDoor","CinderWallDoor_DZ","CinderWallDoorSmall_DZ","WoodenGate_foundation_DZ","WoodenGate_1_DZ","WoodenGate_2_DZ","WoodenGate_3_DZ","WoodenGate_4_DZ","Land_DZE_WoodGate","Land_DZE_WoodOpenTopGarageDoor","CinderGate_DZ","CinderGarageOpenTop_DZ","CinderDoorHatch_DZ","Door_DZ","Concrete_Bunker_DZ","Metal_Drawbridge_DZ"];
|
||||
local _isModular = (_cursorTarget isKindOf "ModularItems" || {_typeOfCursorTarget in DZE_modularDoors});
|
||||
local _hasDeconstructAccess = false;
|
||||
local _player_deleteBuild = false;
|
||||
local _player_lockUnlock_crtl = false;
|
||||
|
||||
@@ -378,20 +378,22 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
};
|
||||
};
|
||||
|
||||
// Remove Object
|
||||
if (_isAlive) then {
|
||||
local _restrict = _typeOfCursorTarget in DZE_restrictRemoval;
|
||||
|
||||
//Allow player to remove objects with no ownership or access required
|
||||
if (!_restrict && {_isDestructable || {_typeOfCursorTarget in DZE_isWreck} || {_typeOfCursorTarget in DZE_isWreckBuilding} || {_typeOfCursorTarget in DZE_isRemovable}}) then {
|
||||
// Allow player to remove objects with no ownership or access required
|
||||
if (!_restrict && (_isDestructable || {_typeOfCursorTarget in DZE_isWreck || {_typeOfCursorTarget in DZE_isWreckBuilding || {_typeOfCursorTarget in DZE_isRemovable}}})) then {
|
||||
if (_hasToolbox && _hasCrowbar) then {
|
||||
_player_deleteBuild = true;
|
||||
};
|
||||
};
|
||||
//Allow player to remove objects only if they have proper ownership or access
|
||||
if (_restrict || _isModular || _isModularDoor || _isGenerator || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
|
||||
// Allow player to remove objects only if they have proper ownership or access
|
||||
if (_restrict || _isModular || _isGenerator || {_typeOfCursorTarget in DZE_isDestroyableStorage}) then {
|
||||
if (_hasToolbox && _hasCrowbar) then {
|
||||
_hasAccess = [player, _cursorTarget] call FNC_check_access;
|
||||
if ((_hasAccess select 0) || {_hasAccess select 2} || {_hasAccess select 3}) then {
|
||||
if ((_hasAccess select 0) || (_hasAccess select 2) || (_hasAccess select 3)) then {
|
||||
_hasDeconstructAccess = true;
|
||||
_player_deleteBuild = true;
|
||||
};
|
||||
};
|
||||
@@ -402,14 +404,27 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (_player_deleteBuild) then {
|
||||
if (s_player_deleteBuild < 0) then {
|
||||
s_player_deleteBuild = player addAction [format[localize "STR_EPOCH_REMOVE",_text], "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, false, true];
|
||||
|
||||
s_player_deleteBuild = player addAction [format[localize "STR_EPOCH_REMOVE", _text], "\z\addons\dayz_code\actions\remove.sqf",[_cursorTarget, 2, _isModular], -3, false, true];
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_deleteBuild;
|
||||
s_player_deleteBuild = -1;
|
||||
|
||||
};
|
||||
|
||||
// Deconstruct Modular Object
|
||||
if (DZE_refundModular && DZE_allowDeconstruct && _hasDeconstructAccess && _isModular && !((DZE_RefundDamageLimit > 0) && (damage _cursorTarget > DZE_RefundDamageLimit))) then {
|
||||
if !(_typeOfCursorTarget in DZE_modularExclude) then { // check if class allows refunds
|
||||
if (s_player_deconstruct < 0) then {
|
||||
s_player_deconstruct = player addAction [format[localize "STR_EPOCH_DECONSTRUCT", _text], "\z\addons\dayz_code\actions\remove.sqf",[_cursorTarget, 3, _isModular], -4, false, true];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
player removeAction s_player_deconstruct;
|
||||
s_player_deconstruct = -1;
|
||||
};
|
||||
|
||||
//remove Own objects
|
||||
@@ -1066,6 +1081,8 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
s_player_sleep = -1;
|
||||
player removeAction s_player_deleteBuild;
|
||||
s_player_deleteBuild = -1;
|
||||
player removeAction s_player_deconstruct;
|
||||
s_player_deconstruct = -1;
|
||||
player removeAction s_player_cook;
|
||||
s_player_cook = -1;
|
||||
player removeAction s_player_boil;
|
||||
@@ -1141,8 +1158,6 @@ if (!isNull _cursorTarget && _noChange && !_inVehicle && !_isPZombie && _canDo &
|
||||
s_player_maint_build = -1;
|
||||
player removeAction s_player_downgrade_build;
|
||||
s_player_downgrade_build = -1;
|
||||
player removeAction s_player_towing;
|
||||
s_player_towing = -1;
|
||||
player removeAction s_player_fuelauto;
|
||||
s_player_fuelauto = -1;
|
||||
player removeAction s_player_fuelauto2;
|
||||
|
||||
@@ -1,78 +1,97 @@
|
||||
/*
|
||||
[_obj] call player_packTent;
|
||||
*/
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// [_obj] call player_packTent;
|
||||
//
|
||||
// Updated by: Victor the Cleaner
|
||||
// Date: August 2021
|
||||
//
|
||||
// - Now includes helper spheres for improved player experience
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if (dayz_actionInProgress) exitWith {
|
||||
localize "str_player_actionslimit" call dayz_rollingMessages; // Wait for the previous action to complete to perform another!
|
||||
};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_alreadyPacking","_backpacks","_bag","_campItems","_dir","_holder","_magazines","_obj","_objectID","_objectUID","_ownerID","_packobj","_playerNear","_pos","_weapons","_finished","_posPlayer","_text","_typeOf"];
|
||||
|
||||
_obj = _this;
|
||||
_typeOf = typeOf _obj;
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||
local _obj = _this;
|
||||
local _objType = typeOf _obj;
|
||||
local _ownerID = _obj getVariable["CharacterID","0"];
|
||||
local _objectID = _obj getVariable["ObjectID","0"];
|
||||
local _objectUID = _obj getVariable["ObjectUID","0"];
|
||||
|
||||
if (DZE_permanentPlot) then {
|
||||
_ownerID = _obj getVariable["ownerPUID","0"];
|
||||
};
|
||||
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
local _playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 12]) > 1;
|
||||
if (_playerNear) exitWith {
|
||||
dayz_actionInProgress = false;
|
||||
localize "str_pickup_limit_5" call dayz_rollingMessages; // Another player is nearby. Only one player can be near to perform this action.
|
||||
};
|
||||
|
||||
_packobj = getText (configFile >> "CfgVehicles" >> _typeOf >> "pack");
|
||||
local _packobj = getText (configFile >> "CfgVehicles" >> _objType >> "pack"); // classname
|
||||
|
||||
player removeAction s_player_packtent;
|
||||
s_player_packtent = -1;
|
||||
player removeAction s_player_packtentinfected;
|
||||
s_player_packtentinfected = -1;
|
||||
|
||||
_campItems = ["IC_DomeTent","IC_Tent"];
|
||||
if (_ownerID in [dayz_characterID, dayz_playerUID] || {_objType in ["IC_DomeTent","IC_Tent"]}) then { // if player is the owner, or infected camp items
|
||||
|
||||
if (_ownerID in [dayz_characterID,dayz_playerUID] || {_typeOf in _campItems}) then {
|
||||
_alreadyPacking = _obj getVariable["packing",0];
|
||||
if (_alreadyPacking == 1) exitWith {localize "str_player_beingpacked" call dayz_rollingMessages;};
|
||||
local _alreadyPacking = _obj getVariable["packing", 0];
|
||||
|
||||
_obj setVariable["packing",1,true];
|
||||
_dir = direction _obj;
|
||||
_pos = getPosATL _obj;
|
||||
if (_alreadyPacking == 1) exitWith {
|
||||
localize "str_player_beingpacked" call dayz_rollingMessages; // That tent is already being packed.
|
||||
};
|
||||
|
||||
[player,(getPosATL player),20,"tentpack"] spawn fnc_alertZombies;
|
||||
local _text = getText (configFile >> "CfgVehicles" >> _objType >> "displayName");
|
||||
format[localize "str_epoch_player_121", _text] call dayz_rollingMessages; // Packing %1, move from this position to cancel within 5 seconds.
|
||||
|
||||
_text = getText (configFile >> "CfgVehicles" >> _typeOf >> "displayName");
|
||||
format[localize "str_epoch_player_121",_text] call dayz_rollingMessages;
|
||||
_obj setVariable["packing", 1, true];
|
||||
|
||||
local _dir = direction _obj;
|
||||
local _pos = getPosATL _obj;
|
||||
|
||||
[_obj, DZE_NoRefundTexture] call fn_displayHelpers; // create helpers (red)
|
||||
|
||||
[player,(getPosATL player), 20, "tentpack"] spawn fnc_alertZombies; // make noise
|
||||
|
||||
local _finished = ["Medic",1] call fn_loopAction; // animation
|
||||
|
||||
[] call fn_displayHelpers; // delete helpers
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (isNull _obj) exitWith {};
|
||||
if (!_finished) exitWith {_obj setVariable["packing",0,true];};
|
||||
|
||||
_posPlayer = getPosATL player;
|
||||
_pos set [2,_posPlayer select 2];
|
||||
if (!_finished) exitWith {_obj setVariable["packing", 0, true];}; // cancel & reset
|
||||
|
||||
if (_pos select 2 < 0) then {_pos set [2,0];};
|
||||
_pos set [2, (getPosATL player) select 2];
|
||||
|
||||
_bag = _packobj createVehicle [0,0,0];
|
||||
if (_pos select 2 < 0) then { // match player height or place on ground
|
||||
_pos set [2,0];
|
||||
};
|
||||
|
||||
local _bag = _packobj createVehicle [0,0,0]; // packed tent
|
||||
_bag setDir _dir;
|
||||
_bag setPosATL _pos;
|
||||
|
||||
_holder = "WeaponHolder" createVehicle [0,0,0];
|
||||
local _holder = "WeaponHolder" createVehicle [0,0,0]; // any packed items go here
|
||||
_holder setPosATL _pos;
|
||||
|
||||
_weapons = getWeaponCargo _obj;
|
||||
_magazines = getMagazineCargo _obj;
|
||||
_backpacks = getBackpackCargo _obj;
|
||||
local _weapons = getWeaponCargo _obj; // prepare items
|
||||
local _magazines = getMagazineCargo _obj;
|
||||
local _backpacks = getBackpackCargo _obj;
|
||||
|
||||
PVDZ_obj_Destroy = [_objectID,_objectUID,player,_pos,dayz_authKey,false];
|
||||
PVDZ_obj_Destroy = [_objectID, _objectUID, player, _pos, dayz_authKey, false]; // delete original tent
|
||||
publicVariableServer "PVDZ_obj_Destroy";
|
||||
deleteVehicle _obj;
|
||||
|
||||
[_weapons,_magazines,_backpacks,_holder] call fn_addCargo;
|
||||
[_weapons, _magazines, _backpacks, _holder] call fn_addCargo; // pile everything onto the ground
|
||||
|
||||
player reveal _holder;
|
||||
|
||||
localize "str_success_tent_pack" call dayz_rollingMessages;
|
||||
localize "str_success_tent_pack" call dayz_rollingMessages; // Your tent has been packed
|
||||
} else {
|
||||
localize "str_fail_tent_pack" call dayz_rollingMessages;
|
||||
localize "str_fail_tent_pack" call dayz_rollingMessages; // You cannot pack this tent, it is not yours
|
||||
};
|
||||
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
@@ -1,62 +1,94 @@
|
||||
/*
|
||||
_obj spawn player_packVault;
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// _obj spawn player_packVault;
|
||||
//
|
||||
// Updated by: Victor the Cleaner
|
||||
// Date: September 2021
|
||||
//
|
||||
// - Now includes helper spheres for improved player experience
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
|
||||
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; // Wait for the previous action to complete to perform another!
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
private ["_code","_obj","_ownerID","_objectID","_objectUID","_packedClass","_text","_playerNear","_finished","_ComboMatch","_typeOf"];
|
||||
|
||||
_obj = _this;
|
||||
_typeOf = typeOf _obj;
|
||||
_packedClass = getText (configFile >> "CfgVehicles" >> _typeOf >> "packedClass");
|
||||
_text = getText (configFile >> "CfgVehicles" >> _typeOf >> "displayName");
|
||||
local _obj = _this;
|
||||
local _typeOf = typeOf _obj;
|
||||
local _text = getText (configFile >> "CfgVehicles" >> _typeOf >> "displayName");
|
||||
local _packedClass = getText (configFile >> "CfgVehicles" >> _typeOf >> "packedClass");
|
||||
|
||||
if (isNull _obj || !(alive _obj)) exitWith {dayz_actionInProgress = false;};
|
||||
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
local _playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
|
||||
if (_playerNear) exitWith {
|
||||
dayz_actionInProgress = false;
|
||||
localize "str_pickup_limit_5" call dayz_rollingMessages; // Another player is nearby. Only one player can be near to perform this action.
|
||||
};
|
||||
|
||||
local _ownerID = _obj getVariable["CharacterID","0"];
|
||||
local _objectID = _obj getVariable["ObjectID","0"];
|
||||
local _objectUID = _obj getVariable["ObjectUID","0"];
|
||||
local _ComboMatch = (_ownerID == dayz_combination);
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
_objectID = _obj getVariable["ObjectID","0"];
|
||||
_objectUID = _obj getVariable["ObjectUID","0"];
|
||||
_ComboMatch = (_ownerID == dayz_combination);
|
||||
if (DZE_permanentPlot) then {_ownerID = _obj getVariable["ownerPUID","0"];};
|
||||
|
||||
if (_objectID == "0" && _objectUID == "0") exitWith {
|
||||
dayz_actionInProgress = false;
|
||||
// s_player_packvault = -1;
|
||||
format[localize "str_epoch_player_118", _text] call dayz_rollingMessages; // %1 not setup yet.
|
||||
};
|
||||
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith {
|
||||
dayz_actionInProgress = false;
|
||||
// s_player_packvault = -1;
|
||||
format[localize "str_epoch_player_119", _text] call dayz_rollingMessages; // You cannot pack this %1, you do not know the combination.
|
||||
};
|
||||
|
||||
if (isNull _obj && {!alive _obj}) exitWith { // object has been destroyed or deleted
|
||||
// s_player_packvault = -1;
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
player removeAction s_player_packvault;
|
||||
s_player_packvault = 1;
|
||||
|
||||
if (_objectID == "0" && _objectUID == "0") exitWith {dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_118",_text] call dayz_rollingMessages;};
|
||||
format[localize "str_epoch_player_121", _text] call dayz_rollingMessages; // Packing %1, move from this position to cancel within 5 seconds.
|
||||
|
||||
if (!_ComboMatch && (_ownerID != dayz_playerUID)) exitWith {dayz_actionInProgress = false; s_player_packvault = -1; format[localize "str_epoch_player_119",_text] call dayz_rollingMessages;};
|
||||
[_obj, DZE_NoRefundTexture] call fn_displayHelpers; // create helpers (red)
|
||||
|
||||
if (isNull _obj && {!alive _obj}) exitWith {s_player_packvault = -1;dayz_actionInProgress = false;};
|
||||
[player,(getPosATL player),20,"tentpack"] spawn fnc_alertZombies;
|
||||
[player,(getPosATL player),20,"tentpack"] spawn fnc_alertZombies; // make noise
|
||||
|
||||
format[localize "str_epoch_player_121",_text] call dayz_rollingMessages;
|
||||
local _finished = ["Medic",1] call fn_loopAction; // animation
|
||||
|
||||
_finished = ["Medic",1] call fn_loopAction;
|
||||
if (isNull _obj || !_finished) exitWith {s_player_packvault = -1;dayz_actionInProgress = false;};
|
||||
[] call fn_displayHelpers; // delete helpers
|
||||
|
||||
if (isNull _obj || !_finished) exitWith {
|
||||
s_player_packvault = -1;
|
||||
dayz_actionInProgress = false;
|
||||
};
|
||||
|
||||
(findDisplay 106) closeDisplay 0; // Close gear
|
||||
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1;
|
||||
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
|
||||
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase", 10]) > 1; // if another player has approached during the packing animation
|
||||
if (_playerNear) exitWith {
|
||||
dayz_actionInProgress = false;
|
||||
localize "str_pickup_limit_5" call dayz_rollingMessages; // Another player is nearby. Only one player can be near to perform this action.
|
||||
};
|
||||
|
||||
["Working",0,[3,2,4,0]] call dayz_NutritionSystem;
|
||||
|
||||
dze_waiting = nil;
|
||||
|
||||
[_packedClass,objNull] call fn_waitForObject;
|
||||
[_packedClass, objNull] call fn_waitForObject;
|
||||
|
||||
_code = [_obj getVariable["CharacterID","0"],dayz_combination] select (_ComboMatch);
|
||||
local _code = [_obj getVariable["CharacterID","0"],dayz_combination] select (_ComboMatch);
|
||||
|
||||
PVDZE_handleSafeGear = [player,_obj,2,_code,dayz_authKey];
|
||||
publicVariableServer "PVDZE_handleSafeGear";
|
||||
|
||||
waitUntil {!isNil "dze_waiting"}; // wait for response from server to verify pack was logged and gear added before proceeding
|
||||
|
||||
format[localize "str_epoch_player_123",_text] call dayz_rollingMessages;
|
||||
format[localize "str_epoch_player_123", _text] call dayz_rollingMessages; // Your %1 has been packed
|
||||
|
||||
s_player_packvault = -1;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
Reference in New Issue
Block a user