Merge branch 'master' into medical-focus-feature

This commit is contained in:
Glowbal 2016-02-13 19:51:45 +01:00
commit ff86359247
56 changed files with 432 additions and 556 deletions

View File

@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
firedBIS = QUOTE(_this call FUNC(handleFired));
};
};
};

View File

@ -22,3 +22,17 @@ if (!GVAR(extensionAvailable)) exitWith {
};
*/
[] call FUNC(initializeTerrainExtension);
if (!hasInterface) exitWith {};
["SettingsInitialized", {
//If not enabled, dont't add PFEH
if (!GVAR(enabled)) exitWith {};
// Register fire event handler
["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler);
["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler);
[] call FUNC(updateTrajectoryPFH);
}] call EFUNC(common,addEventHandler);

View File

@ -1,16 +1,10 @@
/*
* Author: Glowbal, Ruthberg
*
* Handles advanced ballistics for (BulletBase) projectiles
* Handles advanced ballistics for (BulletBase) projectiles. Called from the unified fired EH only for players.
*
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* None
@ -19,20 +13,16 @@
*/
#include "script_component.hpp"
// Early Quiting
if (!hasInterface) exitWith {};
if (!GVAR(enabled)) exitWith {};
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
// Parameterization
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletLength", "_barrelTwist", "_stabilityFactor", "_aceTimeSecond", "_barrelVelocityShift", "_ammoTemperatureVelocityShift"];
params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"];
_abort = false;
if (!(_ammo isKindOf "BulletBase")) exitWith {};
if (!alive _bullet) exitWith {};
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
if (!alive _projectile) exitWith {};
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {};
if (underwater _unit) exitWith {};
if (!GVAR(simulateForEveryone) && !(local _unit)) then {
@ -54,7 +44,7 @@ if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _wea
if (_abort || !(GVAR(extensionAvailable))) exitWith {
if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then {
EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];
EGVAR(windDeflection,trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];
};
};
@ -72,7 +62,7 @@ _AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMas
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
_bulletVelocity = velocity _bullet;
_bulletVelocity = velocity _projectile;
_muzzleVelocity = vectorMagnitude _bulletVelocity;
_barrelVelocityShift = 0;
@ -92,7 +82,7 @@ if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
if (_muzzleVelocityShift != 0) then {
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
_bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift));
_bullet setVelocity _bulletVelocity;
_projectile setVelocity _bulletVelocity;
};
};
@ -114,16 +104,16 @@ if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) th
if (isNil "_temperature") then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
};
_barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure);
_barometricPressure = ((getPosASL _projectile) select 2) call EFUNC(weather,calculateBarometricPressure);
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
};
GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
_aceTimeSecond = floor ACE_time;
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond];
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond];
GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];
GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];
if (isNil QGVAR(BulletPFH)) then {
GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler;

View File

@ -59,3 +59,8 @@ class Extended_Local_EventHandlers {
};
};
class Extended_FiredBIS_EventHandlers {
class All {
ADDON = QUOTE(_this call FUNC(firedEH));
};
};

View File

@ -47,6 +47,7 @@ PREP(execRemoteFnc);
PREP(executePersistent);
PREP(filter);
PREP(findUnloadPosition);
PREP(firedEH);
PREP(fixCollision);
PREP(fixFloating);
PREP(fixLoweredRifleAnimation);

View File

@ -0,0 +1,68 @@
/*
* Author: esteldunedain
* Unfied handling of weapon fire
*
* Argument:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
BEGIN_COUNTER(firedEH);
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile);
if (_unit isKindOf "CAManBase") then {
// The unit it on foot
if (_unit == ACE_player) then {
["firedPlayer", _this] call FUNC(localEvent);
} else {
if ([_unit] call EFUNC(common,isPlayer)) then {
["firedPlayerNonLocal", _this] call FUNC(localEvent);
} else {
["firedNonPlayer", _this] call FUNC(localEvent);
};
};
} else {
// The unit is a vehicle
private _vehicle = _unit;
// Get the gunner and turret path.
// Code based on FUNC(getGunner), extracted for efficency.
private _gunner = objNull;
private _turret = [];
{
if (_weapon in (_unit weaponsTurret _x)) exitWith {
_gunner = _unit turretUnit _x;
_turret = _x;
};
false
} count allTurrets [_unit, true];
// Ensure that at least the pilot is returned if there is no gunner
if (isManualFire _unit && {isNull _gunner}) then {
_gunner = effectiveCommander _unit;
};
if (_gunner == ACE_player) then {
["firedPlayerVehicle", _this] call FUNC(localEvent);
} else {
if ([_gunner] call EFUNC(common,isPlayer)) then {
["firedPlayerVehicleNonLocal", _this] call FUNC(localEvent);
} else {
["firedNonPlayerVehicle", _this] call FUNC(localEvent);
};
};
};
END_COUNTER(firedEH);

View File

@ -30,7 +30,7 @@ private _gunner = objNull;
// ensure that at least the pilot is returned if there is no gunner
if (isManualFire _vehicle && {isNull _gunner}) then {
_gunner = driver _vehicle;
_gunner = effectiveCommander _vehicle;
};
_gunner

View File

@ -10,14 +10,6 @@ class Extended_PostInit_EventHandlers {
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
firedBIS = QUOTE(_this call FUNC(replaceATWeapon));
};
};
};
// handle preloaded missile
class Extended_InitPost_EventHandlers {
class CAManBase {

View File

@ -12,3 +12,8 @@ if (!hasInterface) exitWith {};
[_unit] call FUNC(takeLoadedATWeapon);
[_unit] call FUNC(updateInventoryDisplay);
}] call EFUNC(common,addEventHandler);
// Register fire event handler
// Only for the local player and for AI. Non-local players will handle it themselves
["firedPlayer", DFUNC(replaceATWeapon)] call EFUNC(common,addEventHandler);
["firedNonPlayer", DFUNC(replaceATWeapon)] call EFUNC(common,addEventHandler);

View File

@ -1,15 +1,9 @@
/*
* Author: bux, commy2
* Replace the disposable launcher with the used dummy.
* Replace the disposable launcher with the used dummy. Called from the unified fired EH.
*
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* Nothing
@ -21,8 +15,8 @@
*/
#include "script_component.hpp"
params ["_unit", "_weapon", "", "", "", "", "_projectile"];
TRACE_3("params",_unit,_weapon,_projectile);
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
if (!local _unit || {_weapon != secondaryWeapon _unit}) exitWith {};

