mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-17 17:20:26 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user