mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Partly fix floating loot
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.
This commit is contained in:
@@ -750,6 +750,7 @@ class Land_A_Crane_02b : Industrial
|
||||
{
|
||||
maxRoaming = 0;
|
||||
lootChance = 0.4;
|
||||
fixWaterPos = 1;
|
||||
lootPos[] =
|
||||
{
|
||||
{-3.4707,-0.149414,-6.06299},
|
||||
|
||||
@@ -66,6 +66,8 @@ class CfgLoot
|
||||
zombieChance = 0.2;
|
||||
minRoaming = 0;
|
||||
maxRoaming = 2;
|
||||
fixWaterPos = 0; // Add fixWaterPos = 1; to the building class that have floating loot if the building is over water.
|
||||
|
||||
zombieClass[] =
|
||||
{
|
||||
// "zZombie_Base",
|
||||
|
||||
@@ -16,7 +16,7 @@ Author:
|
||||
#include "\z\addons\dayz_code\util\Vector.hpp"
|
||||
#include "\z\addons\dayz_code\loot\Loot.hpp"
|
||||
|
||||
private ["_vectorUp","_type","_config","_lootChance","_lootPos","_lootGroup","_worldPos","_existingPile","_loot","_group","_smallGroup"];
|
||||
private ["_vectorUp","_obj","_config","_lootChance","_lootPos","_lootGroup","_worldPos","_group","_smallGroup","_type"];
|
||||
|
||||
_obj = _this select 0;
|
||||
_type = _this select 1;
|
||||
@@ -52,7 +52,7 @@ if (_group in ["Military","MilitaryIndustrial"]) then {
|
||||
} count (_worldPos nearObjects ["ReammoBox", 1]);
|
||||
|
||||
if (_lootChance > random 1 && {dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders}) then {
|
||||
Loot_SpawnGroup(_lootGroup, _worldPos);
|
||||
Loot_SpawnGroup(_lootGroup, _worldPos, _type);
|
||||
};
|
||||
}
|
||||
foreach _lootPos;
|
||||
@@ -83,7 +83,7 @@ if (isArray (_config >> "lootPosSmall")) then {
|
||||
} count (_worldPos nearObjects ["ReammoBox", 1]);
|
||||
|
||||
if (_lootChance > random 1 && {dayz_currentWeaponHolders < dayz_maxMaxWeaponHolders}) then {
|
||||
Loot_SpawnGroup(_lootGroup, _worldPos);
|
||||
Loot_SpawnGroup(_lootGroup, _worldPos, _type);
|
||||
};
|
||||
} foreach _lootPos;
|
||||
} else {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#define Loot_GetGroup(name) (dz_loot_groups find (name))
|
||||
#define Loot_Select(group, count) ([group, count] call dz_fn_loot_select)
|
||||
#define Loot_SelectSingle(group) (Loot_Select(group, 1) select 0)
|
||||
#define Loot_Spawn(def, loc) ([def, loc] call dz_fn_loot_spawn)
|
||||
#define Loot_SpawnGroup(group, loc) ([group, loc] call dz_fn_loot_spawnGroup)
|
||||
#define Loot_Spawn(def, loc, class) ([def, loc, class] call dz_fn_loot_spawn)
|
||||
#define Loot_SpawnGroup(group, loc, class) ([group, loc, class] call dz_fn_loot_spawnGroup)
|
||||
#define Loot_Insert(unit, group, count) ([unit, group, count] call dz_fn_loot_insert)
|
||||
#define Loot_InsertCargo(object, group, count) ([object, group, count] call dz_fn_loot_insertCargo)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ if (isServer) then {
|
||||
|
||||
#include "\z\addons\dayz_code\Configs\CfgLoot\LootDefines.hpp"
|
||||
|
||||
private ["_cfgGroups","_cfg","_lootGroup","_weight","_weighted","_index","_count"];
|
||||
private ["_cfgGroups","_cfg","_lootGroup","_weight","_weighted","_index","_count","_type"];
|
||||
|
||||
dz_loot_groups = [];
|
||||
dz_loot_weighted = [];
|
||||
@@ -52,12 +52,13 @@ for "_i" from 0 to (count _cfgGroups) - 1 do {
|
||||
};
|
||||
|
||||
{
|
||||
if !((_x select 0) in [0,2,3,5,6]) then { // skip types other than listed below
|
||||
switch (_x select 0) do {
|
||||
case Loot_GROUP: { _x set [1, dz_loot_groups find (_x select 1)]; };
|
||||
case Loot_PILE: { _x set [1, dz_loot_groups find (_x select 1)]; };
|
||||
case Loot_CONTAINER: { _x set [2, dz_loot_groups find (_x select 2)]; };
|
||||
case Loot_CUSTOM: { _x set [1, compile (_x select 1)]; };
|
||||
_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;
|
||||
|
||||
@@ -23,10 +23,11 @@ Author:
|
||||
#define INCREMENT_WEAPON_HOLDERS dayz_currentWeaponHolders = dayz_currentWeaponHolders + 1;
|
||||
#endif
|
||||
|
||||
private ["_item","_isWater","_type","_lootInfo","_vehicle","_spawnCount","_magazines"];
|
||||
private ["_item","_isWater","_type","_lootInfo","_vehicle","_spawnCount","_magazines","_fixWaterSpawn"];
|
||||
|
||||
_lootInfo = _this select 0;
|
||||
_pos = _this select 1;
|
||||
_class = ["",_this select 2] select (count _this > 2);
|
||||
_type = _lootInfo select 0;
|
||||
_item = _lootInfo select 1;
|
||||
_isWater = surfaceIsWater _pos;
|
||||
@@ -46,7 +47,12 @@ call {
|
||||
_vehicle addMagazineCargoGlobal [_item, 1];
|
||||
|
||||
if (_isWater) then {
|
||||
_vehicle setPos (_pos);
|
||||
_fixWaterSpawn = getNumber(missionconfigFile >> "CfgLoot" >> "Buildings" >> _class >> "fixWaterPos");
|
||||
if (_fixWaterSpawn == 1) then {
|
||||
_vehicle setPosASL (_pos);
|
||||
} else {
|
||||
_vehicle setPos (_pos);
|
||||
};
|
||||
} else {
|
||||
_vehicle setPosATL (_pos);
|
||||
};
|
||||
@@ -60,7 +66,12 @@ call {
|
||||
_vehicle addWeaponCargoGlobal [_item, 1];
|
||||
|
||||
if (_isWater) then {
|
||||
_vehicle setPos (_pos);
|
||||
_fixWaterSpawn = getNumber(missionconfigFile >> "CfgLoot" >> "Buildings" >> _class >> "fixWaterPos");
|
||||
if (_fixWaterSpawn == 1) then {
|
||||
_vehicle setPosASL (_pos);
|
||||
} else {
|
||||
_vehicle setPos (_pos);
|
||||
};
|
||||
} else {
|
||||
_vehicle setPosATL (_pos);
|
||||
};
|
||||
@@ -83,7 +94,12 @@ call {
|
||||
_pos set [2, ((_pos select 2) - .15)];
|
||||
|
||||
if (_isWater) then {
|
||||
_vehicle setPos (_pos);
|
||||
_fixWaterSpawn = getNumber(missionconfigFile >> "CfgLoot" >> "Buildings" >> _class >> "fixWaterPos");
|
||||
if (_fixWaterSpawn == 1) then {
|
||||
_vehicle setPosASL (_pos);
|
||||
} else {
|
||||
_vehicle setPos (_pos);
|
||||
};
|
||||
} else {
|
||||
_vehicle setPosATL (_pos);
|
||||
};
|
||||
@@ -96,10 +112,16 @@ call {
|
||||
Loot_InsertCargo(_vehicle, _item, _spawnCount);
|
||||
|
||||
if (_isWater) then {
|
||||
_vehicle setPos (_pos);
|
||||
_fixWaterSpawn = getNumber(missionconfigFile >> "CfgLoot" >> "Buildings" >> _class >> "fixWaterPos");
|
||||
if (_fixWaterSpawn == 1) then {
|
||||
_vehicle setPosASL (_pos);
|
||||
} else {
|
||||
_vehicle setPos (_pos);
|
||||
};
|
||||
} else {
|
||||
_vehicle setPosATL (_pos);
|
||||
};
|
||||
|
||||
INCREMENT_WEAPON_HOLDERS
|
||||
};
|
||||
|
||||
@@ -109,7 +131,12 @@ call {
|
||||
_vehicle setDir random 360;
|
||||
|
||||
if (_isWater) then {
|
||||
_vehicle setPos (_pos);
|
||||
_fixWaterSpawn = getNumber(missionconfigFile >> "CfgLoot" >> "Buildings" >> _class >> "fixWaterPos");
|
||||
if (_fixWaterSpawn == 1) then {
|
||||
_vehicle setPosASL (_pos);
|
||||
} else {
|
||||
_vehicle setPos (_pos);
|
||||
};
|
||||
} else {
|
||||
_vehicle setPosATL (_pos);
|
||||
};
|
||||
@@ -125,10 +152,16 @@ call {
|
||||
_vehicle setDir random 360;
|
||||
|
||||
if (_isWater) then {
|
||||
_vehicle setPos (_pos);
|
||||
_fixWaterSpawn = getNumber(missionconfigFile >> "CfgLoot" >> "Buildings" >> _class >> "fixWaterPos");
|
||||
if (_fixWaterSpawn == 1) then {
|
||||
_vehicle setPosASL (_pos);
|
||||
} else {
|
||||
_vehicle setPos (_pos);
|
||||
};
|
||||
} else {
|
||||
_vehicle setPosATL (_pos);
|
||||
};
|
||||
|
||||
INCREMENT_WEAPON_HOLDERS
|
||||
};
|
||||
|
||||
@@ -139,7 +172,12 @@ call {
|
||||
|
||||
if (!isNull _vehicle) then {
|
||||
if (_isWater) then {
|
||||
_vehicle setPos (_pos);
|
||||
_fixWaterSpawn = getNumber(missionconfigFile >> "CfgLoot" >> "Buildings" >> _class >> "fixWaterPos");
|
||||
if (_fixWaterSpawn == 1) then {
|
||||
_vehicle setPosASL (_pos);
|
||||
} else {
|
||||
_vehicle setPos (_pos);
|
||||
};
|
||||
} else {
|
||||
_vehicle setPosATL (_pos);
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ Spawns randomly selected loot from given group.
|
||||
Parameters:
|
||||
integer Loot group index in dayz_lootGroups
|
||||
vector Spawn position relative to world
|
||||
class Classname of the object
|
||||
|
||||
Return value:
|
||||
object Spawned vehicle.
|
||||
@@ -14,5 +15,5 @@ Author:
|
||||
|
||||
#include "Loot.hpp"
|
||||
|
||||
Loot_Spawn(Loot_Select(_this select 0, 1) select 0, _this select 1);
|
||||
//[([_this select 0, 1] call loot_select) select 0, _this select 1] call loot_spawn
|
||||
Loot_Spawn(Loot_Select(_this select 0, 1) select 0, _this select 1, _this select 2);
|
||||
//[([_this select 0, 1] call loot_select) select 0, _this select 1, _this select 2] call loot_spawn
|
||||
Reference in New Issue
Block a user