View File

@ -76,36 +76,3 @@ class Extended_Respawn_EventHandlers {
};
};
};
class Extended_FiredBIS_EventHandlers {
class Tank {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
class Car {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
class Helicopter {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
class Plane {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
class Ship_F {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
class StaticWeapon {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH));
};
};
};

View File

@ -15,5 +15,9 @@ if (!hasInterface) exitWith {};
};
}] call EFUNC(common,addEventHandler);
// Register fire event handler
["firedPlayerVehicle", DFUNC(firedEH)] call EFUNC(common,addEventHandler);
["firedPlayerVehicleNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler);
// Register event for global updates
[QGVAR(forceUpdate), {[ACE_player] call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler);

View File

@ -1,9 +1,9 @@
/*
* Author: KoffeinFlummi
* Adjusts the direction of a shell.
* Adjusts the direction of a shell. Called from the unified fired EH only if the gunner is a player.
*
* Arguments:
* -> arguments of the FiredBIS EH
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* None
@ -12,13 +12,8 @@
*/
#include "script_component.hpp"
params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine", "_projectile"];
private _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner);
private _turret = _gunner call EFUNC(common,getTurretIndex);
// Exit if the unit isn't a player
if !([_gunner] call EFUNC(common,isPlayer)) exitWith {};
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines), _turret], []];
private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret];
@ -36,7 +31,7 @@ private _offset = 0;
[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection);
// Remove the platform velocity
// Remove the platform velocity
if (vectorMagnitude velocity _vehicle > 2) then {
private _sumVelocity = (velocity _projectile) vectorDiff (velocity _vehicle);

View File

@ -9,9 +9,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {
class AllVehicles {
ADDON = QUOTE(_this call FUNC(fired));
};
};

View File

@ -9,7 +9,21 @@ if(isServer) then {
[QGVAR(frag_eh), { _this call FUNC(frago); }] call EFUNC(common,addEventHandler);
};
[FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler;
["SettingsInitialized", {
//If not enabled, exit
if (!GVAR(enabled)) exitWith {};
// Register fire event handler
["firedPlayer", DFUNC(fired)] call EFUNC(common,addEventHandler);
["firedPlayerNonLocal", DFUNC(fired)] call EFUNC(common,addEventHandler);
["firedNonPlayer", DFUNC(fired)] call EFUNC(common,addEventHandler);
["firedPlayerVehicle", DFUNC(fired)] call EFUNC(common,addEventHandler);
["firedPlayerVehicleNonLocal", DFUNC(fired)] call EFUNC(common,addEventHandler);
["firedNonPlayerVehicle", DFUNC(fired)] call EFUNC(common,addEventHandler);
[FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler;
}] call EFUNC(common,addEventHandler);
//Cache for ammo type configs
GVAR(cacheRoundsTypesToTrack) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0];

View File

@ -1,12 +1,10 @@
/*
* Author: nou, jaynus, PabstMirror
* Called from FiredBIS event on AllVehicles
* Called from the unified fired EH for all.
* If spall is not enabled (default), then cache and only track those that will actually trigger fragmentation.
*
* Arguments:
* 0: gun - Object the event handler is assigned to <OBJECT>
* 4: type - Ammo used <STRING>
* 6: round - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* Nothing
@ -19,38 +17,39 @@
// #define DEBUG_ENABLED_FRAG
#include "script_component.hpp"
params ["_gun", "", "", "", "_type", "", "_round"];
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
private _shouldAdd = GVAR(cacheRoundsTypesToTrack) getVariable _type;
private _shouldAdd = GVAR(cacheRoundsTypesToTrack) getVariable _ammo;
if (isNil "_shouldAdd") then {
TRACE_1("no cache for round",_type);
TRACE_1("no cache for round",_ammo);
if (!EGVAR(common,settingsInitFinished)) exitWith {
//Just incase fired event happens before settings init, don't want to set cache wrong if spall setting changes
TRACE_1("Settings not init yet - exit without setting cache",_type);
TRACE_1("Settings not init yet - exit without setting cache",_ammo);
_shouldAdd = false;
};
if (GVAR(SpallEnabled)) exitWith {
//Always want to run whenever spall is enabled?
_shouldAdd = true;
TRACE_2("SettingCache[spallEnabled]",_type,_shouldAdd);
GVAR(cacheRoundsTypesToTrack) setVariable [_type, _shouldAdd];
TRACE_2("SettingCache[spallEnabled]",_ammo,_shouldAdd);
GVAR(cacheRoundsTypesToTrack) setVariable [_ammo, _shouldAdd];
};
//Read configs and test if it would actually cause a frag, using same logic as FUNC(pfhRound)
private _skip = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip));
private _explosive = getNumber (configFile >> "CfgAmmo" >> _type >> "explosive");
private _indirectRange = getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange");
private _force = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force));
private _fragPower = getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"))));
private _skip = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(skip));
private _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive");
private _indirectRange = getNumber (configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange");
private _force = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(force));
private _fragPower = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange"))));
_shouldAdd = (_skip == 0) && {(_force == 1) || {_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}}};
TRACE_6("SettingCache[willFrag?]",_skip,_explosive,_indirectRange,_force,_fragPower,_shouldAdd);
GVAR(cacheRoundsTypesToTrack) setVariable [_type, _shouldAdd];
GVAR(cacheRoundsTypesToTrack) setVariable [_ammo, _shouldAdd];
};
if (_shouldAdd) then {
TRACE_3("Running Frag Tracking",_gun,_type,_round);
[_gun, _type, _round] call FUNC(addPfhRound);
TRACE_3("Running Frag Tracking",_unit,_ammo,_projectile);
[_unit, _ammo, _projectile] call FUNC(addPfhRound);
};

View File

@ -19,14 +19,6 @@ class Extended_Killed_EventHandlers {
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
clientFiredBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleFired)});
};
};
};
class Extended_Explosion_EventHandlers {
class CAManBase {
class ADDON {

View File

@ -131,3 +131,6 @@ private _fnc_checkGoggles = {
END_COUNTER(goggles);
}, 0.5, []] call CBA_fnc_addPerFrameHandler;
// Register fire event handler
["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler);

View File

@ -1,10 +1,9 @@
/*
* Author: Garth 'L-H' de Wet, commy2
* Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements.
* Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. Called from the unified fired EH only for the local player.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* Function is handled? <BOOL>
@ -13,9 +12,8 @@
*/
#include "script_component.hpp"
params ["_unit", "_weapon"];
if (_unit != ACE_player) exitWith {true};
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
// no dust in rain
if (rain > 0.1) exitWith {true};

View File

@ -10,11 +10,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
firedBIS = QUOTE(_this call FUNC(throwGrenade));
};
};
};

