mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-04 15:22:53 +03:00
1.0.1.6 Developer Build
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
private ["_obj","_type","_config","_positions","_iPos","_nearBy","_itemType","_itemTypes","_lootChance","_weights","_cntWeights","_index"];
|
||||
//_t1 = diag_tickTime;
|
||||
|
||||
_obj = _this select 0;
|
||||
|
||||
@@ -10,10 +11,12 @@ _config = configFile >> "CfgBuildingLoot" >> _type;
|
||||
_positions = [] + getArray (_config >> "lootPos");
|
||||
_itemTypes = [] + getArray (_config >> "itemType");
|
||||
_lootChance = getNumber (_config >> "lootChance");
|
||||
_positionsSmall = [] + getArray (_config >> "lootPosSmall");
|
||||
|
||||
{
|
||||
if ((random 1) < _lootChance) then {
|
||||
_iPos = _obj modelToWorld _x;
|
||||
_nearBy = nearestObjects [_iPos, ["WeaponHolder","WeaponHolderBase"], 1];
|
||||
_nearBy = nearestObjects [_iPos, ["ReammoBox","WeaponHolder","WeaponHolderBase"], 1];
|
||||
if (count _nearBy == 0) then {
|
||||
_index = dayz_CBLBase find _type;
|
||||
//diag_log format["Found %2 at index: %1", _index,_type];
|
||||
@@ -26,4 +29,23 @@ _lootChance = getNumber (_config >> "lootChance");
|
||||
_obj setVariable ["created",(DateToNumber date),true];
|
||||
};
|
||||
};
|
||||
} forEach _positions;
|
||||
} forEach _positions;
|
||||
|
||||
{
|
||||
if ((random 1) < _lootChance) then {
|
||||
_iPos = _obj modelToWorld _x;
|
||||
_nearBy = nearestObjects [_iPos, ["ReammoBox","WeaponHolder","WeaponHolderBase"], 1];
|
||||
if (count _nearBy == 0) then {
|
||||
_index = dayz_CBLBase find _type;
|
||||
//diag_log format["Found %2 at index: %1", _index,_type];
|
||||
_weights = dayz_CBLChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_itemType = _itemTypes select _index;
|
||||
[_itemType select 0, _itemType select 1 , _iPos, 0.0] call spawn_loot_small;
|
||||
_obj setVariable ["created",(DateToNumber date),true];
|
||||
};
|
||||
};
|
||||
} forEach _positionsSmall;
|
||||
//["building_spawnLoot.sqf",(diag_tickTime - _t1)] call fnc_dump;
|
||||
Reference in New Issue
Block a user