Merge branch 'master' into 155selectRandom

This commit is contained in:
PabstMirror 2016-02-17 15:58:19 -06:00
commit be742c13cd
82 changed files with 594 additions and 659 deletions

Binary file not shown.

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

@ -13,7 +13,7 @@ class CfgWeapons {
};
class ACE_FakePrimaryWeapon: Rifle_Base_F {
scope = 2;
scope = 1;
scopeCurator = 1;
scopeArsenal = 1;
displayName = "";

View File

@ -47,6 +47,7 @@ PREP(execRemoteFnc);
PREP(executePersistent);
PREP(filter);
PREP(findUnloadPosition);
PREP(firedEH);
PREP(fixCollision);
PREP(fixFloating);
PREP(fixLoweredRifleAnimation);
@ -256,7 +257,8 @@ PREP(addCuratorUnloadEventhandler);
PREP(fixCrateContent);
//ACE events global variables
GVAR(events) = [[],[]];
GVAR(eventsLocation) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0];
GVAR(eventsLocation) setText QGVAR(eventsLocation);
PREP(globalEvent);
PREP(_handleNetEvent);

View File

@ -16,12 +16,9 @@ params ["_eventType", "_event"];
if (_eventType == "ACEg") then {
_event params ["_eventName", "_eventArgs"];
GVAR(events) params ["_eventNames"];
private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
private _events = (GVAR(events) select 1) select _eventIndex;
private _eventFunctions = GVAR(eventsLocation) getVariable _eventName;
if (!isNil "_eventFunctions") then {
#ifdef DEBUG_EVENTS
ACE_LOGINFO_1("* Net Event %1",_eventName);
@ -35,7 +32,7 @@ if (_eventType == "ACEg") then {
ACE_LOGINFO_1(" ID: %1",_forEachIndex);
#endif
};
} forEach _events;
} forEach _eventFunctions;
};
};

View File

@ -15,18 +15,11 @@
params ["_eventName", "_eventCode"];
GVAR(events) params ["_eventNames"];
private _eventFunctions = GVAR(eventsLocation) getVariable _eventName;
private _eventFunctions = [];
private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
_eventFunctions = (GVAR(events) select 1) select _eventIndex;
} else {
private _eventNameCount = count _eventNames;
_eventNames set [_eventNameCount, _eventName];
(GVAR(events) select 1) set [_eventNameCount, _eventFunctions];
if (isNil "_eventFunctions") then {
_eventFunctions = [];
GVAR(eventsLocation) setVariable [_eventName, _eventFunctions];
};
_eventFunctions pushBack _eventCode // Return event function count

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

@ -15,12 +15,9 @@
params ["_eventName", "_eventArgs"];
GVAR(events) params ["_eventNames", "_eventArray"];
private _eventFunctions = GVAR(eventsLocation) getVariable _eventName;
private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
private _events = _eventArray select _eventIndex;
if (!isNil "_eventFunctions") then {
#ifdef DEBUG_EVENTS
ACE_LOGINFO_1("* Local Event: %1",_eventName);
@ -35,5 +32,5 @@ if (_eventIndex != -1) then {
ACE_LOGINFO_1(" ID: %1",_forEachIndex);
#endif
};
} forEach _events;
} forEach _eventFunctions;
};

View File

@ -14,11 +14,4 @@
params ["_eventName"];
GVAR(events) params ["_eventNames", "_events"];
private _eventFunctions = [];
private _eventIndex = _eventNames find _eventName;
if (_eventIndex != -1) then {
_events set [_eventIndex, []];
};
GVAR(eventsLocation) setVariable [_eventName, nil];

View File

@ -15,12 +15,9 @@
params ["_eventName", "_eventCodeIndex"];
GVAR(events) params ["_eventNames", "_events"];
private _eventFunctions = GVAR(eventsLocation) getVariable _eventName;
private _eventFunctions = [];
private _eventIndex = _eventNames find _eventName;
if (isNil "_eventFunctions") exitWith {TRACE_1("eventName not found",_eventName);};
if ((_eventCodeIndex < 0) || {(count _eventFunctions) <= _eventCodeIndex}) exitWith {TRACE_2("index out of bounds",_eventName,_eventCodeIndex);};
if (_eventIndex != -1) then {
_eventFunctions = _events select _eventIndex;
_eventFunctions set [_eventCodeIndex, nil];
};
_eventFunctions set [_eventCodeIndex, nil];

View File

@ -0,0 +1 @@
#include "\z\ace\addons\common\script_component.hpp"

View File