View File

@ -22,3 +22,9 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
},
{false},
[9, [false, false, false]], false] call CBA_fnc_addKeybind; //8 Key
// Register fire event handler
["firedPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler);
["firedPlayerNonLocal", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler);
["firedNonPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler);

View File

@ -1,15 +1,9 @@
/*
* Author: commy2
* Adjust the grenades throwing direction and speed to the selected throwing mode.
* Adjust the grenades throwing direction and speed to the selected throwing mode. Called from the unified fired EH only for CAManBase
*
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* None
@ -21,7 +15,8 @@
*/
#include "script_component.hpp"
params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"];
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
if (_weapon != "Throw") exitWith {};

View File

@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
clientFiredBIS = QUOTE(_this call FUNC(handleFired));
};
};
};

View File

@ -7,3 +7,8 @@ GVAR(TI) = 0;
GVAR(cur_cam) = 0;
GVAR(ROTATE) = 0;
GVAR(ELEVAT) = 0.01;
// Register fire event handler
// Don't run for non players, as they are too dumb to launch huntirs anyway
["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler);
["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler);

View File

@ -1,16 +1,10 @@
/*
* Author: Norrin, Rocko, Ruthberg
*
* Handles HuntIR projectiles
* Handles HuntIR projectiles. Called from the unified fired EH for all CAManBase.
*
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* None
@ -19,10 +13,13 @@
*/
#include "script_component.hpp"
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
if (_ammo != "F_HuntIR") exitWith {};
if (!hasInterface) exitWith {};
[{
params ["_projectile"];

View File

@ -198,4 +198,13 @@
#define ACE_DEPRECATED(arg1,arg2,arg3) ACE_LOGWARNING_3("%1 is deprecated. Support will be dropped in version %2. Replaced by: %3",arg1,arg2,arg3)
#define PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \
format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10 J=%11', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I), RETNIL(J)]
#ifdef DEBUG_MODE_FULL
#define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \
[THIS_FILE_, __LINE__, PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J)] call CBA_fnc_log
#else
#define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) /* disabled */
#endif
#include "script_debug.hpp"

View File

@ -126,4 +126,35 @@ call FUNC(parseConfigForInjuries);
GVAR(HITPOINTS) = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
GVAR(SELECTIONS) = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
//Hack for #3168 (units in static weapons do not take any damage):
//doing a manual pre-load with a small distance seems to fix the LOD problems with handle damage not returning full results
GVAR(fixedStatics) = [];
private _fixStatic = {
params ["_vehicle"];
private _vehType = typeOf _vehicle;
TRACE_2("",_vehicle,_vehType);
if (!(_vehType in GVAR(fixedStatics))) then {
GVAR(fixedStatics) pushBack _vehType;
TRACE_1("starting preload",_vehType);
[{
1 preloadObject (_this select 0);
}, {
TRACE_1("preload done",_this);
}, [_vehType]] call EFUNC(common,waitUntilAndExecute);
};
};
["StaticWeapon", "init", _fixStatic] call CBA_fnc_addClassEventHandler;
["Car", "init", _fixStatic] call CBA_fnc_addClassEventHandler;
addMissionEventHandler ["Loaded",{
{
TRACE_1("starting preload (save load)",_x);
[{
1 preloadObject (_this select 0);
}, {
TRACE_1("preload done",_this);
}, [_x]] call EFUNC(common,waitUntilAndExecute);
} forEach GVAR(fixedStatics);
}];
ADDON = true;

View File

@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers {
clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) );
};
};
class Extended_FiredBIS_EventHandlers {
class AllVehicles {
class ADDON {
clientFiredBIS = QUOTE( _this call FUNC(blending) );
};
};
};

