Skip to content

Commit

Permalink
Fixed an issue with fragments being created above water for explosion…
Browse files Browse the repository at this point in the history
…s below the surface
  • Loading branch information
lambdatiger committed May 19, 2024
1 parent e2dce5e commit b9aa3cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addons/frag/functions/fnc_doFragRandom.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ _maxFragCount = switch (true) do {
};

// Spawn the fragment spawner
private _fragSpawner = createVehicle [_type + _maxFragCount + _hMode, ASLToATL _posASL, [], 0, "CAN_COLLIDE"];
private _fragSpawner = createVehicle [_type + _maxFragCount + _hMode, ASLToAGL _posASL, [], 0, "CAN_COLLIDE"];
private _randDir = random 360;
_fragSpawner setVectorDirandUp [[0,0,-1], [cos _randDir, sin _randDir,0]];
_fragSpawner setVelocity (_projectileVelocity vectorAdd [0, 0, -0.5*_fragVelocity]);
Expand Down
5 changes: 3 additions & 2 deletions addons/frag/functions/fnc_doFragTargeted.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ if (_fragTypes isEqualTo []) then {
];
};

private _posAGL = ASLToAGL _posASL;
// Post 2.18 change - uncomment line 41, and remove lines 43, 50-55, 64-66
// private _targets = [ASLToAGL _posASL, _fragRange, _fragRange, 0, false, _fragRange] nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], false, true, true];
private _objects = (ASLToAGL _posASL) nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange];
private _objects = _posAGL nearEntities [["Car", "Motorcycle", "Tank", "StaticWeapon", "CAManBase", "Air", "Ship"], _fragRange];
if (_objects isEqualTo []) exitWith {
TRACE_2("No nearby targets",_posASL,_fragRange);
0
Expand Down Expand Up @@ -152,7 +153,7 @@ private _totalFragCount = 0;

// Create fragment
private _vectorDir = _posASL vectorFromTo _targetPos;
private _fragObj = createVehicle [_fragSpawner, ASLtoATL _posASL, [], 0, "CAN_COLLIDE"];
private _fragObj = createVehicle [_fragSpawner, _posAGL, [], 0, "CAN_COLLIDE"];
_fragObj setVectorDir _vectorDir;
_fragObj setVelocity (_vectorDir vectorMultiply _locFragVel);
_fragObj setShotParents _shotParents;
Expand Down

0 comments on commit b9aa3cb

Please sign in to comment.