12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- if (!isServer) exitWith {};
- params ["_impactEmitter","_maxKillRange", "_maxDamageRange"];
- private _ace_enabled = isClass(configFile >> "CfgPatches" >> "ace_main");
- _nearObjects = nearestObjects[_impactEmitter, ["Building", "House", "Man", "LandVehicle", "Air"], _maxDamageRange];
- {
- private _distance = _impactEmitter distance _x;
- private _dirFromTo = (getPosATL _impactEmitter) vectorFromTo (getPosATL _x);
-
- _effectCoef = if (_distance < _maxKillRange) then {1} else {
- private _coef = (_distance - _maxKillRange)/(_maxDamageRange - _maxKillRange);
- (1 - _coef)
- };
-
- private _throwSpeedKill = [30*_dirFromTo#0, 30*_dirFromTo#1, 5] vectorMultiply _effectCoef;
- private _throwSpeedDamage = [15*_dirFromTo#0, 15*_dirFromTo#1, 5] vectorMultiply _effectCoef;
- if (_distance <= _maxKillRange) then {
- if (!(_x isKindOf "Static")) then {[_x, _throwSpeedKill] remoteExec ["setVelocity", _x, false];};
- [_x, _impactEmitter] spawn {sleep 0.001; if (_this#0 != _this#1) then {_this#0 setDamage 1};};
- } else {
- if (_distance <= _maxDamageRange) then {
- if (!(_x isKindOf "Static")) then {[_x, _throwSpeedDamage] remoteExec ["setVelocity", _x, false];};
-
- private _damageToAdd = 0.5*(_effectCoef^2);
- if (!(_x isKindOf "Man")) then {
- _x setDamage ((damage _x) + _damageToAdd);
- } else {
- if (_ace_enabled) then {
- _damageRegions = ["body", "hand_l", "hand_r", "leg_l", "leg_r"];
- _damagePoint = selectRandom _damageRegions;
- [_x, _damageToAdd*2, _damagePoint, "explosive"] remoteExec ["ace_medical_fnc_addDamageToUnit", _x, false];
- } else {
- _x setDamage ((damage _x) + _damageToAdd);
- };
- if (_effectCoef >= 0.1) then {
- _x spawn {sleep 0.001; [_this] remoteExec ["tts_beam_fnc_ragdollUnit", _this, false];};
- };
- };
- };
- };
- sleep 0.0005;
- } foreach _nearObjects;
|