Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Litter distribution fix and "floating litter over water" fix (medical) #1164

Merged
merged 2 commits into from
May 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions addons/medical/functions/fnc_createLitter.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 4 additions & 1 deletion addons/medical/functions/fnc_handleCreateLitter.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ 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]] call EFUNC(common,execNextFrame);

_maxLitterCount = getArray (configFile >> "ACE_Settings" >> QGVAR(litterSimulationDetail) >> "_values") select GVAR(litterSimulationDetail);
if((count GVAR(allCreatedLitter)) > _maxLitterCount ) then {
// gank the first litter object, and spawn ours.
Expand Down