mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Code Cleanup Grenades, fix dedicated server AI thrown flasbangs do nothing
This commit is contained in:
parent
f77242fce3
commit
6cc920dc34
@ -1,3 +1,4 @@
|
||||
|
||||
class CfgAmmo {
|
||||
class FlareCore;
|
||||
class FlareBase: FlareCore {
|
||||
|
@ -1,19 +1,20 @@
|
||||
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) );
|
||||
firedBIS = QUOTE(_this call FUNC(throwGrenade));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,9 +1,6 @@
|
||||
|
||||
class CfgVehicles {
|
||||
class NATO_Box_Base;
|
||||
class EAST_Box_Base;
|
||||
class IND_Box_Base;
|
||||
class Box_NATO_Support_F;
|
||||
|
||||
class Box_NATO_Grenades_F: NATO_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_HandFlare_White,12);
|
||||
@ -12,6 +9,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class EAST_Box_Base;
|
||||
class Box_East_Grenades_F: EAST_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_HandFlare_Yellow,12);
|
||||
@ -20,6 +18,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class IND_Box_Base;
|
||||
class Box_IND_Grenades_F: IND_Box_Base {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_HandFlare_Yellow,12);
|
||||
@ -28,6 +27,7 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
|
||||
class Box_NATO_Support_F;
|
||||
class ACE_Box_Misc: Box_NATO_Support_F {
|
||||
class TransportItems {
|
||||
MACRO_ADDITEM(ACE_HandFlare_White,12);
|
||||
|
@ -1,21 +1,26 @@
|
||||
|
||||
class CfgWeapons {
|
||||
class GrenadeLauncher;
|
||||
|
||||
class Throw: GrenadeLauncher {
|
||||
muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"};
|
||||
muzzles[] += {"ACE_HandFlare_WhiteMuzzle","ACE_HandFlare_RedMuzzle","ACE_HandFlare_GreenMuzzle","ACE_HandFlare_YellowMuzzle","ACE_M84Muzzle"};
|
||||
|
||||
class ThrowMuzzle;
|
||||
class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_HandFlare_White"};
|
||||
};
|
||||
|
||||
class ACE_HandFlare_RedMuzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_HandFlare_Red"};
|
||||
};
|
||||
|
||||
class ACE_HandFlare_GreenMuzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_HandFlare_Green"};
|
||||
};
|
||||
|
||||
class ACE_HandFlare_YellowMuzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_HandFlare_Yellow"};
|
||||
};
|
||||
|
||||
class ACE_M84Muzzle: ThrowMuzzle {
|
||||
magazines[] = {"ACE_M84"};
|
||||
};
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
["flashbangExplosion", DFUNC(flashbangExplosionEH)] call EFUNC(common,addEventHandler);
|
||||
["flashbangExplosion", {_this call FUNC(flashbangExplosionEH)}] call EFUNC(common,addEventHandler);
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
@ -21,4 +21,4 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
|
||||
[] call FUNC(nextMode);
|
||||
},
|
||||
{false},
|
||||
[9, [false, false, false]], false] call cba_fnc_addKeybind; //8 Key
|
||||
[9, [false, false, false]], false] call CBA_fnc_addKeybind; //8 Key
|
||||
|
@ -15,13 +15,14 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_affected", "_strength", "_posGrenade", "_angleDiff", "_light", "_losCount", "_dirToUnitVector", "_eyeDir", "_eyePos"];
|
||||
params ["_grenade"];
|
||||
|
||||
private ["_affected", "_strength", "_posGrenade", "_eyePos", "_losCount", "_eyeDir", "_dirToUnitVector", "_angleDiff", "_light"];
|
||||
|
||||
_affected = _grenade nearEntities ["CAManBase", 20];
|
||||
|
||||
{
|
||||
if ((local _x) && {alive _x}) then {
|
||||
if (local _x && {alive _x}) then {
|
||||
|
||||
_strength = 1 - ((_x distance _grenade) min 15) / 15;
|
||||
|
||||
@ -30,14 +31,17 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
if (_x != ACE_player) then {
|
||||
//must be AI
|
||||
[_x, true] call EFUNC(common,disableAI);
|
||||
_x setSkill ((skill _x) / 50);
|
||||
|
||||
_x setSkill (skill _x / 50);
|
||||
|
||||
[{
|
||||
params ["_unit"];
|
||||
|
||||
//Make sure we don't enable AI for unconscious units
|
||||
if (!(_unit getVariable ["ace_isunconscious", false])) then {
|
||||
if (!(_unit getVariable ["ace_isUnconscious", false])) then {
|
||||
[_unit, false] call EFUNC(common,disableAI);
|
||||
};
|
||||
|
||||
_unit setSkill (skill _unit * 50);
|
||||
}, [_x], (7 * _strength)] call EFUNC(common,waitAndExecute);
|
||||
} else {
|
||||
@ -49,7 +53,7 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
|
||||
//Check for line of sight (check 4 points in case grenade is stuck in an object or underground)
|
||||
_losCount = {
|
||||
(!lineIntersects [(_posGrenade vectorAdd _x), _eyePos, _grenade, ACE_player])
|
||||
!lineIntersects [_posGrenade vectorAdd _x, _eyePos, _grenade, ACE_player]
|
||||
} count [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]];
|
||||
|
||||
TRACE_1("Line of sight count (out of 4)",_losCount);
|
||||
@ -57,9 +61,9 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
_strength = _strength / 10;
|
||||
};
|
||||
|
||||
//Add ace_hearing ear ringing sound effect
|
||||
if ((isClass (configFile >> "CfgPatches" >> "ACE_Hearing")) && {_strength > 0}) then {
|
||||
[_x, (20 * _strength)] call EFUNC(hearing,earRinging);
|
||||
// add ace_hearing ear ringing sound effect
|
||||
if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") && {_strength > 0}) then {
|
||||
[_x, 20 * _strength] call EFUNC(hearing,earRinging);
|
||||
};
|
||||
|
||||
// account for people looking away by slightly
|
||||
@ -68,16 +72,16 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
_dirToUnitVector = _eyePos vectorFromTo _posGrenade;
|
||||
_angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector);
|
||||
|
||||
//From 0-45deg, full effect
|
||||
// from 0-45deg, full effect
|
||||
if (_angleDiff > 45) then {
|
||||
_strength = _strength - _strength * ((_angleDiff - 45) / 120);
|
||||
};
|
||||
|
||||
TRACE_1("Final strength for player",_strength);
|
||||
|
||||
//Add ace_medical pain effect:
|
||||
if ((isClass (configFile >> "CfgPatches" >> "ACE_Medical")) && {_strength > 0.1}) then {
|
||||
[ACE_player, (_strength / 2)] call EFUNC(medical,adjustPainLevel);
|
||||
// add ace_medical pain effect:
|
||||
if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {_strength > 0.1}) then {
|
||||
[ACE_player, _strength / 2] call EFUNC(medical,adjustPainLevel);
|
||||
};
|
||||
|
||||
// create flash to illuminate environment
|
||||
@ -87,14 +91,14 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
_light setLightColor [1,1,1];
|
||||
_light setLightDayLight true;
|
||||
|
||||
//Delete the light after 0.1 seconds
|
||||
// delete the light after 0.1 seconds
|
||||
[{
|
||||
params ["_light"];
|
||||
deleteVehicle _light;
|
||||
}, [_light], 0.1] call EFUNC(common,waitAndExecute);
|
||||
|
||||
// blind player
|
||||
if (_strength > 0.1 && hasInterface) then {
|
||||
if (hasInterface && {_strength > 0.1}) then {
|
||||
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) ppEffectCommit 0.01;
|
||||
@ -102,14 +106,15 @@ _affected = _grenade nearEntities ["CAManBase", 20];
|
||||
//PARTIALRECOVERY - start decreasing effect over ACE_time
|
||||
[{
|
||||
params ["_strength"];
|
||||
|
||||
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
||||
GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength);
|
||||
}, [_strength], (7 * _strength), 0] call EFUNC(common,waitAndExecute);
|
||||
}, [_strength], 7 * _strength] call EFUNC(common,waitAndExecute);
|
||||
|
||||
//FULLRECOVERY - end effect
|
||||
[{
|
||||
GVAR(flashbangPPEffectCC) ppEffectEnable false;
|
||||
}, [], (17 * _strength)] call EFUNC(common,waitAndExecute);
|
||||
}, [], 17 * _strength] call EFUNC(common,waitAndExecute);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -14,6 +14,7 @@
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_projectile"];
|
||||
|
||||
if (alive _projectile) then {
|
||||
@ -21,5 +22,6 @@ if (alive _projectile) then {
|
||||
|
||||
private "_affected";
|
||||
_affected = _projectile nearEntities ["CAManBase", 50];
|
||||
|
||||
["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user