mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 12:12:34 +03:00
This commit fixes partly the floating loot issue. The whole problem is not fixable. It is a problem with different components. The main point is that the position can be half water and half not. The second is the building collision and the collision of the loot object. Normally setPosATL should do its work but the object moves on the placement. Adding a special handling for buildings that are mostly over water did the best job so far. With fixWaterPos = 1; in the building class which has those floating loot problems, the position gets converted to ASL which is better over water but not always. Some loot objects are still floating a bit but I could reach all of them. It is a way better as before.
65 lines
2.1 KiB
Plaintext
65 lines
2.1 KiB
Plaintext
// Compiles
|
|
dz_fn_loot_select = compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\select.sqf";
|
|
dz_fn_loot_spawnGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\spawnGroup.sqf";
|
|
dz_fn_loot_insert = compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\insert.sqf";
|
|
dz_fn_loot_insertCargo = compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\insertCargo.sqf";
|
|
if (isServer) then {
|
|
dz_fn_loot_spawn = compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\spawn_server.sqf";
|
|
} else {
|
|
dz_fn_loot_spawn = compile preprocessFileLineNumbers "\z\addons\dayz_code\loot\spawn.sqf";
|
|
};
|
|
|
|
#include "\z\addons\dayz_code\Configs\CfgLoot\LootDefines.hpp"
|
|
|
|
private ["_cfgGroups","_cfg","_lootGroup","_weight","_weighted","_index","_count","_type"];
|
|
|
|
dz_loot_groups = [];
|
|
dz_loot_weighted = [];
|
|
dz_loot_definitions = [];
|
|
|
|
_cfgGroups = missionConfigFile >> "CfgLoot" >> "Groups";
|
|
|
|
for "_i" from 0 to (count _cfgGroups) - 1 do {
|
|
|
|
_cfg = _cfgGroups select _i;
|
|
dz_loot_groups set [_i, configName _cfg];
|
|
|
|
_lootGroup = getArray _cfg;
|
|
_weighted = [];
|
|
_count = 0;
|
|
|
|
{
|
|
// Round the weight just in case somebody doesn't use a whole number.
|
|
_weight = round(_x select 1);
|
|
|
|
//Remove weight from _x
|
|
for "_j" from 1 to (count _x) - 2 do { _x set [_j, _x select (_j + 1)]; };
|
|
_x resize ((count _x) - 1);
|
|
|
|
// Add resized group array to definitions array
|
|
_index = count dz_loot_definitions;
|
|
dz_loot_definitions set [_index, _x];
|
|
|
|
// Build weighted array for the group
|
|
for "_j" from _count to (_count + _weight - 1) do {
|
|
_weighted set [_j, _index];
|
|
};
|
|
|
|
_count = _count + _weight;
|
|
} count _lootGroup;
|
|
|
|
dz_loot_weighted set [_i, _weighted];
|
|
};
|
|
|
|
{
|
|
_type = _x select 0;
|
|
if !(_type in [0,2,3,5,6]) then { // skip types other than listed below
|
|
call {
|
|
if (_type == Loot_GROUP) exitwith { _x set [1, dz_loot_groups find (_x select 1)]; };
|
|
if (_type == Loot_PILE) exitwith { _x set [1, dz_loot_groups find (_x select 1)]; };
|
|
if (_type == Loot_CONTAINER) exitwith { _x set [2, dz_loot_groups find (_x select 2)]; };
|
|
if (_type == Loot_CUSTOM) exitwith { _x set [1, compile (_x select 1)]; };
|
|
};
|
|
};
|
|
} count dz_loot_definitions;
|