Fixed: Litter spawning at huge radius, floating litter over water. Fixes #1112

This commit is contained in:
jaynus 2015-05-13 17:29:09 -07:00
parent 72715dd34d
commit b13d44fb6b
2 changed files with 13 additions and 4 deletions

View File

@ -38,12 +38,18 @@ _litter = getArray (_config >> "litter");
_createLitter = {
private["_position", "_litterClass", "_direction"];
_position = getPos (_this select 0);
// @TODO: handle carriers over water
// For now, don't spawn litter if we are over water to avoid floating litter
if(surfaceIsWater (getPos (_this select 0))) exitWith { false };
_position = getPosATL (_this select 0);
_position = [_position select 0, _position select 1, 0];
_litterClass = _this select 1;
if (random(1) >= 0.5) then {
_position = [(_position select 0) + random 2, (_position select 1) + random 2, _position select 2];
_position = [(_position select 0) + random 1, (_position select 1) + random 1, _position select 2];
} else {
_position = [(_position select 0) - random 2, (_position select 1) - random 2, _position select 2];
_position = [(_position select 0) - random 1, (_position select 1) - random 1, _position select 2];
};
_direction = (random 360);

View File

@ -14,6 +14,9 @@ if (isNil QGVAR(allCreatedLitter)) then {
_litterObject = _litterClass createVehicleLocal _position;
_litterObject setDir _direction;
_litterObject setPosATL _position;
// Move the litter next frame to get rid of HORRIBLE spacing, fixes #1112
[{ (_this select 0) setPosATL (_this select 1); }, [_litterObject, _position], 0, 0] call EFUNC(common,waitAndExecute);
_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail);
if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then {