Merge pull request #3699 from acemod/cWireFixes

Concertina Wire - Don't recoil broken wire, fix killer
This commit is contained in:
PabstMirror 2016-04-22 10:40:04 -05:00
commit 7366133629
2 changed files with 6 additions and 2 deletions

View File

@ -86,7 +86,7 @@ class CfgVehicles {
selection = "";
displayName = "$STR_ACE_UNROLLWIRE";
distance = 5;
condition = "true";
condition = "alive _target";
statement = QUOTE([ARR_2(_target,_player)] call FUNC(dismount));
showDisabled = 0;
exceptions[] = {};

View File

@ -14,13 +14,17 @@
*/
#include "script_component.hpp"
params ["_wire", "_killer"];
TRACE_2("params",_wire,_killer);
private ["_distance", "_vehicle"];
if (isNull _killer) then {
_killer = _wire getVariable ["ace_concertina_wire_lastDamager", objNull];
if (isNull _killer) then {
_killer = nearestObject [_wire, "car"];
private _midPoint = ((_wire selectionPosition "start") vectorAdd (_wire selectionPosition "deploy")) vectorMultiply 0.5;
{
if ((vectorMagnitude velocity _x) > 0) exitWith {_killer = _x};
} forEach (nearestObjects [(_wire modelToWorld _midPoint), ["Car"], 8]);
};
};
if (isNull _killer || {_killer == _wire} || {_killer == gunner (vehicle _killer)}) exitWith {};