mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Convert Spawned/Sleep
This commit is contained in:
parent
cedb05f8d9
commit
1d083aa072
@ -5,21 +5,9 @@
|
|||||||
GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265];
|
GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265];
|
||||||
GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
|
GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
|
||||||
|
|
||||||
// class ACE_Core_Default_Keys {
|
|
||||||
// class switchGrenadeMode {
|
|
||||||
// displayName = "$STR_ACE_Grenades_SwitchGrenadeMode";
|
|
||||||
// condition = "[_player] call ACE_Core_fnc_canUseWeapon";
|
|
||||||
// statement = "call ACE_Grenades_fnc_nextMode";
|
|
||||||
// key = 9;//34;
|
|
||||||
// shift = 0;
|
|
||||||
// control = 0;
|
|
||||||
// alt = 0;//1;
|
|
||||||
// };
|
|
||||||
// };
|
|
||||||
|
|
||||||
["ACE3",
|
["ACE3",
|
||||||
localize "STR_ACE_Grenades_SwitchGrenadeMode",
|
localize "STR_ACE_Grenades_SwitchGrenadeMode",
|
||||||
{_this call FUNC(nextMode)},
|
{_this call FUNC(nextMode)},
|
||||||
[17, [false, false, false]], //8 key
|
[9, [false, false, false]], //8 key
|
||||||
false,
|
false,
|
||||||
"keydown"] call cba_fnc_registerKeybind;
|
"keydown"] call cba_fnc_registerKeybind;
|
@ -1,6 +1,6 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PREP(flashbangEffect);
|
PREP(flashbangEffectStages);
|
||||||
PREP(flashbangExplosionEH);
|
PREP(flashbangExplosionEH);
|
||||||
PREP(flashbangThrownFuze);
|
PREP(flashbangThrownFuze);
|
||||||
PREP(nextMode);
|
PREP(nextMode);
|
||||||
|
@ -1,14 +1,57 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi, Pabst Mirror
|
||||||
*
|
*
|
||||||
* Creates the flashbang effect locally/knocks out AI units.
|
* Handles the different stages of the flash bang effect recovery
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The unit (Object)
|
* ARRAY[
|
||||||
* 1: The grenade (Object)
|
* 0-ARRAY - PARAMS:
|
||||||
*
|
* 0: NUMBER - Stage, controls a case statement
|
||||||
* Return Value:
|
* 1: NUMBER - Time To Wait Until
|
||||||
* None
|
* 2: VARIES - Stage's Variable
|
||||||
*/
|
* 1-NUMBER perFrame handle
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_stage", "_waitUntilTime"];
|
||||||
|
|
||||||
|
_stage = (_this select 0) select 0;
|
||||||
|
_waitUntilTime = (_this select 0) select 1;
|
||||||
|
|
||||||
|
if (_waitUntilTime > time) exitWith {};
|
||||||
|
|
||||||
|
//remove frameEH
|
||||||
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
|
|
||||||
|
switch (_stage) do {
|
||||||
|
case(EFFECT_STAGE_RESETAI): {
|
||||||
|
private "_unit";
|
||||||
|
_unit = (_this select 0) select 2;
|
||||||
|
_unit enableAI "MOVE";
|
||||||
|
_unit enableAI "ANIM";
|
||||||
|
_unit enableAI "AUTOTARGET";
|
||||||
|
_unit enableAI "TARGET";
|
||||||
|
_unit enableAI "FSM";
|
||||||
|
_unit setSkill (skill _unit * 50);
|
||||||
|
};
|
||||||
|
case(EFFECT_STAGE_DELETELIGHT): {
|
||||||
|
private "_light";
|
||||||
|
_light = (_this select 0) select 2;
|
||||||
|
deleteVehicle _light;
|
||||||
|
};
|
||||||
|
case(EFFECT_STAGE_PARTIALRECOVERY): {
|
||||||
|
private "_strength";
|
||||||
|
_strength = (_this select 0) select 2;
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength);
|
||||||
|
};
|
||||||
|
case(EFFECT_STAGE_FULLRECOVERY): {
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectEnable false;
|
||||||
|
};
|
||||||
|
default {
|
||||||
|
TRACE_1("EffectStage Bad Stage", _stage);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
#include "script_component.hpp"
|
/*
|
||||||
|
* Author: KoffeinFlummi
|
||||||
|
*
|
||||||
|
* Creates the flashbang effect locally/knocks out AI units.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The unit (Object)
|
||||||
|
* 1: The grenade (Object)
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*/
|
||||||
|
|
||||||
#define EFFECT_STAGE_RESETAI 0
|
#include "script_component.hpp"
|
||||||
#define EFFECT_STAGE_DELETELIGHT 1
|
|
||||||
|
|
||||||
_unit = _this select 0;
|
_unit = _this select 0;
|
||||||
_grenade = _this select 1;
|
_grenade = _this select 1;
|
||||||
@ -13,34 +23,27 @@ if (damage _unit >= 1) exitWith {};
|
|||||||
_strength = 1 - ((_unit distance _grenade) min 15) / 15;
|
_strength = 1 - ((_unit distance _grenade) min 15) / 15;
|
||||||
|
|
||||||
if (_unit != ACE_player) exitWith {
|
if (_unit != ACE_player) exitWith {
|
||||||
//must be AI
|
//must be AI
|
||||||
_unit disableAI "MOVE";
|
_unit disableAI "MOVE";
|
||||||
_unit disableAI "ANIM";
|
_unit disableAI "ANIM";
|
||||||
_unit disableAI "AUTOTARGET";
|
_unit disableAI "AUTOTARGET";
|
||||||
_unit disableAI "TARGET";
|
_unit disableAI "TARGET";
|
||||||
_unit disableAI "FSM";
|
_unit disableAI "FSM";
|
||||||
_unit setSkill (skill _unit / 50);
|
_unit setSkill (skill _unit / 50);
|
||||||
|
|
||||||
sleep (7 * _strength);
|
[FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_RESETAI, (time + (7 * _strength)), _unit]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
_unit enableAI "MOVE";
|
|
||||||
_unit enableAI "ANIM";
|
|
||||||
_unit enableAI "AUTOTARGET";
|
|
||||||
_unit enableAI "TARGET";
|
|
||||||
_unit enableAI "FSM";
|
|
||||||
_unit setSkill (skill _unit * 50);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// is there line of sight to the grenade?
|
// is there line of sight to the grenade?
|
||||||
_posGrenade = getPosASL _grenade;
|
_posGrenade = getPosASL _grenade;
|
||||||
_posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground
|
_posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground
|
||||||
if (lineIntersects [_posGrenade, getPosASL _unit, _grenade, _unit]) then {
|
if (lineIntersects [_posGrenade, getPosASL _unit, _grenade, _unit]) then {
|
||||||
_strength = _strength / 10;
|
_strength = _strength / 10;
|
||||||
};
|
};
|
||||||
|
|
||||||
// beeeeeeeeeeeeeeeeeeeeeeeeeeeeep
|
// beeeeeeeeeeeeeeeeeeeeeeeeeeeeep
|
||||||
if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then {
|
if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then {
|
||||||
[_unit, 0.5 + (_strength / 2)] call EFUNC(hearing,earRinging);
|
[_unit, 0.5 + (_strength / 2)] call EFUNC(hearing,earRinging);
|
||||||
};
|
};
|
||||||
|
|
||||||
// account for people looking away by slightly
|
// account for people looking away by slightly
|
||||||
@ -65,25 +68,15 @@ _light setLightAmbient [1,1,1];
|
|||||||
_light setLightColor [1,1,1];
|
_light setLightColor [1,1,1];
|
||||||
_light setLightDayLight true;
|
_light setLightDayLight true;
|
||||||
|
|
||||||
|
[FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_DELETELIGHT, (time + (0.1)), _light]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
|
|
||||||
// blind player
|
// blind player
|
||||||
if (_strength > 0.1) then {
|
if (_strength > 0.1) then {
|
||||||
GVAR(flashbangPPEffectCC) ppEffectEnable true;
|
GVAR(flashbangPPEffectCC) ppEffectEnable true;
|
||||||
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
||||||
GVAR(flashbangPPEffectCC) ppEffectCommit 0.01;
|
GVAR(flashbangPPEffectCC) ppEffectCommit 0.01;
|
||||||
};
|
|
||||||
|
[FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_PARTIALRECOVERY, (time + (7 * _strength)), _strength]] call CBA_fnc_addPerFrameHandler;
|
||||||
[] spawn {
|
[FUNC(flashbangEffectStages), 0, [ EFFECT_STAGE_FULLRECOVERY, (time + (17 * _strength))]] call CBA_fnc_addPerFrameHandler;
|
||||||
sleep 0.1;
|
|
||||||
deleteVehicle _light;
|
|
||||||
};
|
|
||||||
|
|
||||||
sleep (7 * _strength);
|
|
||||||
|
|
||||||
if (_strength > 0.1) then {
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength);
|
|
||||||
|
|
||||||
sleep (10 * _strength);
|
|
||||||
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectEnable false;
|
|
||||||
};
|
};
|
||||||
|
@ -15,7 +15,6 @@ if (alive _projectile) then {
|
|||||||
|
|
||||||
_affected = _projectile nearEntities ["CAManBase", 50];
|
_affected = _projectile nearEntities ["CAManBase", 50];
|
||||||
{
|
{
|
||||||
// [[_x, _projectile], "ACE_Grenades_fnc_flashbangEffect", _x] call ACE_Core_fnc_execRemoteFnc;
|
|
||||||
[QGVAR(flashbangExplosionEvent), [_x, _projectile]] call EFUNC(common,globalEvent);
|
[QGVAR(flashbangExplosionEvent), [_x, _projectile]] call EFUNC(common,globalEvent);
|
||||||
} forEach _affected;
|
} forEach _affected;
|
||||||
};
|
};
|
@ -41,3 +41,4 @@ _hint = [
|
|||||||
|
|
||||||
GVAR(currentThrowMode) = _mode;
|
GVAR(currentThrowMode) = _mode;
|
||||||
|
|
||||||
|
true
|
||||||
|
@ -12,3 +12,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "\z\ace\addons\main\script_macros.hpp"
|
#include "\z\ace\addons\main\script_macros.hpp"
|
||||||
|
|
||||||
|
#define EFFECT_STAGE_RESETAI 0
|
||||||
|
#define EFFECT_STAGE_DELETELIGHT 1
|
||||||
|
#define EFFECT_STAGE_PARTIALRECOVERY 2
|
||||||
|
#define EFFECT_STAGE_FULLRECOVERY 3
|
||||||
|
Loading…
Reference in New Issue
Block a user