View File

@ -70,3 +70,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0;
},
{false},
[209, [false, false, true]], false] call CBA_fnc_addKeybind; //PageDown + ALT
// Register fire event handler
["firedPlayer", DFUNC(blending)] call EFUNC(common,addEventHandler);
["firedPlayerVehicle", DFUNC(blending)] call EFUNC(common,addEventHandler);

View File

@ -1,15 +1,9 @@
/*
* Author: commy2
* Change the blending when the player fires??
* Change the blending when the player fires??. Called from the unified fired EH only for the local player and his vehicle.
*
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* Nothing
@ -21,17 +15,14 @@
*/
#include "script_component.hpp"
if (!hasInterface) exitWith {};
params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine"];
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
private "_player";
_player = ACE_player;
//If our vehicle didn't shoot, or we're not in NVG mode, exit
if ((_vehicle != (vehicle _player)) || {(currentVisionMode _player) != 1}) exitWith {};
//If we are mounted, and it wasn't our weapon system that fired, exit
if (_player != _vehicle && {!(_weapon in (_vehicle weaponsTurret ([_player] call EFUNC(common,getTurretIndex))))}) exitWith {};
if ((currentVisionMode _player) != 1) exitWith {};
private["_darkness", "_nvgBrightnessCoef", "_silencer", "_visibleFire", "_visibleFireCoef", "_visibleFireTime", "_visibleFireTimeCoef"];

View File

@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class AGM_Optics {
clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call DFUNC(handleFired)};);
};
};
};

View File

