mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Prevent changing clothes while wearing a backback
Also removed 10m restriction on other players nearby
This commit is contained in:
@@ -7,10 +7,6 @@ private ["_item","_onLadder","_hasclothesitem","_config","_text","_myModel","_it
|
||||
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_83") , "PLAIN DOWN"] };
|
||||
DZE_ActionInProgress = true;
|
||||
|
||||
// cannot change clothes when another player is nearby
|
||||
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
|
||||
if(_playerNear) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_84") , "PLAIN DOWN"]; };
|
||||
|
||||
_item = _this;
|
||||
call gear_ui_init;
|
||||
|
||||
@@ -25,6 +21,8 @@ if (!_hasclothesitem) exitWith {DZE_ActionInProgress = false; cutText [format[(l
|
||||
|
||||
if (vehicle player != player) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_85"), "PLAIN DOWN"]};
|
||||
|
||||
if (!isNull (unitBackpack player)) exitWith { DZE_ActionInProgress = false; cutText ["\n\nUnable to change clothes while still hearing backpack.", "PLAIN DOWN"] };
|
||||
|
||||
_myModel = (typeOf player);
|
||||
_itemNew = "Skin_" + _myModel;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private ["_class","_position","_dir","_group","_oldUnit","_newUnit","_currentWpn","_muzzles","_currentAnim","_playerUID","_weapons","_magazines","_primweapon","_secweapon","_newBackpackType","_backpackWpn","_backpackMag","_backpackWpnTypes","_backpackWpnQtys","_countr","_backpackmagTypes","_backpackmagQtys","_playerObjName"];
|
||||
private ["_class","_position","_dir","_group","_oldUnit","_newUnit","_currentWpn","_muzzles","_currentAnim","_playerUID","_weapons","_magazines","_primweapon","_secweapon","_playerObjName","_wpnType","_ismelee"];
|
||||
_class = _this;
|
||||
|
||||
_position = getPosATL player;
|
||||
@@ -8,7 +8,6 @@ _currentAnim = animationState player;
|
||||
|
||||
|
||||
//Get PlayerID
|
||||
private ["_playerUID"];
|
||||
_playerUID = "";
|
||||
if (count playableUnits == 0 and isServer) then {
|
||||
//In Single Player
|
||||
@@ -21,15 +20,12 @@ private ["_playerUID"];
|
||||
};
|
||||
|
||||
//BackUp Weapons and Mags
|
||||
private ["_weapons","_magazines","_primweapon","_secweapon"];
|
||||
|
||||
_weapons = weapons player;
|
||||
_magazines = call player_countmagazines; //magazines player;
|
||||
|
||||
if ( (_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0 )) exitWith {cutText [(localize "str_epoch_player_17"), "PLAIN DOWN"]};
|
||||
|
||||
|
||||
// if ( count _magazines == 0 ) exitWith {cutText [(localize "str_epoch_player_17"), "PLAIN DOWN"]};
|
||||
|
||||
_primweapon = primaryWeapon player;
|
||||
_secweapon = secondaryWeapon player;
|
||||
|
||||
@@ -42,19 +38,6 @@ private ["_weapons","_magazines","_primweapon","_secweapon"];
|
||||
_weapons = _weapons + [_secweapon];
|
||||
};
|
||||
|
||||
// if(count _magazines == 0) then {
|
||||
// _magazines = magazines player;
|
||||
// };
|
||||
|
||||
//BackUp Backpack
|
||||
private ["_newBackpackType","_backpackWpn","_backpackMag"];
|
||||
dayz_myBackpack = unitBackpack player;
|
||||
_newBackpackType = (typeOf dayz_myBackpack);
|
||||
if(_newBackpackType != "") then {
|
||||
_backpackWpn = getWeaponCargo unitBackpack player;
|
||||
_backpackMag = getMagazineCargo unitBackpack player;
|
||||
};
|
||||
|
||||
//Get Muzzle
|
||||
_currentWpn = currentWeapon player;
|
||||
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
|
||||
@@ -70,6 +53,7 @@ diag_log str(_magazines);
|
||||
diag_log (str(_backpackWpn));
|
||||
diag_log (str(_backpackMag));
|
||||
*/
|
||||
|
||||
//Secure Player for Transformation
|
||||
player setPosATL dayz_spawnPos;
|
||||
|
||||
@@ -95,12 +79,10 @@ diag_log (str(_backpackMag));
|
||||
//Equip New Charactar
|
||||
{
|
||||
if (typeName _x == "ARRAY") then {_newUnit addMagazine [_x select 0,_x select 1] } else { _newUnit addMagazine _x };
|
||||
//sleep 0.05;
|
||||
} forEach _magazines;
|
||||
|
||||
{
|
||||
_newUnit addWeapon _x;
|
||||
//sleep 0.05;
|
||||
} forEach _weapons;
|
||||
|
||||
//Check and Compare it
|
||||
@@ -113,7 +95,6 @@ diag_log (str(_backpackMag));
|
||||
//Add the Missing
|
||||
{
|
||||
_newUnit addWeapon _x;
|
||||
//sleep 0.2;
|
||||
} forEach _weapons;
|
||||
};
|
||||
|
||||
@@ -141,41 +122,6 @@ diag_log (str(_backpackMag));
|
||||
_newUnit addWeapon _secweapon;
|
||||
};
|
||||
|
||||
//Add and Fill BackPack
|
||||
if (!isNil "_newBackpackType") then {
|
||||
if (_newBackpackType != "") then {
|
||||
_newUnit addBackpack _newBackpackType;
|
||||
//_oldBackpack = dayz_myBackpack;
|
||||
dayz_myBackpack = unitBackpack _newUnit;
|
||||
|
||||
|
||||
//Fill backpack contents
|
||||
//Weapons
|
||||
_backpackWpnTypes = [];
|
||||
_backpackWpnQtys = [];
|
||||
if (count _backpackWpn > 0) then {
|
||||
_backpackWpnTypes = _backpackWpn select 0;
|
||||
_backpackWpnQtys = _backpackWpn select 1;
|
||||
};
|
||||
_countr = 0;
|
||||
{
|
||||
dayz_myBackpack addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _backpackWpnTypes;
|
||||
//magazines
|
||||
_backpackmagTypes = [];
|
||||
_backpackmagQtys = [];
|
||||
if (count _backpackmag > 0) then {
|
||||
_backpackmagTypes = _backpackMag select 0;
|
||||
_backpackmagQtys = _backpackMag select 1;
|
||||
};
|
||||
_countr = 0;
|
||||
{
|
||||
dayz_myBackpack addmagazineCargoGlobal [_x,(_backpackmagQtys select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _backpackmagTypes;
|
||||
};
|
||||
};
|
||||
//Debug Message
|
||||
/*
|
||||
diag_log "Swichtable Unit Created. Equipment:";
|
||||
@@ -218,5 +164,5 @@ diag_log str(getMagazineCargo unitBackpack _newUnit);
|
||||
};
|
||||
|
||||
//reveal all near objects.
|
||||
{player reveal _x} forEach (nearestObjects [getPosATL player, ["All"], 75]);
|
||||
{player reveal _x} forEach (nearestObjects [getPosATL player, ["All"], 50]);
|
||||
//All is arbitrary and will need to be changed to ["AllVehicles","WeaponHolder","tentStorage"] ++ others (stashes etc.)
|
||||
|
||||
Reference in New Issue
Block a user