Files
DayZ-Epoch/dayz_code/actions/object_pickup.sqf
vbawol 3cbb79051e 1.0.0.7 Developer Build
+ [CHANGED] Build-ables now get deleted from database when killed.
+ [ADDED] Basic fishing on ocean using toolbelt item: ItemFishingPole.
TODO: add model
+ [ADDED] New way of chopping down trees that actually takes into
account the size of the tree for number of chops/output. For example
medium sized tree will typically require 3 animations and will yield 3
wood piles.
+ [ADDED] Airplane dealer to Namalsk and updated trader config.
+ [CHANGED] Can now remove park bench with refund.
+ [FIXED] dayz_maxGlobalZombies was not incrementing when other players
are within 400m. Also, variable was overwritten in player_spawncheck
code so a init variable was added dayz_maxGlobalZombiesInit (default=40)
as well as dayz_maxGlobalZombiesIncrease (default=10) to control the
amount of increase for each additional player within range.
+ [CHANGED] Any backpack placed on the ground will with gear will now
disappear to all other players.
+ [FIXED] Added 5 second sleep to swimming in ground fix, now it should
actually work without glitching. fixes #326
+ [CHANGED] To prevent lost primary weapons in backpacks, all backpacks
have been Upgraded. This requires that backpacks the weapon to magazines
ratio be within 1:10. http://dayzepoch.com/wiki/index.php/Backpacks
+ [CLEANUP] disable debug of player zombie vision.
+ [ADDED] ASC EU Lights Mod FROM
http://www.armaholic.com/page.php?id=12076
+ [ADDED] New Craft-able light_pole_kit and Build-able LightPole_DZ for
night lighting. RECIPE 4 lumber + 1 scrap + 1 Light Bulb
+ [ADDED] MAP Editorupgrade (EU) @MAP Mod FROM
http://www.armaholic.com/page.php?id=6194
+ [CHANGED] Picking up crowbar now gives toolbelt item instead of melee
weapon.
2013-05-04 15:21:57 -05:00

99 lines
3.0 KiB
Plaintext

private["_array","_type","_classname","_holder","_config","_isOk","_muzzles","_playerID","_claimedBy","_text","_control","_dialog","_item","_val","_max","_bolts","_quivers","_quiver","_broken"];
// Exit if player zombie
if(player isKindOf "PZombie_VB") exitWith {};
if(TradeInprogress) exitWith { cutText ["Take item already in progress." , "PLAIN DOWN"]; };
TradeInprogress = true;
_array = _this select 3;
_type = _array select 0;
_classname = _array select 1;
_holder = _array select 2;
_playerID = getPlayerUID player;
_text = getText (configFile >> _type >> _classname >> "displayName");
_claimedBy = _holder getVariable["claimed","0"];
// Check if any players are nearby if not allow player to claim item.
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
// Only allow if not already claimed.
if (_claimedBy == "0" or !_playerNear) then {
// Since item was not claimed proceed with claiming it.
_holder setVariable["claimed",_playerID,true];
};
if(_classname isKindOf "TrapBear") exitwith {TradeInprogress = false; deleteVehicle _holder;};
player playActionNow "PutDown";
if (_classname == "MeleeCrowbar") then {
player addMagazine 'crowbar_swing';
};
if (_classname == "MeleeHatchet") then {
player addMagazine 'hatchet_swing';
};
if (_classname == "MeleeMachete") then {
player addMagazine 'Machete_swing';
};
_broken = false;
if(_classname == "WoodenArrow") then {
if (20 > random 100) then {
_broken = true;
};
};
if (_broken) exitWith { deleteVehicle _holder; TradeInprogress = false; cutText [localize "str_broken_arrow", "PLAIN DOWN"] };
sleep 1;
_claimedBy = _holder getVariable["claimed","0"];
if (_claimedBy != _playerID) exitWith {TradeInprogress = false; cutText [format[(localize "str_player_beinglooted"),_text] , "PLAIN DOWN"]};
if(_classname isKindOf "Bag_Base_EP1") then {
diag_log("Picked up a bag: " + _classname);
};
// test to see if item still exists just before adding and removing
if(_holder == objNull) exitWith { TradeInprogress = false; };
_obj = nearestObjects [(getPosATL player), [(typeOf _holder)], 5];
_qty = count _obj;
if(_qty >= 1) then {
_config = (configFile >> _type >> _classname);
_isOk = [player,_config] call BIS_fnc_invAdd;
if (_isOk) then {
deleteVehicle _holder;
if (_classname in ["MeleeHatchet","MeleeCrowbar","MeleeMachete"]) 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;
};
};
};
} else {
_holder setVariable["claimed","0",true];
cutText [localize "STR_DAYZ_CODE_2", "PLAIN DOWN"];
if (_classname == "MeleeCrowbar") then {
player removeMagazine 'crowbar_swing';
};
if (_classname == "MeleeHatchet") then {
player removeMagazine 'hatchet_swing';
};
if (_classname == "MeleeMachete") then {
player removeMagazine 'Machete_swing';
};
};
};
TradeInprogress = false;