@ -10,7 +10,7 @@ GVAR(camera) = objNull;
if ((!isNil {is3DEN}) && {is3DEN}) exitWith {
ACE_LOGINFO("Eden detected: disabling Optics PIP Camera");
};
waitUntil {!isNull ACE_player};
waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}};
@ -50,3 +50,6 @@ GVAR(camera) = objNull;
GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"];
};
}] call EFUNC(common,addEventHandler);
// Register fire event handler
["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler);

View File

@ -2,26 +2,18 @@
* Original Author: Taosenai
* Adapted By: KoffeinFlummi, commy2
*
* Animates the scope when firing.
* Animates the scope when firing. Called from the unified fired EH only for the local player.
*
* Arguments:
* 0: Unit (Object)
* 1: Weapon (String)
* 2: Muzzle (String)
* 3: Mode (String)
* 4: Ammo (Object)
* 5: Magazine (String)
* 6: Projectile (Object)
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* None
*/
#include "script_component.hpp"
private ["_unit", "_weapon"];
_unit = _this select 0;
_weapon = _this select 1;
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
// check if compatible scope is used
private "_display";

View File

@ -10,14 +10,6 @@ class Extended_PostInit_EventHandlers {
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class GVAR(Overheat) {
clientFiredBIS = QUOTE(_this call FUNC(firedEH));
};
};
};
class Extended_Take_EventHandlers {
class CAManBase {
class GVAR(UnjamReload) {

View File

@ -36,3 +36,12 @@ GVAR(cacheWeaponData) setText QGVAR(cacheWeaponData);
// Schedule cool down calculation of player weapons at (infrequent) regular intervals
[] call FUNC(updateTemperatureThread);
["SettingsInitialized", {
// Register fire event handler
["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler);
// Only add eh to non local players if dispersion is enabled
if (GVAR(overheatingDispersion)) then {
["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler);
};
}] call EFUNC(common,addEventHandler);

View File

@ -1,15 +1,9 @@
/*
* Author: Commy2 and esteldunedain
* Handle weapon fire
* Handle weapon fire. Called from the unified fired EH 1- always for the local player 2- and for non local players if dispersion is simulated.
*
* Argument:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return value:
* None
@ -18,15 +12,13 @@
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
BEGIN_COUNTER(firedEH);
params ["_unit", "_weapon", "_muzzle", "", "_ammo", "", "_projectile"];
TRACE_5("params",_unit,_weapon,_muzzle,_ammo,_projectile);
if (((!GVAR(overheatingDispersion)) && {_unit != ACE_player}) //If no dispersion, only run when local
|| {!([_unit] call EFUNC(common,isPlayer))} //Ignore AI
|| {(_unit distance ACE_player) > 3000} //Ignore far away shots
|| {(_muzzle != (primaryWeapon _unit)) && {_muzzle != (handgunWeapon _unit)}}) exitWith { // Only rifle or pistol muzzles (ignore grenades / GLs)
if ((_unit distance ACE_player) > 3000 //Ignore far away shots
|| {(_muzzle != (primaryWeapon _unit)) && {_muzzle != (handgunWeapon _unit)}}) exitWith { // Only rifle or pistol muzzles (ignore grenades / GLs)
END_COUNTER(firedEH);
};

View File

@ -10,42 +10,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
clientFiredBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};);
};
};
class Tank {
class ADDON {
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
};
};
class Car {
class ADDON {
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
};
};
class Helicopter {
class ADDON {
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
};
};
class Plane {
class ADDON {
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
};
};
class Ship_F {
class ADDON {
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
};
};
class StaticWeapon {
class ADDON {
firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};);
};
};
};

View File

@ -1,3 +1,7 @@
#include "script_component.hpp"
["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler);
// Register fire event handler
["firedPlayer", DFUNC(firedEHBB)] call EFUNC(common,addEventHandler);
["firedPlayerVehicle", DFUNC(firedEHOP)] call EFUNC(common,addEventHandler);

View File

@ -2,8 +2,6 @@
ADDON = false;
PREP(fireLauncherBackblast);
PREP(fireOverpressureZone);
PREP(getDistance);
PREP(overpressureDamage);
PREP(cacheOverPressureValues);

View File

@ -1,95 +0,0 @@
/*
* Author: commy2 and esteldunedain
* Handle fire of local launchers
* Called from firedEHBB, only for ace_player with shot that will cause damage
*
* Arguments:
* 0: Unit that fired <OBJECT>
* 1: Weapon fired <STRING>
* 2: Muzzle <STRING>
* 3: Mode <STRING>
* 4: Ammo <STRING>
* 5: Magazine <STRING>
* 6: Projectile <OBJECT>
*
* Return value:
* None
*
* Example:
* [player, "launch_RPG32_F", "launch_RPG32_F", "Single", "R_PG32V_F", "RPG32_F", projectile] call ace_overpressure_fnc_fireLauncherBackblast;
*
* Public: No
*/
#include "script_component.hpp"
params ["_firer", "_weapon", "_muzzle", "", "_ammo", "_magazine", "_projectile"];
TRACE_6("params",_firer,_weapon,_muzzle,_ammo,_magazine,_projectile);
private _position = getPosASL _projectile;
private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
// Bake variable name and check if the variable exists, call the caching function otherwise
private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
private _var = if (isNil _varName) then {
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
} else {
missionNameSpace getVariable _varName;
};
_var params["_backblastAngle","_backblastRange","_backblastDamage"];
TRACE_3("cache",_backblastAngle,_backblastRange,_backblastDamage);
// Damage to others
private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange];
// Let each client handle their own affected units
["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
// Damage to the firer
private _distance = 2 * ([_position, _direction, _backblastRange, _firer] call FUNC(getDistance));
TRACE_1("Distance",_distance);
if (_distance < _backblastRange) then {
private _alpha = sqrt (1 - _distance / _backblastRange);
private _beta = sqrt 0.5;
private _damage = _alpha * _beta * _backblastDamage;
[_damage * 100] call BIS_fnc_bloodEffect;
if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_firer] call EFUNC(medical,hasMedicalEnabled))}) then {
[_firer, _damage, "body", "backblast"] call EFUNC(medical,addDamageToUnit);
} else {
_firer setDamage (damage _firer + _damage);
};
};
// Draw debug lines
#ifdef DEBUG_MODE_FULL
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
private _ref = _direction call EFUNC(common,createOrthonormalReference);
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply ((_distance/2) min _backblastRange)),
[1,0,0,1]
] call EFUNC(common,addLineToDebugDraw);
#endif

