Merge branch 'master' of github.com:KoffeinFlummi/ACE3 into reflectionsDefaultOff

This commit is contained in:
esteldunedain 2016-02-18 12:18:51 -03:00
commit a8131f597a
123 changed files with 787 additions and 2087 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

@ -30,7 +30,7 @@ private _sounds = [
private _position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
playSound3D [
_sounds select floor random count _sounds,
selectRandom _sounds,
objNull,
false,
_position,

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

@ -16,7 +16,7 @@
params ["_unit", "_target", ["_exceptions", []]];
_exceptions = [_exceptions, {toLower _this}] call FUNC(map);
_exceptions = _exceptions apply {toLower _x};
private _owner = _target getVariable [QGVAR(owner), objNull];

View File

@ -21,8 +21,8 @@ ACE_LOGINFO_1("ACE is version %1.",_version);
//private _addons = activatedAddons; // broken with High-Command module, see #2134
private _addons = "true" configClasses (configFile >> "CfgPatches");//
_addons = [_addons, {toLower configName _this}] call FUNC(map);//
_addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
_addons = _addons apply {toLower configName _x};//
_addons = _addons select {_x find "ace_" == 0};
{
if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then {
@ -63,7 +63,7 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
///////////////
if (isMultiplayer) then {
// don't check optional addons
_addons = [_addons, {getNumber (configFile >> "CfgPatches" >> _this >> "ACE_isOptional") != 1}] call FUNC(filter);
_addons = _addons select {getNumber (configFile >> "CfgPatches" >> _x >> "ACE_isOptional") != 1};
if (isServer) then {
// send servers version of ACE to all clients

View File

@ -9,15 +9,16 @@
* Return Value:
* Final array
*
* Usage:
* [[0,1,2,3,4], {_this > 2}] call FUNC(filter) ==> [3,4]
*
* Public: Yes
*
* Deprecated
*/
#include "script_component.hpp"
params [["_array", [], [[]]], ["_code", {}, [{}]]];
ACE_DEPRECATED("ace_common_fnc_filter","3.7.0","select CODE");
private _result = [];
{

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

@ -16,4 +16,4 @@ params ["_name", "_cfgClass"];
private _classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass);
[_classes, {configName _this}] call FUNC(map) // return
_classes apply {configName _x} // return

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

@ -14,4 +14,4 @@
params [["_vehicle", objNull, [objNull]]];
[crew _vehicle, {getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "UAVPilot"}] call FUNC(filter) // return
crew _vehicle select {getText (configFile >> "CfgVehicles" >> typeOf _x >> "simulation") == "UAVPilot"} // return

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

@ -1,6 +1,6 @@
/*
* Author: KoffeinFlummi, commy2
* Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT.
* Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT. <- :kappa:
*
* Arguments:
* 0: Array to be thingied.
@ -9,15 +9,16 @@
* Return Value:
* Final array
*
* Usage:
* [["2", "gobblecock", "25"], {parseNumber _this}] call FUNC(map) ==> [2, 0, 25]
*
* Public: Yes
*
* Deprecated
*/
#include "script_component.hpp"
params [["_array", [], [[]]], ["_code", {}, [{}]]];
ACE_DEPRECATED("ace_common_fnc_map","3.7.0","apply");
// copy array to not alter the original one
_array = + _array;

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

@ -19,7 +19,7 @@ params [["_unit", objNull, [objNull]], ["_magazineType", "", [""]], ["_ammoCount
private _isRemoved = false;
// Check uniform
private _magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
private _magazines = magazinesAmmoCargo uniformContainer _unit select {_x select 0 == _magazineType};
private _index = _magazines find [_magazineType, _ammoCount];
if (_index > -1) exitWith {
@ -39,7 +39,7 @@ if (_index > -1) exitWith {
};
// Check vest
_magazines = [magazinesAmmoCargo vestContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
_magazines = magazinesAmmoCargo vestContainer _unit select {_x select 0 == _magazineType};
_index = _magazines find [_magazineType, _ammoCount];
if (_index > -1) exitWith {
@ -59,7 +59,7 @@ if (_index > -1) exitWith {
};
// Check backpack
_magazines = [magazinesAmmoCargo backpackContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter);
_magazines = magazinesAmmoCargo backpackContainer _unit select {_x select 0 == _magazineType};
_index = _magazines find [_magazineType, _ammoCount];
if (_index > -1) exitWith {

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

@ -19,16 +19,7 @@
params ["_unit"];
TRACE_1("params",_unit);
private ["_items", "_result", "_config"];
_items = (items _unit);
_result = [];
{
_config = ConfigFile >> "CfgWeapons" >> _x;
if (getNumber (_config >> QGVAR(Detonator)) == 1 && {!(_x in _result)}) then {
_result pushBack _x;
};
} forEach _items;
private _result = (items _unit) select {getNumber (ConfigFile >> "CfgWeapons" >> _x >> QGVAR(Detonator)) == 1};
_result = _result arrayIntersect _result;
_result

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

@ -43,10 +43,7 @@ private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret
} count _muzzles;
// Fix the `in` operator being case sensitive and BI fucking up the spelling of their own classnames
private _weaponMagazinesCheck = [];
{
_weaponMagazinesCheck pushBack (toLower _x);
} forEach _weaponMagazines;
private _weaponMagazinesCheck = _weaponMagazines apply {toLower _x};
// Another BIS fix: ShotBullet simulation uses weapon initSpeed, others ignore it
if (toLower _magazine in _weaponMagazinesCheck && {_bulletSimulation == "shotBullet"}) exitWith {

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

@ -289,6 +289,7 @@ class CfgVehicles {
icon = PATHTOF(UI\team\team_management_ca.paa);
};
};
class ACE_Equipment {
displayName = CSTRING(Equipment);
condition = QUOTE(true);

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

@ -21,10 +21,7 @@ params ["_player", "_target", "_weapon"];
private ["_compatibleMags", "_filteredMags", "_magToPass", "_magToPassIndex", "_playerName", "_magToPassDisplayName"];
_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines");
_filteredMags = [magazinesAmmoFull _player, {
params ["_className", "", "_loaded"];
_className in _compatibleMags && !_loaded
}] call EFUNC(common,filter);
_filteredMags = magazinesAmmoFull _player select {(_x select 0) in _compatibleMags && {!(_x select 2)}};
//select magazine with most ammo
_magToPass = _filteredMags select 0;

View File

@ -18,7 +18,7 @@ GVAR(Grenades_ItemList) = [];
} count getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles");
// make list case insensitive
GVAR(Grenades_ItemList) = [GVAR(Grenades_ItemList), {toLower _this}] call EFUNC(common,map);
GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) apply {toLower _x};
// filter duplicates
GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) arrayIntersect GVAR(Grenades_ItemList);
@ -41,8 +41,11 @@ GVAR(Medical_ItemList) = [];
("true" configClasses (configFile >> QEGVAR(Medical,Actions) >> "Advanced"))
);
// remove all numbers from list
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) select {_x isEqualType ""};
// make list case insensitive
GVAR(Medical_ItemList) = [GVAR(Medical_ItemList), {if (_this isEqualType "") then {toLower _this}}] call EFUNC(common,map);
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) apply {toLower _x};
// filter duplicates
GVAR(Medical_ItemList) = GVAR(Medical_ItemList) arrayIntersect GVAR(Medical_ItemList);

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

@ -16,15 +16,14 @@ if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then {
_groupsToDrawMarkers = [];
_playerSide = call EFUNC(common,playerSide);
if !(GVAR(BFT_HideAiGroups)) then {
_groupsToDrawMarkers = [allGroups, {side _this == _playerSide}] call EFUNC(common,filter);
} else {
_groupsToDrawMarkers = [allGroups, {
_anyPlayers = {
[_x] call EFUNC(common,isPlayer);
} count units _this;
(side _this == _playerSide) && _anyPlayers > 0
}] call EFUNC(common,filter);
_groupsToDrawMarkers = allGroups select {side _x == _playerSide};
if (GVAR(BFT_HideAiGroups)) then {
_groupsToDrawMarkers = _groupsToDrawMarkers select {
{
_x call EFUNC(common,isPlayer);
} count units _x > 0;
};
};
{

View File

@ -90,26 +90,21 @@ TRACE_1("Player is on foot or in an open vehicle","");
_lightLevel = _lightLevel max ([_unit, _x] call EFUNC(common,lightIntensityFromObject));
} forEach nearestObjects [_unit, ["All"], 40];
// @todo: Illumination flares (timed)
// Using chemlights
_nearObjects = [_unit nearObjects ["SmokeShell", 4], {
alive _this && {(typeOf _this == "Chemlight_red") || {
(typeOf _this == "Chemlight_green") || {
(typeOf _this == "Chemlight_blue") || {
(typeOf _this == "Chemlight_yellow")}}}}}] call EFUNC(common,filter);
_nearObjects = (_unit nearObjects ["SmokeShell", 4]) select {alive _x && {toLower typeOf _x in ["chemlight_red", "chemlight_green", "chemlight_blue", "chemlight_yellow"]}};
if (count (_nearObjects) > 0) then {
_light = _nearObjects select 0;
_ll = (1 - ((((_unit distance _light) - 2)/2) max 0)) * 0.4;
if (_ll > _lightLevel) then {
_flareTint = switch (typeOf _light) do {
case "Chemlight_red" : {[1,0,0,1]};
case "Chemlight_green" : {[0,1,0,1]};
case "Chemlight_blue" : {[0,0,1,1]};
case "Chemlight_yellow" : {[1,1,0,1]};
_flareTint = switch (toLower typeOf _light) do {
case "chemlight_red" : {[1,0,0,1]};
case "chemlight_green" : {[0,1,0,1]};
case "chemlight_blue" : {[0,0,1,1]};
case "chemlight_yellow" : {[1,1,0,1]};
};
_lightTint = [_lightTint, _flareTint, (_ll - _lightLevel)/(1 - _lightLevel)] call _fnc_blendColor;
_lightLevel = _ll;

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

@ -81,7 +81,7 @@ _createdLitter = [];
// Loop through through the litter options and place the litter
{
if (_x isEqualType [] && {(count _x > 0)}) then {
[_target, _x select (floor(random(count _x)))] call _createLitter;
[_target, selectRandom _x] call _createLitter;
};
if (_x isEqualType "") then {
[_target, _x] call _createLitter;

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 = GVAR(SELECTIONS) select (floor(random(count 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,9 +29,10 @@ 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 = _hitSelections select (floor(random(count _hitSelections)));
_selectionName = selectRandom _hitSelections;
_projectile = "vehiclecrash";
_this set [1, _selectionName];
_this set [4, _projectile];
@ -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];
@ -59,7 +60,7 @@ if (_unit getVariable [QGVAR(isFalling), false]) then {
};
} else {
if (_selectionName == "") then {
_selectionName = ["leg_l", "leg_r"] select (floor(random 2));
_selectionName = selectRandom ["leg_l", "leg_r"];
_this set [1, _selectionName];
};
_newDamage = _newDamage * 0.7;

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,10 +80,10 @@ _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 {_allPossibleInjuries select (floor(random (count _allPossibleInjuries)));};
_toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {selectRandom _allPossibleInjuries};
_toAddClassID = _toAddInjury select 0;
_foundIndex = -1;

View File

@ -59,12 +59,12 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith {
// Select the to be played sound based upon damage amount.
if (_pain > 0.5) then {
if (random(1) > 0.5) then {
_sound = _availableSounds_A select (round(random((count _availableSounds_A) - 1)));
_sound = selectRandom _availableSounds_A;
} else {
_sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1)));
_sound = selectRandom _availableSounds_B;
};
} else {
_sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1)));
_sound = selectRandom _availableSounds_B;
};
// Play the sound
playSound3D [(getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0) + ".wss", objNull, false, getPos _unit, 15, 1, 25]; // +2db, 15 meters.

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

@ -47,8 +47,7 @@ if !(_selection in _selections) exitWith {
_unit setHitPointDamage [_selection, _damage];
};
GVAR(unit) = _unit;
_damages = [_selections, {GVAR(unit) getHitPointDamage _this}] call EFUNC(common,map);
_damages = _selections apply {_unit getHitPointDamage _x};
_damageOld = damage _unit;
_damageSumOld = 0;

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

@ -108,7 +108,7 @@ if (_activated && local _logic) then {
// If no unit is to close to this position, we will play the sound.
if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then {
playSound3D [_ambianceSounds call BIS_fnc_selectRandom, objNull, false, _newPos, _volume, 1, 1000];
playSound3D [selectRandom _ambianceSounds, objNull, false, _newPos, _volume, 1, 1000];
_args set [8, ACE_time];
};
};

View File

@ -18,23 +18,19 @@
private["_roleImages", "_player", "_vehicle", "_type", "_config", "_text", "_data", "_isAir", "_turretUnits", "_turretRoles", "_index", "_roleType", "_unit", "_toShow"];
_player = ACE_player;
_vehicle = vehicle _player;
_type = typeOf _vehicle;
_config = configFile >> "CfgVehicles" >> _type;
_text = format["<t size='1.4'><img image='%1'></t> <t size='1.7' shadow='true'>%2</t><br/>", getText(_config>>"picture"), getText (_config >> "DisplayName")];
_data = [_type] call FUNC(getVehicleData);
_isAir = _data select 0;
_data = _data select 1;
_turretUnits = [_data, { _vehicle turretUnit (_x select 0) } ] call EFUNC(common,map);
_turretRoles = [_data, { _x select 1 } ] call EFUNC(common,map);
_turretUnits = _data apply {_vehicle turretUnit (_x select 0)};
_turretRoles = _data apply {_x select 1};
_roleType = CARGO;
_toShow = [];
@ -61,7 +57,6 @@ _toShow = [];
_toShow pushBack [_x, _roleType];
} forEach crew _vehicle;
_toShow = [
_toShow,
[],
@ -75,7 +70,6 @@ _toShow = [
}
] call BIS_fnc_sortBy;
_roleImages = ROLE_IMAGES;
{
_unit = _x select 0;
@ -83,7 +77,6 @@ _roleImages = ROLE_IMAGES;
_text = _text + format["<t size='1.5' shadow='true'>%1</t> <t size='1.3'><img image='%2'></t><br/>", [_unit] call EFUNC(common,getName), _roleImages select _roleType];
} forEach _toShow;
("ACE_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutRsc ["ACE_CrewInfo_dialog", "PLAIN", 1, false];
terminate (missionNamespace getVariable [QGVAR(hideCrewInfoHandle), scriptNull]);

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 +0,0 @@
z\ace\addons\ragdolls

View File

@ -1,12 +0,0 @@
ace_ragdolls
============
Tweaks the ragdoll behaviour to be more responsive to bullet impacts and explosions.
## Maintainers
The people responsible for merging changes to this component or answering potential questions.
- [KoffeinFlummi](https://github.com/KoffeinFlummi)
- [commy2](https://github.com/commy2)

View File

@ -1,801 +0,0 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"KoffeinFlummi", "Opticalsnare"};
authorUrl = "https://github.com/KoffeinFlummi/";
VERSION_CONFIG;
};
};
/*
* BASED ON OPTICALSNARE'S WORK
* He gave permission to use his code here:
* http://forums.bistudio.com/showthread.php?171771-Flying-bodies-Physics-Mod&p=2603042#post2603042
*/
class PhysXParams {
epeImpulseDamageCoef = 1320.0;
impulseForceRagdollCoef = 200;
impulseTorqueRagdollCoef = 100;
maxRagdollImpulseForceMagnitude = 500;
maxRagdollImpulseTorqueMagnitude = 150;
ragdollHitDmgLimit = "0.01f";
ragdollHitForceCoef = "20f";
ragdollHitTime = "0.05f";
ragdollOnCollideForceCoef = "20.0f";
ragdollOnCollideMassLimit = "0.0f";
ragdollOnCollideMaxForce = "25.0f";
ragdollOnCollideMaxOffset = "2.0f";
ragdollOnCollideMaxOffsetSpeed = "50.0f";
ragdollOnCollideSpeedLimit = "2500.0f";
ragdollOnCollideVehicleImpulseCoef = "0.5f";
ragdollUnconsciousSleepCoef = "0f";
ragdollUnderwaterBuoyancyCoef = 9.7;
ragdollUnderwaterResistanceCoef = 0.005;
ragdollVehicleCollision = 1;
};
class RagDollDefaultLimit {
value = 0;
restitution = 0.9;
hardness = 0.5;
};
class RagDollDefaultSpring {
enabled = 0;
value = 0.5;
damper = 1;
targetValue = 0;
};
class RagDollSphericalJoint {
class TwistLimitLow : RagDollDefaultLimit {};
class TwistLimitHigh : RagDollDefaultLimit {};
class SwingLimit : RagDollDefaultLimit {};
class TwistSpring : RagDollDefaultSpring {
enabled = 1;
};
class SwingSpring : RagDollDefaultSpring {
enabled = 1;
damper = 2;
};
class JointSpring : RagDollDefaultSpring {
enabled = 0;
};
type = "spherical";
enableCollision = 0;
projectionDistance = 0.05;
projectionMode = "point";
};
class RagDollRevoluteJoint {
class LimitLow : RagDollDefaultLimit {};
class LimitHigh : RagDollDefaultLimit {};
class Spring : RagDollDefaultSpring {
enabled = 0;
};
type = "revolute";
enableCollision = 0;
projectionDistance = 0.05;
projectionMode = "point";
};
class RagDollD6Joint_PX3 {
type = "D6";
enableCollision = 0;
projectionDistance = 0.05;
projectionMode = "point";
swingLimitY = "0.0f";
swingLimitZ = "0.0f";
swingSpring = "0.0f";
swingDamping = "0.0f";
swingRestitution = "0.6f";
swingContactDistance = "0.05f";
twistLimitLower = "0.0f";
twistLimitUpper = "0.0f";
twistSpring = "0.0f";
twistDamping = "0.0f";
twistRestitution = "0.6f";
twistContactDistance = "0.05f";
driveSpring = "20.0f";
driveDamping = "20.0f";
driveMaxForce = "1000000.0f";
driveUseAcceleration = 1;
driveLinearVelocity[] = {0, 0, 0};
driveAngularVelocity[] = {0, 0, 0};
};
class CfgRagDollSkeletons {
class BaseRagdoll {
primaryWeaponBone = "";
secondaryWeaponBone = "";
networkBonePrimary = "";
networkBoneSecondary = "";
weaponSleepLinearVelocity = 20;
weaponSleepAngularVelocity = 20;
weaponDropMinTime = 1.0;
weaponDropMaxTime = 100.0;
weaponDistanceLimit = "10f";
weaponDistanceLimitTime = "5.0f";
sleepLinearVelocity = 0.05;
sleepAngularVelocity = 0.05;
simulateMinTime = 30;
simulateMaxTime = 100.0;
simulateDistanceLimit = "0.05f";
simulateDistanceLimitTime = "5.0f";
recoveryBlendTime = "0.5f";
recoveryCosLimit = "0.3f";
recoveryDistLimit = "0.7f";
animBlendTime = "0.0f";
};
class Soldier : BaseRagdoll {
primaryWeaponBone = "weapon";
secondaryWeaponBone = "launcher";
networkBonePrimary = "chest";
networkBoneSecondary = "pelvis";
draggingMask = "dragging";
hitMask = "hit";
hitMaskUnderwater = "hitUnderwater";
class WeaponLinkBones {
class LinkBone1 {
bone = "leftHand";
canBeDropped = 1;
prefference = "1.0f";
};
class LinkBone2 {
bone = "rightHand";
canBeDropped = 1;
prefference = "2.0f";
};
class LinkBone3 {
bone = "chest";
canBeDropped = 1;
prefference = "1.0f";
};
};
class Masks {
class DraggingMask {
name = "dragging";
mask[] = {{"pelvis", 0, 1}, {"chest", 0, 1}, {"head", "0.6f", 0}, {"leftArm", 1, 0}, {"leftForeArm", 1, 0}, {"leftHand", 1, 0}, {"rightArm", 1, 0}, {"rightForeArm", 1, 0}, {"rightHand", 1, 0}, {"leftUpLeg", 1, 0}, {"leftLeg", 1, 0}, {"leftFoot", 1, 0}, {"rightUpLeg", 1, 0}, {"rightLeg", 1, 0}, {"rightFoot", 1, 0}, {"weapon", 0, 1}, {"launcher", 0, 1}};
};
class HitMask {
name = "hit";
mask[] = {{"pelvis", 1, 0}, {"chest", 1, 0}, {"head", 1, 0}, {"leftArm", 1, 0}, {"leftForeArm", 1, 0}, {"leftHand", 1, 0}, {"rightArm", 1, 0}, {"rightForeArm", 1, 0}, {"rightHand", 1, 0}, {"leftUpLeg", 1, 0}, {"leftLeg", 1, 0}, {"leftFoot", 1, 1}, {"rightUpLeg", 1, 0}, {"rightLeg", 1, 0}, {"rightFoot", 1, 1}, {"weapon", 1, 0}, {"launcher", 1, 0}};
};
class HitMaskUnderwater {
name = "hitUnderwater";
mask[] = {{"pelvis", 1, 1}, {"chest", 1, 1}, {"head", 1, 0}, {"leftArm", 1, 0}, {"leftForeArm", 1, 0}, {"leftHand", 1, 0}, {"rightArm", 1, 0}, {"rightForeArm", 1, 0}, {"rightHand", 1, 0}, {"leftUpLeg", 1, 0}, {"leftLeg", 1, 0}, {"leftFoot", 1, 0}, {"rightUpLeg", 1, 0}, {"rightLeg", 1, 0}, {"rightFoot", 1, 0}, {"weapon", 1, 0}, {"launcher", 1, 0}};
};
};
class BaseRagdollBone {
material = "Ragdoll";
childrenUseStartTrans = 1;
};
class Bones {
class Pelvis : BaseRagdollBone {
name = "pelvis";
type = "capsule";
startBone = "pelvis";
endBone = "spine2";
mass = 15;
radius = 0.12;
networkType = "root";
};
class Chest : BaseRagdollBone {
name = "chest";
type = "capsule";
startBone = "spine1";
endBone = "neck";
radius = 0.16;
mass = 15;
};
class Head : BaseRagdollBone {
name = "head";
type = "sphere";
startBone = "head";
mass = 8;
radius = 0.16;
};
class LeftArm : BaseRagdollBone {
name = "leftArm";
type = "capsule";
startBone = "leftArm";
endBone = "leftForeArm";
mass = 8;
};
class LeftForeArm : BaseRagdollBone {
name = "leftForeArm";
type = "capsule";
startBone = "leftForeArm";
endBone = "leftHand";
mass = 6;
};
class LeftHand : BaseRagdollBone {
name = "leftHand";
type = "sphere";
startBone = "leftHand";
mass = 6;
radius = 0.08;
childrenUseStartTrans = 0;
networkType = "leftHand";
};
class RightArm : BaseRagdollBone {
name = "rightArm";
type = "capsule";
startBone = "rightArm";
endBone = "rightForeArm";
mass = 8;
};
class RightForeArm : BaseRagdollBone {
name = "rightForeArm";
type = "capsule";
startBone = "rightForeArm";
endBone = "rightHand";
mass = 6;
};
class RightHand : BaseRagdollBone {
name = "rightHand";
type = "sphere";
startBone = "rightHand";
mass = 6;
radius = 0.08;
childrenUseStartTrans = 0;
networkType = "rightHand";
};
class LeftUpLeg : BaseRagdollBone {
name = "leftUpLeg";
type = "capsule";
startBone = "leftUpLeg";
endBone = "leftLeg";
mass = 15;
};
class LeftLeg : BaseRagdollBone {
name = "leftLeg";
type = "capsule";
startBone = "leftLeg";
endBone = "leftFoot";
mass = 10;
};
class LeftFoot : BaseRagdollBone {
name = "leftFoot";
type = "box";
startBone = "leftFoot";
size[] = {0.15, 0.035, 0.07};
mass = 8;
networkType = "leftFoot";
};
class RightUpLeg : BaseRagdollBone {
name = "rightUpLeg";
type = "capsule";
startBone = "rightUpLeg";
endBone = "rightLeg";
mass = 15;
};
class RightLeg : BaseRagdollBone {
name = "rightLeg";
type = "capsule";
startBone = "rightLeg";
endBone = "rightFoot";
mass = 10;
};
class RightFoot : BaseRagdollBone {
name = "rightFoot";
type = "box";
startBone = "rightFoot";
size[] = {0.15, 0.035, 0.07};
mass = 8;
networkType = "rightFoot";
};
class Weapon : BaseRagdollBone {
name = "weapon";
type = "weapon";
startBone = "weapon";
endPosRelToStart[] = {0.0, 1.0, 0.0};
mass = 3;
};
class Launcher : BaseRagdollBone {
name = "launcher";
type = "weapon";
startBone = "launcher";
endPosRelToStart[] = {1.0, 0.0, 0.0};
mass = 3;
};
};
class JointsPX2 {
class Pelvis_Chest_PX2 : RagDollSphericalJoint {
name = "pelvis_chest";
bone1 = "pelvis";
bone2 = "chest";
axis[] = {0, 1, 0.3};
class SwingLimit : SwingLimit {
value = 25;
};
class TwistLimitLow : TwistLimitLow {
value = -15;
};
class TwistLimitHigh : TwistLimitHigh {
value = 25;
};
};
class Chest_Head_PX2 : RagDollSphericalJoint {
name = "chest_head";
bone1 = "chest";
bone2 = "head";
class SwingLimit : SwingLimit {
value = 20;
};
class TwistLimitLow : TwistLimitLow {
value = -15;
};
class TwistLimitHigh : TwistLimitHigh {
value = 15;
};
};
class Chest_LeftArm_PX2 : RagDollSphericalJoint {
name = "chest_leftArm";
bone1 = "chest";
bone2 = "leftArm";
axis[] = {-1, 0.0, 0.5};
enableCollision = 1;
class SwingLimit : SwingLimit {
value = 60;
};
class TwistLimitLow : TwistLimitLow {
value = -20;
};
class TwistLimitHigh : TwistLimitHigh {
value = 20;
};
};
class LeftArm_LeftForeArm_PX2 : RagDollRevoluteJoint {
name = "leftArm_leftForeArm";
bone1 = "leftArm";
bone2 = "leftForeArm";
axis[] = {1, -1, 0.2};
class LimitLow : LimitLow {
value = -2;
};
class LimitHigh : LimitHigh {
value = 60;
};
};
class LeftForeArm_LeftHand_PX2 : RagDollSphericalJoint {
name = "leftForeArm_leftHand";
bone1 = "leftForeArm";
bone2 = "leftHand";
class SwingLimit : SwingLimit {
value = 20;
};
class TwistLimitLow : TwistLimitLow {
value = -5;
};
class TwistLimitHigh : TwistLimitHigh {
value = 5;
};
};
class Chest_RightArm_PX2 : RagDollSphericalJoint {
name = "chest_rightArm";
bone1 = "chest";
bone2 = "rightArm";
axis[] = {1, 0.0, 0.5};
enableCollision = 1;
class SwingLimit : SwingLimit {
value = 60;
};
class TwistLimitLow : TwistLimitLow {
value = -20;
};
class TwistLimitHigh : TwistLimitHigh {
value = 20;
};
};
class RightArm_RightForeArm_PX2 : RagDollRevoluteJoint {
name = "rightArm_rightForeArm";
bone1 = "rightArm";
bone2 = "rightForeArm";
axis[] = {1, 1, -0.2};
class LimitLow : LimitLow {
value = -2;
};
class LimitHigh : LimitHigh {
value = 60;
};
};
class RightForeArm_RightHand_PX2 : RagDollSphericalJoint {
name = "rightForeArm_rightHand";
bone1 = "rightForeArm";
bone2 = "rightHand";
class SwingLimit : SwingLimit {
value = 20;
};
class TwistLimitLow : TwistLimitLow {
value = -5;
};
class TwistLimitHigh : TwistLimitHigh {
value = 5;
};
};
class Pelvis_LeftUpLeg_PX2 : RagDollSphericalJoint {
name = "pelvis_leftUpLeg";
bone1 = "pelvis";
bone2 = "leftUpLeg";
axis[] = {-1.5, -1.1, 2};
enableCollision = 1;
class SwingLimit : SwingLimit {
value = 45;
};
class TwistLimitLow : TwistLimitLow {
value = -10;
};
class TwistLimitHigh : TwistLimitHigh {
value = 20;
};
};
class LeftUpLeg_LeftLeg_PX2 : RagDollRevoluteJoint {
name = "leftUpLeg_leftLeg";
bone1 = "leftUpLeg";
bone2 = "leftLeg";
axis[] = {-1, 0, 0};
class LimitLow : LimitLow {
value = -5;
};
class LimitHigh : LimitHigh {
value = 110;
};
};
class LeftLeg_LeftFoot_PX2 : RagDollRevoluteJoint {
name = "leftLeg_leftFoot";
bone1 = "leftLeg";
bone2 = "leftFoot";
axis[] = {-1, 0, 0};
class LimitLow : LimitLow {
value = -15;
};
class LimitHigh : LimitHigh {
value = 45;
};
};
class Pelvis_RightUpLeg_PX2 : RagDollSphericalJoint {
name = "pelvis_rightUpLeg";
bone1 = "pelvis";
bone2 = "rightUpLeg";
axis[] = {1.5, -1.1, 2};
enableCollision = 1;
class SwingLimit : SwingLimit {
value = 45;
};
class TwistLimitLow : TwistLimitLow {
value = -10;
};
class TwistLimitHigh : TwistLimitHigh {
value = 20;
};
};
class RightUpLeg_RightLeg_PX2 : RagDollRevoluteJoint {
name = "rightUpLeg_rightLeg";
bone1 = "rightUpLeg";
bone2 = "rightLeg";
axis[] = {-1, 0, 0};
class LimitLow : LimitLow {
value = -5;
};
class LimitHigh : LimitHigh {
value = 110;
};
};
class RightLeg_RightFoot_PX2 : RagDollRevoluteJoint {
name = "rightLeg_rightFoot";
bone1 = "rightLeg";
bone2 = "rightFoot";
axis[] = {-1, 0, 0};
class LimitLow : LimitLow {
value = -15;
};
class LimitHigh : LimitHigh {
value = 45;
};
};
};
class JointsPX3 {
class Pelvis_Chest_PX3 : RagDollD6Joint_PX3 {
name = "pelvis_chest";
bone1 = "pelvis";
bone2 = "chest";
axis[] = {0, 1, 0.3};
enableCollision = 0;
swingLimitY = 30;
swingLimitZ = 30;
twistLimitLower = -25;
twistLimitUpper = 25;
driveSpring = 30;
driveDamping = 30;
driveSpringWater = 5;
driveDampingWater = 5;
};
class Chest_Head_PX3 : RagDollD6Joint_PX3 {
name = "chest_head";
bone1 = "chest";
bone2 = "head";
swingLimitY = 45;
swingLimitZ = 45;
twistLimitLower = -40;
twistLimitUpper = 40;
driveSpring = 15.0;
driveDamping = 30;
driveSpringWater = 1.5;
driveDampingWater = 3.0;
twistSpring = 15.0;
twistDamping = 30.0;
};
class Chest_LeftArm_PX3 : RagDollD6Joint_PX3 {
name = "chest_leftArm";
bone1 = "chest";
bone2 = "leftArm";
enableCollision = 1;
swingLimitY = 85;
swingLimitZ = 85;
twistLimitLower = -60;
twistLimitUpper = 60;
driveSpring = 30;
driveDamping = 30;
driveSpringWater = 3;
driveDampingWater = 3;
};
class LeftArm_LeftForeArm_PX3 : RagDollD6Joint_PX3 {
name = "leftArm_leftForeArm";
bone1 = "leftArm";
bone2 = "leftForeArm";
axis[] = {-1, 1, -0.2};
swingLimitY = 10;
swingLimitZ = 10;
twistLimitLower = -5;
twistLimitUpper = 150;
driveSpring = 10;
driveDamping = 10;
driveSpringWater = 1;
driveDampingWater = 1;
};
class LeftForeArm_LeftHand_PX3 : RagDollD6Joint_PX3 {
name = "leftForeArm_leftHand";
bone1 = "leftForeArm";
bone2 = "leftHand";
swingLimitY = 10;
swingLimitZ = 10;
twistLimitLower = -20;
twistLimitUpper = 20;
driveSpring = 10;
driveDamping = 10;
driveSpringWater = 1;
driveDampingWater = 1;
};
class Chest_RightArm_PX3 : RagDollD6Joint_PX3 {
name = "chest_rightArm";
bone1 = "chest";
bone2 = "rightArm";
enableCollision = 1;
swingLimitY = 85;
swingLimitZ = 85;
twistLimitLower = -60;
twistLimitUpper = 60;
driveSpring = 30;
driveDamping = 30;
driveSpringWater = 3;
driveDampingWater = 3;
};
class RightArm_RightForeArm_PX3 : RagDollD6Joint_PX3 {
name = "rightArm_rightForeArm";
bone1 = "rightArm";
bone2 = "rightForeArm";
axis[] = {-1, -1, 0.2};
swingLimitY = 10;
swingLimitZ = 10;
twistLimitLower = -5;
twistLimitUpper = 150;
driveSpring = 10;
driveDamping = 10;
driveSpringWater = 1;
driveDampingWater = 1;
};
class RightForeArm_RightHand_PX3 : RagDollD6Joint_PX3 {
name = "rightForeArm_rightHand";
bone1 = "rightForeArm";
bone2 = "rightHand";
swingLimitY = 10;
swingLimitZ = 10;
twistLimitLower = -20;
twistLimitUpper = 20;
driveSpring = 10;
driveDamping = 10;
driveSpringWater = 1;
driveDampingWater = 1;
};
class Pelvis_LeftUpLeg_PX3 : RagDollD6Joint_PX3 {
name = "pelvis_leftUpLeg";
bone1 = "pelvis";
bone2 = "leftUpLeg";
enableCollision = 1;
swingLimitY = 35;
swingLimitZ = 35;
twistLimitLower = -10;
twistLimitUpper = 60;
driveSpring = 30;
driveDamping = 30;
driveSpringWater = 3;
driveDampingWater = 3;
twistDamping = 30.0;
};
class LeftUpLeg_LeftLeg_PX3 : RagDollD6Joint_PX3 {
name = "leftUpLeg_leftLeg";
bone1 = "leftUpLeg";
bone2 = "leftLeg";
axis[] = {1, 0, 0};
swingLimitY = 10;
swingLimitZ = 10;
twistLimitLower = -5;
twistLimitUpper = 120;
driveSpring = 20;
driveDamping = 20;
driveSpringWater = 2;
driveDampingWater = 2;
};
class LeftLeg_LeftFoot_PX3 : RagDollD6Joint_PX3 {
name = "leftLeg_leftFoot";
bone1 = "leftLeg";
bone2 = "leftFoot";
axis[] = {1, 0, 0};
swingLimitY = 10;
swingLimitZ = 10;
twistLimitLower = -15;
twistLimitUpper = 45;
driveSpring = 20;
driveDamping = 20;
driveSpringWater = 2;
driveDampingWater = 2;
};
class Pelvis_RightUpLeg_PX3 : RagDollD6Joint_PX3 {
name = "pelvis_rightUpLeg";
bone1 = "pelvis";
bone2 = "rightUpLeg";
enableCollision = 1;
swingLimitY = 35;
swingLimitZ = 35;
twistLimitLower = -10;
twistLimitUpper = 60;
driveSpring = 30;
driveDamping = 30;
driveSpringWater = 3;
driveDampingWater = 3;
twistDamping = 30.0;
};
class RightUpLeg_RightLeg_PX3 : RagDollD6Joint_PX3 {
name = "rightUpLeg_rightLeg";
bone1 = "rightUpLeg";
bone2 = "rightLeg";
axis[] = {1, 0, 0};
swingLimitY = 10;
swingLimitZ = 10;
twistLimitLower = -5;
twistLimitUpper = 120;
driveSpring = 20;
driveDamping = 20;
driveSpringWater = 2;
driveDampingWater = 2;
};
class RightLeg_RightFoot_PX3 : RagDollD6Joint_PX3 {
name = "rightLeg_rightFoot";
bone1 = "rightLeg";
bone2 = "rightFoot";
axis[] = {1, 0, 0};
swingLimitY = 10;
swingLimitZ = 10;
twistLimitLower = -15;
twistLimitUpper = 45;
driveSpring = 20;
driveDamping = 20;
driveSpringWater = 2;
driveDampingWater = 2;
};
};
};
};

View File

@ -1,17 +0,0 @@
#define COMPONENT ragdolls
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_RAGDOLLS
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_RAGDOLLS
#define DEBUG_SETTINGS DEBUG_SETTINGS_RAGDOLLS
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -170,7 +170,7 @@ class CfgVehicles {
// wheeled apcs
class B_APC_Wheeled_01_base_F;
class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F {
displayName = CSTRING(APC_Wheeled_cannon_Name);
displayName = CSTRING(APC_Wheeled_01_cannon_Name);
};
class O_APC_Wheeled_02_base_F;

View File

@ -527,10 +527,10 @@ class CfgWeapons {
};
// class ACE_LMG_coax_PKT_mem2: LMG_coax {};
class ACE_LMG_coax_MAG58_mem2: LMG_coax {
displayName = "MAG 58";
displayName = "MAG 58M";
};
class ACE_LMG_coax_MAG58_mem3: LMG_coax {
displayName = "MAG 58";
displayName = "MAG 58M";
};
class ACE_LMG_coax_L94A1_mem3: LMG_coax {
displayName = "L94A1";

View File

@ -229,17 +229,17 @@
<Hungarian>Bardelas</Hungarian>
<Italian>Bardelas</Italian>
</Key>
<Key ID="STR_ACE_RealisticNames_APC_Wheeled_cannon_Name">
<English>Patria AMV</English>
<German>Patria AMV</German>
<Spanish>Patria AMV</Spanish>
<Polish>Patria AMV</Polish>
<Czech>Patria AMV</Czech>
<French>Patria AMV</French>
<Russian>Patria AMV</Russian>
<Portuguese>Patria AMV</Portuguese>
<Hungarian>Patria AMV</Hungarian>
<Italian>Patria AMV</Italian>
<Key ID="STR_ACE_RealisticNames_APC_Wheeled_01_cannon_Name">
<English>Badger IFV</English>
<German>SPz Badger</German>
<Spanish>Badger IFV</Spanish>
<Polish>Badger IFV</Polish>
<Czech>Badger IFV</Czech>
<French>Badger IFV</French>
<Russian>БМП Badger</Russian>
<Portuguese>Badger IFV</Portuguese>
<Hungarian>Badger IFV</Hungarian>
<Italian>Badger IFV</Italian>
</Key>
<Key ID="STR_ACE_RealisticNames_APC_Tracked_01_CRV_Name">
<English>Nemmera</English>

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

@ -32,6 +32,6 @@ private _maxAmmo = 0;
{
_maxAmmo = _maxAmmo max (_x select 1);
} forEach ([magazinesAmmo _player, {_this select 0 == _magazineType}] call EFUNC(common,filter));
} forEach (magazinesAmmo _player select {_x select 0 == _magazineType});
_maxAmmo > 0

View File

@ -32,7 +32,7 @@ private _maxAmmo = 0;
{
_maxAmmo = _maxAmmo max (_x select 1);
} forEach ([magazinesAmmo _player, {_this select 0 == _magazineType}] call EFUNC(common,filter));
} forEach (magazinesAmmo _player select {_x select 0 == _magazineType});
if (_maxAmmo == 0) exitWith {};

View File

@ -22,7 +22,7 @@ private "_magazines";
_magazines = magazines _unit;
// case sensitvity
_magazines = [_magazines, {toLower _this}] call EFUNC(common,map);
_magazines = _magazines apply {toLower _x};
// get reloaders magazine types compatible with targets launcher. No duplicates.
[getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"), {toLower _this in _magazines}] call EFUNC(common,filter)
getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select {toLower _x in _magazines} // return

Some files were not shown because too many files have changed in this diff Show More