@ -0,0 +1,78 @@
// ----------------------------------------------------------------------------
#define DEBUG_MODE_FULL
#include "script_component.hpp"
#ifndef TEST_DEFINED_AND_OP
if (true) exitWith {};
#endif
// ----------------------------------------------------------------------------
LOG('Testing EventHandlers');
TEST_DEFINED(QFUNC(_handleNetEvent),"");
TEST_DEFINED(QFUNC(addEventHandler),"");
TEST_DEFINED(QFUNC(localEvent),"");
TEST_DEFINED(QFUNC(targetEvent),"");
TEST_DEFINED(QFUNC(globalEvent),"");
TEST_DEFINED(QFUNC(serverEvent),"");
TEST_DEFINED(QFUNC(removeAllEventHandlers),"");
TEST_DEFINED(QFUNC(removeEventHandler),"");
private _result = ["A", {}] call ace_common_fnc_addEventHandler;
private _expected = 0;
TEST_DEFINED_AND_OP(_result,==,_expected,"Adding first A EH");
_result = ["A", {GVAR(test_A2) = _this}] call ace_common_fnc_addEventHandler;
_expected = 1;
TEST_DEFINED_AND_OP(_result,==,_expected,"Adding second A EH");
_result = ["A", {GVAR(test_A3) = _this}] call ace_common_fnc_addEventHandler;
_expected = 2;
TEST_DEFINED_AND_OP(_result,==,_expected,"Adding third A EH");
GVAR(test_A2) = -1;
["A", 11] call FUNC(localEvent);
_expected = 11;
_result = GVAR(test_A2);
TEST_DEFINED_AND_OP(_result,==,_expected,"Test Local Event");
//Remove 2nd EH
["A", 1] call FUNC(removeEventHandler);
GVAR(test_A2) = -1;
GVAR(test_A3) = -1;
["A", 22] call FUNC(localEvent);
_expected = -1;
_result = GVAR(test_A2);
TEST_DEFINED_AND_OP(_result,==,_expected,"Test 2nd (removed) EH");
_expected = 22;
_result = GVAR(test_A3);
TEST_DEFINED_AND_OP(_result,==,_expected,"Test 3rd Event");
//Remove All EH:
["A"] call FUNC(removeAllEventHandlers);
GVAR(test_A3) = -1;
["A", 77] call FUNC(localEvent);
_expected = -1;
_result = GVAR(test_A3);
TEST_DEFINED_AND_OP(_result,==,_expected,"Test 3rd is removed after removeAll");
//Much harder to test network events
TRACE_2("testing network events",isServer,isDedicated);
["B", {GVAR(test_B) = _this}] call ace_common_fnc_addEventHandler;
GVAR(test_B) = -1;
["B", 33] call FUNC(globalEvent);
_expected = 33;
_result = GVAR(test_B);
TEST_DEFINED_AND_OP(_result,==,_expected,"Test globalEvent");
GVAR(test_B) = -1;
["B", 44] call FUNC(serverEvent);
_expected = if (isServer) then {44} else {-1};
_result = GVAR(test_B);
TEST_DEFINED_AND_OP(_result,==,_expected,"Test serverEvent");

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

@ -32,7 +32,6 @@ class CfgVehicles {
// ammo boxes
class ThingX;
class ReammoBox_F: ThingX {
XEH_ENABLED;
GVAR(canCarry) = 0;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;

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

@ -76,28 +76,3 @@ GVAR(ParsedTextCached) = [];
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
}] call EFUNC(common,addEventHandler);
//Debug to help end users identify mods that break CBA's XEH
[{
private _badClassnames = [];
{
//Only check Land objects (WeaponHolderSimulated show up in `vehicles` for some reason)
if ((_x isKindOf "Land") && {(isNil (format [QGVAR(Act_%1), typeOf _x])) || {isNil (format [QGVAR(SelfAct_%1), typeOf _x])}}) then {
if (!((typeOf _x) in _badClassnames)) then {
_badClassnames pushBack (typeOf _x);
ACE_LOGERROR_3("Compile checks bad for (classname: %1)(addon: %2) %3", (typeOf _x), (unitAddons (typeOf _x)), _x);
};
};
} forEach (allUnits + allDeadMen + vehicles);
if ((count _badClassnames) == 0) then {
ACE_LOGINFO("All compile checks passed");
} else {
ACE_LOGERROR_1("%1 Classnames failed compile check!!! (bad XEH / missing cba_enable_auto_xeh.pbo)", (count _badClassnames));
//Only show visual error if they are actually missing the pbo:
#define SUPMON configFile>>"CfgSettings">>"CBA">>"XEH">>"supportMonitor"
if ((!isNumber(SUPMON)) || {getNumber(SUPMON) != 1}) then {
["ACE Interaction failed to compile for some units (try adding cba_enable_auto_xeh.pbo)"] call BIS_fnc_error;
};
};
}, [], 5] call EFUNC(common,waitAndExecute); //ensure CBASupMon has time to run first

