diff --git a/SQF/dayz_code/actions/player_wearClothes.sqf b/SQF/dayz_code/actions/player_wearClothes.sqf index 157463271..33843fbff 100644 --- a/SQF/dayz_code/actions/player_wearClothes.sqf +++ b/SQF/dayz_code/actions/player_wearClothes.sqf @@ -1,55 +1,66 @@ +private ["_item","_onLadder","_hasclothesitem","_config","_text","_myModel","_itemNew","_model","_morphHandle","_playerNear","_targeted","_pos"]; + if (dayz_lastClothesChange + 5 > diag_tickTime) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; dayz_lastClothesChange = diag_tickTime; +if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; + +if (vehicle player != player) exitWith {localize "str_player_fail_wear1" call dayz_rollingMessages;}; +//if (!isNull (unitBackpack player)) exitWith {localize "STR_EPOCH_ACTIONS_9" call dayz_rollingMessages;}; +if ("CSGAS" in (magazines player)) exitWith {localize "STR_EPOCH_ACTIONS_10" call dayz_rollingMessages;}; + // Make sure no other players are nearby _playerNear = {isPlayer _x} count (([player] call FNC_GetPos) nearEntities ["CAManBase",12]) > 1; if (_playerNear) exitWith {localize "STR_EPOCH_PLAYER_84" call dayz_rollingMessages;}; -if (_this in DZE_RestrictSkins) exitWith { format[localize "str_epoch_player_315",_this] call dayz_rollingMessages; }; -if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;}; +if (_this in DZE_RestrictSkins) exitWith {format[localize "str_epoch_player_315",_this] call dayz_rollingMessages;}; + +_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; +if (_onLadder) exitWith {localize "str_player_21" call dayz_rollingMessages;}; + +// Make sure the player isn't trying to reset AI targeting. +_targeted = false; +{ + if (!(isPlayer _x) && {_x distance player < 800}) then { + _pos = _x getHideFrom player; + if (_pos select 0 != 0 && {_pos select 1 != 0}) exitWith { + _targeted = true; + }; + }; +} count allUnits; +if (_targeted) exitWith {localize "str_player_fail_wear4" call dayz_rollingMessages;}; + dayz_actionInProgress = true; + /* _item call player_wearClothes; Added Female skin changes - DayZ Epoch - vbawol */ -private ["_item","_onLadder","_hasclothesitem","_config","_text","_isFemale","_myModel","_humanity","_isBandit","_isHero", -"_itemNew","_model","_skinToArray","_finalArray","_skinToModel","_morphHandle"]; _item = _this; call gear_ui_init; -_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1; -if (_onLadder) exitWith {localize "str_player_21" call dayz_rollingMessages; dayz_actionInProgress = false;}; - -_hasclothesitem = _this in magazines player; +_hasclothesitem = _item in magazines player; _config = configFile >> "CfgMagazines"; _text = getText (_config >> _item >> "displayName"); if (!_hasclothesitem) exitWith {format[localize "str_player_31",_text,localize "str_player_31_wear"] call dayz_rollingMessages; dayz_actionInProgress = false;}; -if (vehicle player != player) exitWith {localize "str_player_fail_wear1" call dayz_rollingMessages; dayz_actionInProgress = false;}; -//if (!isNull (unitBackpack player)) exitWith {dayz_actionInProgress = false; localize "STR_EPOCH_ACTIONS_9" call dayz_rollingMessages;}; -if ("CSGAS" in (magazines player)) exitWith {dayz_actionInProgress = false; localize "STR_EPOCH_ACTIONS_10" call dayz_rollingMessages;}; - _myModel = (typeOf player); -_humanity = player getVariable ["humanity",0]; -_isBandit = _humanity < -2000; -_isHero = _humanity > 5000; _itemNew = "Skin_" + _myModel; _morphHandle = nil; if ( (isClass(_config >> _itemNew)) ) then { if ( (isClass(_config >> _item)) ) then { // Current sex of player skin - - _currentSex = getText (configFile >> "CfgMagazines" >> _itemNew >> "sex"); + _currentSex = getText (_config >> _itemNew >> "sex"); // Sex of new skin - _newSex = getText (configFile >> "CfgMagazines" >> _item >> "sex"); + _newSex = getText (_config >> _item >> "sex"); //diag_log ("Debug Clothes: sex In: " + str(_currentSex) + " Out: " + str(_newSex)); if(_currentSex == _newSex) then { // Get model name from config - _model = getText (configFile >> "CfgMagazines" >> _item >> "playerModel"); + _model = getText (_config >> _item >> "playerModel"); if (_model != _myModel) then { if(([player,_item] call BIS_fnc_invRemove) == 1) then { player addMagazine _itemNew; @@ -67,4 +78,4 @@ if ( (isClass(_config >> _itemNew)) ) then { if (isNil "_morphHandle") then { // Don't set if humanity morph is still in progress (done at bottom of humanityMorph) dayz_actionInProgress = false; -}; \ No newline at end of file +};