emulate frag grenade ai behaviour for incendiaries (#4534)

This commit is contained in:
commy2 2016-10-11 19:04:08 +02:00 committed by Glowbal
parent b8cc10fecb
commit 8822cb1b90
2 changed files with 21 additions and 2 deletions

View File

@ -16,6 +16,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
#define ALERT_NEAR_ENEMY_RANGE 60
#define PARTICLE_LIFE_TIME 2 #define PARTICLE_LIFE_TIME 2
#define PARTICLE_DENSITY 20 #define PARTICLE_DENSITY 20
#define PARTICLE_SIZE 1 #define PARTICLE_SIZE 1
@ -32,12 +34,29 @@
#define ORIENTATION 5.4 #define ORIENTATION 5.4
#define EXPANSION 1 #define EXPANSION 1
params ["_projectile", "_timeToLive"]; params ["_projectile", "_timeToLive", "_center"];
if (isNull _projectile) exitWith {TRACE_1("null",_projectile);}; if (isNull _projectile) exitWith {TRACE_1("null",_projectile);};
private _position = position _projectile; private _position = position _projectile;
// --- AI
private _nearLocalEnemies = [];
{
{
if (local _x && {[_center, side _x] call BIS_fnc_sideIsEnemy}) then { // WE WANT THE OBJECTS SIDE HERE!
_nearLocalEnemies pushBackUnique _x;
};
} forEach crew _x;
} forEach (_position nearObjects ALERT_NEAR_ENEMY_RANGE);
{
if (behaviour _x in ["SAFE", "AWARE"]) then {
_x setBehaviour "COMBAT";
};
} forEach _nearLocalEnemies;
// --- fire // --- fire
private _fire = "#particlesource" createVehicleLocal _position; private _fire = "#particlesource" createVehicleLocal _position;

View File

@ -56,7 +56,7 @@ if (getNumber (_config >> QGVAR(incendiary)) == 1) then {
private _fuzeTime = getNumber (_config >> "explosionTime"); private _fuzeTime = getNumber (_config >> "explosionTime");
private _timeToLive = getNumber (_config >> "timeToLive"); private _timeToLive = getNumber (_config >> "timeToLive");
[FUNC(incendiary), [_projectile, _timeToLive], _fuzeTime] call CBA_fnc_waitAndExecute; [FUNC(incendiary), [_projectile, _timeToLive, side _unit], _fuzeTime] call CBA_fnc_waitAndExecute; // WE WANT THE OBJECTS SIDE HERE!
}; };
// handle throw modes // handle throw modes