View File

@ -1,75 +0,0 @@
/*
* Author: commy2 and esteldunedain
* Handle fire of local vehicle weapons creating overpressure zones
* Called from firedEHOP, only for local vehicles
*
* Arguments:
* 0: Vehicle that fired <OBJECT>
* 1: Weapon fired <STRING>
* 2: Muzzle <STRING>
* 3: Mode <STRING>
* 4: Ammo <STRING>
* 5: Magazine <STRING>
* 6: Projectile <OBJECT>
*
* Return value:
* None
*
* Example:
* [tank, "cannon_125mm", "cannon_125mm", "player", "Sh_125mm_APFSDS_T_Green", "24Rnd_125mm_APFSDS_T_Green", projectile] call ace_overpressure_fnc_fireOverpressureZone
*
* Public: No
*/
#include "script_component.hpp"
params ["_firer", "_weapon", "_muzzle", "", "_ammo", "_magazine", "_projectile"];
TRACE_6("params",_firer,_weapon,_muzzle,_ammo,_magazine,_projectile);
// Prevent AI from causing overpressure damage (NOTE: Vehicle is local, but turret gunner may not be)
if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {};
private _position = getPosASL _projectile;
private _direction = vectorDir _projectile;
// Bake variable name and check if the variable exists, call the caching function otherwise
private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
private _var = if (isNil _varName) then {
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
} else {
missionNameSpace getVariable _varName;
};
_var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"];
TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage);
// Damage to others
private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange];
// Let each client handle their own affected units
["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
// Draw debug lines
#ifdef DEBUG_MODE_FULL
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange),
[1,0,0,1]
] call EFUNC(common,addLineToDebugDraw);
private _ref = _direction call EFUNC(common,createOrthonormalReference);
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
#endif

View File

@ -1,39 +1,90 @@
/*
* Author: joko // Jonas
* Handle fire of local launchers
* Handle fire of local launchers. Called from the unified fired EH only for the local player.
*
* Arguments:
* 0: Unit that fired <OBJECT>
* 1: Weapon fired <STRING>
* 2: Muzzle <STRING>
* 3: Mode <STRING>
* 4: Ammo <STRING>
* 5: Magazine <STRING>
* 6: Projectile <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return value:
* None
*
* Example:
* Example:
* [player, "launch_RPG32_F", "launch_RPG32_F", "Single", "R_PG32V_F", "RPG32_F", projectile] call ace_overpressure_fnc_firedEHBB;
*
* Public: No
*/
#include "script_component.hpp"
params ["_firer", "_weapon", "", "", "_ammo", "_magazine", ""];
// Prevent AI from causing backblast damage (fast exit to only run for local players)
if (_firer != ACE_player) exitWith {};
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
// Bake variable name and check if the variable exists, call the caching function otherwise
private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
private _damage = if (isNil _varName) then {
([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2;
private _var = if (isNil _varName) then {
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
} else {
(missionNameSpace getVariable _varName) select 2;
missionNameSpace getVariable _varName;
};
_var params["_backblastAngle","_backblastRange","_backblastDamage"];
TRACE_3("cache",_backblastAngle,_backblastRange,_backblastDamage);
if (_backblastDamage <= 0) exitWith {};
private _position = getPosASL _projectile;
private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile);
// Damage to others
private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange];
// Let each client handle their own affected units
["overpressure", _affected, [_unit, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
// Damage to the firer
private _distance = 2 * ([_position, _direction, _backblastRange, _unit] call FUNC(getDistance));
TRACE_1("Distance",_distance);
if (_distance < _backblastRange) then {
private _alpha = sqrt (1 - _distance / _backblastRange);
private _beta = sqrt 0.5;
private _damage = _alpha * _beta * _backblastDamage;
[_damage * 100] call BIS_fnc_bloodEffect;
if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_unit] call EFUNC(medical,hasMedicalEnabled))}) then {
[_unit, _damage, "body", "backblast"] call EFUNC(medical,addDamageToUnit);
} else {
_unit setDamage (damage _unit + _damage);
};
};
if (_damage > 0) then {
_this call DFUNC(fireLauncherBackblast)
};
// Draw debug lines
#ifdef DEBUG_MODE_FULL
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
private _ref = _direction call EFUNC(common,createOrthonormalReference);
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply ((_distance/2) min _backblastRange)),
[1,0,0,1]
] call EFUNC(common,addLineToDebugDraw);
#endif

View File