View File

@ -41,8 +41,8 @@ if ((GVAR(openedMenuType) == 0) && {vehicle ACE_player == ACE_player} && {isNull
if (_distanceToBasePoint > _distance) exitWith {true};
if ((_distanceToBasePoint > 1.5) && {!(_params select 4)}) exitWith {
// If distance to action is greater than 1.5 m and check isn't disabled in params, check LOS
if ((_distanceToBasePoint > 1.2) && {!(_params select 4)}) exitWith {
// If distance to action is greater than 1.2 m and check isn't disabled in params, check LOS
lineIntersects [AGLtoASL _headPos, AGLtoASL _pos, _object, ACE_player]
};
false

View File

@ -20,12 +20,10 @@
params ["", "", "_parameters"];
_parameters params ["_unit"];
private ["_varName", "_actionTrees", "_actions"];
private _varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit];
private _actionTrees = missionNamespace getVariable [_varName, []];
_varName = format [QEGVAR(interact_menu,Act_%1), typeOf _unit];
_actionTrees = missionNamespace getVariable [_varName, []];
_actions = [];
private _actions = [];
// Mount unit MainActions menu
{

View File

@ -23,12 +23,10 @@ private "_actions";
_actions = [];
{
private ["_unit", "_icon"];
_unit = _x;
private _unit = _x;
if (_unit != _player && {getText (configFile >> "CfgVehicles" >> typeOf _unit >> "simulation") != "UAVPilot"}) then {
_icon = [
private _icon = [
"",
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_driver_ca.paa",
"A3\ui_f\data\IGUI\RscIngameUI\RscUnitInfo\role_gunner_ca.paa",
@ -44,14 +42,27 @@ _actions = [];
format ["%1", _unit],
[_unit, true] call EFUNC(common,getName),
_icon,
{},
{
//statement (Run on hover) - reset the cache so we will insert actions immedietly when hovering over new unit
TRACE_2("Cleaning Cache",_target,vehicle _target);
[vehicle _target, QEGVAR(interact_menu,ATCache_ACE_SelfActions)] call EFUNC(common,eraseCache);
},
{true},
{_this call FUNC(addPassengerActions)},
[_unit]
] call EFUNC(interact_menu,createAction),
[],
_unit
];
{
if (EGVAR(interact_menu,selectedTarget) isEqualTo _target) then {
_this call FUNC(addPassengerActions)
} else {
[] //not selected, don't waste time on actions
};
},
[_unit],
{[0, 0, 0]},
2,
[false,false,false,true,false] //add run on hover (4th bit true)
] call EFUNC(interact_menu,createAction),
[],
_unit
];
};
false
} count crew _vehicle;

View File

@ -18,11 +18,11 @@
#include "script_component.hpp"
params ["_player", "_target", "_weapon"];
private ["_compatibleMags"];
if (!GVAR(enableMagazinePassing)) exitWith {false};
if (((vehicle _target) != _target) && {(vehicle _target) != (vehicle _player)}) exitWith {false};
_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines");
private _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines");
{
_x params ["_className", "", "_loaded"];
if ((_className in _compatibleMags) && {!_loaded} && {_target canAdd _className}) exitWith {true};

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

@ -651,12 +651,12 @@ class ACE_Medical_Advanced {
selectionSpecific = 0;
};
class vehiclecrash {
thresholds[] = {{0.25, 5}};
thresholds[] = {{0.25, 5}, {0.05, 1}};
selectionSpecific = 0;
lethalDamage = 0.2;
};
class backblast {
thresholds[] = {{0, 2},{0.55, 5}, {1, 6}};
thresholds[] = {{1, 6}, {0.55, 5}, {0, 2}};
selectionSpecific = 0;
lethalDamage = 1;
};

View File

@ -118,11 +118,49 @@ PREP(handleCreateLitter);
GVAR(injuredUnitCollection) = [];
GVAR(IVBags) = [];
DFUNC(handleDamage_assignWounds) = if ("ace_medical" callExtension "version" == "") then { DFUNC(handleDamage_woundsOld) } else { DFUNC(handleDamage_wounds)};
private _versionEx = "ace_medical" callExtension "version";
DFUNC(handleDamage_assignWounds) = if (_versionEx == "") then {
ACE_LOGINFO_1("Extension %1.dll not installed.","ace_medical");
DFUNC(handleDamage_woundsOld)
} else {
ACE_LOGINFO_2("Extension version: %1: %2","ace_medical",_versionEx);
DFUNC(handleDamage_wounds)
};
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

@ -26,8 +26,8 @@ private ["_damageThreshold", "_damageBodyPart", "_chanceFatal"];
params ["_unit", "_part", ["_withDamage", 0]];
if (!alive _unit) exitWith {true};
if (_part < 0 || _part > 5) exitWith {false};
if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitWith { true };
if (_part < 0 || _part > 5) exitWith {false};
// Find the correct Damage threshold for unit.
_damageThreshold = [1,1,1];

View File

@ -77,13 +77,15 @@ _minLethalDamage = if (_typeIndex >= 0) then {
0.01
};
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _shooter} && {_projectile == ""} && {_selection == ""}) then {
private _vehicle = vehicle _unit;
private _effectiveSelectionName = _selection;
if ((_vehicle != _unit) && {!(_vehicle isKindOf "StaticWeapon")} && {_shooter in [objNull, driver _vehicle, _vehicle]} && {_projectile == ""} && {_selection == ""}) then {
if (GVAR(enableVehicleCrashes)) then {
_selection = selectRandom GVAR(SELECTIONS);
_effectiveSelectionName = _this select 1; //pull random selection from HDC
};
};
if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then {
if ((_minLethalDamage <= _newDamage) && {[_unit, [_effectiveSelectionName] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)}) then {
if ((_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)])) exitwith {
_damageReturn = 0.9;
};
@ -99,13 +101,8 @@ if ((_minLethalDamage <= _newDamage) && {[_unit, [_selection] call FUNC(selectio
[_unit] call FUNC(addToInjuredCollection);
if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitWith {
if (vehicle _unit != _unit and {damage (vehicle _unit) >= 1}) then {
[_unit] call EFUNC(common,unloadPerson);
};
private "_delayedUnconsicous";
_delayedUnconsicous = false;
if (vehicle _unit != _unit and {damage (vehicle _unit) >= 1}) then {
private _delayedUnconsicous = false;
if (_vehicle != _unit and {damage _vehicle >= 1}) then {
[_unit] call EFUNC(common,unloadPerson);
_delayedUnconsicous = true;
};
@ -118,7 +115,7 @@ if (_unit getVariable [QGVAR(preventInstaDeath), GVAR(preventInstaDeath)]) exitW
if (_delayedUnconsicous) then {
[{
[_this select 0, true] call FUNC(setUnconscious);
}, [_unit], 0.7, 0] call EFUNC(common,waitAndExecute);
}, [_unit], 0.7] call EFUNC(common,waitAndExecute);
} else {
[{
[_this select 0, true] call FUNC(setUnconscious);

View File

@ -29,7 +29,8 @@ if (_hitPointIndex >= 0) then {_newDamage = _damage - (_unit getHitIndex _hitPoi
TRACE_7("ACE_DEBUG: HandleDamage_Caching Called",_unit, _selectionName, _damage, _source, _projectile,_hitPointIndex,_newDamage);
// Check for vehicle crash
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then {
private _vehicle = vehicle _unit;
if ((_vehicle != _unit) && {!(_vehicle isKindOf "StaticWeapon")} && {_source in [objNull, driver _vehicle, _vehicle]} && {_projectile == ""} && {_selectionName == ""}) then {
if (GVAR(enableVehicleCrashes)) then {
_selectionName = selectRandom _hitSelections;
_projectile = "vehiclecrash";
@ -40,7 +41,7 @@ if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")} && {isN
// Handle falling damage
_impactVelocity = (velocity _unit) select 2;
if (_impactVelocity < -5 && {vehicle _unit == _unit}) then {
if (_impactVelocity < -5 && {_vehicle == _unit}) then {
TRACE_1("Starting isFalling", time);
_unit setVariable [QGVAR(isFalling), true];
_unit setVariable [QGVAR(impactVelocity), _impactVelocity];

View File

@ -31,8 +31,8 @@ _painToAdd = 0;
_woundsCreated = [];
call compile _extensionOutput;
_foundIndex = -1;
{
_foundIndex = -1;
_toAddClassID = _x select 1;
_bodyPartNToAdd = _x select 2;
{

View File

@ -80,7 +80,7 @@ _painToAdd = 0;
_woundsCreated = [];
{
if (_x select 0 <= _damage) exitWith {
for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do {
for "_i" from 0 to ((_x select 1)-1) do {
// Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage]
_toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {selectRandom _allPossibleInjuries};

View File

@ -47,6 +47,12 @@ if (((_reviveVal == 1 && {[_unit] call EFUNC(common,isPlayer)} || _reviveVal ==
_args params ["_unit"];
_startTime = _unit getVariable [QGVAR(reviveStartTime), 0];
//If we are in reivie state in a blown up vehicle, try to unload so that people can access the body
if ((alive _unit) && {(vehicle _unit) != _unit} && {!alive (vehicle _unit)}) then {
TRACE_2("Unloading", _unit, vehicle _unit);
[_unit] call EFUNC(common,unloadPerson);
};
if (GVAR(maxReviveTime) > 0 && {ACE_time - _startTime > GVAR(maxReviveTime)}) exitwith {
[_idPFH] call CBA_fnc_removePerFrameHandler;
_unit setVariable [QGVAR(inReviveState), nil, true];

View File

@ -81,7 +81,7 @@ if ((GVAR(level) >= 2) && {([_target] call FUNC(hasMedicalEnabled))}) then {
} else {
//Basic Medical (just use blodyPartStatus):
private _damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];
_bloodLossOnSelection = _damageBodyParts select _partNumber
_bloodLossOnSelection = _damageBodyParts select _partNumber;
TRACE_1("basic",_bloodLossOnSelection);
};

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

@ -21,5 +21,6 @@ params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]];
private _nozzle = _unit getVariable [QGVAR(nozzle), objNull];
!(isNull _nozzle ||
{isEngineOn _target} ||
{(_target distance _unit) > REFUEL_ACTION_DISTANCE} ||
{!isNull (_target getVariable [QGVAR(nozzle), objNull])}) // TODO verify cant connect multiple fuel lines

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

@ -89,8 +89,8 @@ endif()
string(TIMESTAMP ACE_BUILDSTAMP "%Y-%m-%dT%H:%M:%SZ")
set(ACE_VERSION_MAJOR 3)
set(ACE_VERSION_MINOR 4)
set(ACE_VERSION_REVISION 1)
set(ACE_VERSION_MINOR 5)
set(ACE_VERSION_REVISION 0)
EXECUTE_PROCESS(COMMAND git rev-parse --verify HEAD
OUTPUT_VARIABLE T_ACE_VERSION_BUILD
OUTPUT_STRIP_TRAILING_WHITESPACE

View File

@ -109,10 +109,10 @@ namespace ace {
injuries::OpenWound newWound(woundID++, injuryToAdd->ID, bodyPartID, 1, injuryToAdd->bloodLoss, injuryToAdd->pain);
injuriesToAdd.push_back(newWound);
}
return injuriesToAdd;
}
++c;
}
return injuriesToAdd;
}
}
return injuriesToAdd;

View File

@ -76,6 +76,8 @@ signature_blacklist = ["ace_server.pbo"]
importantFiles = ["mod.cpp", "README.md", "docs\\README_DE.md", "docs\\README_PL.md", "AUTHORS.txt", "LICENSE", "logo_ace3_ca.paa"]
versionFiles = ["README.md", "docs\\README_DE.md", "docs\\README_PL.md", "mod.cpp"]
ciBuild = False # Used for CI builds
###############################################################################
# http://akiscode.com/articles/sha-1directoryhash.shtml
# Copyright (c) 2009 Stephen Akiki
@ -757,6 +759,7 @@ def main(argv):
global dssignfile
global prefix
global pbo_name_prefix
global ciBuild
if sys.platform != "win32":
print_error("Non-Windows platform (Cygwin?). Please re-run from cmd.")
@ -860,6 +863,10 @@ See the make.cfg file for additional build options.
else:
version_update = False
if "--ci" in argv:
argv.remove("--ci")
ciBuild = True
print_yellow("\nCheck external references is set to {}".format(str(check_external)))
# Get the directory the make script is in.
@ -949,7 +956,7 @@ See the make.cfg file for additional build options.
# See if we have been given specific modules to build from command line.
if len(argv) > 1 and not make_release_zip:
arg_modules = True
modules = argv[1:]
modules = [a for a in argv[1:] if a[0] != "-"]
# Find the tools we need.
try:
@ -1424,6 +1431,7 @@ See the make.cfg file for additional build options.
for failedModuleName in namesOfBuildsFailed:
print("- {} failed.".format(failedModuleName))
sys.exit(1)
else:
print_green("\Completed with 0 errors.")
@ -1432,4 +1440,8 @@ if __name__ == "__main__":
main(sys.argv)
d,h,m,s = Fract_Sec(timeit.default_timer() - start_time)
print("\nTotal Program time elapsed: {0:2}h {1:2}m {2:4.5f}s".format(h,m,s))
if ciBuild:
sys.exit(0)
input("Press Enter to continue...")