Actions Done

This commit is contained in:
icomrade
2016-02-29 10:45:53 -05:00
parent a47c3dc137
commit b667d01c1c
27 changed files with 1958 additions and 1094 deletions

View File

@@ -1,60 +1,110 @@
private ["_array","_type","_classname","_holder","_config","_isOk","_muzzles","_playerID","_claimedBy","_text","_playerNear","_obj","_qty"];
// Exit if player zombie
if(player isKindOf "PZombie_VB") exitWith {};
if (!DZE_CanPickup) exitWith { cutText [(localize "str_epoch_player_38") , "PLAIN DOWN"]; };
DZE_CanPickup = false;
private ["_array","_type","_classname","_holder","_playerID","_text","_broken","_claimedBy","_config","_isOk","_PlayerNear","_wpn","_ismelee"];
_array = _this select 3;
_type = _array select 0;
_classname = _array select 1;
_holder = _array select 2;
// if holder is null disallow pickup for 5 seconds
if(isNull _holder) exitWith {
DZE_CanPickup = true;
};
// Check if closest player
_PlayerNear = _holder call dze_isnearest_player;
if (_PlayerNear) exitWith {cutText [localize "str_pickup_limit_4", "PLAIN DOWN"]};
if (player distance _holder > 3) exitwith { localize "str_pickup_limit_1","PLAIN DOWN" };
_playerID = getPlayerUID player;
player removeAction s_player_holderPickup;
_text = getText (configFile >> _type >> _classname >> "displayName");
if (!canPickup || !DZE_CanPickup) exitwith {
if (pickupInit) then {
cutText [localize "str_pickup_limit_2","PLAIN DOWN"];
} else {
cutText [localize "str_pickup_limit_3","PLAIN DOWN"];
};
};
_claimedBy = _holder getVariable "claimed";
if (isnil "claimed") then {
_holder setVariable["claimed",_playerID,true];
};
canPickup = false;
DZE_CanPickup = false;
if(_classname isKindOf "TrapBear") exitwith {DZE_CanPickup = true; deleteVehicle _holder; };
player playActionNow "PutDown";
if(_classname isKindOf "TrapBear") exitwith {DZE_CanPickup = true; deleteVehicle _holder;};
//Adding random chance of arrow is re-usable on pickup
_broken = false;
if(_classname == "WoodenArrow") then {
if ([0.15] call fn_chance) then {
_broken = true;
};
};
if (_broken) exitWith {DZE_CanPickup = true; deleteVehicle _holder; cutText [localize "str_broken_arrow", "PLAIN DOWN"]; };
sleep 0.25; //Why are we waiting? Animation
_claimedBy = _holder getVariable["claimed","0"];
if (_claimedBy != _playerID) exitWith { cutText [format [localize "str_player_beinglooted",_text] , "PLAIN DOWN"]; };
if(_classname isKindOf "Bag_Base_EP1") exitwith {
_PlayerNear = {isPlayer _x} count ((getPosATL _holder) nearEntities ["CAManBase", 10]) > 1;
if (_PlayerNear) exitWith {DZE_CanPickup = true; cutText [localize "str_pickup_limit_4", "PLAIN DOWN"]};
diag_log("Picked up a bag: " + _classname);
// diag_log("Picked up a bag: " + _classname);
if(_classname == typeOf _holder) then {
_hasBag = unitBackpack player;
if (isNull _hasBag) then {
player action ["TakeBag", _holder];
} else {
player action ["putbag", player];
uisleep 0.03;
player action ["TakeBag", _holder];
};
DZE_CanPickup = true;
//Lets wait to make sure the player has some kind of backpack.
waitUntil { !isNull (unitBackpack player) };
uisleep 0.03;
//Lets call inventory save
PVDZ_plr_Save = [player,nil,false];
publicVariableServer "PVDZ_plr_Save";
};
_obj = nearestObjects [(getPosATL player), [(typeOf _holder)], 5];
_qty = count _obj;
_config = (configFile >> _type >> _classname);
if(_qty >= 1) then {
_config = (configFile >> _type >> _classname);
_isOk = [player,_config] call BIS_fnc_invAdd;
if (_isOk) then {
deleteVehicle _holder;
if (_classname in ["MeleeHatchet_DZE","MeleeCrowbar","MeleeMachete","MeleeFishingPole","MeleeSledge"]) then {
if (_type == "cfgWeapons") then {
_muzzles = getArray(configFile >> "cfgWeapons" >> _classname >> "muzzles");
//_wtype = ((weapons player) select 0);
if (count _muzzles > 1) then {
player selectWeapon (_muzzles select 0);
} else {
player selectWeapon _classname;
};
};
};
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} forEach MeleeMagazines;
_isOk = [player,_config] call BIS_fnc_invAdd;
if (_isOk) then {
deleteVehicle _holder;
} else {
if (!_isOk) exitWith {
_holder setVariable["claimed",0,true];
cutText [localize "str_player_24", "PLAIN DOWN"];
};
};
uisleep 3;
//adding melee mags back if needed
_wpn = primaryWeapon player;
//diag_log format["Classname: %1, WPN: %2", _classname,_wpn];
_ismelee = (getNumber (configFile >> "CfgWeapons" >> _wpn >> "melee") == 1);
if (_ismelee) then {
call dayz_meleeMagazineCheck;
};
DZE_CanPickup = true;