@ -1,15 +1,9 @@
/*
* Author: joko // Jonas
* Handle fire of Vehicle Weapons
* Handle fire of Vehicle Weapons. Called from the unified fired EH only for the local player vehicle.
*
* Arguments:
* 0: Vehicle that fired (XEH will filter only local) <OBJECT>
* 1: Weapon fired <STRING>
* 2: Muzzle <STRING>
* 3: Mode <STRING>
* 4: Ammo <STRING>
* 5: Magazine <STRING>
* 6: Projectile <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return value:
* None
@ -21,16 +15,56 @@
*/
#include "script_component.hpp"
params ["", "_weapon", "", "", "_ammo", "_magazine", ""];
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
// Bake variable name and check if the variable exists, call the caching function otherwise
private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
private _damage = if (isNil _varName) then {
([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2;
private _var = if (isNil _varName) then {
[_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues);
} else {
(missionNameSpace getVariable _varName) select 2;
missionNameSpace getVariable _varName;
};
_var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"];
TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage);
if (_damage > 0) then {
_this call DFUNC(fireOverpressureZone)
};
if (_dangerZoneDamage <= 0) exitWith {};
// The weapon produces overpressure, calculate
private _position = getPosASL _projectile;
private _direction = vectorDir _projectile;
// Damage to others
private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange];
// Let each client handle their own affected units
["overpressure", _affected, [_unit, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent);
// Draw debug lines
#ifdef DEBUG_MODE_FULL
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange),
[1,0,0,1]
] call EFUNC(common,addLineToDebugDraw);
private _ref = _direction call EFUNC(common,createOrthonormalReference);
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
[ _position,
_position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle),
[1,1,0,1]
] call EFUNC(common,addLineToDebugDraw);
#endif

View File

@ -1,14 +1,11 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(camshake)};);
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_postInit) );
};
};

View File

@ -0,0 +1,4 @@
#include "script_component.hpp"
// Register fire event handler
["firedPlayer", DFUNC(camShake)] call EFUNC(common,addEventHandler);

View File

@ -1,12 +1,10 @@
/*
* Author: Orginal by Ryan Schultz, edited by KoffeinFlummi, commy2
* Adds camera shake when firing
* Adds camera shake when firing. Called from the unified fired EH only for the local player.
* From TMR: Small Arms
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
* 3: Muzzle <STRING>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* Nothing
@ -18,13 +16,14 @@
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
#define BASE_POWER 0.40
#define BASE_TIME 0.19
#define BASE_FREQ 13
#define RECOIL_COEF 40
params ["_unit", "_weapon", "_muzzle"];
if (toLower _weapon in ["throw", "put"]) exitWith {};
private _powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView));

View File

@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
firedBIS = QUOTE(_this call FUNC(firedEH););
};
};
};

View File

@ -136,3 +136,8 @@ if (!hasInterface) exitWith {};
},
{false},
[201, [true, true, false]], true] call CBA_fnc_addKeybind;
// Register fire event handler
["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler);
["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler);

View File

@ -1,15 +1,9 @@
/*
* Author: KoffeinFlummi, esteldunedain
* Adjusts the flight path of the bullet according to the zeroing
* Adjusts the flight path of the bullet according to the zeroing. Called from the unified fired EH only for local and non-local players on foot.
*
* Argument:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return value:
* None
@ -18,12 +12,11 @@
*/
#include "script_component.hpp"
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
private ["_adjustment", "_weaponIndex", "_zeroing", "_adjustment"];
params ["_unit", "", "", "", "", "", "_projectile"];
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {};
_adjustment = _unit getVariable [QGVAR(Adjustment), []];
if (_adjustment isEqualTo []) exitWith {};

View File

@ -10,11 +10,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class GVAR(throwGrenade) {
clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(throwGrenade)});
};
};
};

View File

@ -195,3 +195,7 @@ if (!hasInterface) exitWith {};
},
{false},
[10, [false, false, false]], false] call CBA_fnc_addKeybind; //9 Key
// Register fire event handler
["firedPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler);

View File

@ -1,15 +1,9 @@
/*
* Author: commy2
* Display Grenade information on grenade throw.
* Display Grenade information on grenade throw. Called from the unified fired EH only for the local player.
*
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* None
@ -21,7 +15,8 @@
*/
#include "script_component.hpp"
params ["_unit", "_weapon", "", "", "", "_magazine"];
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
if (_weapon != "Throw") exitWith {};

View File

@ -8,10 +8,3 @@ class Extended_PostInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_postInit));
};
};
class Extended_FiredBIS_EventHandlers {
class AllVehicles {
class ADDON {
firedBIS = QUOTE(_this call FUNC(handleFired));
};
};
};

View File

