Files
DayZ-Epoch/dayz_code/actions/player_addToolbelt.sqf
vbawol 21291e389e 0.997a
+ Fixed females unable to select gender after death.
+ Fixed Alice and Assault packs inventory issues created with last
patch.
+ Fixed being unable to take items that may have already been claimed by
another player. Should work if no other players are within 6 meters.
+ Cooking, Crafting, Repairing, and Salvaging all now require full Medic
animation cycle to complete. You can cancel the process just by moving.
+ Traders that deal with magazine items now require full Medic animation
cycle per trade. Also, number of possible trades now based on quantity
of available items being sold or cost divided by available bars.
+ Changed several PublicVariable calls from 1.7.6.1 code sync that
should have been PublicVariableServer.
+ Fixed Bio-meat was not causing infection and increased chance of
infection from "Bad Food" to 50/50.
+ Added distance checks (5m) for player zombie attacks.
+ Fixed player zombie was unable to feed.
2013-03-15 12:17:18 -05:00

84 lines
2.6 KiB
Plaintext

private["_item","_config","_onLadder","_create","_isOk","_config2","_consume"];
if(TradeInprogress) exitWith { cutText ["Add to toolbelt already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true;
_item = _this;
_config = configFile >> "cfgWeapons" >> _item;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {TradeInprogress = false; cutText [(localize "str_player_21") , "PLAIN DOWN"]};
_hastoolweapon = _this in weapons player;
_text = getText (_config >> "displayName");
if (!_hastoolweapon) exitWith {TradeInprogress = false; cutText [format[(localize "str_player_30"),_text] , "PLAIN DOWN"]};
call gear_ui_init;
//Add new item
_create = getArray (_config >> "ItemActions" >> "Toolbelt" >> "output") select 0;
_config2 = configFile >> "cfgWeapons" >> _create;
//Remove magazines if needed
if (_item in ["MeleeHatchet","MeleeCrowbar","MeleeMachete"]) then {
_magType = ([] + getArray (configFile >> "cfgWeapons" >> _item >> "magazines")) select 0;
_meleeNum = ({_x == _magType} count magazines player);
for "_i" from 1 to _meleeNum do {
player removeMagazine _magType;
};
};
if (_item in ["ItemHatchet","ItemCrowbar","ItemMachete"]) then {
switch (primaryWeapon player) do
{
case "MeleeHatchet": { "MeleeHatchet" call player_addToolbelt };
case "MeleeCrowbar": { "MeleeCrowbar" call player_addToolbelt };
case "MeleeMachete": { "MeleeMachete" call player_addToolbelt };
};
};
_isOk = [player,_config2] call BIS_fnc_invAdd;
if (_isOk) then {
//Remove item
player removeWeapon _item;
//Add magazines if needed
if (_create in ["MeleeHatchet","MeleeCrowbar","MeleeMachete"]) then {
if (_create == "MeleeCrowbar") then {
player addMagazine 'crowbar_swing';
};
if (_create == "MeleeHatchet") then {
player addMagazine 'hatchet_swing';
};
if (_create == "MeleeMachete") then {
player addMagazine 'Machete_swing';
};
if (_type == "cfgWeapons") then {
_muzzles = getArray(configFile >> "cfgWeapons" >> _create >> "muzzles");
_wtype = ((weapons player) select 0);
if (count _muzzles > 1) then {
player selectWeapon (_muzzles select 0);
} else {
player selectWeapon _wtype;
};
};
};
} else {
cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"];
//Add magazines back
if (_item in ["MeleeHatchet","MeleeCrowbar","MeleeMachete"]) then {
if (_item == "MeleeCrowbar") then {
player addMagazine 'crowbar_swing';
};
if (_item == "MeleeHatchet") then {
player addMagazine 'hatchet_swing';
};
if (_item == "MeleeMachete") then {
player addMagazine 'Machete_swing';
};
};
};
TradeInprogress = false;