@ -8,6 +8,15 @@ GVAR(trackedBullets) = [];
//If not enabled, dont't add PFEH
if (!GVAR(enabled)) exitWith {};
// Register fire event handler
["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler);
["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler);
if (GVAR(vehicleEnabled)) then {
["firedPlayerVehicle", DFUNC(handleFired)] call EFUNC(common,addEventHandler);
["firedPlayerVehicleNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler);
};
[] call FUNC(updateTrajectoryPFH);
}] call EFUNC(common,addEventHandler);

View File

@ -1,15 +1,9 @@
/*
* Author: Glowbal, Ruthberg
* Handles wind deflection for projectiles.
* Handles wind deflection for projectiles. Called from the unified fired EH only for players on foot and their vehicles if required by settings.
*
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
* 1: weapon - Fired weapon <STRING>
* 2: muzzle - Muzzle that was used <STRING>
* 3: mode - Current mode of the fired weapon <STRING>
* 4: ammo - Ammo used <STRING>
* 5: magazine - magazine name which was used <STRING>
* 6: projectile - Object of the projectile that was shot <OBJECT>
* None. Parameters inherited from EFUNC(common,firedEH)
*
* Return Value:
* Nothing
@ -21,17 +15,12 @@
*/
#include "script_component.hpp"
params ["_unit", "", "", "", "_ammo", "", "_bullet"];
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_bullet isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false};
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_projectile isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false};
if (!hasInterface) exitWith {false};
if (!(GVAR(enabled))) exitWith {false};
if (!(GVAR(vehicleEnabled)) && !(_unit isKindOf "Man")) exitWith {false};
if (!((_bullet isKindOf "BulletBase") || (_bullet isKindOf "GrenadeBase"))) exitWith {false};
if (!((_projectile isKindOf "BulletBase") || (_projectile isKindOf "GrenadeBase"))) exitWith {false};
if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false};
if (!([_unit] call EFUNC(common,isPlayer))) exitWith {false};
GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];
true;
GVAR(trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")];

View File

@ -1,21 +1,22 @@
<p align="center">
<img src="https://github.com/acemod/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" width="480">
<img src="https://github.com/acemod/ACE3/raw/master/extras/assets/logo/black/ACE3-Logo.jpg" width="480">
</p>
<p align="center">
<a href="https://github.com/acemod/ACE3/releases">
<img src="https://img.shields.io/badge/Version-3.3.2-blue.svg?style=flat-square" alt="ACE3 Version">
<img src="https://img.shields.io/badge/Version-3.4.2-blue.svg?style=flat-square" alt="ACE3 Version">
</a>
<a href="https://github.com/acemod/ACE3/releases/download/v3.3.2/ace3_3.3.2.zip">
<img src="https://img.shields.io/badge/Download-65.7_MB-green.svg?style=flat-square" alt="ACE3 Download">
<a href="https://github.com/acemod/ACE3/releases/download/v3.4.2/ace3_3.4.2.zip">
<img src="https://img.shields.io/badge/Download-72.6_MB-green.svg?style=flat-square" alt="ACE3 Download">
</a>
<a href="https://github.com/acemod/ACE3/issues">
<img src="https://img.shields.io/github/issues-raw/acemod/ACE3.svg?style=flat-square&label=Issues" alt="ACE3 Issues">
<img src="https://img.shields.io/github/issues-raw/acemod/ACE3.svg?style=flat-square&label=Issues" alt="ACE3 Fehlermeldungen">
</a>
<a href="https://forums.bistudio.com/topic/181341-ace3-a-collaborative-merger-between-agm-cse-and-ace/?p=2859670">
<img src="https://img.shields.io/badge/BIF-Thread-lightgrey.svg?style=flat-square" alt="BIF Thread">
</a>
<a href="https://github.com/acemod/ACE3/blob/master/LICENSE">
<img src="https://img.shields.io/badge/License-GPLv2-red.svg?style=flat-square" alt="ACE3 License">
<img src="https://img.shields.io/badge/License-GPLv2-red.svg?style=flat-square" alt="ACE3 Lizenz">
</a>
<a href="http://slackin.ace3mod.com/">
<img src="http://slackin.ace3mod.com/badge.svg?style=flat-square&label=Slack" alt="ACE3 Slack">
@ -24,7 +25,11 @@
<img src="https://img.shields.io/travis/acemod/ACE3.svg?style=flat-square&label=Build" alt="ACE3 Build Status">
</a>
</p>
<p align="center"><sup><strong>Benötigt die aktuellste Version von <a href="https://github.com/CBATeam/CBA_A3/releases">CBA A3</a>. Besucht uns auf <a href="https://www.facebook.com/ACE3Mod">Facebook</a> | <a href="https://www.youtube.com/c/ACE3Mod">YouTube</a> | <a href="https://twitter.com/ACE3Mod">Twitter</a> | <a href="http://www.reddit.com/r/arma/search?q=ACE&restrict_sr=on&sort=new&t=all">Reddit</a></strong></sup></p>
</p>
<p align="center">
<sup><strong>Benötigt die aktuellste Version von<a href="https://github.com/CBATeam/CBA_A3/releases">CBA A3</a>.<br/>
Besucht uns auf <a href="https://twitter.com/ACE3Mod">Twitter</a> | <a href="https://www.facebook.com/ACE3Mod">Facebook</a> | <a href="https://www.youtube.com/c/ACE3Mod">YouTube</a> | <a href="http://www.reddit.com/r/arma/search?q=ACE&restrict_sr=on&sort=new&t=all">Reddit</a></strong></sup>
</p>
**ACE3** ist ein Gemeinschaftsprojekt der sich zusammengeschlossenen Moddinggruppen von **ACE2**, **AGM** und **CSE** mit dem Ziel den Realismus und die Spieltiefe von Arma 3 zu steigern.