From 8f0c6f7a1fd4a012a5c2770d9baf06370eccca74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 25 Jan 2015 00:56:23 -0300 Subject: [PATCH 001/113] common: function for drawing debug lines --- addons/common/XEH_preInit.sqf | 2 + .../functions/fnc_addLineToDebugDraw.sqf | 48 +++++++++++++++++++ .../fnc_createOrthonormalReference.sqf | 21 ++++++++ 3 files changed, 71 insertions(+) create mode 100644 addons/common/functions/fnc_addLineToDebugDraw.sqf create mode 100644 addons/common/functions/fnc_createOrthonormalReference.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index f33b3c47fe..498321b857 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -6,6 +6,7 @@ PREP(addActionEventHandler); PREP(addActionMenuEventHandler); PREP(addCameraEventHandler); PREP(addCustomEventHandler); +PREP(addLineToDebugDraw); PREP(addMapMarkerCreatedEventHandler); PREP(addScrollWheelEventHandler); PREP(adminKick); @@ -24,6 +25,7 @@ PREP(closeDialogIfTargetMoves); PREP(codeToLetter); PREP(codeToString); PREP(convertKeyCode); +PREP(createOrthonormalReference); PREP(currentChannel); PREP(disableUserInput); PREP(displayText); diff --git a/addons/common/functions/fnc_addLineToDebugDraw.sqf b/addons/common/functions/fnc_addLineToDebugDraw.sqf new file mode 100644 index 0000000000..cfe45359c9 --- /dev/null +++ b/addons/common/functions/fnc_addLineToDebugDraw.sqf @@ -0,0 +1,48 @@ +/* + * Author: CAA-Picard + * + * Add line to draw on debug + * + * Argument: + * 0: Start point ASL (Array) + * 1: End point ASL (Array) + * 2: Color (Array) + * + * Return value: + * + */ +#include "script_component.hpp" + +if (isNil QGVAR(debugLines)) then { + GVAR(debugLines) = []; + GVAR(debugLinesIndex) = 0; +}; + +if (count GVAR(debugLines) < 100) then { + GVAR(debugLines) pushBack _this; + GVAR(debugLinesIndex) = 0; +} else { + GVAR(debugLines) set [GVAR(debugLinesIndex), _this]; + GVAR(debugLinesIndex) = (GVAR(debugLinesIndex) + 1) mod 100; +}; + +if (isNil QGVAR(debugDrawHandler)) then { + GVAR(debugDrawHandler) = addMissionEventHandler ["Draw3D", { + if (count GVAR(debugLines) == 0) exitWith { + removeMissionEventHandler GVAR(debugDrawHandler); + GVAR(debugDrawHandler) = nil; + }; + + { + _p0 = _x select 0; + if (!surfaceIsWater _p0) then { + _p0 = ASLtoATL _p0; + }; + _p1 = _x select 1; + if (!surfaceIsWater _p1) then { + _p1 = ASLtoATL _p1; + }; + drawLine3D [_p0, _p1, _x select 2]; + } forEach GVAR(debugLines); + }]; +}; \ No newline at end of file diff --git a/addons/common/functions/fnc_createOrthonormalReference.sqf b/addons/common/functions/fnc_createOrthonormalReference.sqf new file mode 100644 index 0000000000..a92464a7f3 --- /dev/null +++ b/addons/common/functions/fnc_createOrthonormalReference.sqf @@ -0,0 +1,21 @@ +/* + * Author: CAA-Picard + * + * Returns a orthonormal system of reference aligned with the supplied vector + * + * Argument: + * Vector to align the coordinate system with (Array) + * + * Return value: + * 0: v1 (Array) + * 1: v2 (Array) + * 2: v3 (Array) + */ +#include "script_component.hpp" + +private ["_v1","_v2","_v3"]; +_v1 = vectorNormalized _this; +_v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]); +_v3 = _v2 vectorCrossProduct _v1; + +[_v1,_v2,_v3] From 8d1ee8c2c2989241ee39b886c04f09728bb79c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 25 Jan 2015 00:59:20 -0300 Subject: [PATCH 002/113] backblast: overhaul - Replace firedNear by firedBIS XEH - Calculate the origin of the backblast and overpressure zones using the projectile position and direction - Handle all effects for each unit on their local machine - Posibility of drawing effect cone for debug - Simplified angle calculations --- addons/backblast/CfgEventHandlers.hpp | 14 ++- addons/backblast/XEH_postInit.sqf | 4 + addons/backblast/XEH_preInit.sqf | 6 +- .../functions/fnc_backblastDamage.sqf | 67 ++++++++++++++ .../functions/fnc_fireLauncherBackblast.sqf | 91 +++++++++++++++++++ .../functions/fnc_fireOverpressureZone.sqf | 65 +++++++++++++ .../backblast/functions/fnc_getDistance.sqf | 45 +++++---- .../functions/fnc_launcherBackblast.sqf | 72 --------------- .../functions/fnc_overpressureDamage.sqf | 65 +++++++++++++ .../functions/fnc_tankDangerZone.sqf | 54 ----------- 10 files changed, 334 insertions(+), 149 deletions(-) create mode 100644 addons/backblast/XEH_postInit.sqf create mode 100644 addons/backblast/functions/fnc_backblastDamage.sqf create mode 100644 addons/backblast/functions/fnc_fireLauncherBackblast.sqf create mode 100644 addons/backblast/functions/fnc_fireOverpressureZone.sqf delete mode 100644 addons/backblast/functions/fnc_launcherBackblast.sqf create mode 100644 addons/backblast/functions/fnc_overpressureDamage.sqf delete mode 100644 addons/backblast/functions/fnc_tankDangerZone.sqf diff --git a/addons/backblast/CfgEventHandlers.hpp b/addons/backblast/CfgEventHandlers.hpp index a336a5dd41..979a683aeb 100644 --- a/addons/backblast/CfgEventHandlers.hpp +++ b/addons/backblast/CfgEventHandlers.hpp @@ -5,13 +5,21 @@ class Extended_PreInit_EventHandlers { }; }; -class Extended_FiredNear_EventHandlers { +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit) ); + }; +}; + +class Extended_FiredBIS_EventHandlers { class CAManBase { class GVAR(LauncherBackblast) { - FiredNear = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_Backblast_Damage') > 0}) then {_this call FUNC(launcherBackblast)} ); + firedBIS = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Backblast_Damage') > 0}) then {_this call FUNC(fireLauncherBackblast)} ); }; + }; + class AllVehicles { class GVAR(TankDangerZone) { - FiredNear = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_DangerZone_Damage') > 0}) then {_this call FUNC(tankDangerZone)} ); + firedBIS = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_DangerZone_Damage') > 0}) then {_this call FUNC(fireOverpressureZone)} ); }; }; }; diff --git a/addons/backblast/XEH_postInit.sqf b/addons/backblast/XEH_postInit.sqf new file mode 100644 index 0000000000..72ca42a012 --- /dev/null +++ b/addons/backblast/XEH_postInit.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +["backblast", FUNC(backblastDamage)] call EFUNC(common,addEventHandler); +["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler); diff --git a/addons/backblast/XEH_preInit.sqf b/addons/backblast/XEH_preInit.sqf index 1becf28c05..1927bc850b 100644 --- a/addons/backblast/XEH_preInit.sqf +++ b/addons/backblast/XEH_preInit.sqf @@ -1,5 +1,7 @@ #include "script_component.hpp" +PREP(backblastDamage); +PREP(fireLauncherBackblast); +PREP(fireOverpressureZone); PREP(getDistance); -PREP(launcherBackblast); -PREP(tankDangerZone); +PREP(overpressureDamage); diff --git a/addons/backblast/functions/fnc_backblastDamage.sqf b/addons/backblast/functions/fnc_backblastDamage.sqf new file mode 100644 index 0000000000..21d2e81736 --- /dev/null +++ b/addons/backblast/functions/fnc_backblastDamage.sqf @@ -0,0 +1,67 @@ +/* + * Author: Commy2 and CAA-Picard + * + * Calculate and apply backblast damage to potentially affected local units + * + * Argument: + * 0: Unit that fired (Object) + * 1: Pos ASL of the projectile (Array) + * 2: Direction of the projectile (Array) + * 3: Weapon fired (String) + * + * Return value: + * None + */ +#include "script_component.hpp" + +EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); + +private ["_backblastAngle","_backblastRange","_backblastDamage"]; +_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Angle") / 2; +_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Range"); +_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Damage"); +TRACE_4("Parameters:",_backblastAngle,_backblastRange,_backblastDamage,_weapon); + +_pos = _posASL; +if (!surfaceIsWater _pos) then { + _pos = ASLtoATL _pos; +}; + +_affected = _pos nearEntities ["CAManBase", _backblastRange]; +{ + _unit = _x; + if (local _unit && _unit != _firer && vehicle _unit == _unit) then { + + _targetPositionASL = eyePos _unit; + _relativePosition = _targetPositionASL vectorDiff _posASL; + _axisDistance = _relativePosition vectorDotProduct _direction; + _distance = vectorMagnitude _relativePosition; + _angle = acos (_axisDistance / _distance); + + _line = [_posASL, _targetPositionASL, _firer, _unit]; + _line2 = [_posASL, _targetPositionASL]; + TRACE_4("Affected:",_unit,_axisDistance,_distance,_angle); + if (_angle < _backblastAngle && {_distance < _backblastRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { + _alpha = sqrt (1 - _distance / _backblastRange); + _beta = sqrt (1 - _angle / _backblastAngle); + + _damage = 2 * _alpha * _beta * _backblastDamage; + + // If the target is the ACE_player + if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; + + // TODO: Sort this interaction with medical + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { + [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + _unit spawn { + sleep 0.5; + [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); + }; + } else { + _unit setDamage (damage _unit + _damage); + }; + }; + }; +} forEach _affected; + + diff --git a/addons/backblast/functions/fnc_fireLauncherBackblast.sqf b/addons/backblast/functions/fnc_fireLauncherBackblast.sqf new file mode 100644 index 0000000000..5970e7b9c2 --- /dev/null +++ b/addons/backblast/functions/fnc_fireLauncherBackblast.sqf @@ -0,0 +1,91 @@ +/* + * Author: Commy2 and CAA-Picard + * + * Handle fire of local launchers + * + * Argument: + * 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 + */ +//#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +// Prevent AI from causing backblast damage +if !([_firer] call EFUNC(common,isPlayer)) exitWith {}; + +private ["_position","_direction","_distance","_alpha","_beta","_damage","_affected"]; +_position = getPosASL _projectile; +_direction = [0, 0, 0] vectorDiff (vectorDir _projectile); + +private ["_backblastAngle","_backblastRange","_backblastDamage"]; +_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Angle") / 2; +_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Range"); +_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Damage"); + + +// Damage to others +_affected = getPos _projectile nearEntities ["CAManBase", _backblastRange]; +// Let each client handle their own affected units +["backblast", _affected, [_firer,_position,_direction,_weapon]] call EFUNC(common,targetEvent); + + +// Damage to the firer +_distance = [_position, _direction, _backblastRange] call FUNC(getDistance); +TRACE_1("Distance", _distance); + +if (_distance < _backblastRange) then { + + _alpha = sqrt (1 - _distance / _backblastRange); + _beta = sqrt 0.5; + + _damage = 2 * _alpha * _beta * _backblastDamage; + [_damage * 100] call BIS_fnc_bloodEffect; + + // TODO: Sort this interaction with medical + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { + [_firer, "HitBody", ([_firer, "", ((_firer getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + } 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); + + _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 min _backblastRange)), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); +#endif \ No newline at end of file diff --git a/addons/backblast/functions/fnc_fireOverpressureZone.sqf b/addons/backblast/functions/fnc_fireOverpressureZone.sqf new file mode 100644 index 0000000000..c638f4ad82 --- /dev/null +++ b/addons/backblast/functions/fnc_fireOverpressureZone.sqf @@ -0,0 +1,65 @@ +/* + * Author: Commy2 and CAA-Picard + * + * Handle fire of local vehicle weapons creating overpressure zones + * + * Argument: + * 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 + *///#define DEBUG_MODE_FULL +#include "script_component.hpp" + +EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); + +// Prevent AI from causing backblast damage +if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; + +private ["_position","_direction","_distance","_alpha","_beta","_damage","_affected"]; +_position = getPosASL _projectile; +_direction = vectorDir _projectile; + +private ["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; +_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Angle") / 2; +_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Range"); +_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Damage"); + + +// Damage to others +_affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; +// Let each client handle their own affected units +["overpressure", _affected, [_firer,_position,_direction,_weapon]] 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); + + _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 \ No newline at end of file diff --git a/addons/backblast/functions/fnc_getDistance.sqf b/addons/backblast/functions/fnc_getDistance.sqf index 83b290e2b0..b6f61548c6 100644 --- a/addons/backblast/functions/fnc_getDistance.sqf +++ b/addons/backblast/functions/fnc_getDistance.sqf @@ -1,31 +1,40 @@ -// by commy2 +/* + * Author: Commy2 and CAA-Picard + * + * Calculate the distance to the first intersection of a line + * + * Argument: + * 0: Pos ASL of origin (Array) + * 1: Direction (Array) + * 2: Max distance to search (Number) + * + * Return value: + * Distance to intersection (+- 0.1 m) + */ #include "script_component.hpp" -private ["_position", "_direction", "_maxDistance", "_distance", "_iteration", "_laser", "_line"]; +private ["_distance", "_interval", "_line", "_line"]; -_position = + _this select 0; -_direction = + _this select 1; -_maxDistance = _this select 2; +EXPLODE_3_PVT(_this,_posASL,_direction,_maxDistance); _distance = _maxDistance; -_iteration = _distance; -_laser = []; -_line = [_position, _laser]; +_interval = _distance; +_line = [_posASL, []]; while { - _iteration > 0.1 + _interval > 0.1 } do { - _iteration = _iteration / 2; + _interval = _interval / 2; - _laser set [0, (_position select 0) - _distance * (_direction select 0)]; - _laser set [1, (_position select 1) - _distance * (_direction select 1)]; - _laser set [2, (_position select 2) - _distance * (_direction select 2)]; + _line set [1, _posASL vectorAdd (_direction vectorMultiply _distance)]; - _intersections = { - _x isKindOf "Static" || {_x isKindOf "AllVehicles"} - } count (lineIntersectsWith _line); + _intersections = { + _x isKindOf "Static" || {_x isKindOf "AllVehicles"} + } count (lineIntersectsWith _line); - _distance = _distance + ([1, -1] select (_intersections > 0)) * _iteration; + _distance = _distance + ([1, -1] select (_intersections > 0 || {terrainIntersectASL _line})) * _interval; + + if (_distance > _maxDistance) exitWith {_distance = 999}; }; -if (_distance > _maxDistance) then {999} else {_distance} +_distance diff --git a/addons/backblast/functions/fnc_launcherBackblast.sqf b/addons/backblast/functions/fnc_launcherBackblast.sqf deleted file mode 100644 index b2cde50c5d..0000000000 --- a/addons/backblast/functions/fnc_launcherBackblast.sqf +++ /dev/null @@ -1,72 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -_unit = _this select 0; -_firer = _this select 1; -_distance = _this select 2; -_weapon = _this select 3; - -if (vehicle _unit != _unit || {!([_firer] call EFUNC(common,isPlayer))}) exitWith {}; - -_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Angle") / 2; -_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Range"); -_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Damage"); - -_position = eyePos _firer; -_direction = _firer weaponDirection currentWeapon _firer; - -if (_unit == _firer) then { - _distance = [_position, _direction, _backblastRange] call FUNC(getDistance); - hint format ["%1", _distance]; - if (_distance < _backblastRange) then { - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt 0.5; - - _damage = 2 * _alpha * _beta * _backblastDamage; - [_damage * 100] call BIS_fnc_bloodEffect; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -} else { - _direction = [0, 0, 0] vectorDiff _direction; - - _azimuth = (_direction select 0) atan2 (_direction select 1); - _inclination = asin (_direction select 2); - - _relativePosition = eyePos _unit; - _relativeDirection = _relativePosition vectorDiff _position; - - _relativeAzimuth = (_relativeDirection select 0) atan2 (_relativeDirection select 1); - _relativeInclination = asin (_relativeDirection select 2); - - _angle = sqrt ((_relativeAzimuth - _azimuth) ^ 2 + (_relativeInclination - _inclination) ^ 2); - _distance = vectorMagnitude _relativeDirection; - - _line = [_position, _relativePosition]; - - if (_angle < _backblastAngle && {_distance < _backblastRange} && {!lineIntersects _line} && {!terrainIntersectASL _line}) then { - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt (1 - _angle / _backblastAngle); - - _damage = 2 * _alpha * _beta * _backblastDamage; - if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _unit spawn { - sleep 0.5; - [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); - }; - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -}; diff --git a/addons/backblast/functions/fnc_overpressureDamage.sqf b/addons/backblast/functions/fnc_overpressureDamage.sqf new file mode 100644 index 0000000000..5dd7447ce8 --- /dev/null +++ b/addons/backblast/functions/fnc_overpressureDamage.sqf @@ -0,0 +1,65 @@ +/* + * Author: Commy2 and CAA-Picard + * + * Calculate and apply overpressure damage to potentially affected local units + * + * Argument: + * 0: Unit that fired (Object) + * 1: Pos ASL of the projectile (Array) + * 2: Direction of the projectile (Array) + * 3: Weapon fired (String) + * + * Return value: + * None + */ +#include "script_component.hpp" + +EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); + +private ["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; +_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Angle") / 2; +_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Range"); +_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Damage"); +TRACE_4("Parameters:",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage,_weapon); + +_pos = _posASL; +if (!surfaceIsWater _pos) then { + _pos = ASLtoATL _pos; +}; + +_affected = _pos nearEntities ["CAManBase", _dangerZoneRange]; +{ + _unit = _x; + if (local _unit && _unit != _firer && vehicle _unit == _unit) then { + + _targetPositionASL = eyePos _unit; + _relativePosition = _targetPositionASL vectorDiff _posASL; + _axisDistance = _relativePosition vectorDotProduct _direction; + _distance = vectorMagnitude _relativePosition; + _angle = acos (_axisDistance / _distance); + + _line = [_posASL, _targetPositionASL, _firer, _unit]; + _line2 = [_posASL, _targetPositionASL]; + TRACE_4("Affected:",_unit,_axisDistance,_distance,_angle); + if (_angle < _dangerZoneAngle && {_distance < _dangerZoneRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { + _alpha = sqrt (1 - _distance / _dangerZoneRange); + _beta = sqrt (1 - _angle / _dangerZoneAngle); + + _damage = 2 * _alpha * _beta * _dangerZoneDamage; + + // If the target is the ACE_player + if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; + + // @todo: Sort this interaction with medical + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { + [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + _unit spawn { + sleep 0.5; + [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); + }; + } else { + _unit setDamage (damage _unit + _damage); + }; + }; + }; +} forEach _affected; diff --git a/addons/backblast/functions/fnc_tankDangerZone.sqf b/addons/backblast/functions/fnc_tankDangerZone.sqf deleted file mode 100644 index 0371ec9620..0000000000 --- a/addons/backblast/functions/fnc_tankDangerZone.sqf +++ /dev/null @@ -1,54 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -#define BARREL_MUZZLE "usti hlavne" - -_unit = _this select 0; -_vehicle = vehicle (_this select 1); -_distance = _this select 2; -_weapon = _this select 3; - -if (vehicle _unit != _unit || {!([gunner _firer] call EFUNC(common,isPlayer))}) exitWith {}; - -_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Angle") / 2; -_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Range"); -_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Damage"); - -_position = ATLToASL (_vehicle modelToWorld (_vehicle selectionPosition BARREL_MUZZLE)); -_direction = _vehicle weaponDirection _weapon; - -if (_unit != _vehicle) then { - _azimuth = (_direction select 0) atan2 (_direction select 1); - _inclination = asin (_direction select 2); - - _relativePosition = eyePos _unit; - _relativeDirection = _relativePosition vectorDiff _position; - - _relativeAzimuth = (_relativeDirection select 0) atan2 (_relativeDirection select 1); - _relativeInclination = asin (_relativeDirection select 2); - - _angle = sqrt ((_relativeAzimuth - _azimuth) ^ 2 + (_relativeInclination - _inclination) ^ 2); - _distance = vectorMagnitude _relativeDirection; - - _line = [_position, _relativePosition]; - - if (_angle < _dangerZoneAngle && {_distance < _dangerZoneRange} && {!lineIntersects (_line + [_vehicle])} && {!terrainIntersectASL _line}) then { - _alpha = sqrt (1 - _distance / _dangerZoneRange); - _beta = sqrt (1 - _angle / _dangerZoneAngle); - - _damage = 2 * _alpha * _beta * _dangerZoneDamage; - if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; - - // TODO: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _unit spawn { - sleep 0.5; - [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); - }; - } else { - _unit setDamage (damage _unit + _damage); - }; - - }; -}; From 05d209191cf60d82ac8581a50f0f2fda18079d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 25 Jan 2015 01:05:19 -0300 Subject: [PATCH 003/113] common: fixed fnc_addLineToDebugDraw --- addons/common/functions/fnc_addLineToDebugDraw.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_addLineToDebugDraw.sqf b/addons/common/functions/fnc_addLineToDebugDraw.sqf index cfe45359c9..1c7d5d5cd1 100644 --- a/addons/common/functions/fnc_addLineToDebugDraw.sqf +++ b/addons/common/functions/fnc_addLineToDebugDraw.sqf @@ -29,7 +29,7 @@ if (count GVAR(debugLines) < 100) then { if (isNil QGVAR(debugDrawHandler)) then { GVAR(debugDrawHandler) = addMissionEventHandler ["Draw3D", { if (count GVAR(debugLines) == 0) exitWith { - removeMissionEventHandler GVAR(debugDrawHandler); + removeMissionEventHandler ["Draw3D", GVAR(debugDrawHandler)]; GVAR(debugDrawHandler) = nil; }; From 30cd9a7499eda9287e7ae4815f8a349dd6041206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 25 Jan 2015 01:16:44 -0300 Subject: [PATCH 004/113] me too --- addons/backblast/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/backblast/config.cpp b/addons/backblast/config.cpp index 88de936cf9..8c59163c54 100644 --- a/addons/backblast/config.cpp +++ b/addons/backblast/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi"}; + author[] = {"commy2", "KoffeinFlummi", "CAA-Picard"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; }; From 08763b6b9f57a9fb0c7e61e0f8bbe5c8fd0570dc Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 30 Jan 2015 14:32:21 -0600 Subject: [PATCH 005/113] Initial port of old pull Still some problem with interaction... --- addons/attach/CfgVehicles.hpp | 56 +++++++++-- addons/attach/XEH_preInit.sqf | 2 + addons/attach/functions/fnc_attach.sqf | 98 ++++++++++++-------- addons/attach/functions/fnc_canAttach.sqf | 8 +- addons/attach/functions/fnc_canDetach.sqf | 42 ++++++--- addons/attach/functions/fnc_detach.sqf | 47 +++++++--- addons/attach/functions/fnc_openAttachUI.sqf | 10 +- addons/attach/functions/fnc_placeApprove.sqf | 87 +++++++++++++++++ addons/attach/functions/fnc_placeCancel.sqf | 42 +++++++++ addons/attach/stringtable.xml | 22 +++++ 10 files changed, 335 insertions(+), 79 deletions(-) create mode 100644 addons/attach/functions/fnc_placeApprove.sqf create mode 100644 addons/attach/functions/fnc_placeCancel.sqf diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index a8653b9e06..8a231d3679 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -1,17 +1,59 @@ #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -}; + name = #ITEM; \ + count = COUNT; \ + }; + +#define MACRO_ATTACHTOVEHICLE \ + class ACE_Actions { \ + class GVAR(AttachVehicle) { \ + displayName = "$STR_ACE_Attach_AttachDetach"; \ + condition = QUOTE( [ARR_3(_player, _target, '')] call FUNC(canAttach) ); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI); ); \ + exceptions[] = {"ACE_Drag_isNotDragging"}; \ + showDisabled = 0; \ + priority = 0; \ + icon = PATHTOF(UI\attach_ca.paa); \ + hotkey = "T"; \ + }; \ + class GVAR(DetachVehicle) { \ + displayName = "$STR_ACE_Attach_Detach"; \ + condition = QUOTE( [ARR_2(_player, _target)] call FUNC(canDetach) ); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \ + exceptions[] = {"ACE_Drag_isNotDragging"}; \ + showDisabled = 0; \ + priority = 0; \ + icon = PATHTOF(UI\detach_ca.paa); \ + }; \ + }; class CfgVehicles { + class LandVehicle; + class Car: LandVehicle { + MACRO_ATTACHTOVEHICLE + }; + class Tank: LandVehicle { + MACRO_ATTACHTOVEHICLE + }; + class Air; + class Helicopter: Air { + MACRO_ATTACHTOVEHICLE + }; + class Plane: Air { + MACRO_ATTACHTOVEHICLE + }; + class Ship; + class Ship_F: Ship { + MACRO_ATTACHTOVEHICLE + }; + class Man; class CAManBase: Man { class ACE_SelfActions { class ACE_Equipment { class GVAR(Attach) { displayName = "$STR_ACE_Attach_AttachDetach"; - condition = QUOTE( [_player, ''] call FUNC(canAttach) ); - statement = QUOTE( [_player] call FUNC(openAttachUI); ); + condition = QUOTE( [ARR_3(_player, _player, '')] call FUNC(canAttach) ); + statement = QUOTE( [ARR_2(_player, _player)] call FUNC(openAttachUI); ); exceptions[] = {"ACE_Drag_isNotDragging"}; showDisabled = 0; priority = 5; @@ -20,8 +62,8 @@ class CfgVehicles { }; class GVAR(Detach) { displayName = "$STR_ACE_Attach_Detach"; - condition = QUOTE( [_player] call FUNC(canDetach) ); - statement = QUOTE( [_player] call FUNC(detach) ); + condition = QUOTE( [ARR_2(_player, _player)] call FUNC(canDetach) ); + statement = QUOTE( [ARR_2(_player, _player)] call FUNC(detach) ); exceptions[] = {"ACE_Drag_isNotDragging"}; showDisabled = 0; priority = 5; diff --git a/addons/attach/XEH_preInit.sqf b/addons/attach/XEH_preInit.sqf index 279ea4d4c7..63eb2e8438 100644 --- a/addons/attach/XEH_preInit.sqf +++ b/addons/attach/XEH_preInit.sqf @@ -7,5 +7,7 @@ PREP(canAttach); PREP(canDetach); PREP(detach); PREP(openAttachUI); +PREP(placeApprove); +PREP(placeCancel); ADDON = true; diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index ab920c6428..2619f8ac98 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -6,57 +6,79 @@ Author: eRazeri and CAA-Picard Attach an item to the unit Arguments: -0: unit -1: Item name +0: OBJECT - unit doing the attaching (player) +1: OBJECT - vehicle that it will be attached to (player or vehicle) +2: STRING - classname of attached item (from CfgMagazines or CfgWeapons) Return Value: none */ -private ["_unit", "_itemName", "_attachedItem"]; +PARAMS_3(_unit,_attachToVehicle,_itemName); -_unit = _this select 0; -_itemName = _this select 1; +//Sanity Check (_unit has item in inventory, not over attach limit) +if (!([_unit,_attachToVehicle,_itemName] call FUNC(canAttach))) exitWith {ERROR("Tried to attach, but check failed");}; -// Check if unit has an attached item -if (_unit getVariable [QGVAR(ItemName), ""] != "") exitWith {}; +_selfAttachPosition = [_unit, [-0.05,0,0.12], "rightshoulder"]; +_itemVehClass = ""; +_onAtachText = ""; -// Check if the unit still has the item -if !((_itemName in items _unit) or (_itemName in magazines _unit)) exitWith {}; - -// Attach item switch true do { - case (_itemName == "ACE_IR_Strobe_Item") : { - _attachedItem = "ACE_IR_Strobe_Effect" createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[0,-0.11,0.16],"pilot"];//makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri - [localize "STR_ACE_Attach_IrStrobe_Attached"] call EFUNC(common,displayTextStructured); +case (_itemName == "ACE_IR_Strobe_Item"): { + _itemVehClass = "ACE_IR_Strobe_Effect"; + _onAtachText = localize "STR_ACE_Attach_IrStrobe_Attached"; + _selfAttachPosition = [_unit,[0,-0.11,0.16],"pilot"]; //makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri }; - case (_itemName == "B_IR_Grenade") : { - _attachedItem = "B_IRStrobe" createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_ACE_Attach_IrGrenade_Attached"] call EFUNC(common,displayTextStructured); +case (_itemName == "B_IR_Grenade"): { + _itemVehClass = "B_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; }; - case (_itemName == "O_IR_Grenade") : { - _attachedItem = "O_IRStrobe" createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_ACE_Attach_IrGrenade_Attached"] call EFUNC(common,displayTextStructured); +case (_itemName == "O_IR_Grenade"): { + _itemVehClass = "O_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; }; - case (_itemName == "I_IR_Grenade") : { - _attachedItem = "I_IRStrobe" createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_ACE_Attach_IrGrenade_Attached"] call EFUNC(common,displayTextStructured); +case (_itemName == "I_IR_Grenade"): { + _itemVehClass = "I_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; }; - case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}) : { - _attachedItem = _itemName createVehicle [0,0,0]; - _attachedItem attachTo [_unit,[-0.05,0,0.12],"rightshoulder"]; - [localize "STR_ACE_Attach_Chemlight_Attached"] call EFUNC(common,displayTextStructured);; - }; - default { - if (true) exitWith {}; +case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}): { + _itemVehClass = _itemName; + _onAtachText = localize "STR_ACE_Attach_Chemlight_Attached"; }; }; -// Remove item -_unit removeItem _itemName; -_unit setVariable [QGVAR(ItemName), _itemName, true]; -_unit setVariable [QGVAR(Item), _attachedItem, true]; +if (_itemVehClass == "") exitWith {ERROR("no _itemVehClass for Item");}; + +if (_unit == _attachToVehicle) then { //Self Attachment + _unit removeItem _itemName; // Remove item + _attachedItem = _itemVehClass createVehicle [0,0,0]; + _attachedItem attachTo _selfAttachPosition; + [_onAtachText] call EFUNC(common,displayTextStructured); + _attachToVehicle setVariable ["ACE_AttachedObjects", [_attachedItem], true]; + _attachToVehicle setVariable ["ACE_AttachedItemNames", [_itemName], true]; +} else { + GVAR(setupObject) = _itemVehClass createVehicleLocal [0,0,-10000]; + GVAR(setupObject) enableSimulationGlobal false; + GVAR(SetupPlacmentText) = _onAtachText; + GVAR(SetupPlacmentItem) = _itemName; + GVAR(SetupAttachVehicle) = _attachToVehicle; + GVAR(placer) = _unit; + [_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); + + [QGVAR(PlacementEachFrame),"OnEachFrame", { + private "_player"; + _player = ACE_player; + //Stop if player switch or player gets to far from vehicle + if ((GVAR(placer) != _player) || ((_player distance GVAR(SetupAttachVehicle)) > 9)) exitWith { + call FUNC(placeCancel); + }; + GVAR(pfeh_running) = true; + _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); + GVAR(setupObject) setPosATL _pos; + }] call BIS_fnc_addStackedEventHandler; + + //had to spawn the mouseHint, not sure why + [localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint); + _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; + _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; +}; diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index fe5191d7e2..264b627887 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -13,9 +13,9 @@ * Boolean (Bool) */ -private ["_unit", "_item"]; +PARAMS_3(_unit,_attachToVehicle,_item); -_unit = _this select 0; -_item = _this select 1; +_attachLimit = if (_unit == _attachToVehicle) then {1} else {10}; +_attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; -canStand _unit && {_unit getVariable [QGVAR(ItemName), ""] == ""} && {_item in (magazines _unit + items _unit + [""])} +canStand _unit && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_item in (magazines _unit + items _unit + [""])} diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf index 3ddfc6c11e..273831a6fc 100644 --- a/addons/attach/functions/fnc_canDetach.sqf +++ b/addons/attach/functions/fnc_canDetach.sqf @@ -1,19 +1,35 @@ #include "script_component.hpp" /* - * Author: commy2 - * - * Check if a unit has an item attached and if it can remove that item. - * - * Argument: - * 0: Unit that wants to detach something (Object) - * - * Return value: - * Boolean (Bool) - */ +* Author: commy2 +* +* Check if a unit has an item attached and if it can remove that item. +* +* Argument: +* 0: Unit that wants to detach something (Object) +* +* Return value: +* Boolean (Bool) +*/ -private "_unit"; +private ["_attachedObjects", "_inRange", "_unitPos", "_objectPos"]; -_unit = _this select 0; +PARAMS_2(_unit,_attachToVehicle); -canStand _unit && {_unit getVariable [QGVAR(ItemName), ""] != ""} +_attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; + +_inRange = false; +if (_unit == _attachToVehicle) then { + _inRange = (count _attachedObjects) > 0; +} else { + //Scan if unit is within range (using 2d distance) + _unitPos = getPos _unit; + _unitPos set [2,0]; + { + _objectPos = getPos _x; + _objectPos set [2, 0]; + if ((_objectPos distance _unitPos) < 2.4) exitWith {_inRange = true}; + } forEach _attachedObjects; +}; + +(canStand _unit) && _inRange && {alive _attachToVehicle} diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index 3ecac44d62..d9ade6e4d0 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -12,14 +12,34 @@ Return Value: none */ -private ["_unit", "_itemName", "_count", "_attachedItem", "_fnc_detachDelay"]; +private ["_itemName", "_count", "_attachedItem", "_fnc_detachDelay"]; -_unit = _this select 0; -_itemName = _unit getVariable [QGVAR(ItemName), ""]; -_attachedItem = _unit getVariable [QGVAR(Item), objNull]; +PARAMS_2(_unit, _attachToVehicle); + +_attachedObjectsArray = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; +_attachedItemsArray = _attachToVehicle getVariable ["ACE_AttachedItemNames", []]; + +_attachedObject = objNull; +_attachedIndex = -1; +_itemName = ""; + +//Find closest attached object +_minDistance = 1000; +_unitPos = getPos _unit; +_unitPos set [2,0]; +{ + _objectPos = getPos _x; + _objectPos set [2, 0]; + if ((_objectPos distance _unitPos) < _minDistance) then { + _minDistance = (_objectPos distance _unitPos); + _attachedObject = _x; + _itemName = _attachedItemsArray select _forEachIndex; + _attachedIndex = _forEachIndex; + }; +} forEach _attachedObjectsArray; // Check if unit has an attached item -if (_itemName == "") exitWith {}; +if ((isNull _attachedObject) || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; // Add item to inventory _count = (count items _unit) + (count magazines _unit); @@ -30,21 +50,23 @@ if ((count items _unit) + (count magazines _unit) <= _count) exitWith { if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") then { // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle - detach _attachedItem; - _attachedItem setPos [getPos _unit select 0, getPos _unit select 1, ((getPos _unit select 2) - 1000)]; + detach _attachedObject; + _attachedObject setPos [getPos _unit select 0, getPos _unit select 1, ((getPos _unit select 2) - 1000)]; // Delete attached item after 0.5 seconds _fnc_detachDelay = { deleteVehicle (_this select 0); }; - [_fnc_detachDelay, [_attachedItem], 0.5, 0] call EFUNC(common,waitAndExecute); + [_fnc_detachDelay, [_attachedObject], 0.5, 0] call EFUNC(common,waitAndExecute); } else { // Delete attached item - deleteVehicle _attachedItem; + deleteVehicle _attachedObject; }; // Reset unit variables -_unit setVariable [QGVAR(ItemName),"", true]; -_unit setVariable [QGVAR(Item),nil, true]; +_attachedObjectsArray deleteAt _attachedIndex; +_attachedItemsArray deleteAt _attachedIndex; +_attachToVehicle setVariable ["ACE_AttachedObjects", _attachedObjectsArray, true]; +_attachToVehicle setVariable ["ACE_AttachedItemNames", _attachedItemsArray, true]; // Display message switch true do { @@ -57,7 +79,4 @@ switch true do { case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}) : { [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); }; - default { - if (true) exitWith {}; - }; }; diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index 97046fa80b..573e0ad27f 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -8,6 +8,7 @@ Parameters: 0: OBJECT - unit + 0: OBJECT - target Returns: Nothing @@ -15,8 +16,11 @@ Example: [player] call ACE_Attach_fnc_openAttachUI; */ -private ["_unit", "_actions", "_attachables", "_item"]; -_unit = _this select 0; +private ["_actions", "_attachables", "_item"]; + +PARAMS_2(_unit,_target); + +GVAR(attachTarget) = _target; _listed = []; _attachables = magazines _unit; _actions = [localize "STR_ACE_Attach_AttachDetach", localize "STR_ACE_Attach_Attach"] call EFUNC(interaction,prepareSelectMenu); @@ -53,7 +57,7 @@ _attachables = items _unit; [ _actions, { - [ACE_player, _this] call FUNC(attach); + [ACE_player, GVAR(attachTarget), _this] call FUNC(attach); call EFUNC(interaction,hideMenu); }, { diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf new file mode 100644 index 0000000000..290812ae4a --- /dev/null +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -0,0 +1,87 @@ +/* + Name: FUNC(placeApprove) + Author(s): + Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) + Description: + Approves placement of the lightObject, releases the placement object for it to settle in a location + Parameters: + Nothing + Returns: + Nothing + Example: + call FUNC(placeApprove); +*/ +#include "script_component.hpp" + +private ["_setupObject", "_setupClassname", "_itemClassname", "_placementText", "_attachToVehicle", "_player", "_position0", "_closeInRatio", "_offset", "_keepGoingCloser", "_pos0temp", "_position1", "_attachedObject", "_currentObjects", "_currentItemNames"]; + +if (GVAR(pfeh_running)) then { + [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; + GVAR(pfeh_running) = false; +}; + +_setupObject = GVAR(setupObject); +_setupClassname = typeOf _setupObject; +_itemClassname = GVAR(SetupPlacmentItem); +_placementText = GVAR(SetupPlacmentText); +_attachToVehicle = GVAR(SetupAttachVehicle); + +GVAR(SetupPlacmentItem) = ""; +GVAR(SetupPlacmentText) = ""; +GVAR(setupObject) = objNull; +GVAR(SetupAttachVehicle) = objNull; +[GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +GVAR(placer) = objNull; + +_player = ACE_player; +[_player, "DefaultAction", _player getVariable [QGVAR(placeActionEH), -1]] call EFUNC(common,removeActionEventHandler); +[_player, "MenuBack", _player getVariable [QGVAR(cancelActionEH), -1]] call EFUNC(common,removeActionEventHandler); +call EFUNC(interaction,hideMouseHint); + +//A player can release the attachObject with it floating in mid-air. +//This will use lineIntersectsWith to scan towards the center of the vehicle to find a collision +//ArmA's collision detection is of couse terrible and often misses collisions (difference between what we see and collision LOD) +//So it does multiple scans at slighly different angles +//This is VERY computationaly intensive, but doesn't happen that often. + +_position0 = getPosAtl _setupObject; +_closeInRatio = 1; +_offset = _attachToVehicle worldToModel _position0; +_keepGoingCloser = true; +while {_keepGoingCloser} do { + _closeInRatio = _closeInRatio - 0.004; + if (_closeInRatio <= 0) exitWith {}; + { + _pos0temp = _position0 vectorAdd _x; + { + _position1 = [(_offset select 0) * _closeInRatio, (_offset select 1) * _closeInRatio, (_offset select 2)]; + _position1 = _attachToVehicle modelToWorld _position1; + _position1 = _position1 vectorAdd _x; + //Uncomment to see the lazor show, and see how the scanning works: + // drawLine3D [_pos0temp, _position1, [1,0,0,1]]; + if (_attachToVehicle in lineIntersectsWith [(ATLToASL _pos0temp), (ATLToASL _position1), player, _setupObject]) exitWith {_keepGoingCloser = false}; + } forEach [[0,0,0], [0,0,0.075], [0,0,-0.075], [0,0.075,0], [0,-0.075,0], [0.075,0,0], [-.075,0,0]]; + } forEach [[0,0,0], [0,0,0.075], [0,0,-0.075]]; +}; +//Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull) +_closeInRatio = (_closeInRatio + 0.006) min 1; + +//Delete Local Placement Object +deleteVehicle _setupObject; + +//Create New 'real' Object +_attachedObject = _setupClassname createVehicle (getPos _player); +_attachedObject attachTo [_attachToVehicle, [(_offset select 0) * _closeInRatio, (_offset select 1) * _closeInRatio, (_offset select 2)]]; + +//Remove Item from inventory +_player removeItem _itemClassname; + +//Add Object to ACE_AttachedObjects and ACE_AttachedItemNames +_currentObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; +_currentObjects pushBack _attachedObject; +_attachToVehicle setVariable ["ACE_AttachedObjects", _currentObjects, true]; +_currentItemNames = _attachToVehicle getVariable ["ACE_AttachedItemNames", []]; +_currentItemNames pushBack _itemClassname; +_attachToVehicle setVariable ["ACE_AttachedItemNames", _currentItemNames, true]; + +[_placementText] call EFUNC(common,displayTextStructured); diff --git a/addons/attach/functions/fnc_placeCancel.sqf b/addons/attach/functions/fnc_placeCancel.sqf new file mode 100644 index 0000000000..ffa84b9d12 --- /dev/null +++ b/addons/attach/functions/fnc_placeCancel.sqf @@ -0,0 +1,42 @@ +/* + Name: FUNC(placeCancel) + + Author(s): + Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) + + Description: + Cancels placement of the lightObject + + Parameters: + Nothing + + Returns: + Nothing + + Example: + call FUNC(placeCancel); +*/ +#include "script_component.hpp" + +if (GVAR(pfeh_running)) then { + [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; + GVAR(pfeh_running) = false; +}; +if (!isNull (GVAR(setupObject))) then { + deleteVehicle GVAR(setupObject); +}; +GVAR(SetupPlacmentItem) = ""; +GVAR(SetupPlacmentText) = ""; +GVAR(setupObject) = objNull; +GVAR(SetupAttachVehicle) = objNull; +if (isNil QGVAR(placer)) then { + ERROR("Nil placer?"); + GVAR(placer) = objNull; +}; + +[GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +call EFUNC(interaction,hideMouseHint); +[GVAR(placer), "DefaultAction", GVAR(placer) getVariable [QGVAR(placeActionEH), -1]] call EFUNC(common,removeActionEventHandler); +[GVAR(placer), "MenuBack", GVAR(placer) getVariable [QGVAR(cancelActionEH), -1]] call EFUNC(common,removeActionEventHandler); + +GVAR(placer) = objNull; diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index 877f26e623..ef26e0738d 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -146,5 +146,27 @@ Az infravörös jeladóval megjelölheted a helyzetedet úgy, hogy annak pulzáló fénye csak éjjellátó készülékkel látható. ИК строб позволяет сигнализировать свое местоположение через пульсирующий маяк, видимый только через ПНВ. + + Place + Platzieren + Colocar + Umieść + Placer + Položit + Colocar + Posiziona + Elhelyez + + + Cancel + Abbrechen + Cancelar + Anuluj + Annuler + Zrušit + Cancelar + Annulla + Mégse + \ No newline at end of file From e277b05afff3cd810054470dc9d20b04b88fd0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Fri, 30 Jan 2015 18:56:45 -0300 Subject: [PATCH 006/113] ace_settings: first draft --- addons/common/CfgEventHandlers.hpp | 1 - addons/common/XEH_preInit.sqf | 8 +- addons/common/config.cpp | 10 ++- .../functions/fnc_loadSettingsOnServer.sqf | 74 ++++++++++++++++++ addons/common/functions/fnc_setSetting.sqf | 40 ++++++++++ .../functions/fnc_setSettingFromConfig.sqf | 76 +++++++++++++++++++ addons/common/scripts/readParameters.sqf | 55 -------------- addons/nametags/config.cpp | 42 +++++++--- 8 files changed, 235 insertions(+), 71 deletions(-) create mode 100644 addons/common/functions/fnc_loadSettingsOnServer.sqf create mode 100644 addons/common/functions/fnc_setSetting.sqf create mode 100644 addons/common/functions/fnc_setSettingFromConfig.sqf delete mode 100644 addons/common/scripts/readParameters.sqf diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index 7ea3b1e1f9..b9c5d7e4ce 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -2,7 +2,6 @@ class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); - serverInit = QUOTE(call COMPILE_FILE(scripts\readParameters)); disableModuload = true; }; }; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 1bd305fa02..6cd1c4ce61 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -85,6 +85,7 @@ PREP(isInBuilding); PREP(isPlayer); PREP(isTurnedOut); PREP(letterToCode); +PREP(loadSettingsOnServer); PREP(map); PREP(moduleCheckPBOs); PREP(moduleLSDVehicles); @@ -115,6 +116,8 @@ PREP(setName); PREP(setParameter); PREP(setPitchBankYaw); PREP(setVariableJIP); +PREP(setSetting); +PREP(setSettingFromConfig); PREP(stringToColoredText); PREP(subString); PREP(toBin); @@ -163,6 +166,10 @@ PREP(hashListSet); PREP(hashListPush); +// Load settings +if (isServer) {} + call FUNC(loadSettingsOnServer); +}; ACE_player = player; @@ -183,7 +190,6 @@ if (hasInterface) then { }, 0, []] call cba_fnc_addPerFrameHandler; }; - PREP(stringCompare); PREP(string_removeWhiteSpace); PREP(isHC); diff --git a/addons/common/config.cpp b/addons/common/config.cpp index 2be05e6b57..0189facd47 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -57,10 +57,16 @@ class ACE_canInteractConditions { }; }; -class ACE_Options { +class ACE_Settings { + class GVAR(forceAllSettings) { + value = 0; + typeName = "BOOL"; + }; class GVAR(enableNumberHotkeys) { + value = 1; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_Common_EnableNumberHotkeys"; - default = 1; }; }; diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf new file mode 100644 index 0000000000..000d8f69cc --- /dev/null +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -0,0 +1,74 @@ +/* + * Author: CAA-Picard + * Load the parameters on the server. + * Config < Server UserConfig < Mission Config + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +GVAR(settingsList) = []; + +// Load settings from main config +_countOptions = count (configFile >> "ACE_Settings"); +for "_index" from 0 to (_countOptions - 1) do { + _optionEntry = (configFile >> "ACE_Settings") select _index; + + _name = configName _optionEntry; + _valueEntry = _optionEntry >> "value"; + _typeEntry = _optionEntry >> "typeName"; + + [_name, _valueEntry, _typeEntry] call FUNC(setSettingFromConfig); +}; +// Check if all settings should be forced +if (GVAR(forceAllSettings)) then { + { + if !(missionNamespace getVariable format ["%1_forced", _x]) then { + missionNamespace setVariable format ["%1_forced", _x, true]; + publicVariable format ["%1_forced", _name]; + }; + } forEach GVAR(settingsList); +}; + + +// Load settings from server userconfig +DFUNC(common,serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp"; +if !(isNil QFUNC(common,serverUserConfig)) then { + [] call FUNC(serverUserConfig); +}; +// Check if all settings should be forced +if (GVAR(forceAllSettings)) then { + { + if !(missionNamespace getVariable format ["%1_forced", _x]) then { + missionNamespace setVariable format ["%1_forced", _x, true]; + publicVariable format ["%1_forced", _name]; + }; + } forEach GVAR(settingsList); +}; + + +// Load settings from mission config +_countOptions = count (missionConfigFile >> "ACE_Settings"); +for "_index" from 0 to (_countOptions - 1) do { + _optionEntry = (missionConfigFile >> "ACE_Settings") select _index; + + _name = configName _optionEntry; + _valueEntry = _optionEntry >> "value"; + + [_name, _valueEntry] call FUNC(setSettingFromConfig); +}; +// Check if all settings should be forced +if (GVAR(forceAllSettings)) then { + { + if !(missionNamespace getVariable format ["%1_forced", _x]) then { + missionNamespace setVariable format ["%1_forced", _x, true]; + publicVariable format ["%1_forced", _name]; + }; + } forEach GVAR(settingsList); +}; \ No newline at end of file diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf new file mode 100644 index 0000000000..5a570d618a --- /dev/null +++ b/addons/common/functions/fnc_setSetting.sqf @@ -0,0 +1,40 @@ +/* + * Author: CAA-Picard + * Set a setting if it was not previosuly forced. Force if neccesary. + * + * Arguments: + * 0: Setting name (String) + * 1: Value (Any) + * 2: Force it? (Bool) (Optional) + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_name,_value); + +if !(isServer) exitWith {}; + +private ["force"]; +_force = false; +if (count _this > 2) then { + _force = _this select 2; +}; + +// Check if it's already forced and quit +if (missionNamespace getVariable [format ["%1_forced", _name], false]) exitWith {}; + +// Check if the variable is already defined +if (isNil _name) then { + // Add the variable to a list on the server + GVAR(settingsList) pushBack _name; +}; + +// Update the variable and publish it +missionNamespace setVariable [_name, _value]; +publicVariable _name; +missionNamespace setVariable [format ["%1_forced", _name], _force]; +publicVariable format ["%1_forced", _name]; diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf new file mode 100644 index 0000000000..8423a16bef --- /dev/null +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -0,0 +1,76 @@ +/* + * Author: CAA-Picard + * Load a setting from config if it was not previosuly forced. Force if neccesary. + * + * Arguments: + * 0: Setting name (String) + * 1: Config entry (config entry) + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_name,_optionEntry); + +_fnc_getValueWithType = { + EXPLODE_2_PVT(_this,_optionEntry,_typeName); + + _value = getNumber (_optionEntry >> "value"); + if (_typeName == "BOOL") exitWith { + _value = _value > 0; + }; + if (_typeName == "STRING") exitWith { + _value = getText (_optionEntry >> "value"); + }; + if (_typeName == "ARRAY") exitWith { + _value = getArray (_optionEntry >> "value"); + }; + _value +}; + +// Check if the variable is already defined +if (isNil _name) exitWith { + // That setting was not loaded yet + + //diag_log text format ["[ACE]: Mission setting '%1' doesn't exist", _name]; + + _typeEntry = _this select 2; + _typeName = getText _typeEntry; + + _value = [_optionEntry, _typeName] call _fnc_getValueWithType; + + // Init the variable and publish it + missionNamespace setVariable [_name, _value]; + publicVariable _name; + // Set the variable to not forced + missionNamespace setVariable [format ["%1_forced", _name], false]; + publicVariable format ["%1_forced", _name]; + + // Add the variable to a list on the server + GVAR(settingsList) pushBack _name; + +} else { + // The setting already exists. + + // Check if it's already forced and quit + if (missionNamespace getVariable format ["%1_forced", _name]) exitWith {}; + + // The setting is not forced, so update the value + + // Get the type from the existing variable + _typeName = typeName missionNamespace getVariable _name; + _value = [_optionEntry, _typeName] call _fnc_getValueWithType; + + // Update the variable and publish it + missionNamespace setVariable [_name, _value]; + publicVariable _name; + + // Check if it needs forcing + if (getNumber (_optionEntry >> "force") > 0) then { + missionNamespace setVariable [format ["%1_forced", _name], true]; + publicVariable format ["%1_forced", _name]; + }; +}; diff --git a/addons/common/scripts/readParameters.sqf b/addons/common/scripts/readParameters.sqf deleted file mode 100644 index 3b17ea7f1f..0000000000 --- a/addons/common/scripts/readParameters.sqf +++ /dev/null @@ -1,55 +0,0 @@ -// by CAA-Picard -#include "script_component.hpp" - -// Read ACE_Parameters from config and set them on the mission namespace -_config = configFile >> "ACE_Parameters_Numeric"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value] call FUNC(setParameter); -}; - -_config = configFile >> "ACE_Parameters_Boolean"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value > 0] call FUNC(setParameter); -}; - - -// Read ACE_Parameters from mission and set them on the mission namespace, replacing defaults if necesary -_config = missionConfigFile >> "ACE_Parameters"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value] call FUNC(setParameter); -}; - -_config = missionConfigFile >> "ACE_Parameters_Numeric"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value] call FUNC(setParameter); -}; - -_config = missionConfigFile >> "ACE_Parameters_Boolean"; -_count = count _config; -for "_index" from 0 to (_count - 1) do { - _x = _config select _index; - - _name = configName _x; - _value = _x call bis_fnc_getcfgdata; - [_name, _value > 0] call FUNC(setParameter); -}; diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp index 1846cd616e..58440192c0 100644 --- a/addons/nametags/config.cpp +++ b/addons/nametags/config.cpp @@ -15,29 +15,47 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -class ACE_Options { +class ACE_Settings { class GVAR(showPlayerNames) { + value = 1; + typeName = "SCALAR"; + isClientSetable = 1; displayName = "$STR_ACE_NameTags_ShowPlayerNames"; values[] = {"Disabled", "Enabled", "Only Cursor", "Only On Keypress", "Only Cursor and KeyPress"}; - default = 1; }; class GVAR(showPlayerRanks) { + value = 1; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_NameTags_ShowPlayerRanks"; - default = 1; }; class GVAR(showVehicleCrewInfo) { + value = 1; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_CrewInfo_ShowVehicleCrewInfo"; - default = 1; }; -}; -class ACE_Parameters_Numeric { - GVAR(PlayerNamesViewDistance) = 5; - GVAR(PlayerNamesMaxAlpha) = 0.8; - GVAR(CrewInfoVisibility) = 0; -}; -class ACE_Parameters_Boolean { - GVAR(ShowNamesForAI) = 0; + class GVAR(PlayerNamesViewDistance) { + value = 5; + typeName = "SCALAR"; + isClientSetable = 0; + }; + class GVAR(PlayerNamesMaxAlpha) { + value = 0.8; + typeName = "SCALAR"; + isClientSetable = 0; + }; + class GVAR(CrewInfoVisibility) { + value = 0; + typeName = "BOOL"; + isClientSetable = 0; + }; + class GVAR(ShowNamesForAI) { + value = 0; + typeName = "BOOL"; + isClientSetable = 0; + }; }; #include From 981978d043ca65f82c47b0670c499752f71c3d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Fri, 30 Jan 2015 19:06:25 -0300 Subject: [PATCH 007/113] ACE_Settings: replace all ACE_Parameters --- addons/explosives/config.cpp | 12 +++++++--- addons/interaction/config.cpp | 7 ++++-- addons/magazinerepack/config.cpp | 12 +++++++--- addons/map/config.cpp | 24 +++++++++++++------ addons/respawn/config.cpp | 12 +++++++--- addons/switchunits/config.cpp | 40 +++++++++++++++++++++++--------- addons/vehiclelock/config.cpp | 7 ++++-- addons/weather/config.cpp | 8 ------- 8 files changed, 83 insertions(+), 39 deletions(-) diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index 8bf463c9f4..e4a079f107 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -39,7 +39,13 @@ class CfgMineTriggers { }; }; -class ACE_Parameters_Boolean { - GVAR(RequireSpecialist) = 0; - GVAR(PunishNonSpecialists) = 1; +class ACE_Settings { + class GVAR(RequireSpecialist) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(PunishNonSpecialists) { + value = 1; + typeName = "BOOL"; + }; }; diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index acb41d362f..38933ef506 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -33,8 +33,11 @@ class ACE_Options { }; }; -class ACE_Parameters_Boolean { - ACE_Interaction_EnableTeamManagement = 1; +class ACE_Settings { + class GVAR(EnableTeamManagement) { + value = 1; + typeName = "BOOL"; + }; }; class ACE_canInteractConditions { diff --git a/addons/magazinerepack/config.cpp b/addons/magazinerepack/config.cpp index 5f2c6edc7d..91a6f5abf5 100644 --- a/addons/magazinerepack/config.cpp +++ b/addons/magazinerepack/config.cpp @@ -15,7 +15,13 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -class ACE_Parameters_Numeric { - GVAR(TimePerAmmo) = 1.5; - GVAR(TimePerMagazine) = 2.0; +class ACE_Settings { + class GVAR(TimePerAmmo) { + value = 1.5; + typeName = "SCALAR"; + }; + class GVAR(TimePerMagazine) { + value = 2.0; + typeName = "SCALAR"; + }; }; diff --git a/addons/map/config.cpp b/addons/map/config.cpp index c9980458db..36a6f85168 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -23,13 +23,23 @@ class RscButtonMenuCancel; class RscButtonMenu; class RscEdit; -class ACE_Parameters_Numeric { - GVAR(BFT_Interval) = 1; -}; -class ACE_Parameters_Boolean { - GVAR(EveryoneCanDrawOnBriefing) = 1; - GVAR(BFT_Enabled) = 0; - GVAR(BFT_HideAiGroups) = 0; +class ACE_Settings { + class GVAR(BFT_Interval) { + value = 1.0; + typeName = "SCALAR"; + }; + class GVAR(EveryoneCanDrawOnBriefing) { + value = 1; + typeName = "BOOL"; + }; + class GVAR(BFT_Enabled) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(BFT_HideAiGroups) { + value = 0; + typeName = "BOOL"; + }; }; #include "MapGpsUI.hpp" diff --git a/addons/respawn/config.cpp b/addons/respawn/config.cpp index 0d914df949..19032df4f7 100644 --- a/addons/respawn/config.cpp +++ b/addons/respawn/config.cpp @@ -17,7 +17,13 @@ class CfgPatches { #include "CfgVehicleClasses.hpp" #include "CfgVehicles.hpp" -class ACE_Parameters_Boolean { - GVAR(SavePreDeathGear) = 0; - GVAR(RemoveDeadBodiesDisconnected) = 1; +class ACE_Settings { + class GVAR(SavePreDeathGear) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(RemoveDeadBodiesDisconnected) { + value = 1; + typeName = "BOOL"; + }; }; diff --git a/addons/switchunits/config.cpp b/addons/switchunits/config.cpp index b89adb3a7a..09d3e05594 100644 --- a/addons/switchunits/config.cpp +++ b/addons/switchunits/config.cpp @@ -15,15 +15,33 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" -class ACE_Parameters_Numeric { - GVAR(SafeZoneRadius) = 100; -}; - -class ACE_Parameters_Boolean { - GVAR(EnableSwitchUnits) = 0; - GVAR(SwitchToWest) = 0; - GVAR(SwitchToEast) = 0; - GVAR(SwitchToIndependent) = 0; - GVAR(SwitchToCivilian) = 0; - GVAR(EnableSafeZone) = 1; +class ACE_Settings { + class GVAR(SafeZoneRadius) { + value = 100; + typeName = "SCALAR"; + }; + class GVAR(EnableSwitchUnits) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(SwitchToWest) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(SwitchToEast) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(SwitchToIndependent) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(SwitchToCivilian) { + value = 0; + typeName = "BOOL"; + }; + class GVAR(EnableSafeZone) { + value = 1; + typeName = "BOOL"; + }; }; diff --git a/addons/vehiclelock/config.cpp b/addons/vehiclelock/config.cpp index 83850a2bef..9031987315 100644 --- a/addons/vehiclelock/config.cpp +++ b/addons/vehiclelock/config.cpp @@ -12,8 +12,11 @@ class CfgPatches { }; }; -class ACE_Parameters_Numeric { - GVAR(DefaultLockpickStrength) = 10; +class ACE_Settings { + class GVAR(DefaultLockpickStrength) { + value = 10; + typeName = "SCALAR"; + }; }; #include "CfgEventHandlers.hpp" diff --git a/addons/weather/config.cpp b/addons/weather/config.cpp index dc3faecf5f..f59267690f 100644 --- a/addons/weather/config.cpp +++ b/addons/weather/config.cpp @@ -14,11 +14,3 @@ class CfgPatches { #include "CfgEventhandlers.hpp" #include "CfgWorlds.hpp" - -/*class ACE_Parameters_Numeric { - GVAR(XXXX) = 100; -}; - -class ACE_Parameters_Boolean { - GVAR(XXXX) = 0; -};*/ From 7519fefee9cee050665240ad0f8241220153b9fc Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 30 Jan 2015 16:11:16 -0600 Subject: [PATCH 008/113] Fix Interaction --- addons/attach/CfgVehicles.hpp | 13 +++++++------ addons/attach/functions/fnc_attach.sqf | 2 +- addons/attach/functions/fnc_detach.sqf | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index 8a231d3679..473b67fcc5 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -7,22 +7,23 @@ class ACE_Actions { \ class GVAR(AttachVehicle) { \ displayName = "$STR_ACE_Attach_AttachDetach"; \ - condition = QUOTE( [ARR_3(_player, _target, '')] call FUNC(canAttach) ); \ - statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI); ); \ + condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI);); \ exceptions[] = {"ACE_Drag_isNotDragging"}; \ showDisabled = 0; \ priority = 0; \ icon = PATHTOF(UI\attach_ca.paa); \ - hotkey = "T"; \ + distance = 4; \ }; \ class GVAR(DetachVehicle) { \ displayName = "$STR_ACE_Attach_Detach"; \ - condition = QUOTE( [ARR_2(_player, _target)] call FUNC(canDetach) ); \ + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canDetach))); \ statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \ exceptions[] = {"ACE_Drag_isNotDragging"}; \ showDisabled = 0; \ priority = 0; \ icon = PATHTOF(UI\detach_ca.paa); \ + distance = 4; \ }; \ }; @@ -52,7 +53,7 @@ class CfgVehicles { class ACE_Equipment { class GVAR(Attach) { displayName = "$STR_ACE_Attach_AttachDetach"; - condition = QUOTE( [ARR_3(_player, _player, '')] call FUNC(canAttach) ); + condition = QUOTE(([ARR_3(_player, _player, '')] call FUNC(canAttach))); statement = QUOTE( [ARR_2(_player, _player)] call FUNC(openAttachUI); ); exceptions[] = {"ACE_Drag_isNotDragging"}; showDisabled = 0; @@ -62,7 +63,7 @@ class CfgVehicles { }; class GVAR(Detach) { displayName = "$STR_ACE_Attach_Detach"; - condition = QUOTE( [ARR_2(_player, _player)] call FUNC(canDetach) ); + condition = QUOTE(([ARR_2(_player, _player)] call FUNC(canDetach))); statement = QUOTE( [ARR_2(_player, _player)] call FUNC(detach) ); exceptions[] = {"ACE_Drag_isNotDragging"}; showDisabled = 0; diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 2619f8ac98..3b99462338 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -78,7 +78,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment }] call BIS_fnc_addStackedEventHandler; //had to spawn the mouseHint, not sure why - [localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint); + [localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] spawn EFUNC(interaction,showMouseHint); _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; }; diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index d9ade6e4d0..7f982654b5 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -6,7 +6,8 @@ Author: eRazeri and CAA-Picard Detach an item from a unit Arguments: -unit +0: OBJECT - unit doing the attaching (player) +1: OBJECT - vehicle that it will be detached from (player or vehicle) Return Value: none @@ -14,7 +15,7 @@ none private ["_itemName", "_count", "_attachedItem", "_fnc_detachDelay"]; -PARAMS_2(_unit, _attachToVehicle); +PARAMS_2(_unit,_attachToVehicle); _attachedObjectsArray = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; _attachedItemsArray = _attachToVehicle getVariable ["ACE_AttachedItemNames", []]; From 96b7c0d30c464b8d0a3a571e3362962a3683b7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Fri, 30 Jan 2015 19:19:45 -0300 Subject: [PATCH 009/113] ACE_Settings: replace all ACE_Options --- addons/goggles/config.cpp | 22 +++++++------ .../goggles/functions/fnc_externalCamera.sqf | 2 +- addons/hearing/config.cpp | 12 ++++--- addons/hearing/functions/fnc_earRinging.sqf | 2 +- addons/interaction/XEH_clientInit.sqf | 4 +-- addons/interaction/config.cpp | 33 ++++++++++--------- .../interaction/functions/fnc_getActions2.sqf | 2 +- .../functions/fnc_initialiseInteraction.sqf | 2 +- addons/movement/config.cpp | 6 ++-- addons/movement/functions/fnc_getWeight.sqf | 2 +- 10 files changed, 48 insertions(+), 39 deletions(-) diff --git a/addons/goggles/config.cpp b/addons/goggles/config.cpp index f804be003e..eafe07fb27 100644 --- a/addons/goggles/config.cpp +++ b/addons/goggles/config.cpp @@ -3,13 +3,13 @@ #define COLOUR 8.0 class CfgPatches { class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"Garth 'L-H' de Wet"}; - authorUrl = "http://garth.snakebiteink.co.za/"; - VERSION_CONFIG; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"Garth 'L-H' de Wet"}; + authorUrl = "http://garth.snakebiteink.co.za/"; + VERSION_CONFIG; }; }; @@ -243,10 +243,12 @@ class SniperCloud { ACE_Goggles_BulletCount = 1; }; -class ACE_Options { +class ACE_Settings { class GVAR(showInThirdPerson) { - displayName = $STR_ACE_Goggles_ShowInThirdPerson; - default = 0; + value = 0; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_Goggles_ShowInThirdPerson;" }; }; diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index 35b94171a6..91cc3f568c 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -19,5 +19,5 @@ #include "script_component.hpp" -if ((missionNameSpace getVariable [QGVAR(showInThirdPerson), 0]) == 1) exitWith { false }; +if (GVAR(showInThirdPerson)) exitWith { false }; (cameraView == "External") diff --git a/addons/hearing/config.cpp b/addons/hearing/config.cpp index 708146a89b..4499e647f6 100644 --- a/addons/hearing/config.cpp +++ b/addons/hearing/config.cpp @@ -22,9 +22,11 @@ class CfgPatches { #include "CfgAmmo.hpp" -class ACE_Options { - class GVAR(Hearing_DisableEarRinging) { - displayName = "$STR_ACE_Hearing_DisableEarRinging"; - default = 0; - }; +class ACE_Settings { + class GVAR(DisableEarRinging) { + default = 1; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_Hearing_DisableEarRinging"; + }; }; \ No newline at end of file diff --git a/addons/hearing/functions/fnc_earRinging.sqf b/addons/hearing/functions/fnc_earRinging.sqf index 9279b6b954..b578dad979 100644 --- a/addons/hearing/functions/fnc_earRinging.sqf +++ b/addons/hearing/functions/fnc_earRinging.sqf @@ -25,7 +25,7 @@ GVAR(newStrength) = GVAR(newStrength) max _strength; if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {}; -if (profileNamespace getVariable [QGVAR(DisableEarRinging), false]) exitWith {}; +if (QGVAR(DisableEarRinging)) exitWith {}; if (_strength > 0.75) exitWith { playSound "ACE_EarRinging_Heavy"; diff --git a/addons/interaction/XEH_clientInit.sqf b/addons/interaction/XEH_clientInit.sqf index bcc3f47def..a4474a5f3e 100644 --- a/addons/interaction/XEH_clientInit.sqf +++ b/addons/interaction/XEH_clientInit.sqf @@ -41,7 +41,7 @@ GVAR(isOpeningDoor) = false; _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; + if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false}; // Statement if (GVAR(MenuType) mod 2 == 0) then {call FUNC(onButtonUp)}; @@ -77,7 +77,7 @@ GVAR(isOpeningDoor) = false; _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; + if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false}; // Statement if (GVAR(MenuType) mod 2 == 1) then {call FUNC(onButtonUp)}; diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index 38933ef506..da62019d3a 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -18,22 +18,25 @@ class CfgPatches { #include -class ACE_Options { - class Interaction_FlowMenu { - displayName = "$STR_ACE_Interaction_FlowMenu"; - default = 0; - }; - class Interaction_AutoCloseMenu { - displayName = "$STR_ACE_Interaction_AutoCloseMenu"; - default = 0; - }; - class Interaction_AutoCenterCursor { - displayName = "$STR_ACE_Interaction_AutoCenterCursor"; - default = 1; - }; -}; - class ACE_Settings { + class GVAR(FlowMenu) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_Interaction_FlowMenu"; + }; + class GVAR(AutoCloseMenu) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_Interaction_AutoCloseMenu"; + }; + class GVAR(AutoCenterCursor) { + value = 1; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_Interaction_AutoCenterCursor"; + }; class GVAR(EnableTeamManagement) { value = 1; typeName = "BOOL"; diff --git a/addons/interaction/functions/fnc_getActions2.sqf b/addons/interaction/functions/fnc_getActions2.sqf index ab64d8d390..0de4f7a534 100644 --- a/addons/interaction/functions/fnc_getActions2.sqf +++ b/addons/interaction/functions/fnc_getActions2.sqf @@ -66,7 +66,7 @@ _cacheIndices = _cache select 2; _statement = getText (_action >> "statement"); _statement = compile _statement; - if (profileNamespace getVariable ["ACE_Interaction_FlowMenu", false]) then { + if (GVAR(FlowMenu)) then { _statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then { compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1]; } else { diff --git a/addons/interaction/functions/fnc_initialiseInteraction.sqf b/addons/interaction/functions/fnc_initialiseInteraction.sqf index 2637d28bf9..4d88eb4ea1 100644 --- a/addons/interaction/functions/fnc_initialiseInteraction.sqf +++ b/addons/interaction/functions/fnc_initialiseInteraction.sqf @@ -67,7 +67,7 @@ if (_this select 2) then { disableSerialization; _dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog); _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3; - if (profileNamespace getVariable [QGVAR(AutoCenterCursor), true]) then {setMousePosition [0.5, 0.5]}; + if (GVAR(AutoCenterCursor)) then {setMousePosition [0.5, 0.5]}; if !(_subMenu) then { _ctrlInteractionDialog ctrlSetText ([_target] call EFUNC(common,getName)); } else { diff --git a/addons/movement/config.cpp b/addons/movement/config.cpp index e8661b748c..51ab97b80a 100644 --- a/addons/movement/config.cpp +++ b/addons/movement/config.cpp @@ -17,9 +17,11 @@ class CfgPatches { //#include "CfgInventoryGlobalVariable.hpp" #include "CfgMoves.hpp" -class ACE_Options { +class ACE_Settings { class GVAR(useImperial) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; displayName = "$STR_ACE_Movement_UseImperial"; - default = 0; }; }; diff --git a/addons/movement/functions/fnc_getWeight.sqf b/addons/movement/functions/fnc_getWeight.sqf index a52ed3cb12..254b706d56 100644 --- a/addons/movement/functions/fnc_getWeight.sqf +++ b/addons/movement/functions/fnc_getWeight.sqf @@ -7,7 +7,7 @@ _unit = _this select 0; _weight = loadAbs _unit * 0.1; -if (GETGVAR(useImperial, 0) == 1) then { +if (GVAR(useImperial)) then { _weight = format ["%1lb", (round (_weight * 100)) / 100]; } else { _weight = format ["%1kg", (round (_weight * FACTOR_POUND_TO_KILOGRAMM * 100)) / 100]; From 3f9d96abd39fdd9c56e90ed390afe8a87e9e2c64 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 31 Jan 2015 03:05:07 -0600 Subject: [PATCH 010/113] Placement rewrite --- addons/attach/functions/fnc_canAttach.sqf | 2 +- addons/attach/functions/fnc_canDetach.sqf | 2 +- addons/attach/functions/fnc_placeApprove.sqf | 87 ++++++++++++-------- 3 files changed, 55 insertions(+), 36 deletions(-) diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index 264b627887..9dc4229c64 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -18,4 +18,4 @@ PARAMS_3(_unit,_attachToVehicle,_item); _attachLimit = if (_unit == _attachToVehicle) then {1} else {10}; _attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; -canStand _unit && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_item in (magazines _unit + items _unit + [""])} +canStand _unit && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_item in ((magazines _unit) + (items _unit) + [""])} diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf index 273831a6fc..bba323d2e3 100644 --- a/addons/attach/functions/fnc_canDetach.sqf +++ b/addons/attach/functions/fnc_canDetach.sqf @@ -28,7 +28,7 @@ if (_unit == _attachToVehicle) then { { _objectPos = getPos _x; _objectPos set [2, 0]; - if ((_objectPos distance _unitPos) < 2.4) exitWith {_inRange = true}; + if ((_objectPos distance _unitPos) < 4) exitWith {_inRange = true}; } forEach _attachedObjects; }; diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index 290812ae4a..630158caa6 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -1,19 +1,20 @@ /* - Name: FUNC(placeApprove) - Author(s): - Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) - Description: - Approves placement of the lightObject, releases the placement object for it to settle in a location - Parameters: - Nothing - Returns: - Nothing - Example: - call FUNC(placeApprove); +Name: FUNC(placeApprove) +Author(s): + Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) +Description: + Approves placement of the lightObject, releases the placement object for it to settle in a location +Parameters: + Nothing +Returns: + Nothing +Example: + call FUNC(placeApprove); */ #include "script_component.hpp" -private ["_setupObject", "_setupClassname", "_itemClassname", "_placementText", "_attachToVehicle", "_player", "_position0", "_closeInRatio", "_offset", "_keepGoingCloser", "_pos0temp", "_position1", "_attachedObject", "_currentObjects", "_currentItemNames"]; +private ["_setupObject", "_setupClassname", "_itemClassname", "_placementText", "_attachToVehicle", "_placer", "_startingPosition", "_startingOffset", "_distanceFromCenter", "_closeInUnitVector", "_keepGoingCloser", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_currentObjects", "_currentItemNames"]; + if (GVAR(pfeh_running)) then { [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; @@ -25,17 +26,17 @@ _setupClassname = typeOf _setupObject; _itemClassname = GVAR(SetupPlacmentItem); _placementText = GVAR(SetupPlacmentText); _attachToVehicle = GVAR(SetupAttachVehicle); +_placer = GVAR(placer); GVAR(SetupPlacmentItem) = ""; GVAR(SetupPlacmentText) = ""; GVAR(setupObject) = objNull; GVAR(SetupAttachVehicle) = objNull; -[GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); GVAR(placer) = objNull; -_player = ACE_player; -[_player, "DefaultAction", _player getVariable [QGVAR(placeActionEH), -1]] call EFUNC(common,removeActionEventHandler); -[_player, "MenuBack", _player getVariable [QGVAR(cancelActionEH), -1]] call EFUNC(common,removeActionEventHandler); +[_placer, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +[_placer, "DefaultAction", _placer getVariable [QGVAR(placeActionEH), -1]] call EFUNC(common,removeActionEventHandler); +[_placer, "MenuBack", _placer getVariable [QGVAR(cancelActionEH), -1]] call EFUNC(common,removeActionEventHandler); call EFUNC(interaction,hideMouseHint); //A player can release the attachObject with it floating in mid-air. @@ -44,37 +45,55 @@ call EFUNC(interaction,hideMouseHint); //So it does multiple scans at slighly different angles //This is VERY computationaly intensive, but doesn't happen that often. -_position0 = getPosAtl _setupObject; -_closeInRatio = 1; -_offset = _attachToVehicle worldToModel _position0; +_startingPosition = _setupObject modelToWorld [0,0,0]; +_startingOffset = _attachToVehicle worldToModel _startingPosition; + +_distanceFromCenter = vectorMagnitude _startingOffset; +_closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); _keepGoingCloser = true; +_closeInDistance = 0; + while {_keepGoingCloser} do { - _closeInRatio = _closeInRatio - 0.004; - if (_closeInRatio <= 0) exitWith {}; + if (_closeInDistance >= _distanceFromCenter) exitWith {}; + + _closeInDistance = _closeInDistance + 0.01; //10mm + _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); + _endPosTestOffset set [2, (_startingOffset select 2)]; + _endPosTest = _attachToVehicle modelToWorld _endPosTestOffset; + { - _pos0temp = _position0 vectorAdd _x; + _startingPosShifted = _startingPosition vectorAdd _x; + _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; { - _position1 = [(_offset select 0) * _closeInRatio, (_offset select 1) * _closeInRatio, (_offset select 2)]; - _position1 = _attachToVehicle modelToWorld _position1; - _position1 = _position1 vectorAdd _x; + _endPosShifted = _endPosTest vectorAdd _x; + _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; + //Uncomment to see the lazor show, and see how the scanning works: - // drawLine3D [_pos0temp, _position1, [1,0,0,1]]; - if (_attachToVehicle in lineIntersectsWith [(ATLToASL _pos0temp), (ATLToASL _position1), player, _setupObject]) exitWith {_keepGoingCloser = false}; - } forEach [[0,0,0], [0,0,0.075], [0,0,-0.075], [0,0.075,0], [0,-0.075,0], [0.075,0,0], [-.075,0,0]]; - } forEach [[0,0,0], [0,0,0.075], [0,0,-0.075]]; + drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]]; + + if (_attachToVehicle in lineIntersectsWith [_startASL, _endASL, _placer, _setupObject]) exitWith {_keepGoingCloser = false}; + } forEach [[0,0,0.045], [0,0,-0.045], [0,0.045,0], [0,-0.045,0], [0.045,0,0], [-0.045,0,0]]; + } forEach [[0,0,0], [0,0,0.05], [0,0,-0.05]]; }; -//Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull) -_closeInRatio = (_closeInRatio + 0.006) min 1; //Delete Local Placement Object deleteVehicle _setupObject; +//Checks +if (_closeInDistance >= _distanceFromCenter) exitWith {ERROR("no valid spot found")}; +if (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach))) exitWith {ERROR("canAttach failed")}; + +//Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull) +_closeInDistance = (_closeInDistance - 0.0085); + //Create New 'real' Object -_attachedObject = _setupClassname createVehicle (getPos _player); -_attachedObject attachTo [_attachToVehicle, [(_offset select 0) * _closeInRatio, (_offset select 1) * _closeInRatio, (_offset select 2)]]; +_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); +_endPosTestOffset set [2, (_startingOffset select 2)]; +_attachedObject = _setupClassname createVehicle (getPos _placer); +_attachedObject attachTo [_attachToVehicle, _endPosTestOffset]; //Remove Item from inventory -_player removeItem _itemClassname; +_placer removeItem _itemClassname; //Add Object to ACE_AttachedObjects and ACE_AttachedItemNames _currentObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; From 8ceb2aabc1137aec9f9c08394cdcbca91b25e978 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 31 Jan 2015 11:43:58 -0600 Subject: [PATCH 011/113] Attach Stuff --- addons/attach/functions/fnc_attach.sqf | 7 ++++--- addons/attach/functions/fnc_openAttachUI.sqf | 2 +- addons/attach/functions/fnc_placeApprove.sqf | 8 +++++--- addons/attach/functions/fnc_placeCancel.sqf | 5 +---- addons/attach/stringtable.xml | 9 ++++++++- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 3b99462338..0c6302db71 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -69,7 +69,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment private "_player"; _player = ACE_player; //Stop if player switch or player gets to far from vehicle - if ((GVAR(placer) != _player) || ((_player distance GVAR(SetupAttachVehicle)) > 9)) exitWith { + if ((GVAR(placer) != _player) || {(_player distance GVAR(SetupAttachVehicle)) > 7}) exitWith { call FUNC(placeCancel); }; GVAR(pfeh_running) = true; @@ -77,8 +77,9 @@ if (_unit == _attachToVehicle) then { //Self Attachment GVAR(setupObject) setPosATL _pos; }] call BIS_fnc_addStackedEventHandler; - //had to spawn the mouseHint, not sure why - [localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] spawn EFUNC(interaction,showMouseHint); + //had to delay the mouseHint, not sure why + [{[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint)}, [], 0, 0] call EFUNC(common,waitAndExecute); + _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; }; diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index 573e0ad27f..db1a5d1513 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -8,7 +8,7 @@ Parameters: 0: OBJECT - unit - 0: OBJECT - target + 1: OBJECT - target Returns: Nothing diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index 630158caa6..687ce472c5 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -56,7 +56,7 @@ _closeInDistance = 0; while {_keepGoingCloser} do { if (_closeInDistance >= _distanceFromCenter) exitWith {}; - _closeInDistance = _closeInDistance + 0.01; //10mm + _closeInDistance = _closeInDistance + 0.01; //10mm each step _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset set [2, (_startingOffset select 2)]; _endPosTest = _attachToVehicle modelToWorld _endPosTestOffset; @@ -80,8 +80,10 @@ while {_keepGoingCloser} do { deleteVehicle _setupObject; //Checks -if (_closeInDistance >= _distanceFromCenter) exitWith {ERROR("no valid spot found")}; -if (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach))) exitWith {ERROR("canAttach failed")}; +if ((_closeInDistance >= _distanceFromCenter) || (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach)))) exitWith { + TRACE_2("no valid spot found",_closeInDistance,_distanceFromCenter); + [localize "STR_ACE_Attach_Failed"] call EFUNC(common,displayTextStructured); +}; //Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull) _closeInDistance = (_closeInDistance - 0.0085); diff --git a/addons/attach/functions/fnc_placeCancel.sqf b/addons/attach/functions/fnc_placeCancel.sqf index ffa84b9d12..12577512e8 100644 --- a/addons/attach/functions/fnc_placeCancel.sqf +++ b/addons/attach/functions/fnc_placeCancel.sqf @@ -29,10 +29,7 @@ GVAR(SetupPlacmentItem) = ""; GVAR(SetupPlacmentText) = ""; GVAR(setupObject) = objNull; GVAR(SetupAttachVehicle) = objNull; -if (isNil QGVAR(placer)) then { - ERROR("Nil placer?"); - GVAR(placer) = objNull; -}; + [GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); call EFUNC(interaction,hideMouseHint); diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index ef26e0738d..21577c55d3 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -168,5 +168,12 @@ Annulla Mégse + + Attach Failed + Échec du Attacher + Befestigen Fehlgeschlagen + Присоединить Ошибка + Error en Acoplar + \ No newline at end of file From 3f0b6650e00826a6057db1839c5f6aac3622fecd Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 1 Feb 2015 11:11:51 +0100 Subject: [PATCH 012/113] Added weapon resting & weapon jam sounds --- addons/overheating/CfgSounds.hpp | 20 ++++++++++++++++++ addons/overheating/functions/fnc_clearJam.sqf | 8 ++++++- .../overheating/sounds}/fixing_pistol.wav | Bin .../overheating/sounds}/fixing_rifle.wav | Bin .../overheating/sounds}/jamming_pistol.wav | Bin .../overheating/sounds}/jamming_rifle.wav | Bin addons/resting/CfgSounds.hpp | 14 ++++++++++++ addons/resting/config.cpp | 2 ++ addons/resting/functions/fnc_restWeapon.sqf | 4 ++++ addons/resting/functions/fnc_unRestWeapon.sqf | 2 ++ .../resting/sounds}/weaponrest_rest.wav | Bin .../resting/sounds}/weaponrest_unrest.wav | Bin 12 files changed, 49 insertions(+), 1 deletion(-) rename {TO_MERGE/cse/sys_weaponheat/sound => addons/overheating/sounds}/fixing_pistol.wav (100%) rename {TO_MERGE/cse/sys_weaponheat/sound => addons/overheating/sounds}/fixing_rifle.wav (100%) rename {TO_MERGE/cse/sys_weaponheat/sound => addons/overheating/sounds}/jamming_pistol.wav (100%) rename {TO_MERGE/cse/sys_weaponheat/sound => addons/overheating/sounds}/jamming_rifle.wav (100%) create mode 100644 addons/resting/CfgSounds.hpp rename {TO_MERGE/cse/sys_equipment/weaponresting/sound => addons/resting/sounds}/weaponrest_rest.wav (100%) rename {TO_MERGE/cse/sys_equipment/weaponresting/sound => addons/resting/sounds}/weaponrest_unrest.wav (100%) diff --git a/addons/overheating/CfgSounds.hpp b/addons/overheating/CfgSounds.hpp index fd3a5596bd..d230561c09 100644 --- a/addons/overheating/CfgSounds.hpp +++ b/addons/overheating/CfgSounds.hpp @@ -3,4 +3,24 @@ class CfgSounds { sound[] = {QUOTE(PATHTOF(sounds\barrelswap.ogg)),5,1,200}; titles[] = {}; }; + class GVAR(jamming_rifle) { + name=QGVAR(jamming_rifle); + sound[]={QUOTE(PATHTOF(sounds\jamming_rifle.wav)),1,1}; + titles[]={}; + }; + class GVAR(jamming_pistol) { + name=QGVAR(jamming_pistol); + sound[]={QUOTE(PATHTOF(sounds\jamming_pistol.wav)),1,1}; + titles[]={}; + }; + class GVAR(fixing_rifle) { + name=QGVAR(fixing_rifle); + sound[]={QUOTE(PATHTOF(sounds\fixing_rifle.wav)),1,1}; + titles[]={}; + }; + class GVAR(fixing_pistol) { + name= QGVAR(fixing_pistol); + sound[]={QUOTE(PATHTOF(sounds\fixing_pistol.wav)),1,1}; + titles[]={}; + }; }; diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf index 829ab34811..2340c6c890 100644 --- a/addons/overheating/functions/fnc_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -42,6 +42,12 @@ if (_weapon in _jammedWeapons) then { _unit playActionNow _clearJamAction; }; - + if (_weapon == primaryWeapon _unit) then { + playSound QGVAR(fixing_rifle); + } else { + if (_weapon == secondaryWeapon _unit) then { + playSound QGVAR(fixing_pistol); + }; + }; [localize "STR_ACE_Overheating_WeaponUnjammed"] call EFUNC(common,displayTextStructured); }; diff --git a/TO_MERGE/cse/sys_weaponheat/sound/fixing_pistol.wav b/addons/overheating/sounds/fixing_pistol.wav similarity index 100% rename from TO_MERGE/cse/sys_weaponheat/sound/fixing_pistol.wav rename to addons/overheating/sounds/fixing_pistol.wav diff --git a/TO_MERGE/cse/sys_weaponheat/sound/fixing_rifle.wav b/addons/overheating/sounds/fixing_rifle.wav similarity index 100% rename from TO_MERGE/cse/sys_weaponheat/sound/fixing_rifle.wav rename to addons/overheating/sounds/fixing_rifle.wav diff --git a/TO_MERGE/cse/sys_weaponheat/sound/jamming_pistol.wav b/addons/overheating/sounds/jamming_pistol.wav similarity index 100% rename from TO_MERGE/cse/sys_weaponheat/sound/jamming_pistol.wav rename to addons/overheating/sounds/jamming_pistol.wav diff --git a/TO_MERGE/cse/sys_weaponheat/sound/jamming_rifle.wav b/addons/overheating/sounds/jamming_rifle.wav similarity index 100% rename from TO_MERGE/cse/sys_weaponheat/sound/jamming_rifle.wav rename to addons/overheating/sounds/jamming_rifle.wav diff --git a/addons/resting/CfgSounds.hpp b/addons/resting/CfgSounds.hpp new file mode 100644 index 0000000000..b55d4d9ae8 --- /dev/null +++ b/addons/resting/CfgSounds.hpp @@ -0,0 +1,14 @@ +class CfgSounds { + class GVAR(rest) + { + name=QGVAR(rest); + sound[]={QUOTE(PATHTOF(sounds\weaponrest_rest.wav)),1,1}; + titles[]={}; + }; + class GVAR(unrest) + { + name=QGVAR(unrest); + sound[]={QUOTE(PATHTOF(sounds\weaponrest_unrest.wav)),1,1}; + titles[]={}; + }; +}; \ No newline at end of file diff --git a/addons/resting/config.cpp b/addons/resting/config.cpp index ac710c82a8..599c15d318 100644 --- a/addons/resting/config.cpp +++ b/addons/resting/config.cpp @@ -17,3 +17,5 @@ class CfgPatches { #include "CfgWeapons.hpp" #include "CfgMoves.hpp" + +#include "CfgSounds.hpp" \ No newline at end of file diff --git a/addons/resting/functions/fnc_restWeapon.sqf b/addons/resting/functions/fnc_restWeapon.sqf index e22a1309f3..e66e13bc6f 100644 --- a/addons/resting/functions/fnc_restWeapon.sqf +++ b/addons/resting/functions/fnc_restWeapon.sqf @@ -14,6 +14,8 @@ EXPLODE_3_PVT(_this,_unit,_vehicle,_weapon); +systemChat format["restingWeapon %1", _this]; + if (_weapon != primaryWeapon _unit) exitWith {}; if (_unit getVariable ["ACE_weaponRested", false]) exitWith {_this call FUNC(unRestWeapon)}; @@ -33,6 +35,8 @@ if (true in _intersects) then { // REST THE WEAPON addCamShake CAMSHAKE; + playSound QGVAR(rest); + // playSound3D [QUOTE(PATHTOF(sounds\weaponrest_rest.wav)), _unit]; if ([_weapon] call FUNC(hasBipod) && {_intersects select 3}) then { _unit setVariable ["ACE_bipodDeployed", true]; diff --git a/addons/resting/functions/fnc_unRestWeapon.sqf b/addons/resting/functions/fnc_unRestWeapon.sqf index b182cd89e8..deeb4f6c52 100644 --- a/addons/resting/functions/fnc_unRestWeapon.sqf +++ b/addons/resting/functions/fnc_unRestWeapon.sqf @@ -43,6 +43,8 @@ if (_unit getVariable ["ACE_bipodDeployed", false]) then { _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [localize "STR_ACE_Resting_WeaponLifted", _picture] call EFUNC(common,displayTextPicture); }; +playSound QGVAR(unrest); +//playSound3D [QUOTE(PATHTOF(sounds\weaponrest_unrest.wav)), _unit]; _unit setVariable ["ACE_weaponRested", false]; _unit setVariable ["ACE_bipodDeployed", false]; diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_rest.wav b/addons/resting/sounds/weaponrest_rest.wav similarity index 100% rename from TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_rest.wav rename to addons/resting/sounds/weaponrest_rest.wav diff --git a/TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_unrest.wav b/addons/resting/sounds/weaponrest_unrest.wav similarity index 100% rename from TO_MERGE/cse/sys_equipment/weaponresting/sound/weaponrest_unrest.wav rename to addons/resting/sounds/weaponrest_unrest.wav From 96e0d0e758514eceb8210441b48c9e89ca07c618 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 1 Feb 2015 11:14:21 +0100 Subject: [PATCH 013/113] Removed rouge debug code & dead code --- addons/resting/functions/fnc_restWeapon.sqf | 3 --- addons/resting/functions/fnc_unRestWeapon.sqf | 1 - 2 files changed, 4 deletions(-) diff --git a/addons/resting/functions/fnc_restWeapon.sqf b/addons/resting/functions/fnc_restWeapon.sqf index e66e13bc6f..52b1932f62 100644 --- a/addons/resting/functions/fnc_restWeapon.sqf +++ b/addons/resting/functions/fnc_restWeapon.sqf @@ -14,8 +14,6 @@ EXPLODE_3_PVT(_this,_unit,_vehicle,_weapon); -systemChat format["restingWeapon %1", _this]; - if (_weapon != primaryWeapon _unit) exitWith {}; if (_unit getVariable ["ACE_weaponRested", false]) exitWith {_this call FUNC(unRestWeapon)}; @@ -36,7 +34,6 @@ if (true in _intersects) then { // REST THE WEAPON addCamShake CAMSHAKE; playSound QGVAR(rest); - // playSound3D [QUOTE(PATHTOF(sounds\weaponrest_rest.wav)), _unit]; if ([_weapon] call FUNC(hasBipod) && {_intersects select 3}) then { _unit setVariable ["ACE_bipodDeployed", true]; diff --git a/addons/resting/functions/fnc_unRestWeapon.sqf b/addons/resting/functions/fnc_unRestWeapon.sqf index deeb4f6c52..86caa31ac8 100644 --- a/addons/resting/functions/fnc_unRestWeapon.sqf +++ b/addons/resting/functions/fnc_unRestWeapon.sqf @@ -44,7 +44,6 @@ if (_unit getVariable ["ACE_bipodDeployed", false]) then { [localize "STR_ACE_Resting_WeaponLifted", _picture] call EFUNC(common,displayTextPicture); }; playSound QGVAR(unrest); -//playSound3D [QUOTE(PATHTOF(sounds\weaponrest_unrest.wav)), _unit]; _unit setVariable ["ACE_weaponRested", false]; _unit setVariable ["ACE_bipodDeployed", false]; From 0419b7cbe5f9c7797bab070fc98ac4e06af6e9fd Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 1 Feb 2015 11:17:15 +0100 Subject: [PATCH 014/113] Formatting --- addons/overheating/CfgSounds.hpp | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/addons/overheating/CfgSounds.hpp b/addons/overheating/CfgSounds.hpp index d230561c09..c32fc02abf 100644 --- a/addons/overheating/CfgSounds.hpp +++ b/addons/overheating/CfgSounds.hpp @@ -3,24 +3,24 @@ class CfgSounds { sound[] = {QUOTE(PATHTOF(sounds\barrelswap.ogg)),5,1,200}; titles[] = {}; }; - class GVAR(jamming_rifle) { - name=QGVAR(jamming_rifle); - sound[]={QUOTE(PATHTOF(sounds\jamming_rifle.wav)),1,1}; - titles[]={}; - }; - class GVAR(jamming_pistol) { - name=QGVAR(jamming_pistol); - sound[]={QUOTE(PATHTOF(sounds\jamming_pistol.wav)),1,1}; - titles[]={}; - }; - class GVAR(fixing_rifle) { - name=QGVAR(fixing_rifle); - sound[]={QUOTE(PATHTOF(sounds\fixing_rifle.wav)),1,1}; - titles[]={}; - }; - class GVAR(fixing_pistol) { - name= QGVAR(fixing_pistol); - sound[]={QUOTE(PATHTOF(sounds\fixing_pistol.wav)),1,1}; - titles[]={}; - }; + class GVAR(jamming_rifle) { + name=QGVAR(jamming_rifle); + sound[]={QUOTE(PATHTOF(sounds\jamming_rifle.wav)),1,1}; + titles[]={}; + }; + class GVAR(jamming_pistol) { + name=QGVAR(jamming_pistol); + sound[]={QUOTE(PATHTOF(sounds\jamming_pistol.wav)),1,1}; + titles[]={}; + }; + class GVAR(fixing_rifle) { + name=QGVAR(fixing_rifle); + sound[]={QUOTE(PATHTOF(sounds\fixing_rifle.wav)),1,1}; + titles[]={}; + }; + class GVAR(fixing_pistol) { + name= QGVAR(fixing_pistol); + sound[]={QUOTE(PATHTOF(sounds\fixing_pistol.wav)),1,1}; + titles[]={}; + }; }; From fa002b4db6515792a77a91f64ef4a522e790d287 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 1 Feb 2015 14:56:19 -0600 Subject: [PATCH 015/113] Formating and Headers --- addons/attach/$PBOPREFIX$ | 2 +- addons/attach/CfgEventHandlers.hpp | 6 +- addons/attach/CfgMagazines.hpp | 16 +- addons/attach/CfgVehicles.hpp | 254 +++++++++---------- addons/attach/CfgWeapons.hpp | 24 +- addons/attach/README.md | 4 +- addons/attach/config.cpp | 18 +- addons/attach/functions/fnc_attach.sqf | 121 ++++----- addons/attach/functions/fnc_canAttach.sqf | 24 +- addons/attach/functions/fnc_canDetach.sqf | 46 ++-- addons/attach/functions/fnc_detach.sqf | 85 ++++--- addons/attach/functions/fnc_openAttachUI.sqf | 86 +++---- addons/attach/functions/fnc_placeApprove.sqf | 66 ++--- addons/attach/functions/fnc_placeCancel.sqf | 46 ++-- 14 files changed, 406 insertions(+), 392 deletions(-) diff --git a/addons/attach/$PBOPREFIX$ b/addons/attach/$PBOPREFIX$ index 1e4e48a4ca..71a2f40af8 100644 --- a/addons/attach/$PBOPREFIX$ +++ b/addons/attach/$PBOPREFIX$ @@ -1 +1 @@ -z\ace\Addons\laser \ No newline at end of file +z\ace\Addons\attach \ No newline at end of file diff --git a/addons/attach/CfgEventHandlers.hpp b/addons/attach/CfgEventHandlers.hpp index 5eca7fa129..4c2b8b16ca 100644 --- a/addons/attach/CfgEventHandlers.hpp +++ b/addons/attach/CfgEventHandlers.hpp @@ -1,5 +1,5 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); - }; + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; }; \ No newline at end of file diff --git a/addons/attach/CfgMagazines.hpp b/addons/attach/CfgMagazines.hpp index 293a075d70..282d36b964 100644 --- a/addons/attach/CfgMagazines.hpp +++ b/addons/attach/CfgMagazines.hpp @@ -1,10 +1,10 @@ class CfgMagazines { - class CA_Magazine; - class B_IR_Grenade: CA_Magazine { - ACE_Attachable = 1; - }; - class SmokeShell; - class Chemlight_green: SmokeShell { - ACE_Attachable = 1; - }; + class CA_Magazine; + class B_IR_Grenade: CA_Magazine { + ACE_Attachable = 1; + }; + class SmokeShell; + class Chemlight_green: SmokeShell { + ACE_Attachable = 1; + }; }; \ No newline at end of file diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index 473b67fcc5..bc1f52988a 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -1,147 +1,147 @@ #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; + name = #ITEM; \ + count = COUNT; \ + }; #define MACRO_ATTACHTOVEHICLE \ - class ACE_Actions { \ - class GVAR(AttachVehicle) { \ - displayName = "$STR_ACE_Attach_AttachDetach"; \ - condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \ - statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI);); \ - exceptions[] = {"ACE_Drag_isNotDragging"}; \ - showDisabled = 0; \ - priority = 0; \ - icon = PATHTOF(UI\attach_ca.paa); \ - distance = 4; \ - }; \ - class GVAR(DetachVehicle) { \ - displayName = "$STR_ACE_Attach_Detach"; \ - condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canDetach))); \ - statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \ - exceptions[] = {"ACE_Drag_isNotDragging"}; \ - showDisabled = 0; \ - priority = 0; \ - icon = PATHTOF(UI\detach_ca.paa); \ - distance = 4; \ - }; \ - }; + class ACE_Actions { \ + class GVAR(AttachVehicle) { \ + displayName = "$STR_ACE_Attach_AttachDetach"; \ + condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI);); \ + exceptions[] = {"ACE_Drag_isNotDragging"}; \ + showDisabled = 0; \ + priority = 0; \ + icon = PATHTOF(UI\attach_ca.paa); \ + distance = 4; \ + }; \ + class GVAR(DetachVehicle) { \ + displayName = "$STR_ACE_Attach_Detach"; \ + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canDetach))); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \ + exceptions[] = {"ACE_Drag_isNotDragging"}; \ + showDisabled = 0; \ + priority = 0; \ + icon = PATHTOF(UI\detach_ca.paa); \ + distance = 4; \ + }; \ + }; class CfgVehicles { - class LandVehicle; - class Car: LandVehicle { - MACRO_ATTACHTOVEHICLE - }; - class Tank: LandVehicle { - MACRO_ATTACHTOVEHICLE - }; - class Air; - class Helicopter: Air { - MACRO_ATTACHTOVEHICLE - }; - class Plane: Air { - MACRO_ATTACHTOVEHICLE - }; - class Ship; - class Ship_F: Ship { - MACRO_ATTACHTOVEHICLE - }; - - class Man; - class CAManBase: Man { - class ACE_SelfActions { - class ACE_Equipment { - class GVAR(Attach) { - displayName = "$STR_ACE_Attach_AttachDetach"; - condition = QUOTE(([ARR_3(_player, _player, '')] call FUNC(canAttach))); - statement = QUOTE( [ARR_2(_player, _player)] call FUNC(openAttachUI); ); - exceptions[] = {"ACE_Drag_isNotDragging"}; - showDisabled = 0; - priority = 5; - icon = PATHTOF(UI\attach_ca.paa); - hotkey = "T"; + class LandVehicle; + class Car: LandVehicle { + MACRO_ATTACHTOVEHICLE + }; + class Tank: LandVehicle { + MACRO_ATTACHTOVEHICLE + }; + class Air; + class Helicopter: Air { + MACRO_ATTACHTOVEHICLE + }; + class Plane: Air { + MACRO_ATTACHTOVEHICLE + }; + class Ship; + class Ship_F: Ship { + MACRO_ATTACHTOVEHICLE + }; + + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(Attach) { + displayName = "$STR_ACE_Attach_AttachDetach"; + condition = QUOTE(([ARR_3(_player, _player, '')] call FUNC(canAttach))); + statement = QUOTE( [ARR_2(_player, _player)] call FUNC(openAttachUI); ); + exceptions[] = {"ACE_Drag_isNotDragging"}; + showDisabled = 0; + priority = 5; + icon = PATHTOF(UI\attach_ca.paa); + hotkey = "T"; + }; + class GVAR(Detach) { + displayName = "$STR_ACE_Attach_Detach"; + condition = QUOTE(([ARR_2(_player, _player)] call FUNC(canDetach))); + statement = QUOTE( [ARR_2(_player, _player)] call FUNC(detach) ); + exceptions[] = {"ACE_Drag_isNotDragging"}; + showDisabled = 0; + priority = 5; + icon = PATHTOF(UI\detach_ca.paa); + hotkey = "T"; + }; + }; }; - class GVAR(Detach) { - displayName = "$STR_ACE_Attach_Detach"; - condition = QUOTE(([ARR_2(_player, _player)] call FUNC(canDetach))); - statement = QUOTE( [ARR_2(_player, _player)] call FUNC(detach) ); - exceptions[] = {"ACE_Drag_isNotDragging"}; - showDisabled = 0; - priority = 5; - icon = PATHTOF(UI\detach_ca.paa); - hotkey = "T"; + }; + + class All; + class ACE_IR_Strobe_Effect: All { + scope = 1; + displayName = "IR Strobe"; + model = "\A3\Weapons_F\empty.p3d"; + simulation = "nvmarker"; + + class NVGMarker { + diffuse[] = {0,0,0}; + ambient[] = {0,0,0}; + brightness = 0.004; + name = "pozicni blik"; + drawLight = 1; + drawLightSize = 0.005; + drawLightCenterSize = 0.003; + activeLight = 0; + blinking=1; + dayLight = 0; + onlyInNvg = 1; + useFlare = 0; }; - }; + side = 7;//-1=NO_SIDE yellow box,3=CIV grey box,4=NEUTRAL yellow box,6=FRIENDLY green box,7=LOGIC no radar signature + accuracy = 1000; + cost = 0; + armor = 500; + threat[] = {0,0,0}; + nameSound = ""; + type = 0; + weapons[] = {}; + magazines[] = {}; + nvTarget = 1; + destrType = "DestructNo"; + brightness = 20; }; - }; - class All; - class ACE_IR_Strobe_Effect: All { - scope = 1; - displayName = "IR Strobe"; - model = "\A3\Weapons_F\empty.p3d"; - simulation = "nvmarker"; + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class FIA_Box_Base_F; - class NVGMarker { - diffuse[] = {0,0,0}; - ambient[] = {0,0,0}; - brightness = 0.004; - name = "pozicni blik"; - drawLight = 1; - drawLightSize = 0.005; - drawLightCenterSize = 0.003; - activeLight = 0; - blinking=1; - dayLight = 0; - onlyInNvg = 1; - useFlare = 0; + class Box_NATO_Support_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + }; }; - side = 7;//-1=NO_SIDE yellow box,3=CIV grey box,4=NEUTRAL yellow box,6=FRIENDLY green box,7=LOGIC no radar signature - accuracy = 1000; - cost = 0; - armor = 500; - threat[] = {0,0,0}; - nameSound = ""; - type = 0; - weapons[] = {}; - magazines[] = {}; - nvTarget = 1; - destrType = "DestructNo"; - brightness = 20; - }; - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class FIA_Box_Base_F; - - class Box_NATO_Support_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + class Box_East_Support_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + }; }; - }; - class Box_East_Support_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + class Box_IND_Support_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + }; }; - }; - class Box_IND_Support_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + class Box_FIA_Support_F: FIA_Box_Base_F { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + }; }; - }; - class Box_FIA_Support_F: FIA_Box_Base_F { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + }; }; - }; - - class ACE_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) - }; - }; }; \ No newline at end of file diff --git a/addons/attach/CfgWeapons.hpp b/addons/attach/CfgWeapons.hpp index 65ca397ec9..8174f67b38 100644 --- a/addons/attach/CfgWeapons.hpp +++ b/addons/attach/CfgWeapons.hpp @@ -1,16 +1,16 @@ class CfgWeapons { - class ACE_ItemCore; - class InventoryItem_Base_F; + class ACE_ItemCore; + class InventoryItem_Base_F; - class ACE_IR_Strobe_Item: ACE_ItemCore { - displayName = "$STR_ACE_IrStrobe_Name"; - descriptionShort = "$STR_ACE_IrStrobe_Description"; - model = "\A3\weapons_F\ammo\mag_univ.p3d"; - picture = PATHTOF(UI\irstrobe_item.paa); - scope = 2; - ACE_attachable = 1; - class ItemInfo: InventoryItem_Base_F { - mass = 1; + class ACE_IR_Strobe_Item: ACE_ItemCore { + displayName = "$STR_ACE_IrStrobe_Name"; + descriptionShort = "$STR_ACE_IrStrobe_Description"; + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + picture = PATHTOF(UI\irstrobe_item.paa); + scope = 2; + ACE_attachable = 1; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; }; - }; }; \ No newline at end of file diff --git a/addons/attach/README.md b/addons/attach/README.md index 7ac36f109d..5fb73d0645 100644 --- a/addons/attach/README.md +++ b/addons/attach/README.md @@ -1,7 +1,8 @@ ace_attach ========== -Introducing the ability to attach various throwables to yourself to mark your position and assist in IFF. +Introducing the ability to attach various throwables to yourself or vehicles, to mark your position and assist in IFF. +Adds item `ACE_IR_Strobe_Item`. ## Maintainers @@ -11,3 +12,4 @@ The people responsible for merging changes to this component or answering potent - [esteldunedain](https://github.com/esteldunedain) - [bux578](https://github.com/bux578) - [KoffeinFlummi](https://github.com/KoffeinFlummi) +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/attach/config.cpp b/addons/attach/config.cpp index 4143f6eb44..9accc9f253 100644 --- a/addons/attach/config.cpp +++ b/addons/attach/config.cpp @@ -1,15 +1,15 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {"ACE_IR_Strobe_Item"}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common", "ace_interaction"}; - author[] = {"KoffeinFlummi", "eRazeri", "CAA-Picard"}; - authorUrl = "https://github.com/KoffeinFlummi/"; - VERSION_CONFIG; - }; + class ADDON { + units[] = {}; + weapons[] = {"ACE_IR_Strobe_Item"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common", "ace_interaction"}; + author[] = {"KoffeinFlummi", "eRazeri", "CAA-Picard"}; + authorUrl = "https://github.com/KoffeinFlummi/"; + VERSION_CONFIG; + }; }; #include "CfgEventHandlers.hpp" diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 0c6302db71..9fd0cf7952 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -1,18 +1,21 @@ -#include "script_component.hpp" - /* -Author: eRazeri and CAA-Picard - -Attach an item to the unit - -Arguments: -0: OBJECT - unit doing the attaching (player) -1: OBJECT - vehicle that it will be attached to (player or vehicle) -2: STRING - classname of attached item (from CfgMagazines or CfgWeapons) - -Return Value: -none -*/ + * Author: eRazeri and CAA-Picard + * Attach an item to the unit + * + * Arguments: + * 0: unit doing the attach (player) + * 1: vehicle that it will be attached to (player or vehicle) + * 2: Name of the attachable item + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ +#include "script_component.hpp" PARAMS_3(_unit,_attachToVehicle,_itemName); @@ -25,61 +28,61 @@ _onAtachText = ""; switch true do { case (_itemName == "ACE_IR_Strobe_Item"): { - _itemVehClass = "ACE_IR_Strobe_Effect"; - _onAtachText = localize "STR_ACE_Attach_IrStrobe_Attached"; - _selfAttachPosition = [_unit,[0,-0.11,0.16],"pilot"]; //makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri - }; + _itemVehClass = "ACE_IR_Strobe_Effect"; + _onAtachText = localize "STR_ACE_Attach_IrStrobe_Attached"; + _selfAttachPosition = [_unit,[0,-0.11,0.16],"pilot"]; //makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri + }; case (_itemName == "B_IR_Grenade"): { - _itemVehClass = "B_IRStrobe"; - _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; - }; + _itemVehClass = "B_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; + }; case (_itemName == "O_IR_Grenade"): { - _itemVehClass = "O_IRStrobe"; - _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; - }; + _itemVehClass = "O_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; + }; case (_itemName == "I_IR_Grenade"): { - _itemVehClass = "I_IRStrobe"; - _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; - }; + _itemVehClass = "I_IRStrobe"; + _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; + }; case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}): { - _itemVehClass = _itemName; - _onAtachText = localize "STR_ACE_Attach_Chemlight_Attached"; - }; + _itemVehClass = _itemName; + _onAtachText = localize "STR_ACE_Attach_Chemlight_Attached"; + }; }; if (_itemVehClass == "") exitWith {ERROR("no _itemVehClass for Item");}; if (_unit == _attachToVehicle) then { //Self Attachment - _unit removeItem _itemName; // Remove item - _attachedItem = _itemVehClass createVehicle [0,0,0]; - _attachedItem attachTo _selfAttachPosition; - [_onAtachText] call EFUNC(common,displayTextStructured); - _attachToVehicle setVariable ["ACE_AttachedObjects", [_attachedItem], true]; - _attachToVehicle setVariable ["ACE_AttachedItemNames", [_itemName], true]; + _unit removeItem _itemName; // Remove item + _attachedItem = _itemVehClass createVehicle [0,0,0]; + _attachedItem attachTo _selfAttachPosition; + [_onAtachText] call EFUNC(common,displayTextStructured); + _attachToVehicle setVariable ["ACE_AttachedObjects", [_attachedItem], true]; + _attachToVehicle setVariable ["ACE_AttachedItemNames", [_itemName], true]; } else { - GVAR(setupObject) = _itemVehClass createVehicleLocal [0,0,-10000]; - GVAR(setupObject) enableSimulationGlobal false; - GVAR(SetupPlacmentText) = _onAtachText; - GVAR(SetupPlacmentItem) = _itemName; - GVAR(SetupAttachVehicle) = _attachToVehicle; - GVAR(placer) = _unit; - [_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); + GVAR(setupObject) = _itemVehClass createVehicleLocal [0,0,-10000]; + GVAR(setupObject) enableSimulationGlobal false; + GVAR(SetupPlacmentText) = _onAtachText; + GVAR(SetupPlacmentItem) = _itemName; + GVAR(SetupAttachVehicle) = _attachToVehicle; + GVAR(placer) = _unit; + [_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); - [QGVAR(PlacementEachFrame),"OnEachFrame", { - private "_player"; - _player = ACE_player; - //Stop if player switch or player gets to far from vehicle - if ((GVAR(placer) != _player) || {(_player distance GVAR(SetupAttachVehicle)) > 7}) exitWith { - call FUNC(placeCancel); - }; - GVAR(pfeh_running) = true; - _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); - GVAR(setupObject) setPosATL _pos; - }] call BIS_fnc_addStackedEventHandler; + [QGVAR(PlacementEachFrame),"OnEachFrame", { + private "_player"; + _player = ACE_player; + //Stop if player switch or player gets to far from vehicle + if ((GVAR(placer) != _player) || {(_player distance GVAR(SetupAttachVehicle)) > 7}) exitWith { + call FUNC(placeCancel); + }; + GVAR(pfeh_running) = true; + _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); + GVAR(setupObject) setPosATL _pos; + }] call BIS_fnc_addStackedEventHandler; - //had to delay the mouseHint, not sure why - [{[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint)}, [], 0, 0] call EFUNC(common,waitAndExecute); - - _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; - _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; + //had to delay the mouseHint, not sure why + [{[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint)}, [], 0, 0] call EFUNC(common,waitAndExecute); + + _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; + _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; }; diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index 9dc4229c64..ac646ef700 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -1,17 +1,21 @@ -#include "script_component.hpp" - /* * Author: commy2 - * * Check if a unit can attach a specific item. - * - * Argument: - * 0: Unit that wants to attach the object (Object) - * 1: Name of the attachable item (String) - * - * Return value: - * Boolean (Bool) + * + * Arguments: + * 0: unit doing the attach (player) + * 1: vehicle that it will be attached to (player or vehicle) + * 2: Name of the attachable item + * + * Return Value: + * Boolean + * + * Example: + * Nothing + * + * Public: No */ +#include "script_component.hpp" PARAMS_3(_unit,_attachToVehicle,_item); diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf index bba323d2e3..d099d2035e 100644 --- a/addons/attach/functions/fnc_canDetach.sqf +++ b/addons/attach/functions/fnc_canDetach.sqf @@ -1,16 +1,20 @@ -#include "script_component.hpp" - /* -* Author: commy2 -* -* Check if a unit has an item attached and if it can remove that item. -* -* Argument: -* 0: Unit that wants to detach something (Object) -* -* Return value: -* Boolean (Bool) -*/ + * Author: commy2 + * Check if a unit has an item attached and if it can remove that item. + * + * Arguments: + * 0: unit doing the detaching (player) + * 1: vehicle that it will be detached from (player or vehicle) + * + * Return Value: + * Boolean + * + * Example: + * Nothing + * + * Public: No + */ +#include "script_component.hpp" private ["_attachedObjects", "_inRange", "_unitPos", "_objectPos"]; @@ -20,16 +24,16 @@ _attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; _inRange = false; if (_unit == _attachToVehicle) then { - _inRange = (count _attachedObjects) > 0; + _inRange = (count _attachedObjects) > 0; } else { - //Scan if unit is within range (using 2d distance) - _unitPos = getPos _unit; - _unitPos set [2,0]; - { - _objectPos = getPos _x; - _objectPos set [2, 0]; - if ((_objectPos distance _unitPos) < 4) exitWith {_inRange = true}; - } forEach _attachedObjects; + //Scan if unit is within range (using 2d distance) + _unitPos = getPos _unit; + _unitPos set [2,0]; + { + _objectPos = getPos _x; + _objectPos set [2, 0]; + if ((_objectPos distance _unitPos) < 4) exitWith {_inRange = true}; + } forEach _attachedObjects; }; (canStand _unit) && _inRange && {alive _attachToVehicle} diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index 7f982654b5..b18cec09bd 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -1,17 +1,20 @@ -#include "script_component.hpp" - /* -Author: eRazeri and CAA-Picard - -Detach an item from a unit - -Arguments: -0: OBJECT - unit doing the attaching (player) -1: OBJECT - vehicle that it will be detached from (player or vehicle) - -Return Value: -none -*/ + * Author: eRazeri and CAA-Picard + * Detach an item from a unit + * + * Arguments: + * 0: unit doing the attaching (player) + * 1: vehicle that it will be detached from (player or vehicle) + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ +#include "script_component.hpp" private ["_itemName", "_count", "_attachedItem", "_fnc_detachDelay"]; @@ -29,14 +32,14 @@ _minDistance = 1000; _unitPos = getPos _unit; _unitPos set [2,0]; { - _objectPos = getPos _x; - _objectPos set [2, 0]; - if ((_objectPos distance _unitPos) < _minDistance) then { - _minDistance = (_objectPos distance _unitPos); - _attachedObject = _x; - _itemName = _attachedItemsArray select _forEachIndex; - _attachedIndex = _forEachIndex; - }; + _objectPos = getPos _x; + _objectPos set [2, 0]; + if ((_objectPos distance _unitPos) < _minDistance) then { + _minDistance = (_objectPos distance _unitPos); + _attachedObject = _x; + _itemName = _attachedItemsArray select _forEachIndex; + _attachedIndex = _forEachIndex; + }; } forEach _attachedObjectsArray; // Check if unit has an attached item @@ -46,21 +49,21 @@ if ((isNull _attachedObject) || {_itemName == ""}) exitWith {ERROR("Could not fi _count = (count items _unit) + (count magazines _unit); _unit addItem _itemName; if ((count items _unit) + (count magazines _unit) <= _count) exitWith { - [localize "STR_ACE_Attach_Inventory_Full"] call EFUNC(common,displayTextStructured); + [localize "STR_ACE_Attach_Inventory_Full"] call EFUNC(common,displayTextStructured); }; if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") then { - // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle - detach _attachedObject; - _attachedObject setPos [getPos _unit select 0, getPos _unit select 1, ((getPos _unit select 2) - 1000)]; - // Delete attached item after 0.5 seconds - _fnc_detachDelay = { - deleteVehicle (_this select 0); - }; - [_fnc_detachDelay, [_attachedObject], 0.5, 0] call EFUNC(common,waitAndExecute); + // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle + detach _attachedObject; + _attachedObject setPos [getPos _unit select 0, getPos _unit select 1, ((getPos _unit select 2) - 1000)]; + // Delete attached item after 0.5 seconds + _fnc_detachDelay = { + deleteVehicle (_this select 0); + }; + [_fnc_detachDelay, [_attachedObject], 0.5, 0] call EFUNC(common,waitAndExecute); } else { - // Delete attached item - deleteVehicle _attachedObject; + // Delete attached item + deleteVehicle _attachedObject; }; // Reset unit variables @@ -71,13 +74,13 @@ _attachToVehicle setVariable ["ACE_AttachedItemNames", _attachedItemsArray, true // Display message switch true do { - case (_itemName == "ACE_IR_Strobe_Item") : { - [localize "STR_ACE_Attach_IrStrobe_Detached"] call EFUNC(common,displayTextStructured); - }; - case (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") : { - [localize "STR_ACE_Attach_IrGrenade_Detached"] call EFUNC(common,displayTextStructured); - }; - case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}) : { - [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); - }; +case (_itemName == "ACE_IR_Strobe_Item") : { + [localize "STR_ACE_Attach_IrStrobe_Detached"] call EFUNC(common,displayTextStructured); + }; +case (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") : { + [localize "STR_ACE_Attach_IrGrenade_Detached"] call EFUNC(common,displayTextStructured); + }; +case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}) : { + [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); + }; }; diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index db1a5d1513..6521e43fbe 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -1,21 +1,21 @@ +/* + * Author: Garth de Wet (LH) + * Opens the UI for attaching objects. + * + * Arguments: + * 0: unit + * 1: target + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ #include "script_component.hpp" -/* - Author: Garth de Wet (LH) - - Description: - Opens the UI for attaching objects. - - Parameters: - 0: OBJECT - unit - 1: OBJECT - target - - Returns: - Nothing - - Example: - [player] call ACE_Attach_fnc_openAttachUI; -*/ private ["_actions", "_attachables", "_item"]; PARAMS_2(_unit,_target); @@ -25,43 +25,43 @@ _listed = []; _attachables = magazines _unit; _actions = [localize "STR_ACE_Attach_AttachDetach", localize "STR_ACE_Attach_Attach"] call EFUNC(interaction,prepareSelectMenu); { - if !(_x in _listed) then { - _item = ConfigFile >> "CfgMagazines" >> _x; - if (getNumber (_item >> "ACE_Attachable") == 1) then { - _actions = [ - _actions, - getText(_item >> "displayName"), - getText(_item >> "picture"), - _x - ] call EFUNC(interaction,addSelectableItem); + if !(_x in _listed) then { + _item = ConfigFile >> "CfgMagazines" >> _x; + if (getNumber (_item >> "ACE_Attachable") == 1) then { + _actions = [ + _actions, + getText(_item >> "displayName"), + getText(_item >> "picture"), + _x + ] call EFUNC(interaction,addSelectableItem); + }; + _listed pushBack _x; }; - _listed pushBack _x; - }; } forEach _attachables; _attachables = items _unit; { - if !(_x in _listed) then { - _item = ConfigFile >> "CfgWeapons" >> _x; - if (getNumber (_item >> "ACE_Attachable") == 1) then { - _actions = [ - _actions, - getText(_item >> "displayName"), - getText(_item >> "picture"), - _x - ] call EFUNC(interaction,addSelectableItem); + if !(_x in _listed) then { + _item = ConfigFile >> "CfgWeapons" >> _x; + if (getNumber (_item >> "ACE_Attachable") == 1) then { + _actions = [ + _actions, + getText(_item >> "displayName"), + getText(_item >> "picture"), + _x + ] call EFUNC(interaction,addSelectableItem); + }; + _listed pushBack _x; }; - _listed pushBack _x; - }; } forEach _attachables; [ - _actions, - { +_actions, +{ [ACE_player, GVAR(attachTarget), _this] call FUNC(attach); call EFUNC(interaction,hideMenu); - }, - { +}, +{ call EFUNC(interaction,hideMenu); if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; - } +} ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index 687ce472c5..ceb48de9b5 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -1,24 +1,26 @@ /* -Name: FUNC(placeApprove) -Author(s): - Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) -Description: - Approves placement of the lightObject, releases the placement object for it to settle in a location -Parameters: - Nothing -Returns: - Nothing -Example: - call FUNC(placeApprove); -*/ + * Author: Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) + * Approves placement of the lightObject, scans for an appropriate location and attaches + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ #include "script_component.hpp" private ["_setupObject", "_setupClassname", "_itemClassname", "_placementText", "_attachToVehicle", "_placer", "_startingPosition", "_startingOffset", "_distanceFromCenter", "_closeInUnitVector", "_keepGoingCloser", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_currentObjects", "_currentItemNames"]; if (GVAR(pfeh_running)) then { - [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; - GVAR(pfeh_running) = false; + [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; + GVAR(pfeh_running) = false; }; _setupObject = GVAR(setupObject); @@ -54,26 +56,26 @@ _keepGoingCloser = true; _closeInDistance = 0; while {_keepGoingCloser} do { - if (_closeInDistance >= _distanceFromCenter) exitWith {}; + if (_closeInDistance >= _distanceFromCenter) exitWith {}; - _closeInDistance = _closeInDistance + 0.01; //10mm each step - _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); - _endPosTestOffset set [2, (_startingOffset select 2)]; - _endPosTest = _attachToVehicle modelToWorld _endPosTestOffset; + _closeInDistance = _closeInDistance + 0.01; //10mm each step + _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); + _endPosTestOffset set [2, (_startingOffset select 2)]; + _endPosTest = _attachToVehicle modelToWorld _endPosTestOffset; - { - _startingPosShifted = _startingPosition vectorAdd _x; - _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; { - _endPosShifted = _endPosTest vectorAdd _x; - _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; - - //Uncomment to see the lazor show, and see how the scanning works: - drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]]; + _startingPosShifted = _startingPosition vectorAdd _x; + _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; + { + _endPosShifted = _endPosTest vectorAdd _x; + _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; - if (_attachToVehicle in lineIntersectsWith [_startASL, _endASL, _placer, _setupObject]) exitWith {_keepGoingCloser = false}; - } forEach [[0,0,0.045], [0,0,-0.045], [0,0.045,0], [0,-0.045,0], [0.045,0,0], [-0.045,0,0]]; - } forEach [[0,0,0], [0,0,0.05], [0,0,-0.05]]; + //Uncomment to see the lazor show, and see how the scanning works: + drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]]; + + if (_attachToVehicle in lineIntersectsWith [_startASL, _endASL, _placer, _setupObject]) exitWith {_keepGoingCloser = false}; + } forEach [[0,0,0.045], [0,0,-0.045], [0,0.045,0], [0,-0.045,0], [0.045,0,0], [-0.045,0,0]]; + } forEach [[0,0,0], [0,0,0.05], [0,0,-0.05]]; }; //Delete Local Placement Object @@ -81,8 +83,8 @@ deleteVehicle _setupObject; //Checks if ((_closeInDistance >= _distanceFromCenter) || (!([_placer,_attachToVehicle,_itemClassname] call FUNC(canAttach)))) exitWith { - TRACE_2("no valid spot found",_closeInDistance,_distanceFromCenter); - [localize "STR_ACE_Attach_Failed"] call EFUNC(common,displayTextStructured); + TRACE_2("no valid spot found",_closeInDistance,_distanceFromCenter); + [localize "STR_ACE_Attach_Failed"] call EFUNC(common,displayTextStructured); }; //Move it out slightly, for visability sake (better to look a little funny than be embedded//sunk in the hull) diff --git a/addons/attach/functions/fnc_placeCancel.sqf b/addons/attach/functions/fnc_placeCancel.sqf index 12577512e8..3abdf848ba 100644 --- a/addons/attach/functions/fnc_placeCancel.sqf +++ b/addons/attach/functions/fnc_placeCancel.sqf @@ -1,35 +1,27 @@ /* - Name: FUNC(placeCancel) - - Author(s): - Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) - - Description: - Cancels placement of the lightObject - - Parameters: - Nothing - - Returns: - Nothing - - Example: - call FUNC(placeCancel); -*/ + * Author: Pabst Mirror (based on Explosive attach by Garth de Wet (LH)) + * Cancels placement of the lightObject + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * Nothing + * + * Public: No + */ #include "script_component.hpp" if (GVAR(pfeh_running)) then { - [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; - GVAR(pfeh_running) = false; + [QGVAR(PlacementEachFrame),"OnEachFrame"] call BIS_fnc_removeStackedEventHandler; + GVAR(pfeh_running) = false; }; if (!isNull (GVAR(setupObject))) then { - deleteVehicle GVAR(setupObject); + deleteVehicle GVAR(setupObject); }; -GVAR(SetupPlacmentItem) = ""; -GVAR(SetupPlacmentText) = ""; -GVAR(setupObject) = objNull; -GVAR(SetupAttachVehicle) = objNull; - [GVAR(placer), QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); call EFUNC(interaction,hideMouseHint); @@ -37,3 +29,7 @@ call EFUNC(interaction,hideMouseHint); [GVAR(placer), "MenuBack", GVAR(placer) getVariable [QGVAR(cancelActionEH), -1]] call EFUNC(common,removeActionEventHandler); GVAR(placer) = objNull; +GVAR(SetupPlacmentItem) = ""; +GVAR(SetupPlacmentText) = ""; +GVAR(setupObject) = objNull; +GVAR(SetupAttachVehicle) = objNull; From d339b9567dcf7554e768d2a776be93613f9c1936 Mon Sep 17 00:00:00 2001 From: bux578 Date: Mon, 2 Feb 2015 23:28:27 +0100 Subject: [PATCH 016/113] add header & PFH WIP --- addons/switchunits/CfgEventHandlers.hpp | 6 +- .../{XEH_postInit.sqf => XEH_clientInit.sqf} | 31 ++-- .../functions/fnc_addMapFunction.sqf | 30 ++-- .../functions/fnc_handleMapClick.sqf | 52 +++--- .../switchunits/functions/fnc_initPlayer.sqf | 30 ++-- .../switchunits/functions/fnc_isValidAi.sqf | 30 ++-- .../switchunits/functions/fnc_markAiOnMap.sqf | 103 ++++++------ addons/switchunits/functions/fnc_module.sqf | 32 ++-- .../functions/fnc_nearestPlayers.sqf | 30 ++-- .../switchunits/functions/fnc_switchBack.sqf | 56 ++++--- .../switchunits/functions/fnc_switchUnit.sqf | 150 ++++++++++-------- 11 files changed, 288 insertions(+), 262 deletions(-) rename addons/switchunits/{XEH_postInit.sqf => XEH_clientInit.sqf} (56%) diff --git a/addons/switchunits/CfgEventHandlers.hpp b/addons/switchunits/CfgEventHandlers.hpp index 47dcd984d1..38f9883743 100644 --- a/addons/switchunits/CfgEventHandlers.hpp +++ b/addons/switchunits/CfgEventHandlers.hpp @@ -5,7 +5,7 @@ class Extended_PreInit_EventHandlers { }; class Extended_PostInit_EventHandlers { - class ADDON { - postInit = QUOTE(call COMPILE_FILE(XEH_postInit) ); - }; + class ADDON { + clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); + }; }; diff --git a/addons/switchunits/XEH_postInit.sqf b/addons/switchunits/XEH_clientInit.sqf similarity index 56% rename from addons/switchunits/XEH_postInit.sqf rename to addons/switchunits/XEH_clientInit.sqf index 3ce84ef838..cf6873c14b 100644 --- a/addons/switchunits/XEH_postInit.sqf +++ b/addons/switchunits/XEH_clientInit.sqf @@ -1,17 +1,22 @@ /* - Author(s): - bux578 -*/ + * Author: bux578 + * Initializes the SwitchUnits pbo. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ #include "script_component.hpp" -//0 spawn { - -private ["_sides"]; - -//waitUntil {sleep 0.5; AGM_SwitchUnits_EnableSwitchUnits}; - -//_side = [west, east, independent, civilian] select AGM_SwitchUnits_SwitchUnitsAllowedForSide; +private "_sides"; _sides = []; @@ -20,8 +25,8 @@ if(GVAR(SwitchToEast)) then {_sides pushBack east}; if(GVAR(SwitchToIndependent)) then {_sides pushBack independent}; if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian}; +hint "TEST"; + if (player getVariable ["ACE_CanSwitchUnits", false]) then { -[player, _sides] call FUNC(initPlayer); + [player, _sides] call FUNC(initPlayer); }; - -//}; diff --git a/addons/switchunits/functions/fnc_addMapFunction.sqf b/addons/switchunits/functions/fnc_addMapFunction.sqf index 1c4e158d80..62a7c42a22 100644 --- a/addons/switchunits/functions/fnc_addMapFunction.sqf +++ b/addons/switchunits/functions/fnc_addMapFunction.sqf @@ -1,19 +1,19 @@ /* - Name: ACE_SwitchUnits_fnc_addMapFunction - - Author(s): - bux578 - - Description: - Adds a mapClick Eventhandler - - Parameters: - 0: OBJECT - unit - 1: ARRAY - sides - - Returns: - VOID -*/ + * Author: bux578 + * Adds a mapClick Eventhandler + * + * Arguments: + * 0: unit + * 1: sides > + * + * Return Value: + * None + * + * Example: + * [_unit, _sides] call FUNC(addMapFunction) + * + * Public: No + */ #include "script_component.hpp" diff --git a/addons/switchunits/functions/fnc_handleMapClick.sqf b/addons/switchunits/functions/fnc_handleMapClick.sqf index bce28963da..3033071984 100644 --- a/addons/switchunits/functions/fnc_handleMapClick.sqf +++ b/addons/switchunits/functions/fnc_handleMapClick.sqf @@ -1,45 +1,41 @@ /* - Name: ACE_SwitchUnits_fnc_handleMapClick - - Author(s): - bux578 - - Description: - Finds the clicked unit - - Parameters: - 0: OBJECT - MapClickEventHandlerArgs - 0: OBJECT - unit // useless - 1: ARRAY - sides - - Returns: - VOID -*/ + * Author: bux578 + * Switches to a unit close to a clicked map position + * + * Arguments: + * 0: unit + * 1: sides > + * + * Return Value: + * None + * + * Example: + * [_unit, _sides] call FUNC(handleMapClick) + * + * Public: No + */ #include "script_component.hpp" private ["_sides", "_pos", "_sideNearest"]; -// that's wrong -//_currentPlayerUnit = (_this select 0) select 0; - _sides = (_this select 0) select 1; _pos = _this select 1; _sideNearest = []; { - if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then { - _sideNearest pushBack _x; - }; + if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then { + _sideNearest pushBack _x; + }; } forEach (nearestObjects [_pos, ["Man"], 20]); if (count _sideNearest > 0) then { - private ["_switchUnit"]; - - _switchUnit = _sideNearest select 0; - [ACE_player, _switchUnit] call FUNC(switchUnit); - - openMap false; + private ["_switchUnit"]; + + _switchUnit = _sideNearest select 0; + [ACE_player, _switchUnit] call FUNC(switchUnit); + + openMap false; }; diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index 81e4fc259f..f904a460c2 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -1,19 +1,19 @@ /* - Name: ACE_SwitchUnits_fnc_initPlayer - - Author(s): - bux578 - - Description: - Initializes the player - - Parameters: - 0: OBJECT - player - 1: ARRAY - Array containing selected sides - - Returns: - VOID -*/ + * Author: bux578 + * Initializes the player + * + * Arguments: + * 0: player + * 1: sides > + * + * Return Value: + * None + * + * Example: + * [_player, _sides] call FUNC(initPlayer) + * + * Public: No + */ #include "script_component.hpp" diff --git a/addons/switchunits/functions/fnc_isValidAi.sqf b/addons/switchunits/functions/fnc_isValidAi.sqf index 5beb59d430..61c2401da9 100644 --- a/addons/switchunits/functions/fnc_isValidAi.sqf +++ b/addons/switchunits/functions/fnc_isValidAi.sqf @@ -1,22 +1,22 @@ /* - Name: ACE_SwitchUnits_fnc_isValidAi - - Author(s): - bux578 - - Description: - Checks if AI is a valid target for switching - - Parameters: - 0: OBJECT - unit - - Returns: - VOID -*/ + * Author: bux578 + * Checks if AI is a valid target for switching. + * + * Arguments: + * 0: unit + * + * Return Value: + * Boolean + * + * Example: + * [_unit] call FUNC(isValidAi) + * + * Public: Yes + */ #include "script_component.hpp" -private ["_unit"]; +private "_unit"; _unit = _this select 0; diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index e54673c1a5..c07199dc31 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -1,69 +1,68 @@ /* - Name: ACE_SwitchUnits_fnc_markAiOnMap - - Author(s): - bux578 - - Description: - Creates markers for AI units for given sides - Marks players in a different color - - Parameters: - 0: OBJECT - side - - Returns: - VOID -*/ + * Author: bux578 + * Creates markers for AI units for given sides. + * Marks players in a different colour. + * + * Arguments: + * 0: side + * + * Return Value: + * None + * + * Example: + * [west, east] call FUNC(markAiOnMap) + * + * Public: No + */ #include "script_component.hpp" -private ["_sidesToShow"]; +private "_sidesToShow"; _sidesToShow = _this select 0; -_sidesToShow spawn { +GVAR(AllMarkerNames) = []; - private ["_sides", "_allMarkerNames"]; - _sides = _this; - _allMarkerNames = []; +DFUNC(pfhMarkAiOnMap) = { + private ["_args", "_sides"]; + _args = _this select 0; + _sides = _args select 0; - while { true } do { - sleep 1.5; + // delete markers + { + deleteMarkerLocal _x; + } forEach GVAR(AllMarkerNames); - // delete markers + if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then { + + // create markers { - deleteMarkerLocal _x; - } forEach _allMarkerNames; + if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then { + private ["_markerName", "_marker", "_markerColor"]; - if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then { + //_markerName = format ["%1", [_x] call EFUNC(common,getName)]; + _markerName = str _x; - // create markers - { - if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then { - private ["_markerName", "_marker", "_markerColor"]; + _marker = createMarkerLocal [_markerName, position _x]; + _markerName setMarkerTypeLocal "mil_triangle"; + _markerName setMarkerShapeLocal "ICON"; + _markerName setMarkerSizeLocal [0.5,0.7]; + _markerName setMarkerDirLocal getDir _x; - //_markerName = format ["%1", [_x] call EFUNC(common,getName)]; - _markerName = str _x; + // commy's one liner magic + _markerColor = format ["Color%1", side group _x]; - _marker = createMarkerLocal [_markerName, position _x]; - _markerName setMarkerTypeLocal "mil_triangle"; - _markerName setMarkerShapeLocal "ICON"; - _markerName setMarkerSizeLocal [0.5,0.7]; - _markerName setMarkerDirLocal getDir _x; - - // commy's one liner magic - _markerColor = format ["Color%1", side group _x]; - - if ((_x getVariable [QGVAR(IsPlayerControlled), false])) then { - _markerName setMarkerColorLocal "ColorOrange"; - _markerName setMarkerTextLocal (_x getVariable [QGVAR(PlayerControlledName), ""]); - } else { - _markerName setMarkerColorLocal _markerColor; - _markerName setMarkerTextLocal (getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName")); - }; - - _allMarkerNames pushBack _markerName; + if ((_x getVariable [QGVAR(IsPlayerControlled), false])) then { + _markerName setMarkerColorLocal "ColorOrange"; + _markerName setMarkerTextLocal (_x getVariable [QGVAR(PlayerControlledName), ""]); + } else { + _markerName setMarkerColorLocal _markerColor; + _markerName setMarkerTextLocal (getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName")); }; - } forEach allUnits; - }; + + GVAR(AllMarkerNames) pushBack _markerName; + }; + } forEach allUnits; }; }; + +[FUNC(pfhMarkAiOnMap), 1, _sidesToShow] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index c4f5c378c2..9444cb5f61 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -1,20 +1,20 @@ /* - Name: ACE_SwitchUnits_fnc_module - - Author(s): - bux578 - - Description: - Initializes the SwitchUnits module - - Parameters: - 0: OBJECT - module logic - 1: ARRAY - list of affected units - 2: BOOLEAN - isActivated - - Returns: - BOOLEAN (Good practice to include one) -*/ + * Author: bux578 + * Initializes the SwitchUnits module + * + * Arguments: + * 0: module logic + * 1: list of affected units > + * 2: isActivated + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ #include "script_component.hpp" diff --git a/addons/switchunits/functions/fnc_nearestPlayers.sqf b/addons/switchunits/functions/fnc_nearestPlayers.sqf index 217e1b90e4..b79c54054f 100644 --- a/addons/switchunits/functions/fnc_nearestPlayers.sqf +++ b/addons/switchunits/functions/fnc_nearestPlayers.sqf @@ -1,19 +1,19 @@ /* - Name: ACE_SwitchUnits_fnc_nearestPlayers - - Author(s): - bux578 - - Description: - Returns an array of alive players in a given radius around a given location - - Parameters: - 0: POSTION - Center position - 1: NUMBER - Radius - - Returns: - ARRAY - Player units -*/ + * Author: bux578 + * Returns an array of alive players in a given radius around a given location + * + * Arguments: + * 0: Center position + * 1: Radius + * + * Return Value: + * Player units > + * + * Example: + * [_pos, 100] call FUNC(nearestPlayers) + * + * Public: Yes + */ #include "script_component.hpp" diff --git a/addons/switchunits/functions/fnc_switchBack.sqf b/addons/switchunits/functions/fnc_switchBack.sqf index 6bdc2c8bac..d54713bbe4 100644 --- a/addons/switchunits/functions/fnc_switchBack.sqf +++ b/addons/switchunits/functions/fnc_switchBack.sqf @@ -1,31 +1,41 @@ /* - Name: ACE_SwitchUnits_fnc_switchBack - - Author(s): - bux578 - - Description: - Switches back to the original player unit - This method needs to be "spawn"ed - - Parameters: - 0: OBJECT - original player unit - 1: OBJECT - respawned unit - - Returns: - VOID -*/ + * Author: bux578 + * Switches back to the original player unit + * + * Arguments: + * 0: Original player unit + * 1: Respawned unit + * + * Return Value: + * None + * + * Example: + * [_origPlayer, _respPlayer] call FUNC(switchBack) + * + * Public: Yes + */ #include "script_component.hpp" -private ["_originalPlayerUnit", "_currentUnit"]; -_originalPlayerUnit = _this select 0; -_currentUnit = _this select 1; +private ["_origPlayerUnit"]; -[_originalPlayerUnit] joinSilent GVAR(OriginalGroup); +_origPlayerUnit = _this select 0; +[_origPlayerUnit] joinSilent GVAR(OriginalGroup); -waitUntil {local _originalPlayerUnit}; +DFUNC(pfhSwitchBack) = { + + private ["_args", "_originalPlayerUnit", "_currentUnit"]; + + _args = _this select 0; + + _originalPlayerUnit = _args select 0; + _currentUnit = _args select 1; -selectPlayer _originalPlayerUnit; + if (local _originalPlayerUnit) exitWith { + selectPlayer _originalPlayerUnit; + deleteVehicle _currentUnit; + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; +}; -deleteVehicle _currentUnit; +[FUNC(pfhSwitchBack), 0.2, _this] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index efe3cef901..d5a4f39a4a 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -1,81 +1,97 @@ /* - Name: ACE_SwitchUnits_fnc_switchUnit - - Author(s): - bux578 - - Description: - Selects the new given player unit - - Parameters: - 0: OBJECT - the unit to switch to - - Returns: - VOID -*/ + * Author: bux578 + * Switches to the new given player unit + * + * Arguments: + * 0: current unit + * 1: the unit to switch to + * + * Return Value: + * None + * + * Example: + * [_unit] call FUNC(switchUnit) + * + * Public: Yes + */ + #include "script_component.hpp" -private ["_newUnit"]; +private ["_unit", "_allNearestPlayers", "_oldUnit", "_leave"]; -_newUnit = _this select 1; +_unit = _this select 1; // don't switch to original player units -if (!([_newUnit] call FUNC(isValidAi))) exitWith {}; +if (!([_unit] call FUNC(isValidAi))) exitWith {}; + +// exit var +_leave = false; + +if (GVAR(EnableSafeZone)) then { -_newUnit spawn { - private ["_unit", "_allNearestPlayers", "_oldUnit", "_respawnEhId", "_oldOwner", "_leave"]; - - _unit = _this; - - _leave = false; - - if (GVAR(EnableSafeZone)) then { - _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); _nearestEnemyPlayers = [_allNearestPlayers, {((side GVAR(OriginalGroup)) getFriend (side _this) < 0.6) && !(_this getVariable [QGVAR(IsPlayerControlled), false])}] call EFUNC(common,filter); if (count _nearestEnemyPlayers > 0) exitWith { - _leave = true; + _leave = true; }; - }; - - // exitWith doesn't exit past the "if(EnableSafeZone)" block - if (_leave) exitWith { - [localize "STR_ACE_SwitchUnits_TooCloseToEnemy"] call EFUNC(common,displayTextStructured); - }; - - // should switch locality - // This doesn't work anymore, because one's now able to switch to units from a different side - //[_unit] joinSilent group player; - [[_unit, player], QUOTE({(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; (_this select 0) setOwner owner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); - - _oldUnit = player; - waitUntil {sleep 0.2; local _unit}; - - _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; - _oldUnit setVariable [QGVAR(PlayerControlledName), "", true]; - - _respawnEhId = _unit getVariable [QGVAR(RespawnEhId), -1]; - if (_respawnEhId != -1) then { - _oldUnit removeEventHandler ["Respawn", _respawnEhId]; - }; - - selectPlayer _unit; - - _unit setVariable [QGVAR(IsPlayerControlled), true, true]; - _unit setVariable [QGVAR(PlayerControlledName), GVAR(OriginalName), true]; - - _respawnEhId = _unit addEventHandler ["Respawn", { - [GVAR(OriginalUnit), _this select 0] spawn FUNC(switchBack); - }]; - _unit setVariable [QGVAR(RespawnEhId), _respawnEhId, true]; - - // set owner back to original owner - _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; - if (_oldOwner > -1) then { - [[_oldUnit, _oldOwner], QUOTE({(_this select 0) setOwner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); - }; - - [localize "STR_ACE_SwitchUnits_SwitchedUnit"] call EFUNC(common,displayTextStructured); + }; + +// exitWith doesn't exit past the "if(EnableSafeZone)" block +if (_leave) exitWith { + [localize "STR_ACE_SwitchUnits_TooCloseToEnemy"] call EFUNC(common,displayTextStructured); +}; + +// should switch locality +// This doesn't work anymore, because one's now able to switch to units from a different side +//[_unit] joinSilent group player; +[[_unit, player], QUOTE({(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; (_this select 0) setOwner owner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); + +_oldUnit = player; + + + +DFUNC(pfhSwitchUnit) = { + + private ["_args", "_unit", "_oldUnit", "_respawnEhId", "_oldOwner"]; + _args = _this select 0; + + _unit = _args select 0; + _oldUnit = _args select 1; + + if (local _unit) exitWith { + + _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; + _oldUnit setVariable [QGVAR(PlayerControlledName), "", true]; + + _respawnEhId = _unit getVariable [QGVAR(RespawnEhId), -1]; + if (_respawnEhId != -1) then { + _oldUnit removeEventHandler ["Respawn", _respawnEhId]; + }; + + selectPlayer _unit; + + _unit setVariable [QGVAR(IsPlayerControlled), true, true]; + _unit setVariable [QGVAR(PlayerControlledName), GVAR(OriginalName), true]; + + _respawnEhId = _unit addEventHandler ["Respawn", { + [GVAR(OriginalUnit), _this select 0] call FUNC(switchBack); + }]; + _unit setVariable [QGVAR(RespawnEhId), _respawnEhId, true]; + + // set owner back to original owner + _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; + if (_oldOwner > -1) then { + [[_oldUnit, _oldOwner], QUOTE({(_this select 0) setOwner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); + }; + + [localize "STR_ACE_SwitchUnits_SwitchedUnit"] call EFUNC(common,displayTextStructured); + + [(_this select 1)] call cba_fnc_removePerFrameHandler; + + }; +}; + +[FUNC(pfhSwitchBack), 0.2, [_unit, _oldUnit]] call cba_fnc_addPerFrameHandler; From 0600a72147c81671d534e2028b2cb72d9ea3288f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Mon, 2 Feb 2015 21:13:31 -0300 Subject: [PATCH 017/113] Fixes --- addons/common/XEH_preInit.sqf | 3 +- .../functions/fnc_loadSettingsOnServer.sqf | 43 ++++++++----------- .../functions/fnc_setSettingFromConfig.sqf | 29 +++++++------ addons/hearing/functions/fnc_earRinging.sqf | 2 +- 4 files changed, 36 insertions(+), 41 deletions(-) diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 6cd1c4ce61..a7b48d7192 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -165,9 +165,8 @@ PREP(hashListSelect); PREP(hashListSet); PREP(hashListPush); - // Load settings -if (isServer) {} +if (isServer) then { call FUNC(loadSettingsOnServer); }; diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf index 000d8f69cc..e9d87ad742 100644 --- a/addons/common/functions/fnc_loadSettingsOnServer.sqf +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -20,11 +20,7 @@ _countOptions = count (configFile >> "ACE_Settings"); for "_index" from 0 to (_countOptions - 1) do { _optionEntry = (configFile >> "ACE_Settings") select _index; - _name = configName _optionEntry; - _valueEntry = _optionEntry >> "value"; - _typeEntry = _optionEntry >> "typeName"; - - [_name, _valueEntry, _typeEntry] call FUNC(setSettingFromConfig); + [_optionEntry] call FUNC(setSettingFromConfig); }; // Check if all settings should be forced if (GVAR(forceAllSettings)) then { @@ -36,32 +32,29 @@ if (GVAR(forceAllSettings)) then { } forEach GVAR(settingsList); }; - -// Load settings from server userconfig -DFUNC(common,serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp"; -if !(isNil QFUNC(common,serverUserConfig)) then { - [] call FUNC(serverUserConfig); +// Load settings from server userconfig only if the ACE_ServerSettings is loaded +if (isClass (configFile >> "CfgPatches" >> "ACE_ServerSettings")) then { + DFUNC(serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp"; + if !(isNil DFUNC(serverUserConfig)) then { + [] call FUNC(serverUserConfig); + }; + // Check if all settings should be forced + if (GVAR(forceAllSettings)) then { + { + if !(missionNamespace getVariable format ["%1_forced", _x]) then { + missionNamespace setVariable format ["%1_forced", _x, true]; + publicVariable format ["%1_forced", _name]; + }; + } forEach GVAR(settingsList); + }; }; -// Check if all settings should be forced -if (GVAR(forceAllSettings)) then { - { - if !(missionNamespace getVariable format ["%1_forced", _x]) then { - missionNamespace setVariable format ["%1_forced", _x, true]; - publicVariable format ["%1_forced", _name]; - }; - } forEach GVAR(settingsList); -}; - // Load settings from mission config _countOptions = count (missionConfigFile >> "ACE_Settings"); for "_index" from 0 to (_countOptions - 1) do { _optionEntry = (missionConfigFile >> "ACE_Settings") select _index; - _name = configName _optionEntry; - _valueEntry = _optionEntry >> "value"; - - [_name, _valueEntry] call FUNC(setSettingFromConfig); + [_optionEntry] call FUNC(setSettingFromConfig); }; // Check if all settings should be forced if (GVAR(forceAllSettings)) then { @@ -71,4 +64,4 @@ if (GVAR(forceAllSettings)) then { publicVariable format ["%1_forced", _name]; }; } forEach GVAR(settingsList); -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index 8423a16bef..89967c357c 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -3,9 +3,8 @@ * Load a setting from config if it was not previosuly forced. Force if neccesary. * * Arguments: - * 0: Setting name (String) - * 1: Config entry (config entry) - * + * 0: Config entry (config entry) + * * Return Value: * None * @@ -13,33 +12,35 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_name,_optionEntry); +EXPLODE_1_PVT(_this,_optionEntry); _fnc_getValueWithType = { EXPLODE_2_PVT(_this,_optionEntry,_typeName); _value = getNumber (_optionEntry >> "value"); + diag_log text format ["%1 %2: %3", configName _optionEntry, _typeName, _value]; if (_typeName == "BOOL") exitWith { - _value = _value > 0; + _value > 0 }; if (_typeName == "STRING") exitWith { - _value = getText (_optionEntry >> "value"); + getText (_optionEntry >> "value") }; if (_typeName == "ARRAY") exitWith { - _value = getArray (_optionEntry >> "value"); + getArray (_optionEntry >> "value") }; _value }; +_name = configName _optionEntry; + // Check if the variable is already defined -if (isNil _name) exitWith { +if (isNil _name) then { // That setting was not loaded yet - //diag_log text format ["[ACE]: Mission setting '%1' doesn't exist", _name]; - - _typeEntry = _this select 2; - _typeName = getText _typeEntry; + // Get type from config + _typeName = getText (_optionEntry >> "typeName"); + // Read entry and cast it to the correct type _value = [_optionEntry, _typeName] call _fnc_getValueWithType; // Init the variable and publish it @@ -61,7 +62,9 @@ if (isNil _name) exitWith { // The setting is not forced, so update the value // Get the type from the existing variable - _typeName = typeName missionNamespace getVariable _name; + _typeName = typeName (missionNamespace getVariable _name); + + // Read entry and cast it to the correct type _value = [_optionEntry, _typeName] call _fnc_getValueWithType; // Update the variable and publish it diff --git a/addons/hearing/functions/fnc_earRinging.sqf b/addons/hearing/functions/fnc_earRinging.sqf index b578dad979..4581a6fdd9 100644 --- a/addons/hearing/functions/fnc_earRinging.sqf +++ b/addons/hearing/functions/fnc_earRinging.sqf @@ -25,7 +25,7 @@ GVAR(newStrength) = GVAR(newStrength) max _strength; if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {}; -if (QGVAR(DisableEarRinging)) exitWith {}; +if (GVAR(DisableEarRinging)) exitWith {}; if (_strength > 0.75) exitWith { playSound "ACE_EarRinging_Heavy"; From 37199f2ba29b1697810eb908456c272caab71d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Mon, 2 Feb 2015 21:14:16 -0300 Subject: [PATCH 018/113] Load client setable settings from profile --- addons/common/XEH_postInit.sqf | 3 ++ .../functions/fnc_loadSettingsFromProfile.sqf | 48 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 addons/common/functions/fnc_loadSettingsFromProfile.sqf diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 542c4277cf..df48d076f2 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -1,6 +1,9 @@ // ACE - Common #include "script_component.hpp" +// Load settings from profile +call FUNC(loadSettingsFromProfile); + // hack to get PFH to work in briefing [QGVAR(onBriefingPFH), "onEachFrame", { if (time > 0) exitWith { diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf new file mode 100644 index 0000000000..a77af66309 --- /dev/null +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -0,0 +1,48 @@ +/* + * Author: CAA-Picard + * Load the user setable setting from the user profile. + * Config < Server UserConfig < Mission Config < Client settings + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +_fnc_setSettingFromProfile = { + EXPLODE_1_PVT(_this,_optionEntry); + + _name = configName _optionEntry; + _valueEntry = _optionEntry >> "value"; + _isClientSetable = getNumber (_optionEntry >> "isClientSetable"); + + if (_isClientSetable > 0) then { + if !(missionNamespace getVariable format ["%1_forced", _name, false]) then { + _profileValue = profileNamespace getvariable _name; + if !(isNil _profileValue) then { + if (typeName _profileValue == typeName (missionNamespace getvariable _name)) then { + missionNamespace setvariable [_name, _profileValue]; + }; + }; + }; + }; +}; + +// Iterate through settings from main config +_countOptions = count (configFile >> "ACE_Settings"); +for "_index" from 0 to (_countOptions - 1) do { + _optionEntry = (configFile >> "ACE_Settings") select _index; + [_optionEntry] call _fnc_setSettingFromProfile; + +}; + +// Iterate through settings from mission config +_countOptions = count (missionConfigFile >> "ACE_Settings"); +for "_index" from 0 to (_countOptions - 1) do { + _optionEntry = (missionConfigFile >> "ACE_Settings") select _index; + [_optionEntry] call _fnc_setSettingFromProfile; +}; From 38655980956b905f31efe7c0feee27b9d58323d1 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 2 Feb 2015 19:48:33 -0600 Subject: [PATCH 019/113] AGM_Captives --- .../captives}/UI/agm_cabletie_x_ca.paa | Bin .../Captives => addons/captives}/UI/captive_ca.paa | Bin .../Captives => addons/captives}/UI/handcuff_ca.paa | Bin .../Captives => addons/captives}/agm_cabletie.p3d | Bin .../agm/Captives => addons/captives}/clientInit.sqf | 0 .../agm/Captives => addons/captives}/config.cpp | 0 .../captives}/functions/fn_canFriskPerson.sqf | 0 .../captives}/functions/fn_canLoadCaptive.sqf | 0 .../captives}/functions/fn_canUnloadCaptive.sqf | 0 .../captives}/functions/fn_escortCaptive.sqf | 0 .../captives}/functions/fn_handleGetOut.sqf | 0 .../captives}/functions/fn_handleKnockedOut.sqf | 0 .../captives}/functions/fn_handlePlayerChanged.sqf | 0 .../captives}/functions/fn_handleWokeUp.sqf | 0 .../captives}/functions/fn_initPost.sqf | 0 .../captives}/functions/fn_initUnit.sqf | 0 .../captives}/functions/fn_loadCaptive.sqf | 0 .../captives}/functions/fn_openFriskMenu.sqf | 0 .../captives}/functions/fn_setCaptive.sqf | 0 .../captives}/functions/fn_surrender.sqf | 0 .../captives}/functions/fn_unloadCaptive.sqf | 0 .../Captives => addons/captives}/stringtable.xml | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename {TO_MERGE/agm/Captives => addons/captives}/UI/agm_cabletie_x_ca.paa (100%) rename {TO_MERGE/agm/Captives => addons/captives}/UI/captive_ca.paa (100%) rename {TO_MERGE/agm/Captives => addons/captives}/UI/handcuff_ca.paa (100%) rename {TO_MERGE/agm/Captives => addons/captives}/agm_cabletie.p3d (100%) rename {TO_MERGE/agm/Captives => addons/captives}/clientInit.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/config.cpp (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_canFriskPerson.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_canLoadCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_canUnloadCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_escortCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_handleGetOut.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_handleKnockedOut.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_handlePlayerChanged.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_handleWokeUp.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_initPost.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_initUnit.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_loadCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_openFriskMenu.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_setCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_surrender.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/functions/fn_unloadCaptive.sqf (100%) rename {TO_MERGE/agm/Captives => addons/captives}/stringtable.xml (100%) diff --git a/TO_MERGE/agm/Captives/UI/agm_cabletie_x_ca.paa b/addons/captives/UI/agm_cabletie_x_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/agm_cabletie_x_ca.paa rename to addons/captives/UI/agm_cabletie_x_ca.paa diff --git a/TO_MERGE/agm/Captives/UI/captive_ca.paa b/addons/captives/UI/captive_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/captive_ca.paa rename to addons/captives/UI/captive_ca.paa diff --git a/TO_MERGE/agm/Captives/UI/handcuff_ca.paa b/addons/captives/UI/handcuff_ca.paa similarity index 100% rename from TO_MERGE/agm/Captives/UI/handcuff_ca.paa rename to addons/captives/UI/handcuff_ca.paa diff --git a/TO_MERGE/agm/Captives/agm_cabletie.p3d b/addons/captives/agm_cabletie.p3d similarity index 100% rename from TO_MERGE/agm/Captives/agm_cabletie.p3d rename to addons/captives/agm_cabletie.p3d diff --git a/TO_MERGE/agm/Captives/clientInit.sqf b/addons/captives/clientInit.sqf similarity index 100% rename from TO_MERGE/agm/Captives/clientInit.sqf rename to addons/captives/clientInit.sqf diff --git a/TO_MERGE/agm/Captives/config.cpp b/addons/captives/config.cpp similarity index 100% rename from TO_MERGE/agm/Captives/config.cpp rename to addons/captives/config.cpp diff --git a/TO_MERGE/agm/Captives/functions/fn_canFriskPerson.sqf b/addons/captives/functions/fn_canFriskPerson.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_canFriskPerson.sqf rename to addons/captives/functions/fn_canFriskPerson.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_canLoadCaptive.sqf b/addons/captives/functions/fn_canLoadCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_canLoadCaptive.sqf rename to addons/captives/functions/fn_canLoadCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_canUnloadCaptive.sqf b/addons/captives/functions/fn_canUnloadCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_canUnloadCaptive.sqf rename to addons/captives/functions/fn_canUnloadCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_escortCaptive.sqf b/addons/captives/functions/fn_escortCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_escortCaptive.sqf rename to addons/captives/functions/fn_escortCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_handleGetOut.sqf b/addons/captives/functions/fn_handleGetOut.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handleGetOut.sqf rename to addons/captives/functions/fn_handleGetOut.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_handleKnockedOut.sqf b/addons/captives/functions/fn_handleKnockedOut.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handleKnockedOut.sqf rename to addons/captives/functions/fn_handleKnockedOut.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_handlePlayerChanged.sqf b/addons/captives/functions/fn_handlePlayerChanged.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handlePlayerChanged.sqf rename to addons/captives/functions/fn_handlePlayerChanged.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_handleWokeUp.sqf b/addons/captives/functions/fn_handleWokeUp.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_handleWokeUp.sqf rename to addons/captives/functions/fn_handleWokeUp.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_initPost.sqf b/addons/captives/functions/fn_initPost.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_initPost.sqf rename to addons/captives/functions/fn_initPost.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_initUnit.sqf b/addons/captives/functions/fn_initUnit.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_initUnit.sqf rename to addons/captives/functions/fn_initUnit.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_loadCaptive.sqf b/addons/captives/functions/fn_loadCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_loadCaptive.sqf rename to addons/captives/functions/fn_loadCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_openFriskMenu.sqf b/addons/captives/functions/fn_openFriskMenu.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_openFriskMenu.sqf rename to addons/captives/functions/fn_openFriskMenu.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_setCaptive.sqf b/addons/captives/functions/fn_setCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_setCaptive.sqf rename to addons/captives/functions/fn_setCaptive.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_surrender.sqf b/addons/captives/functions/fn_surrender.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_surrender.sqf rename to addons/captives/functions/fn_surrender.sqf diff --git a/TO_MERGE/agm/Captives/functions/fn_unloadCaptive.sqf b/addons/captives/functions/fn_unloadCaptive.sqf similarity index 100% rename from TO_MERGE/agm/Captives/functions/fn_unloadCaptive.sqf rename to addons/captives/functions/fn_unloadCaptive.sqf diff --git a/TO_MERGE/agm/Captives/stringtable.xml b/addons/captives/stringtable.xml similarity index 100% rename from TO_MERGE/agm/Captives/stringtable.xml rename to addons/captives/stringtable.xml From 982f3b230ad0a2a9d1ccf6c6f3a7f798f87729c8 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 2 Feb 2015 20:04:50 -0600 Subject: [PATCH 020/113] Captives First Pass --- addons/captives/$PBOPREFIX$ | 1 + addons/captives/CfgEventHandlers.hpp | 57 +++ addons/captives/CfgMoves.hpp | 90 +++++ addons/captives/CfgVehicles.hpp | 157 ++++++++ addons/captives/CfgWeapons.hpp | 15 + ..._cabletie_x_ca.paa => ace_cabletie_ca.paa} | Bin addons/captives/XEH_postInitClient.sqf | 3 + addons/captives/XEH_preInit.sqf | 22 + addons/captives/agm_cabletie.p3d | Bin 49251 -> 0 bytes addons/captives/clientInit.sqf | 3 - addons/captives/config.cpp | 381 ++---------------- .../captives/functions/fn_canFriskPerson.sqf | 21 - .../captives/functions/fn_canLoadCaptive.sqf | 35 -- .../functions/fn_canUnloadCaptive.sqf | 23 -- .../captives/functions/fn_escortCaptive.sqf | 43 -- addons/captives/functions/fn_handleGetOut.sqf | 14 - .../functions/fn_handlePlayerChanged.sqf | 12 - addons/captives/functions/fn_handleWokeUp.sqf | 10 - addons/captives/functions/fn_initPost.sqf | 11 - addons/captives/functions/fn_initUnit.sqf | 12 - addons/captives/functions/fn_setCaptive.sqf | 57 --- .../captives/functions/fn_unloadCaptive.sqf | 31 -- .../captives/functions/fnc_canFriskPerson.sqf | 23 ++ .../captives/functions/fnc_canLoadCaptive.sqf | 38 ++ .../functions/fnc_canUnloadCaptive.sqf | 28 ++ .../captives/functions/fnc_escortCaptive.sqf | 55 +++ .../captives/functions/fnc_handleGetOut.sqf | 29 ++ ...nockedOut.sqf => fnc_handleKnockedOut.sqf} | 0 .../functions/fnc_handlePlayerChanged.sqf | 25 ++ .../captives/functions/fnc_handleWokeUp.sqf | 23 ++ addons/captives/functions/fnc_initPost.sqf | 24 ++ addons/captives/functions/fnc_initUnit.sqf | 29 ++ ...fn_loadCaptive.sqf => fnc_loadCaptive.sqf} | 33 +- ...penFriskMenu.sqf => fnc_openFriskMenu.sqf} | 44 +- addons/captives/functions/fnc_setCaptive.sqf | 59 +++ .../{fn_surrender.sqf => fnc_surrender.sqf} | 43 +- .../captives/functions/fnc_unloadCaptive.sqf | 35 ++ .../captives/functions/script_component.hpp | 1 + addons/captives/models/ace_cabletie.p3d | Bin 0 -> 52371 bytes addons/captives/models/ace_default.rvmat | 79 ++++ addons/captives/script_component.hpp | 12 + addons/captives/stringtable.xml | 24 +- 42 files changed, 907 insertions(+), 695 deletions(-) create mode 100644 addons/captives/$PBOPREFIX$ create mode 100644 addons/captives/CfgEventHandlers.hpp create mode 100644 addons/captives/CfgMoves.hpp create mode 100644 addons/captives/CfgVehicles.hpp create mode 100644 addons/captives/CfgWeapons.hpp rename addons/captives/UI/{agm_cabletie_x_ca.paa => ace_cabletie_ca.paa} (100%) create mode 100644 addons/captives/XEH_postInitClient.sqf create mode 100644 addons/captives/XEH_preInit.sqf delete mode 100644 addons/captives/agm_cabletie.p3d delete mode 100644 addons/captives/clientInit.sqf delete mode 100644 addons/captives/functions/fn_canFriskPerson.sqf delete mode 100644 addons/captives/functions/fn_canLoadCaptive.sqf delete mode 100644 addons/captives/functions/fn_canUnloadCaptive.sqf delete mode 100644 addons/captives/functions/fn_escortCaptive.sqf delete mode 100644 addons/captives/functions/fn_handleGetOut.sqf delete mode 100644 addons/captives/functions/fn_handlePlayerChanged.sqf delete mode 100644 addons/captives/functions/fn_handleWokeUp.sqf delete mode 100644 addons/captives/functions/fn_initPost.sqf delete mode 100644 addons/captives/functions/fn_initUnit.sqf delete mode 100644 addons/captives/functions/fn_setCaptive.sqf delete mode 100644 addons/captives/functions/fn_unloadCaptive.sqf create mode 100644 addons/captives/functions/fnc_canFriskPerson.sqf create mode 100644 addons/captives/functions/fnc_canLoadCaptive.sqf create mode 100644 addons/captives/functions/fnc_canUnloadCaptive.sqf create mode 100644 addons/captives/functions/fnc_escortCaptive.sqf create mode 100644 addons/captives/functions/fnc_handleGetOut.sqf rename addons/captives/functions/{fn_handleKnockedOut.sqf => fnc_handleKnockedOut.sqf} (100%) create mode 100644 addons/captives/functions/fnc_handlePlayerChanged.sqf create mode 100644 addons/captives/functions/fnc_handleWokeUp.sqf create mode 100644 addons/captives/functions/fnc_initPost.sqf create mode 100644 addons/captives/functions/fnc_initUnit.sqf rename addons/captives/functions/{fn_loadCaptive.sqf => fnc_loadCaptive.sqf} (52%) rename addons/captives/functions/{fn_openFriskMenu.sqf => fnc_openFriskMenu.sqf} (54%) create mode 100644 addons/captives/functions/fnc_setCaptive.sqf rename addons/captives/functions/{fn_surrender.sqf => fnc_surrender.sqf} (53%) create mode 100644 addons/captives/functions/fnc_unloadCaptive.sqf create mode 100644 addons/captives/functions/script_component.hpp create mode 100644 addons/captives/models/ace_cabletie.p3d create mode 100644 addons/captives/models/ace_default.rvmat create mode 100644 addons/captives/script_component.hpp diff --git a/addons/captives/$PBOPREFIX$ b/addons/captives/$PBOPREFIX$ new file mode 100644 index 0000000000..aac16576c4 --- /dev/null +++ b/addons/captives/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\captives \ No newline at end of file diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp new file mode 100644 index 0000000000..eb08f7e865 --- /dev/null +++ b/addons/captives/CfgEventHandlers.hpp @@ -0,0 +1,57 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient)); + }; +}; + +//release escorted captive when entering a vehicle +class Extended_GetIn_EventHandlers { + class All { + class GVAR(AutoDetachCaptive) { + getIn = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isEscorting', false]}) then {(_this select 2) setVariable ['ACE_isEscorting', false, true]}"; + }; + }; +}; + +//reset captive animation after leaving vehicle +class Extended_GetOut_EventHandlers { + class All { + class GVAR(AutoDetachCaptive) { + getOut = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isCaptive', false]}) then {_this call ACE_Captives_fnc_handleGetOut}"; + }; + }; +}; + +//reset captivity and escorting status when getting killed +class Extended_Killed_EventHandlers { + class CAManBase { + class GVAR(AutoDetachCaptive) { + killed = "if ((_this select 0) getVariable ['ACE_isCaptive', false]) then {(_this select 0) setVariable ['ACE_isCaptive', false, true]}; if ((_this select 0) getVariable ['ACE_isEscorting', false]) then {(_this select 0) setVariable ['ACE_isEscorting', false, true]};"; + }; + }; +}; + +//handle captive and unconsciousness state +class Extended_Init_EventHandlers { + class CAManBase { + class GVAR(AutoDetachCaptive) { + init = "_this call ACE_Captives_fnc_initUnit"; + }; + }; +}; + +//mission start +class Extended_InitPost_EventHandlers { + class CAManBase { + class GVAR(InitPost) { + init = "if (local (_this select 0)) then {_this call ACE_Captives_fnc_initPost};"; + }; + }; +}; + diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp new file mode 100644 index 0000000000..da43b21aae --- /dev/null +++ b/addons/captives/CfgMoves.hpp @@ -0,0 +1,90 @@ +class CfgMovesBasic { + class Actions { + class CivilStandActions; + class ACE_CivilStandCaptiveActions: CivilStandActions { + turnL = ""; + turnR = ""; + stop = "ACE_AmovPercMstpScapWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; + default = "ACE_AmovPercMstpScapWnonDnon"; + getOver = ""; + throwPrepare = ""; + throwGrenade[] = {"","Gesture"}; + }; + }; +}; + +class CfgMovesMaleSdr: CfgMovesBasic { + class StandBase; + class States { + class AmovPercMstpSnonWnonDnon: StandBase { + ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; + + class CutSceneAnimationBase; + class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { + actions = "ACE_CivilStandCaptiveActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; + speed = 1; + looped = 0; + interpolationRestart = 2; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; + + class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; + speed = 0; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01}; + looped = 1; + }; + + class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + actions = "CivilStandActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; + ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; + }; +}; + +/* +player playMove "ACE_AmovPercMstpScapWnonDnon"; +player switchMove "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon"; +*/ + +/*class CfgMovesBasic; +class CfgMovesMaleSdr: CfgMovesBasic { + class States { + class CutSceneAnimationBase; + class AmovPercMstpSnonWnonDnon_EaseIn: CutSceneAnimationBase { + head = "headDefault"; + static = 1; + disableWeapons = 0; + forceAim = 0; + InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; + }; + class AmovPercMstpSnonWnonDnon_Ease: AmovPercMstpSnonWnonDnon_EaseIn { + looped = 1; + InterpolateTo[] = {"Unconscious",0.1}; + }; + class AmovPercMstpSnonWnonDnon_EaseOut: AmovPercMstpSnonWnonDnon_EaseIn { + InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; + }; + + class AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { + InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; + + class AmovPercMstpSsurWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + looped = 1; + InterpolateTo[] = {"Unconscious",0.01}; + }; + + class AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + }; + }; +};*/ + diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp new file mode 100644 index 0000000000..3036ccf196 --- /dev/null +++ b/addons/captives/CfgVehicles.hpp @@ -0,0 +1,157 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_Actions { + class ACE_SetCaptive { + displayName = "$STR_ACE_Captives_SetCaptive"; + distance = 4; + condition = "'ACE_CableTie' in items _player && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}"; + statement = "player removeItem 'ACE_CableTie'; [_target, true] call ACE_Captives_fnc_setCaptive"; + showDisabled = 0; + priority = 2.4; + icon = "\ACE_Captives\UI\handcuff_ca.paa"; + hotkey = "C"; + }; + class ACE_ReleaseCaptive { + displayName = "$STR_ACE_Captives_ReleaseCaptive"; + distance = 4; + condition = "_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}"; + statement = "[_target, false] call ACE_Captives_fnc_setCaptive"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.4; + icon = "\ACE_Captives\UI\handcuff_ca.paa"; + hotkey = "R"; + }; + class ACE_EscortCaptive { + displayName = "$STR_ACE_Captives_EscortCaptive"; + distance = 4; + condition = "_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}"; + statement = "[_target, true] call ACE_Captives_fnc_escortCaptive"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = "\ACE_Captives\UI\captive_ca.paa"; + priority = 2.3; + hotkey = "E"; + }; + class ACE_StopEscorting { + displayName = "$STR_ACE_Captives_StopEscorting"; + distance = 4; + condition = "_target getVariable ['ACE_isCaptive', false] && {_target in attachedObjects _player}"; + statement = "[_target, false] call ACE_Captives_fnc_escortCaptive"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = "\ACE_Captives\UI\captive_ca.paa"; + priority = 2.3; + hotkey = "E"; + }; + class ACE_LoadCaptive { + displayName = "$STR_ACE_Captives_LoadCaptive"; + distance = 4; + condition = "[_player, _target, objNull] call ACE_Captives_fnc_canLoadCaptive"; + statement = "[_player, _target, objNull] call ACE_Captives_fnc_loadCaptive"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = "\ACE_Captives\UI\captive_ca.paa"; + priority = 2.2; + hotkey = "L"; + }; + class ACE_FriskPerson { + displayName = "$STR_ACE_Captives_FriskPerson"; + distance = 2; + condition = "[_player, _target] call ACE_Captives_fnc_canFriskPerson"; + statement = "[_player, _target] call ACE_Captives_fnc_openFriskMenu"; + showDisabled = 0; + //icon = ""; //@todo + priority = 3; + hotkey = "F"; + }; + }; + + class ACE_SelfActions { + class ACE_StopEscortingSelf { + displayName = "$STR_ACE_Captives_StopEscorting"; + condition = "(_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false] && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}"; + statement = "[_player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.3; + hotkey = "C"; + }; + /*class ACE_LoadCaptiveSelf { + displayName = "$STR_ACE_Captives_LoadCaptive"; + condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle"; + statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle"; + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.2; + hotkey = "K"; + };*/ + }; + }; + + #define MACRO_LOADUNLOADCAPTIVE \ + class ACE_Actions { \ + class ACE_LoadCaptive { \ + displayName = "$STR_ACE_Captives_LoadCaptive"; \ + distance = 4; \ + condition = "[_player, objNull, _target] call ACE_Captives_fnc_canLoadCaptive"; \ + statement = "[_player, objNull, _target] call ACE_Captives_fnc_loadCaptive"; \ + exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "L"; \ + }; \ + class ACE_UnloadCaptive { \ + displayName = "$STR_ACE_Captives_UnloadCaptive"; \ + distance = 4; \ + condition = "[_player, _target] call ACE_Captives_fnc_canUnloadCaptive"; \ + statement = "[_player, _target] call ACE_Captives_fnc_unloadCaptive"; \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "C"; \ + }; \ + }; + + class LandVehicle; + class Car: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + class Tank: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class Air; + class Helicopter: Air { + MACRO_LOADUNLOADCAPTIVE + }; + class Plane: Air { + MACRO_LOADUNLOADCAPTIVE + }; + + class Ship; + class Ship_F: Ship { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticWeapon: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticMortar; + class Mortar_01_base_F: StaticMortar { + MACRO_LOADUNLOADCAPTIVE + }; + + #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_CableTie,12) + }; + }; +}; diff --git a/addons/captives/CfgWeapons.hpp b/addons/captives/CfgWeapons.hpp new file mode 100644 index 0000000000..3005a2fa5c --- /dev/null +++ b/addons/captives/CfgWeapons.hpp @@ -0,0 +1,15 @@ +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_CableTie: ACE_ItemCore { + displayName = "$STR_ACE_Captives_CableTie"; + descriptionShort = "$STR_ACE_Captives_CableTieDescription"; + model = QUOTE(PATHTOF(models\ace_cabletie.p3d)); + picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; + }; +}; diff --git a/addons/captives/UI/agm_cabletie_x_ca.paa b/addons/captives/UI/ace_cabletie_ca.paa similarity index 100% rename from addons/captives/UI/agm_cabletie_x_ca.paa rename to addons/captives/UI/ace_cabletie_ca.paa diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf new file mode 100644 index 0000000000..a08c5d4239 --- /dev/null +++ b/addons/captives/XEH_postInitClient.sqf @@ -0,0 +1,3 @@ +// by commy2 + +[missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf new file mode 100644 index 0000000000..5e6f35bc48 --- /dev/null +++ b/addons/captives/XEH_preInit.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(empty); +PREP(canFriskPerson); +PREP(canLoadCaptive); +PREP(canUnloadCaptive); +PREP(escortCaptive); +PREP(handleGetOut); +PREP(handleKnockedOut); +PREP(handlePlayerChanged); +PREP(handleWokeUp); +PREP(initPost); +PREP(initUnit); +PREP(loadCaptive); +PREP(openFriskMenu); +PREP(setCaptive); +PREP(surrender); +PREP(unloadCaptive); + +ADDON = true; diff --git a/addons/captives/agm_cabletie.p3d b/addons/captives/agm_cabletie.p3d deleted file mode 100644 index e0804b8c5ff7324feead360c873d5bd44fec4f6d..0000000000000000000000000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UkQZ?ygIgpD7V|ZW& zIe4(k~*Gbee;QWo)=PDWQ_-n z>l^60vmrTaJZM~}EN6%HcwhgvEsF)@+UDc=m+g1!j4L z2#e$>O#iO^j2xxUODAdVf6|eK`B`kw$oVI|&-6=P0n}f-GRTGAhtkQbf?T|>B+2dP z$8k@tf4Y(+`3~C~IxHzkayus#yqNagg`^ui(x5w744P8@AMxdlO)qY>iV<)u_PXexTaAvE3SCohQB>i>Y>Aqr{6njPzOa5!V(|yH4yuSH| z#sBZV^F1>d*mu;3X8i^vjt=*WV?p%d_rx!FjrDOKBjlQ`%h#CZn%^0>;Xl64W4Irl z;5J|PZ!&!7h~dNNgvN+k$|e8u0YrG)zM~0HC=K|(y|TV$$^&-R2yfJQNwmEd@_H|e uksC3-KC1Zz{{J8SkOke44;t5%V(5 0} diff --git a/addons/captives/functions/fn_canUnloadCaptive.sqf b/addons/captives/functions/fn_canUnloadCaptive.sqf deleted file mode 100644 index 8c52bac0b0..0000000000 --- a/addons/captives/functions/fn_canUnloadCaptive.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Author: commy2 - * - * Check if the unit can unload a captive from the vehicle. - * - * Argument: - * 0: Unit that wants to unload a captive (Object) - * 1: Vehicle to unload a captive from. (Object) - * - * Return value: - * Boolean (Bool) - */ - -private ["_unit", "_vehicle", "_cargo"]; - -_unit = _this select 0; -_vehicle = _this select 1; - -_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. - -_cargo = [_cargo, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; - -count _cargo > 0 diff --git a/addons/captives/functions/fn_escortCaptive.sqf b/addons/captives/functions/fn_escortCaptive.sqf deleted file mode 100644 index 55244cf2f8..0000000000 --- a/addons/captives/functions/fn_escortCaptive.sqf +++ /dev/null @@ -1,43 +0,0 @@ -//author : Nic547 -//Attaches a Captive to the player - -private ["_unit", "_state"]; - -_unit = _this select 0; -_state = _this select 1; - -if !("AGM_Handcuffed" in ([_unit] call AGM_Core_fnc_getCaptivityStatus)) exitWith { - [localize "STR_AGM_Captives_NoCaptive"] call AGM_Core_fnc_displayTextStructured; -}; - -if (_state) then { - if (player getVariable ["AGM_isEscorting", false]) exitWith {}; - - [player, _unit] call AGM_Core_fnc_claim; - player setVariable ["AGM_isEscorting", true, true]; - - _unit attachTo [player, [0, 1, 0]]; - - player setVariable ["AGM_escortedUnit", _unit, true]; - _actionID = player addAction [format ["%1", localize "STR_AGM_Captives_StopEscorting"], "[player getVariable ['AGM_escortedUnit', objNull], false] call AGM_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['AGM_escortedUnit', objNull])"]; - - [_unit, _actionID] spawn { - _unit = _this select 0; - _actionID = _this select 1; - - while {player getVariable ["AGM_isEscorting", false]} do { - sleep 0.2; - - if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["AGM_isUnconscious", false]} || {player getVariable ["AGM_isUnconscious", false]} || {!isNull (attachedTo player)}) then { - player setVariable ["AGM_isEscorting", false, true]; - }; - }; - [objNull, _unit] call AGM_Core_fnc_claim; - - detach _unit; - player removeAction _actionID; - }; -} else { - player setVariable ["AGM_isEscorting", false, true]; - player setVariable ["AGM_escortedUnit", objNull, true]; -}; diff --git a/addons/captives/functions/fn_handleGetOut.sqf b/addons/captives/functions/fn_handleGetOut.sqf deleted file mode 100644 index 0cb88b0a8e..0000000000 --- a/addons/captives/functions/fn_handleGetOut.sqf +++ /dev/null @@ -1,14 +0,0 @@ -// by commy2 - -private ["_vehicle", "_unit", "_cargoIndex"]; - -_vehicle = _this select 0; -_unit = _this select 2; - -_cargoIndex = _unit getVariable ["AGM_Captives_CargoIndex", -1]; - -if (_cargoIndex != -1) exitWith { - _unit moveInCargo [_vehicle, _cargoIndex]; -}; - -[_unit, 'AGM_AmovPercMstpScapWnonDnon', 2] call AGM_Core_fnc_doAnimation; diff --git a/addons/captives/functions/fn_handlePlayerChanged.sqf b/addons/captives/functions/fn_handlePlayerChanged.sqf deleted file mode 100644 index 5bece824f9..0000000000 --- a/addons/captives/functions/fn_handlePlayerChanged.sqf +++ /dev/null @@ -1,12 +0,0 @@ -// by commy2 - -private ["_unit", "_oldUnit"]; - -_unit = _this select 0; -_oldUnit = _this select 1; - -if (_unit getVariable ["AGM_isCaptive", false]) then { - showHUD false; -} else { - showHUD true; -}; diff --git a/addons/captives/functions/fn_handleWokeUp.sqf b/addons/captives/functions/fn_handleWokeUp.sqf deleted file mode 100644 index facbf9b31f..0000000000 --- a/addons/captives/functions/fn_handleWokeUp.sqf +++ /dev/null @@ -1,10 +0,0 @@ -// by commy2 - -private "_unit"; - -_unit = _this select 0; - -if (_unit getVariable ["AGM_isCaptive", false] && {vehicle _unit == _unit}) then { - [_unit] call AGM_Core_fnc_fixLoweredRifleAnimation; - [_unit, "AGM_AmovPercMstpScapWnonDnon", 0] call AGM_Core_fnc_doAnimation; -}; diff --git a/addons/captives/functions/fn_initPost.sqf b/addons/captives/functions/fn_initPost.sqf deleted file mode 100644 index 73c9674f7a..0000000000 --- a/addons/captives/functions/fn_initPost.sqf +++ /dev/null @@ -1,11 +0,0 @@ -// by commy2 - -private "_unit"; - -_unit = _this select 0; - -// reset status on mission start -if (_unit getVariable ["AGM_isCaptive", false]) then { - _unit setVariable ["AGM_isCaptive", false]; - [_unit, true] call AGM_Captives_fnc_setCaptive; -}; diff --git a/addons/captives/functions/fn_initUnit.sqf b/addons/captives/functions/fn_initUnit.sqf deleted file mode 100644 index 76d4671b7f..0000000000 --- a/addons/captives/functions/fn_initUnit.sqf +++ /dev/null @@ -1,12 +0,0 @@ -// by commy2 - -[_this select 0, "knockedOut", { - if (local (_this select 0)) then {_this call AGM_Captives_fnc_handleKnockedOut}; -}] call AGM_Core_fnc_addCustomEventhandler; - -[_this select 0, "wokeUp", { - if (local (_this select 0)) then {_this call AGM_Captives_fnc_handleWokeUp}; -}] call AGM_Core_fnc_addCustomEventhandler; - -// prevent players from throwing grenades -[_this select 0, "Throw", {(_this select 1) getVariable ["AGM_isCaptive", false]}, {}] call AGM_Core_fnc_addActionEventhandler; diff --git a/addons/captives/functions/fn_setCaptive.sqf b/addons/captives/functions/fn_setCaptive.sqf deleted file mode 100644 index a2e4ed7e3e..0000000000 --- a/addons/captives/functions/fn_setCaptive.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: Nic547, commy2 - * - * Makes a civilian unable to move. - * - * Argument: - * 0: Unit (Object) - * 1: True to take captive, false to release captive (Object) - * - * Return value: - * Nothing - */ - -private ["_unit", "_state"]; - -_unit = _this select 0; -_state = _this select 1; - -if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call AGM_Core_fnc_execRemoteFnc}; - -if (_state) then { - if (_unit getVariable ["AGM_isCaptive", false]) exitWith {}; - - _unit setVariable ["AGM_isCaptive", true, true]; - - // fix anim on mission start (should work on dedicated servers) - _unit spawn { - [_this, "AGM_Handcuffed", true] call AGM_Core_fnc_setCaptivityStatus; - - if (_this getVariable ["AGM_isCaptive", false] && {vehicle _this == _this}) then { - [_this] call AGM_Core_fnc_fixLoweredRifleAnimation; - [_this, "AGM_AmovPercMstpScapWnonDnon", 0] spawn AGM_Core_fnc_doAnimation; - }; - }; - - _unit setVariable ["AGM_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; - - if (_unit == AGM_player) then { - showHUD false; - }; -} else { - if !(_unit getVariable ["AGM_isCaptive", false]) exitWith {}; - - _unit setVariable ["AGM_isCaptive", false, true]; - [_unit, "AGM_Handcuffed", false] call AGM_Core_fnc_setCaptivityStatus; - if (vehicle _unit == _unit) then { - [_unit, "AGM_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call AGM_Core_fnc_doAnimation; - }; - - if (_unit getVariable ["AGM_Captives_CargoIndex", -1] != -1) then { - _unit setVariable ["AGM_Captives_CargoIndex", -1, true]; - }; - - if (_unit == AGM_player) then { - showHUD true; - }; -}; diff --git a/addons/captives/functions/fn_unloadCaptive.sqf b/addons/captives/functions/fn_unloadCaptive.sqf deleted file mode 100644 index e7849f1c0e..0000000000 --- a/addons/captives/functions/fn_unloadCaptive.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Author: commy2 - * - * Unit unloads a captive from a vehicle. - * - * Argument: - * 0: Unit that wants to unload a captive (Object) - * 1: Vehicle to unload a captive from. (Object) - * - * Return value: - * Nothing - */ - -private ["_unit", "_vehicle", "_cargo", "_target"]; - -_unit = _this select 0; -_vehicle = _this select 1; - -_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. - -_cargo = [_cargo, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; - -if (count _cargo > 0) then { - _target = _cargo select 0; - - _target setVariable ["AGM_Captives_CargoIndex", -1, true]; - - moveOut _target; - [_target, "AGM_AmovPercMstpScapWnonDnon", 2] call AGM_Core_fnc_doAnimation; - [_target, "{unassignVehicle _this}", _target] call AGM_Core_fnc_execRemoteFnc; -}; diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf new file mode 100644 index 0000000000..62d5a06742 --- /dev/null +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -0,0 +1,23 @@ +/* + * Author: bux578 + * Checks the conditions for being able to frisk a unit + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +_target getVariable ["ACE_isCaptive", false] +|| {_target getVariable ["ACE_isSearchable", false]} +|| {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf new file mode 100644 index 0000000000..b8021e602f --- /dev/null +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -0,0 +1,38 @@ +/* + * Author: commy2 + * Check if the unit can load the target object into a vehicle. + * + * Arguments: + * 0: Unit that wants to load a captive + * 1: A captive. ObjNull for the first escorted captive + * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +private ["_objects"]; + +PARAMS_3(_unit,_target,_vehicle); + +if (isNull _target) then { + _objects = attachedObjects _unit; + _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _target = _objects select 0; +}; + +if (isNull _vehicle) then { + _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; + _vehicle = _objects select 0; +}; + +_unit getVariable ["ACE_isEscorting", false] +&& {!isNil "_target"} +&& {!isNil "_vehicle"} +&& {_vehicle emptyPositions "cargo" > 0} diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf new file mode 100644 index 0000000000..b714ebc8ae --- /dev/null +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -0,0 +1,28 @@ +/* + * Author: commy2 + * Check if the unit can unload a captive from the vehicle. + * + * Arguments: + * 0: Unit that wants to unload a captive + * 1: A captive. ObjNull for the first escorted captive + * 2: Vehicle to unload a captive from + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +private ["_cargo"]; + +PARAMS_2(_unit,_vehicle); + +_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. + +_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + +count _cargo > 0 diff --git a/addons/captives/functions/fnc_escortCaptive.sqf b/addons/captives/functions/fnc_escortCaptive.sqf new file mode 100644 index 0000000000..c3030a9d33 --- /dev/null +++ b/addons/captives/functions/fnc_escortCaptive.sqf @@ -0,0 +1,55 @@ +/* + * Author: Nic547 + * Attaches a Captive to the player + * + * Arguments: + * 0: _unit + * 1: _state + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_state); + +if !("ACE_Handcuffed" in ([_unit] call ACE_Core_fnc_getCaptivityStatus)) exitWith { + [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); +}; + +if (_state) then { + if (player getVariable ["ACE_isEscorting", false]) exitWith {}; + + [player, _unit] call EFUNC(common,claim); + player setVariable ["ACE_isEscorting", true, true]; + + _unit attachTo [player, [0, 1, 0]]; + + player setVariable ["ACE_escortedUnit", _unit, true]; + _actionID = player addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['ACE_escortedUnit', objNull])"]; + + [_unit, _actionID] spawn { + _unit = _this select 0; + _actionID = _this select 1; + + while {player getVariable ["ACE_isEscorting", false]} do { + sleep 0.2; + + if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["ACE_isUnconscious", false]} || {player getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo player)}) then { + player setVariable ["ACE_isEscorting", false, true]; + }; + }; + [objNull, _unit] call EFUNC(common,claim); + + detach _unit; + player removeAction _actionID; + }; +} else { + player setVariable ["ACE_isEscorting", false, true]; + player setVariable ["ACE_escortedUnit", objNull, true]; +}; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf new file mode 100644 index 0000000000..7cc1fd6f5c --- /dev/null +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -0,0 +1,29 @@ +/* + * Author: commy2 + * X + * + * Arguments: + * 0: _vehicle + * 1: _unit + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_vehicle,_unit); + +private ["_cargoIndex"]; + +_cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; + +if (_cargoIndex != -1) exitWith { + _unit moveInCargo [_vehicle, _cargoIndex]; +}; + +[_unit, 'ACE_AmovPercMstpScapWnonDnon', 2] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fn_handleKnockedOut.sqf b/addons/captives/functions/fnc_handleKnockedOut.sqf similarity index 100% rename from addons/captives/functions/fn_handleKnockedOut.sqf rename to addons/captives/functions/fnc_handleKnockedOut.sqf diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..fea03cfe16 --- /dev/null +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,25 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * 1: _oldUnit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_oldUnit); + +if (_unit getVariable ["ACE_isCaptive", false]) then { + showHUD false; +} else { + showHUD true; +}; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf new file mode 100644 index 0000000000..cbcd2a07ae --- /dev/null +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -0,0 +1,23 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +if (_unit getVariable ["ACE_isCaptive", false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); +}; diff --git a/addons/captives/functions/fnc_initPost.sqf b/addons/captives/functions/fnc_initPost.sqf new file mode 100644 index 0000000000..5c116be417 --- /dev/null +++ b/addons/captives/functions/fnc_initPost.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +// reset status on mission start +if (_unit getVariable ["ACE_isCaptive", false]) then { + _unit setVariable ["ACE_isCaptive", false]; + [_unit, true] call ACE_Captives_fnc_setCaptive; +}; diff --git a/addons/captives/functions/fnc_initUnit.sqf b/addons/captives/functions/fnc_initUnit.sqf new file mode 100644 index 0000000000..13777dca1d --- /dev/null +++ b/addons/captives/functions/fnc_initUnit.sqf @@ -0,0 +1,29 @@ +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +[_unit, "knockedOut", { + if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; +}] call ACE_Core_fnc_addCustomEventhandler; + +[_unit, "wokeUp", { + if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; +}] call ACE_Core_fnc_addCustomEventhandler; + +// prevent players from throwing grenades +[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call ACE_Core_fnc_addActionEventhandler; diff --git a/addons/captives/functions/fn_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf similarity index 52% rename from addons/captives/functions/fn_loadCaptive.sqf rename to addons/captives/functions/fnc_loadCaptive.sqf index 12bcb35f9b..255581a593 100644 --- a/addons/captives/functions/fn_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -1,26 +1,27 @@ /* * Author: commy2 - * * Unit loads the target object into a vehicle. - * - * Argument: - * 0: Unit that wants to load a captive (Object) - * 1: A captive. ObjNull for the first escorted captive (Object) - * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (Object) - * - * Return value: + * + * Arguments: + * 0: Unit that wants to load a captive + * 1: A captive. ObjNull for the first escorted captive + * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle + * + * Return Value: * Nothing + * + * Example: + * TODO + * + * Public: No */ +#include "script_component.hpp" -private ["_unit", "_target", "_vehicle", "_objects"]; - -_unit = _this select 0; -_target = _this select 1; -_vehicle = _this select 2; +PARAMS_1(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["AGM_isCaptive", false]}] call AGM_Core_fnc_filter; + _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); _target = _objects select 0; }; @@ -30,6 +31,6 @@ if (isNull _vehicle) then { }; if (!isNil "_target" && {!isNil "_vehicle"}) then { - _unit setVariable ["AGM_isEscorting", false]; - [[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['AGM_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call AGM_Core_fnc_execRemoteFnc; + _unit setVariable ["ACE_isEscorting", false]; + [[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['ACE_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call ACE_Core_fnc_execRemoteFnc; }; diff --git a/addons/captives/functions/fn_openFriskMenu.sqf b/addons/captives/functions/fnc_openFriskMenu.sqf similarity index 54% rename from addons/captives/functions/fn_openFriskMenu.sqf rename to addons/captives/functions/fnc_openFriskMenu.sqf index c7f60ba2e6..42dda4ab66 100644 --- a/addons/captives/functions/fn_openFriskMenu.sqf +++ b/addons/captives/functions/fnc_openFriskMenu.sqf @@ -1,33 +1,33 @@ /* - Name: AGM_Captives_fnc_openFriskMenu - - Author: bux578 - - Description: - Open the select menu with the "personal" items of a frisked unit - It only shows "handgunWeapon", "uniformItems", "vestItems", "backpackItems" and "assignedItems" because every other item is visible on the character - - Parameters: - 0: Object - player unit - 1: Object - unit + * Author: bux578 + * Open the select menu with the "personal" items of a frisked unit. It only shows "handgunWeapon", "uniformItems", "vestItems", "backpackItems" and "assignedItems" because every other item is visible on the character + * + * Arguments: + * 0: player unit + * 1: unit + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" - Returns: - Nothing -*/ +private ["_weapon", "_listedItemClasses", "_actions", "_allGear"]; -private ["_player", "_unit", "_weapon", "_listedItemClasses", "_actions", "_allGear"]; - -_player = _this select 0; -_unit = _this select 1; +PARAMS_2(_player,_unit); _weapon = currentWeapon _player; if (_weapon == primaryWeapon _player && {_weapon != ""}) then { - [_player, "AmovPercMstpSlowWrflDnon", 0] call AGM_Core_fnc_doAnimation; + [_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation); }; _listedItemClasses = []; -_actions = [localize "STR_AGM_Captives_FriskMenuHeader", localize "STR_AGM_Captives_CancelSelection"] call AGM_Interaction_fnc_prepareSelectMenu; +_actions = [localize "STR_ACE_Captives_FriskMenuHeader", localize "STR_ACE_Captives_CancelSelection"] call ACE_Interaction_fnc_prepareSelectMenu; _allGear = []; @@ -59,12 +59,12 @@ if (count (assignedItems _unit) > 0) then { if (isNil "_item" || str _item == "") then { //str _item ? _item = configFile >> "CfgWeapons" >> _x; }; - _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call AGM_Interaction_fnc_addSelectableItem; + _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call ACE_Interaction_fnc_addSelectableItem; _listedItemClasses pushBack _x; }; } forEach (_allGear); -[_actions, {call AGM_Interaction_fnc_hideMenu;}, {call AGM_Interaction_fnc_hideMenu;}] call AGM_Interaction_fnc_openSelectMenu; +[_actions, {call ACE_Interaction_fnc_hideMenu;}, {call ACE_Interaction_fnc_hideMenu;}] call ACE_Interaction_fnc_openSelectMenu; // don't need an "Ok" Button ctrlShow [8860, false]; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setCaptive.sqf new file mode 100644 index 0000000000..38ce997a88 --- /dev/null +++ b/addons/captives/functions/fnc_setCaptive.sqf @@ -0,0 +1,59 @@ +/* + * Author: Nic547, commy2 + * Makes a civilian unable to move. + * + * Arguments: + * 0: Unit + * 1: True to take captive, false to release captive + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_state); + +if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; + +if (_state) then { + if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + + _unit setVariable ["ACE_isCaptive", true, true]; + + // fix anim on mission start (should work on dedicated servers) + _unit spawn { + [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; + + if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { + [_this] call EFUNC(common,fixLoweredRifleAnimation); + [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); + }; + }; + + _unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; + + if (_unit == ACE_player) then { + showHUD false; + }; +} else { + if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + + _unit setVariable ["ACE_isCaptive", false, true]; + [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; + if (vehicle _unit == _unit) then { + [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; + + if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then { + _unit setVariable ["ACE_Captives_CargoIndex", -1, true]; + }; + + if (_unit == ACE_player) then { + showHUD true; + }; +}; diff --git a/addons/captives/functions/fn_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf similarity index 53% rename from addons/captives/functions/fn_surrender.sqf rename to addons/captives/functions/fnc_surrender.sqf index 9ba1dbcfc2..b308775040 100644 --- a/addons/captives/functions/fn_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -1,17 +1,30 @@ -// by commy2 +/* + * Author: commy2 + * TODO + * + * Arguments: + * 0: Unit + * 1: State + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" -private ["_unit", "_state"]; +PARAMS_2(_unit,_state); -_unit = _this select 0; -_state = _this select 1; - -if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call AGM_Core_fnc_execRemoteFnc}; +if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["AGM_isSurrender", false]) exitWith {}; + if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; - _unit setVariable ["AGM_isSurrender", true, true]; - [_unit, "AGM_Surrendered", true] call AGM_Core_fnc_setCaptivityStatus; + _unit setVariable ["ACE_isSurrender", true, true]; + [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; _unit spawn { // fix for lowered rifle animation glitch @@ -19,29 +32,29 @@ if (_state) then { _this playMove "amovpercmstpsraswrfldnon"; }; - while {_this getVariable ["AGM_isSurrender", false]} do { + while {_this getVariable ["ACE_isSurrender", false]} do { sleep 0.001; //sleep in UI if (isPlayer _this) then {showHUD false}; - if (!alive _this || {_this getVariable ["AGM_isUnconscious", false]}) then { - _this setVariable ["AGM_isSurrender", false, true]; + if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { + _this setVariable ["ACE_isSurrender", false, true]; } else { _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; }; }; - if !(_this getVariable ["AGM_isUnconscious", false]) then { + if !(_this getVariable ["ACE_isUnconscious", false]) then { _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; } else { _this playMoveNow "unconscious"; }; - [_this, "AGM_Surrendered", false] call AGM_Core_fnc_setCaptivityStatus; + [_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus; if (isPlayer _this) then {showHUD true}; }; } else { - _unit setVariable ["AGM_isSurrender", false, true]; + _unit setVariable ["ACE_isSurrender", false, true]; }; /* diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_unloadCaptive.sqf new file mode 100644 index 0000000000..01e1d48e74 --- /dev/null +++ b/addons/captives/functions/fnc_unloadCaptive.sqf @@ -0,0 +1,35 @@ +/* + * Author: commy2 + * Unit unloads a captive from a vehicle. + * + * Arguments: + * 0: Unit that wants to unload a captive + * 1: Vehicle to unload a captive from. + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_vehicle); + +private ["_cargo", "_target"]; + +_cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. + +_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + +if (count _cargo > 0) then { + _target = _cargo select 0; + + _target setVariable ["ACE_Captives_CargoIndex", -1, true]; + + moveOut _target; + [_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); + [_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc; +}; diff --git a/addons/captives/functions/script_component.hpp b/addons/captives/functions/script_component.hpp new file mode 100644 index 0000000000..3cc9111162 --- /dev/null +++ b/addons/captives/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\blank\script_component.hpp" \ No newline at end of file diff --git a/addons/captives/models/ace_cabletie.p3d b/addons/captives/models/ace_cabletie.p3d new file mode 100644 index 0000000000000000000000000000000000000000..72a6facd2bd7aa35487f2e4bd7e05b9f3bc495e7 GIT binary patch literal 52371 zcmeHwcYGJc)^|b;5J>0&DG8xBLl4RBOz1^=5rhCCg(kfhfxx8-VnB)lVpNbKB_bju z``eAeMO2U?9fW{1L7H?$c+Z*qzPa4t-skaoKkvKupC^2VnKOI#obR6b{^qyYIXh|F zrhQXiUmu^GK0ZDj>NIUzifSK{7gO~v6|VWG>8tCln`f$9!4JoUv%GuXdMj>uC9BKw z>X9rjp7No!WJMV({r-(FSq{4Yp;hs<64u7E71i+~m(E+~3NMQIe(#T|>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M7D7l@J3VvAj z-i4!!YPQ5j*qZkziqFc_RG6Z;pShO#lZi7Q#H^Yv@tJwDdVHeTN?s*rTH-7H$C-(e zx zGvdXwWHi{4K33dUNGY(T%rpPm*zwgd4nB(u$1M}R!laJp!(PkW`fFpS zj}>2CQ9j*k>93ESK2{u)V$WG(%YSX`^s!c1aDZrH15R zK7a^q+jkTJ3Z@hOyPvGDneu?0bw(y@GDWmABa}IMS&H0<^7c{9KhXbw(GOej4f~LB bTsemCs7wqv23_F!zwdwHYxv5Hf?fX)mwKPg literal 0 HcmV?d00001 diff --git a/addons/captives/models/ace_default.rvmat b/addons/captives/models/ace_default.rvmat new file mode 100644 index 0000000000..c7a241ca38 --- /dev/null +++ b/addons/captives/models/ace_default.rvmat @@ -0,0 +1,79 @@ +ambient[]={1,1,1,1}; +diffuse[]={1,1,1,1}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.01,0.01,0.01,1}; //amount of glossiness - the higher the number, the higher the glossiness +specularPower=500; //area of glossiness - the higher the number, the smaller the area +PixelShaderID="Super"; +VertexShaderID="Super"; + +class Stage1 { + texture="#(rgb,1,1,1)color(0.5,0.5,1,1)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 { + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,dt)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage3 { + texture="#(argb,8,8,3)color(0,0,0,0,mc)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage4 { + texture="#(argb,8,8,3)color(1,1,1,1,as)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,1}; + }; +}; +class Stage5 { + texture="#(rgb,1,1,1)color(0.2,0.2,1,1)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 { + texture="#(ai,64,64,1)fresnel(4.7,1.2)"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; +class Stage7 { + texture="a3\data_f\env_land_ca.paa"; + uvSource="tex"; + class uvTransform { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,1}; + pos[]={0,0,0}; + }; +}; diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp new file mode 100644 index 0000000000..e68eb19d2f --- /dev/null +++ b/addons/captives/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT captives +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_CAPTIVES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_CAPTIVES + #define DEBUG_SETTINGS DEBUG_SETTINGS_CAPTIVES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 060f89d9ec..eaf63b2d41 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -1,8 +1,8 @@  - + - + Take Prisoner Gefangen nehmen Tomar prisionero @@ -14,7 +14,7 @@ Foglyul ejtés Взять в плен - + Free Prisoner Gefangenen freilassen Liberar prisionero @@ -26,7 +26,7 @@ Fogoly szabadon elengedése Освободить пленника - + Escort Prisoner Gefangenen eskortieren Escoltar prisionero @@ -38,7 +38,7 @@ Fogoly kísérése Конвоировать пленника - + Release Prisoner Gefangenen loslassen Soltar prisionero @@ -50,7 +50,7 @@ Fogoly elengedése Прекратить конвоирование - + You need to take him as prisoner first! Du must ihn zuerst gefangen nehmen. Necesitas hacerle prisionero primero! @@ -62,7 +62,7 @@ Először foglyul kell ejtened! Вы должны сначала взять его в плен! - + Load Captive Gefangenen einladen Cargar prisionero @@ -72,7 +72,7 @@ Fogoly berakása Загрузить пленного - + Unload Captive Gefangenen ausladen Descargar prisionero @@ -82,7 +82,7 @@ Fogoly kivevése Выгрузить пленного - + Cable Tie Kabelbinder Opaska zaciskowa @@ -94,7 +94,7 @@ Gyorskötöző Кабельная стяжка - + Cable ties that allow you to restrain prisoners. Kabelbinder ermöglichen es, Gefangene zu fesseln. Opaska zaciskowa pozwala na skrępowanie dłoni u więźnia. @@ -106,7 +106,7 @@ Gyorskötöző emberek fogjulejtéséhez. Кабельные стяжки позволяют связывать пленников. - + Inventory of frisked person Inventar der durchsuchten Person Inventaire de la fouille @@ -116,7 +116,7 @@ Ekwipunek rewidowanej osoby Инвентарь обысканных лиц - + Frisk person Person durchsuchen Fouiller From 67f78427226895a01fcaa8c1f6e4253a5600308c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 00:43:23 -0300 Subject: [PATCH 021/113] ACE_Settings: store settings data on a list --- addons/common/XEH_preInit.sqf | 1 + .../common/functions/fnc_getSettingData.sqf | 29 ++++++++++++ .../functions/fnc_loadSettingsFromProfile.sqf | 39 ++++++---------- .../functions/fnc_loadSettingsOnServer.sqf | 28 ++++++------ .../functions/fnc_setSettingFromConfig.sqf | 45 ++++++++++++++----- 5 files changed, 92 insertions(+), 50 deletions(-) create mode 100644 addons/common/functions/fnc_getSettingData.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index a7b48d7192..1b724625ab 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -55,6 +55,7 @@ PREP(getMarkerType); PREP(getName); PREP(getNumberFromMissionSQM); PREP(getPitchBankYaw); +PREP(getSettingData); PREP(getStringFromMissionSQM); PREP(getTargetAzimuthAndInclination); PREP(getTargetDistance); diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf new file mode 100644 index 0000000000..f8572c5f42 --- /dev/null +++ b/addons/common/functions/fnc_getSettingData.sqf @@ -0,0 +1,29 @@ +/* + * Author: CAA-Picard + * Returns the metadata of a setting if it exists + * + * Arguments: + * 0: Name of the setting (String) + * + * Return Value: + * Setting Data (Array) + * 0: _name + * 1: _typeName + * 2: _isClientSetable + * 3: _localizedName + * 4: _localizedDescription + * 5: _possibleValues + * 6: _isForced + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_1_PVT(_this,_name); + +_value = objNull; +{ + if ((_x select 0) == _name) exitWith {_value = _x}; +} forEach GVAR(settings); + +_value diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf index a77af66309..9d077359ce 100644 --- a/addons/common/functions/fnc_loadSettingsFromProfile.sqf +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -1,6 +1,6 @@ /* * Author: CAA-Picard - * Load the user setable setting from the user profile. + * Load the user setable settings from the user profile. * Config < Server UserConfig < Mission Config < Client settings * * Arguments: @@ -13,36 +13,25 @@ */ #include "script_component.hpp" -_fnc_setSettingFromProfile = { - EXPLODE_1_PVT(_this,_optionEntry); +// Iterate through settings +{ + _name = _x select 0; + _isClientSetable = _x select 2; + _isForced = _x select 6; - _name = configName _optionEntry; - _valueEntry = _optionEntry >> "value"; - _isClientSetable = getNumber (_optionEntry >> "isClientSetable"); - - if (_isClientSetable > 0) then { - if !(missionNamespace getVariable format ["%1_forced", _name, false]) then { + // If setting is user setable + if (_isClientSetable) then { + // If setting is not forced + if !(_isForced) then { _profileValue = profileNamespace getvariable _name; + // If the setting is stored on the profile if !(isNil _profileValue) then { + // If the profile variable has the correct type if (typeName _profileValue == typeName (missionNamespace getvariable _name)) then { + // Load the setting from the profile missionNamespace setvariable [_name, _profileValue]; }; }; }; }; -}; - -// Iterate through settings from main config -_countOptions = count (configFile >> "ACE_Settings"); -for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = (configFile >> "ACE_Settings") select _index; - [_optionEntry] call _fnc_setSettingFromProfile; - -}; - -// Iterate through settings from mission config -_countOptions = count (missionConfigFile >> "ACE_Settings"); -for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = (missionConfigFile >> "ACE_Settings") select _index; - [_optionEntry] call _fnc_setSettingFromProfile; -}; +} forEach GVAR(settings); diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf index e9d87ad742..20a7e1c40f 100644 --- a/addons/common/functions/fnc_loadSettingsOnServer.sqf +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -13,7 +13,7 @@ */ #include "script_component.hpp" -GVAR(settingsList) = []; +GVAR(settings) = []; // Load settings from main config _countOptions = count (configFile >> "ACE_Settings"); @@ -25,15 +25,13 @@ for "_index" from 0 to (_countOptions - 1) do { // Check if all settings should be forced if (GVAR(forceAllSettings)) then { { - if !(missionNamespace getVariable format ["%1_forced", _x]) then { - missionNamespace setVariable format ["%1_forced", _x, true]; - publicVariable format ["%1_forced", _name]; - }; - } forEach GVAR(settingsList); + _x set [6, true]; + } forEach GVAR(settings); }; +// @todo // Load settings from server userconfig only if the ACE_ServerSettings is loaded -if (isClass (configFile >> "CfgPatches" >> "ACE_ServerSettings")) then { +/*if (isClass (configFile >> "CfgPatches" >> "ACE_ServerSettings")) then { DFUNC(serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp"; if !(isNil DFUNC(serverUserConfig)) then { [] call FUNC(serverUserConfig); @@ -47,7 +45,7 @@ if (isClass (configFile >> "CfgPatches" >> "ACE_ServerSettings")) then { }; } forEach GVAR(settingsList); }; -}; +};*/ // Load settings from mission config _countOptions = count (missionConfigFile >> "ACE_Settings"); @@ -59,9 +57,13 @@ for "_index" from 0 to (_countOptions - 1) do { // Check if all settings should be forced if (GVAR(forceAllSettings)) then { { - if !(missionNamespace getVariable format ["%1_forced", _x]) then { - missionNamespace setVariable format ["%1_forced", _x, true]; - publicVariable format ["%1_forced", _name]; - }; - } forEach GVAR(settingsList); + _x set [6, true]; + } forEach GVAR(settings); }; + +// Publish all settings data +publicVariable QGVAR(settings); +// Publish all setting values +{ + publicVariable (_x select 0); +} forEach GVAR(settings); diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index 89967c357c..a6b46f45c4 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -28,6 +28,9 @@ _fnc_getValueWithType = { if (_typeName == "ARRAY") exitWith { getArray (_optionEntry >> "value") }; + if (_typeName == "COLOR") exitWith { + getArray (_optionEntry >> "value") + }; _value }; @@ -39,41 +42,59 @@ if (isNil _name) then { // Get type from config _typeName = getText (_optionEntry >> "typeName"); + if (_typeName == "") then { + _typeName = "SCALAR"; + }; // Read entry and cast it to the correct type _value = [_optionEntry, _typeName] call _fnc_getValueWithType; // Init the variable and publish it missionNamespace setVariable [_name, _value]; - publicVariable _name; - // Set the variable to not forced - missionNamespace setVariable [format ["%1_forced", _name], false]; - publicVariable format ["%1_forced", _name]; - // Add the variable to a list on the server - GVAR(settingsList) pushBack _name; + // Add the setting to a list on the server + // Set the variable to not forced + /*_settingData = [ + _name, + _typeName, + _isClientSetable, + _localizedName, + _localizedDescription, + _possibleValues, + _isForced + ];*/ + _settingData = [ + _name, + _typeName, + (getNumber (_optionEntry >> "isClientSetable")) > 0, + getText (_optionEntry >> "displayName"), + getText (_optionEntry >> "description"), + getArray (_optionEntry >> "values"), + getNumber (_optionEntry >> "force") > 0 + ]; + + GVAR(settings) pushBack _settingData; } else { // The setting already exists. // Check if it's already forced and quit - if (missionNamespace getVariable format ["%1_forced", _name]) exitWith {}; + _settingData = [_name] call FUNC(getSettingData); + if (_settingData select 6) exitWith {}; // The setting is not forced, so update the value // Get the type from the existing variable - _typeName = typeName (missionNamespace getVariable _name); + _typeName = _settingData select 1; // Read entry and cast it to the correct type _value = [_optionEntry, _typeName] call _fnc_getValueWithType; // Update the variable and publish it missionNamespace setVariable [_name, _value]; - publicVariable _name; - // Check if it needs forcing + // Force the setting if requested if (getNumber (_optionEntry >> "force") > 0) then { - missionNamespace setVariable [format ["%1_forced", _name], true]; - publicVariable format ["%1_forced", _name]; + _settingData set [6, true]; }; }; From 354b2616779df2a42bfa8f9284c1ac278858f024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 00:43:53 -0300 Subject: [PATCH 022/113] ACE_Settings: added sample setting entry for documentation --- addons/common/config.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/addons/common/config.cpp b/addons/common/config.cpp index 0189facd47..84052cbdfb 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -58,6 +58,32 @@ class ACE_canInteractConditions { }; class ACE_Settings { + /* + *class GVAR(sampleSetting) { + * Value + * value = 1; + * + * Type (SCALAR, BOOL, STRING, ARRAY, COLOR) + * typeName = "SCALAR"; + * + * Force the setting? + * force = 0; + * + * Does it appear on the options menu? + * isClientSetable = 1; + * + * The following settings only apply when isClientSetable == 1 + * Stringtable entry with the setting name + * displayName = "$STR_ACE_Common_SettingName"; + * + * Stringtable entry with the setting description + * description = "$STR_ACE_Common_SettingDescription"; + * + * Stringtable entries that describe the options + * Only applies if typeName == "SCALAR"; + * values[] = {"Disabled", "Enabled", "Only Cursor", "Only On Keypress", "Only Cursor and KeyPress"}; + *}; + */ class GVAR(forceAllSettings) { value = 0; typeName = "BOOL"; From 173169bc3d6b1aba5176c48deee2c15b943daadd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 00:44:06 -0300 Subject: [PATCH 023/113] Fix in goggles --- addons/goggles/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/goggles/config.cpp b/addons/goggles/config.cpp index eafe07fb27..dcc9c6ed0e 100644 --- a/addons/goggles/config.cpp +++ b/addons/goggles/config.cpp @@ -248,7 +248,7 @@ class ACE_Settings { value = 0; typeName = "BOOL"; isClientSetable = 1; - displayName = "$STR_ACE_Goggles_ShowInThirdPerson;" + displayName = "$STR_ACE_Goggles_ShowInThirdPerson"; }; }; From 91cfb40e6f5b25918daa33fb7c76beac8e2f7a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 00:44:34 -0300 Subject: [PATCH 024/113] ACE_Settings: updated optionsmenu to use the the new system --- addons/optionsmenu/CfgEventHandlers.hpp | 6 --- addons/optionsmenu/XEH_postInit.sqf | 4 -- addons/optionsmenu/XEH_preInit.sqf | 5 --- .../functions/fnc_addClientSideColor.sqf | 19 ---------- .../functions/fnc_addClientSideOptions.sqf | 19 ---------- .../functions/fnc_addFromConfig.sqf | 38 ------------------- .../functions/fnc_loadFromProfile.sqf | 36 ------------------ .../functions/fnc_onSettingsMenuOpen.sqf | 21 ++++++++++ .../functions/fnc_saveToProfile.sqf | 37 ------------------ .../fnc_settingsMenuUpdateKeyView.sqf | 22 +++++++---- .../functions/fnc_settingsMenuUpdateList.sqf | 19 +++++++--- .../functions/fnc_updateSetting.sqf | 20 +++++++--- 12 files changed, 64 insertions(+), 182 deletions(-) delete mode 100644 addons/optionsmenu/XEH_postInit.sqf delete mode 100644 addons/optionsmenu/functions/fnc_addClientSideColor.sqf delete mode 100644 addons/optionsmenu/functions/fnc_addClientSideOptions.sqf delete mode 100644 addons/optionsmenu/functions/fnc_addFromConfig.sqf delete mode 100644 addons/optionsmenu/functions/fnc_loadFromProfile.sqf delete mode 100644 addons/optionsmenu/functions/fnc_saveToProfile.sqf diff --git a/addons/optionsmenu/CfgEventHandlers.hpp b/addons/optionsmenu/CfgEventHandlers.hpp index 88bfdf4e6b..b97829836e 100644 --- a/addons/optionsmenu/CfgEventHandlers.hpp +++ b/addons/optionsmenu/CfgEventHandlers.hpp @@ -3,9 +3,3 @@ class Extended_PreInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); - }; -}; diff --git a/addons/optionsmenu/XEH_postInit.sqf b/addons/optionsmenu/XEH_postInit.sqf deleted file mode 100644 index c0b61d87de..0000000000 --- a/addons/optionsmenu/XEH_postInit.sqf +++ /dev/null @@ -1,4 +0,0 @@ -#include "script_component.hpp" - -//Add Settings from configFile -[] call FUNC(addFromConfig); diff --git a/addons/optionsmenu/XEH_preInit.sqf b/addons/optionsmenu/XEH_preInit.sqf index 97df9410e6..83a50bce65 100644 --- a/addons/optionsmenu/XEH_preInit.sqf +++ b/addons/optionsmenu/XEH_preInit.sqf @@ -2,16 +2,11 @@ ADDON = false; -PREP(addClientSideColor); -PREP(addClientSideOptions); -PREP(addFromConfig); -PREP(loadFromProfile); PREP(onListBoxSettingsChanged); PREP(onListBoxShowSelectionChanged); PREP(onSettingsMenuOpen); PREP(onSliderPosChanged); PREP(resetSettings); -PREP(saveToProfile); PREP(settingsMenuUpdateKeyView); PREP(settingsMenuUpdateList); PREP(updateSetting); diff --git a/addons/optionsmenu/functions/fnc_addClientSideColor.sqf b/addons/optionsmenu/functions/fnc_addClientSideColor.sqf deleted file mode 100644 index ca0473cb89..0000000000 --- a/addons/optionsmenu/functions/fnc_addClientSideColor.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/** - * fnc_addClientSideColor.sqf - * @Descr: N/A - * @Author: PabstMirror - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" - -private ["_currentValue"]; -PARAMS_4(_name,_localizedName,_localizedDescription,_defaultValue); - -GVAR(clientSideColors) pushBack [_name, _localizedName, _localizedDescription, [], _defaultValue]; - -//Get the current setting from profile (or default) and set it: -_currentValue = [MENU_TAB_COLORS, _name, _defaultValue] call FUNC(loadFromProfile); -[MENU_TAB_COLORS, _name, _currentValue] call FUNC(updateSetting); diff --git a/addons/optionsmenu/functions/fnc_addClientSideOptions.sqf b/addons/optionsmenu/functions/fnc_addClientSideOptions.sqf deleted file mode 100644 index 4ad9584410..0000000000 --- a/addons/optionsmenu/functions/fnc_addClientSideOptions.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/** - * fnc_addClientSideOptions.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" - -private ["_currentValue"]; -PARAMS_5(_name,_localizedName,_localizedDescription,_possibleValues,_defaultValue); - -GVAR(clientSideOptions) pushBack [_name, _localizedName, _localizedDescription, _possibleValues, -1, _defaultValue]; - -//Get the current setting from profile (or default) and set it: -_currentValue = [MENU_TAB_OPTIONS, _name, _defaultValue] call FUNC(loadFromProfile); -[MENU_TAB_OPTIONS, _name, _currentValue] call FUNC(updateSetting); diff --git a/addons/optionsmenu/functions/fnc_addFromConfig.sqf b/addons/optionsmenu/functions/fnc_addFromConfig.sqf deleted file mode 100644 index 226b5dee73..0000000000 --- a/addons/optionsmenu/functions/fnc_addFromConfig.sqf +++ /dev/null @@ -1,38 +0,0 @@ -/** -* fnc_addFromConfig.sqf -* @Descr: N/A -* @Author: PabstMirror -* -* @Arguments: [] -* @Return: -* @PublicAPI: false -*/ -#include "script_component.hpp" - -if (isClass (configFile >> "ACE_Options")) then { - _countOptions = count (configFile >> "ACE_Options"); - for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = (configFile >> "ACE_Options") select _index; - _name = configName _optionEntry; - _displayName = getText (_optionEntry >> "displayName"); - _description = getText (_optionEntry >> "description"); - _default = getNumber (_optionEntry >> "default"); - _choices = getArray (_optionEntry >> "values"); - if ((count _choices) == 0) then { - _choices = [(localize "STR_ACE_OptionsMenu_Disabled"), (localize "STR_ACE_OptionsMenu_Enabled")]; - }; - [_name, _displayName, _description, _choices, _default] call FUNC(addClientSideOptions); - }; -}; - -if (isClass (configFile >> "ACE_Colors")) then { - _countOptions = count (configFile >> "ACE_Colors"); - for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = (configFile >> "ACE_Colors") select _index; - _name = configName _optionEntry; - _displayName = getText (_optionEntry >> "displayName"); - _description = getText (_optionEntry >> "description"); - _default = getArray (_optionEntry >> "default"); - [_name, _displayName, _description, _default] call FUNC(addClientSideColor); - }; -}; diff --git a/addons/optionsmenu/functions/fnc_loadFromProfile.sqf b/addons/optionsmenu/functions/fnc_loadFromProfile.sqf deleted file mode 100644 index 21819f1add..0000000000 --- a/addons/optionsmenu/functions/fnc_loadFromProfile.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/** -* fnc_loadFromProfile.sqf -* @Descr: N/A -* @Author: Glowbal -* -* @Arguments: [] -* @Return: -* @PublicAPI: false -*/ -#include "script_component.hpp" - -private ["_typeString", "_settingValue", "_badData"]; -PARAMS_3(_type,_name,_default); - -_typeString = ""; -switch (_type) do { -case (MENU_TAB_OPTIONS): {_typeString = "option";}; -case (MENU_TAB_COLORS): {_typeString = "color";}; -}; - -_settingValue = profileNamespace getvariable [(format ["ace_%1_%2", _typeString, _name]), _default]; - -_badData = isNil "_settingValue"; -if (!_badData) then { - switch (_type) do { - case (MENU_TAB_OPTIONS): {_badData = ((typeName _settingValue) != (typeName 0));}; - case (MENU_TAB_COLORS): {_badData = (((typeName _settingValue) != (typeName [])) || {(count _settingValue) != 4});}; - }; -}; -if (_badData) then { - _settingValue = _default; - systemChat format ["Bad Data in profile [ace_%1_%2] using default", _typeString, _name]; - ERROR("Bad Value in profile"); -}; - -_settingValue diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index 11f5a3ef64..d0b104135d 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -9,5 +9,26 @@ */ #include "script_component.hpp" +// Filter only user setable setting +GVAR(clientSideOptions) = []; +GVAR(clientSideColors) = []; +{ + // If the setting is user setable + if (_x select 2) then { + // Append the current value to the setting metadata + _setting = + _x; + _setting pushBack (missionNamespace getVariable (_x select 0)); + + // Categorize the setting according to types + // @todo: allow the user to modify other types of parameters? + if ((_x select 1) == "SCALAR" || (_x select 1) == "BOOL") then { + GVAR(clientSideOptions) pushBack _setting; + }; + if ((_x select 1) == "COLOR") then { + GVAR(clientSideColors) pushBack _setting; + }; + }; +} forEach EGVAR(common,settings); + //Delay a frame [{ [MENU_TAB_OPTIONS] call FUNC(onListBoxShowSelectionChanged) }, []] call EFUNC(common,execNextFrame); diff --git a/addons/optionsmenu/functions/fnc_saveToProfile.sqf b/addons/optionsmenu/functions/fnc_saveToProfile.sqf deleted file mode 100644 index 30db652186..0000000000 --- a/addons/optionsmenu/functions/fnc_saveToProfile.sqf +++ /dev/null @@ -1,37 +0,0 @@ -/** -* fnc_saveToProfile.sqf -* @Descr: Save the clientside option to the profile. -* @Author: Glowbal -* -* @Arguments: [name STRING (Name of setting)] -* @Return: BOOL True if saved. -* @PublicAPI: false -*/ -#include "script_component.hpp" - -private ["_nameSelected", "_saved"]; -PARAMS_2(_type,_name); - -_saved = false; -switch (_type) do { -case (MENU_TAB_OPTIONS): { - { - _nameSelected = _x select 0; - if (_nameSelected == _name) exitwith { - profileNamespace setvariable [(format ["ace_option_%1", _name]), (_x select 4)]; - _saved = true; - }; - }foreach GVAR(clientSideOptions); - }; -case (MENU_TAB_COLORS): { - { - _nameSelected = _x select 0; - if (_nameSelected == _name) exitwith { - profileNamespace setvariable [(format ["ace_color_%1", _name]), (_x select 3)]; - _saved = true; - }; - }foreach GVAR(clientSideColors); - }; -}; - -_saved diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf index 09242bcb8c..23b9ed9523 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf @@ -33,8 +33,8 @@ if (count _collection > 0) then { _setting = _collection select _settingIndex; _entryName = _setting select 0; - _localizedName = _setting select 1; - _localizedDescription = _setting select 2; + _localizedName = _setting select 3; + _localizedDescription = _setting select 4; if (_localizedName == "") then {_localizedName = _entryName;}; (_settingsMenu displayCtrl 250) ctrlSetText _localizedName; @@ -43,15 +43,23 @@ if (count _collection > 0) then { switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { - _possibleValues = _setting select 3; - _settingsValue = _setting select 4; - lbClear 400; - { lbAdd [400, _x]; } foreach _possibleValues; + _possibleValues = _setting select 5; + _settingsValue = _setting select 7; + // Created disable/enable options for bools + if ((_setting select 1) == "BOOL") then { + lbClear 400; + lbAdd [400, (localize "STR_ACE_OptionsMenu_Disabled")]; + lbAdd [400, (localize "STR_ACE_OptionsMenu_Enabled")]; + _settingsValue = [0, 1] select _settingsValue; + } else { + lbClear 400; + { lbAdd [400, _x]; } foreach _possibleValues; + }; (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue; }; case (MENU_TAB_COLORS): { - _currentColor = _setting select 3; + _currentColor = _setting select 7; { sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))]; } forEach [410, 411, 412, 413]; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf index ff825a2141..78b5113203 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf @@ -21,21 +21,30 @@ lbclear _ctrlList; switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { { - _settingsText = ((_x select 3) select (_x select 4)); - _ctrlList lbadd (_x select 1); + _ctrlList lbadd (_x select 3); + + _settingsValue = _x select 7; + + // Created disable/enable options for bools + _settingsText = if ((_x select 1) == "BOOL") then { + [(localize "STR_ACE_OptionsMenu_Disabled"), (localize "STR_ACE_OptionsMenu_Enabled")] select _settingsValue; + } else { + (_x select 5) select _settingsValue; + }; + _ctrlList lbadd (_settingsText); }foreach GVAR(clientSideOptions); }; case (MENU_TAB_COLORS): { { - _color = +(_x select 3); + _color = +(_x select 7); { _color set [_forEachIndex, ((round (_x * 100))/100)]; } forEach _color; _settingsColor = str _color; - _ctrlList lbadd (_x select 1); + _ctrlList lbadd (_x select 3); _ctrlList lbadd (_settingsColor); - _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 3)]; + _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 7)]; }foreach GVAR(clientSideColors); }; }; diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index 403a09cdb2..270d39f540 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -17,25 +17,33 @@ _changed = false; switch (_type) do { case (MENU_TAB_OPTIONS): { { - if (((_x select 0) == _name) && {!((_x select 4) isEqualTo _newValue)}) then { - _changed = true; - _x set [4, _newValue]; + if ((_x select 0) == _name) then { + + if ((_x select 1) == "BOOL") then { + _newValue = [false, true] select _newValue; + }; + + if !((_x select 7) isEqualTo _newValue) then { + _changed = true; + _x set [7, _newValue]; + } ; + }; } foreach GVAR(clientSideOptions); }; case (MENU_TAB_COLORS): { { - if (((_x select 0) == _name) && {!((_x select 3) isEqualTo _newValue)}) then { + if (((_x select 0) == _name) && {!((_x select 7) isEqualTo _newValue)}) then { _changed = true; - _x set [3, _newValue]; + _x set [7, _newValue]; }; } foreach GVAR(clientSideColors); }; }; if (_changed) then { + profileNamespace setvariable [_name, _newValue]; missionNameSpace setVariable [_name, _newValue]; - [_type, _name] call FUNC(saveToProfile); ["SettingChanged", [_name, _newValue]] call EFUNC(common,localEvent); TRACE_2("Variable Updated",_name,_newValue); }; From 857b45453a126f045fc01babeb8c207a51ba3371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 01:03:26 -0300 Subject: [PATCH 025/113] ACE_Settings: fix option to reset user setable settings to default --- addons/common/functions/fnc_getSettingData.sqf | 1 + addons/common/functions/fnc_setSettingFromConfig.sqf | 6 ++++-- addons/optionsmenu/functions/fnc_resetSettings.sqf | 4 ++-- .../functions/fnc_settingsMenuUpdateKeyView.sqf | 4 ++-- .../functions/fnc_settingsMenuUpdateList.sqf | 6 +++--- addons/optionsmenu/functions/fnc_updateSetting.sqf | 10 +++++----- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf index f8572c5f42..5b0c1c96ea 100644 --- a/addons/common/functions/fnc_getSettingData.sqf +++ b/addons/common/functions/fnc_getSettingData.sqf @@ -14,6 +14,7 @@ * 4: _localizedDescription * 5: _possibleValues * 6: _isForced + * 7: _defaultValue * * Public: No */ diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index a6b46f45c4..f87249786f 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -61,7 +61,8 @@ if (isNil _name) then { _localizedName, _localizedDescription, _possibleValues, - _isForced + _isForced, + _defaultValue ];*/ _settingData = [ _name, @@ -70,7 +71,8 @@ if (isNil _name) then { getText (_optionEntry >> "displayName"), getText (_optionEntry >> "description"), getArray (_optionEntry >> "values"), - getNumber (_optionEntry >> "force") > 0 + getNumber (_optionEntry >> "force") > 0, + _value ]; GVAR(settings) pushBack _settingData; diff --git a/addons/optionsmenu/functions/fnc_resetSettings.sqf b/addons/optionsmenu/functions/fnc_resetSettings.sqf index bdc5c7662a..dd4b951ef5 100644 --- a/addons/optionsmenu/functions/fnc_resetSettings.sqf +++ b/addons/optionsmenu/functions/fnc_resetSettings.sqf @@ -13,13 +13,13 @@ private ["_name", "_default", "_lastSelected"]; { _name = _x select 0; - _default = _x select 5; + _default = _x select 7; [MENU_TAB_OPTIONS, _name, _default] call FUNC(updateSetting); } forEach GVAR(clientSideOptions); { _name = _x select 0; - _default = _x select 4; + _default = _x select 7; [MENU_TAB_COLORS, _name, _default] call FUNC(updateSetting); } forEach GVAR(clientSideColors); diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf index 23b9ed9523..c271ecd176 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf @@ -44,7 +44,7 @@ if (count _collection > 0) then { switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { _possibleValues = _setting select 5; - _settingsValue = _setting select 7; + _settingsValue = _setting select 8; // Created disable/enable options for bools if ((_setting select 1) == "BOOL") then { @@ -59,7 +59,7 @@ if (count _collection > 0) then { (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue; }; case (MENU_TAB_COLORS): { - _currentColor = _setting select 7; + _currentColor = _setting select 8; { sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))]; } forEach [410, 411, 412, 413]; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf index 78b5113203..73a6d3de3b 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf @@ -23,7 +23,7 @@ case (MENU_TAB_OPTIONS): { { _ctrlList lbadd (_x select 3); - _settingsValue = _x select 7; + _settingsValue = _x select 8; // Created disable/enable options for bools _settingsText = if ((_x select 1) == "BOOL") then { @@ -37,14 +37,14 @@ case (MENU_TAB_OPTIONS): { }; case (MENU_TAB_COLORS): { { - _color = +(_x select 7); + _color = +(_x select 8); { _color set [_forEachIndex, ((round (_x * 100))/100)]; } forEach _color; _settingsColor = str _color; _ctrlList lbadd (_x select 3); _ctrlList lbadd (_settingsColor); - _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 7)]; + _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 8)]; }foreach GVAR(clientSideColors); }; }; diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index 270d39f540..4691ff8e67 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -23,9 +23,9 @@ case (MENU_TAB_OPTIONS): { _newValue = [false, true] select _newValue; }; - if !((_x select 7) isEqualTo _newValue) then { + if !((_x select 8) isEqualTo _newValue) then { _changed = true; - _x set [7, _newValue]; + _x set [8, _newValue]; } ; }; @@ -33,16 +33,16 @@ case (MENU_TAB_OPTIONS): { }; case (MENU_TAB_COLORS): { { - if (((_x select 0) == _name) && {!((_x select 7) isEqualTo _newValue)}) then { + if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then { _changed = true; - _x set [7, _newValue]; + _x set [8, _newValue]; }; } foreach GVAR(clientSideColors); }; }; if (_changed) then { - profileNamespace setvariable [_name, _newValue]; + profileNamespace setVariable [_name, _newValue]; missionNameSpace setVariable [_name, _newValue]; ["SettingChanged", [_name, _newValue]] call EFUNC(common,localEvent); TRACE_2("Variable Updated",_name,_newValue); From 2c0d2013d47e9716bd02be857190b76519af56d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 01:45:04 -0300 Subject: [PATCH 026/113] ACE_Settings: Added a function to change settings on runtime (e.g. for modules) --- addons/common/XEH_postInit.sqf | 14 ++++++ addons/common/functions/fnc_setSetting.sqf | 46 +++++++++++++------ .../functions/fnc_setSettingFromConfig.sqf | 4 +- .../functions/fnc_updateSetting.sqf | 4 +- 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 70826b7f11..5abdfbc597 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -4,6 +4,20 @@ // Load settings from profile call FUNC(loadSettingsFromProfile); +// Listens for global "SettingChanged" events, to update the force status locally +["SettingChanged", { + + PARAMS_2(_name,_value); + if !(count _this > 2) exitWith {}; + + _force = _this select 2; + if (_force) then { + _settingData = [_name] call FUNC(getSettingData); + if (isNull _settingData) exitWith {}; + _settingData set [6,_force]; + }; +}] call FUNC(addEventhandler); + // hack to get PFH to work in briefing [QGVAR(onBriefingPFH), "onEachFrame", { if (time > 0) exitWith { diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index 5a570d618a..3fd273adca 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -1,11 +1,14 @@ /* * Author: CAA-Picard - * Set a setting if it was not previosuly forced. Force if neccesary. + * Change the value of an existing setting if it was not previously forced. Force if neccesary. + * If executed on clients it has local effect. + * If executed on server it can have global effect if the last parameter is set to true. * * Arguments: * 0: Setting name (String) * 1: Value (Any) * 2: Force it? (Bool) (Optional) + * 3: Broadcast the change to all clients (Bool) (Optional) * * Return Value: * None @@ -16,25 +19,40 @@ EXPLODE_2_PVT(_this,_name,_value); -if !(isServer) exitWith {}; - private ["force"]; _force = false; if (count _this > 2) then { _force = _this select 2; }; -// Check if it's already forced and quit -if (missionNamespace getVariable [format ["%1_forced", _name], false]) exitWith {}; +_settingData = [_name] call FUNC(getSettingData); -// Check if the variable is already defined -if (isNil _name) then { - // Add the variable to a list on the server - GVAR(settingsList) pushBack _name; -}; +// Exit if the setting does not exist +if (isNull _settingData) exitWith {}; -// Update the variable and publish it +// Exit if the setting is already forced +if (_settingData select 6) exitWith {}; + +// Exit if the type is not right +if (typeName _value != typeName (missionNamespace getVariable _name)) exitWith {}; + +// Force it if it was required +_settingData set [6, _force]; + +// Exit if the value didn't change +if (_value isEqualTo (missionNamespace getVariable _name)) exitWith {}; + +// Update the variable +TRACE_2("Variable Updated",_name,_value); missionNamespace setVariable [_name, _value]; -publicVariable _name; -missionNamespace setVariable [format ["%1_forced", _name], _force]; -publicVariable format ["%1_forced", _name]; + +if (isServer && {count _this > 3} && {_this select 3}) then { + // Publicize the new value + publicVariable _name; + + // Raise event globally, this publicizes eventual changes in _force status so clients can update it locally + ["SettingChanged", [_name, _value, _force]] call FUNC(globalEvent); +} else { + // Raise event locally + ["SettingChanged", [_name, _value, _force]] call FUNC(localEvent); +}; diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index f87249786f..6054942485 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -49,7 +49,7 @@ if (isNil _name) then { // Read entry and cast it to the correct type _value = [_optionEntry, _typeName] call _fnc_getValueWithType; - // Init the variable and publish it + // Init the variable missionNamespace setVariable [_name, _value]; // Add the setting to a list on the server @@ -92,7 +92,7 @@ if (isNil _name) then { // Read entry and cast it to the correct type _value = [_optionEntry, _typeName] call _fnc_getValueWithType; - // Update the variable and publish it + // Update the variable missionNamespace setVariable [_name, _value]; // Force the setting if requested diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index 4691ff8e67..e4a9917f25 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -43,7 +43,5 @@ case (MENU_TAB_COLORS): { if (_changed) then { profileNamespace setVariable [_name, _newValue]; - missionNameSpace setVariable [_name, _newValue]; - ["SettingChanged", [_name, _newValue]] call EFUNC(common,localEvent); - TRACE_2("Variable Updated",_name,_newValue); + [_name, _newValue] call EFUNC(common,setSetting); }; From 658f30b9a2f28b871216754f3bdffe2337b730b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 02:37:13 -0300 Subject: [PATCH 027/113] ACE_Settings: various fixes --- addons/common/XEH_postInit.sqf | 2 +- addons/common/functions/fnc_getSettingData.sqf | 3 ++- addons/common/functions/fnc_setSetting.sqf | 10 ++++++---- .../optionsmenu/functions/fnc_onSettingsMenuOpen.sqf | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 5abdfbc597..a645d48293 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -13,7 +13,7 @@ call FUNC(loadSettingsFromProfile); _force = _this select 2; if (_force) then { _settingData = [_name] call FUNC(getSettingData); - if (isNull _settingData) exitWith {}; + if (count _settingData == 0) exitWith {}; _settingData set [6,_force]; }; }] call FUNC(addEventhandler); diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf index 5b0c1c96ea..3dd2582860 100644 --- a/addons/common/functions/fnc_getSettingData.sqf +++ b/addons/common/functions/fnc_getSettingData.sqf @@ -22,7 +22,8 @@ EXPLODE_1_PVT(_this,_name); -_value = objNull; +private ["_value"]; +_value = []; { if ((_x select 0) == _name) exitWith {_value = _x}; } forEach GVAR(settings); diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index 3fd273adca..8c9e6853a9 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -17,9 +17,11 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_name,_value); +private ["_name","_value"]; +_name = _this select 0; +_value = _this select 1; -private ["force"]; +private ["_force"]; _force = false; if (count _this > 2) then { _force = _this select 2; @@ -28,13 +30,13 @@ if (count _this > 2) then { _settingData = [_name] call FUNC(getSettingData); // Exit if the setting does not exist -if (isNull _settingData) exitWith {}; +if (count _settingData == 0) exitWith {}; // Exit if the setting is already forced if (_settingData select 6) exitWith {}; // Exit if the type is not right -if (typeName _value != typeName (missionNamespace getVariable _name)) exitWith {}; +if ((typeName _value) != typeName (missionNamespace getVariable _name)) exitWith {}; // Force it if it was required _settingData set [6, _force]; diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index d0b104135d..e3137f8ca9 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -13,8 +13,8 @@ GVAR(clientSideOptions) = []; GVAR(clientSideColors) = []; { - // If the setting is user setable - if (_x select 2) then { + // If the setting is user setable and not forced + if ((_x select 2) && !(_x select 6)) then { // Append the current value to the setting metadata _setting = + _x; _setting pushBack (missionNamespace getVariable (_x select 0)); From 051ad008060636c8b135df975445ba29b59d1d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 02:37:38 -0300 Subject: [PATCH 028/113] ACE_Settings: added function to add settings at runtime --- addons/common/XEH_preInit.sqf | 1 + addons/common/functions/fnc_addSetting.sqf | 40 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 addons/common/functions/fnc_addSetting.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 1b724625ab..a967c5f222 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -11,6 +11,7 @@ PREP(addCustomEventHandler); PREP(addLineToDebugDraw); PREP(addMapMarkerCreatedEventHandler); PREP(addScrollWheelEventHandler); +PREP(addSetting); PREP(adminKick); PREP(ambientBrightness); PREP(applyForceWalkStatus); diff --git a/addons/common/functions/fnc_addSetting.sqf b/addons/common/functions/fnc_addSetting.sqf new file mode 100644 index 0000000000..866b7fb35b --- /dev/null +++ b/addons/common/functions/fnc_addSetting.sqf @@ -0,0 +1,40 @@ +/* + * Author: CAA-Picard + * Adds a new setting at runtime, with all it's metadata. + * If has only local effects. + * + * Arguments: + * 0: _name (String) + * 1: _typeName (String) + * 2: _isClientSetable (Bool) + * 3: _localizedName (String) + * 4: _localizedDescription (String) + * 5: _possibleValues (Array) + * 6: _isForced (Bool) + * 7: _defaultValue (Any) + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_8_PVT(_this,_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value); + +_settingData = [_name] call FUNC(getSettingData); + +// Exit if the setting already exists +if (count _settingData > 0) exitWith {}; + +// Update the variable +TRACE_2("Setting added",_name,_value); + +// Init the variable +missionNamespace setVariable [_name, _value]; + +// Add the setting data +GVAR(settings) pushBack _this; + +// Raise event locally +["SettingChanged", [_name, _value]] call FUNC(localEvent); From 66045b8d5198fe0d9eb854bfeab68802c0fa6f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 02:51:41 -0300 Subject: [PATCH 029/113] ACE_Settings: setSettings tab to space, casting --- addons/common/functions/fnc_setSetting.sqf | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index 8c9e6853a9..ec83cd8c31 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -35,8 +35,18 @@ if (count _settingData == 0) exitWith {}; // Exit if the setting is already forced if (_settingData select 6) exitWith {}; -// Exit if the type is not right -if ((typeName _value) != typeName (missionNamespace getVariable _name)) exitWith {}; +// If the type is not equal, try to cast it +if ((typeName _value) != (_settingData select 1)) then { + _failed = True; + if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") exitWith { + _value = _value > 0; + _failed = false; + }; + if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") exitWith { + _failed = false; + }; +}; +if (_failed) exitWith {}; // Force it if it was required _settingData set [6, _force]; @@ -49,12 +59,12 @@ TRACE_2("Variable Updated",_name,_value); missionNamespace setVariable [_name, _value]; if (isServer && {count _this > 3} && {_this select 3}) then { - // Publicize the new value - publicVariable _name; + // Publicize the new value + publicVariable _name; - // Raise event globally, this publicizes eventual changes in _force status so clients can update it locally - ["SettingChanged", [_name, _value, _force]] call FUNC(globalEvent); + // Raise event globally, this publicizes eventual changes in _force status so clients can update it locally + ["SettingChanged", [_name, _value, _force]] call FUNC(globalEvent); } else { - // Raise event locally - ["SettingChanged", [_name, _value, _force]] call FUNC(localEvent); + // Raise event locally + ["SettingChanged", [_name, _value, _force]] call FUNC(localEvent); }; From 92d21af8c602348e397816d292d8daa5311bda5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 02:52:07 -0300 Subject: [PATCH 030/113] ACE_Settings: function for updating settings from modules --- addons/common/XEH_preInit.sqf | 3 +- .../fnc_readBooleanParameterFromModule.sqf | 28 --------------- .../fnc_readNumericParameterFromModule.sqf | 34 ------------------- .../functions/fnc_readSettingFromModule.sqf | 27 +++++++++++++++ 4 files changed, 28 insertions(+), 64 deletions(-) delete mode 100644 addons/common/functions/fnc_readBooleanParameterFromModule.sqf delete mode 100644 addons/common/functions/fnc_readNumericParameterFromModule.sqf create mode 100644 addons/common/functions/fnc_readSettingFromModule.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index a967c5f222..b2f5ef209d 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -100,8 +100,7 @@ PREP(player); PREP(playerSide); PREP(progressBar); PREP(queueAnimation); -PREP(readBooleanParameterFromModule); -PREP(readNumericParameterFromModule); +PREP(readSettingFromModule); PREP(removeActionEventHandler); PREP(removeActionMenuEventHandler); PREP(removeCameraEventHandler); diff --git a/addons/common/functions/fnc_readBooleanParameterFromModule.sqf b/addons/common/functions/fnc_readBooleanParameterFromModule.sqf deleted file mode 100644 index 9ee2faa001..0000000000 --- a/addons/common/functions/fnc_readBooleanParameterFromModule.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: CAA-Picard - * - * Reads a boolean value from a module, sets de ACE_Parameter. Logs if parameters are missing in the module. - * - * Arguments: - * 0: Module (Object) - * 1: ACE_Parameter name (string) - * 2: Module parameter name (string) - * - * Return Value: - * None - */ -#include "script_component.hpp" - - private ["_logic", "_parameterName", "_moduleParameterName"]; - -_logic = _this select 0; -_parameterName = _this select 1; -_moduleParameterName = _this select 2; - -// Check if the parameter is defined in the module -if (isNil {_logic getVariable _moduleParameterName}) exitWith { - diag_log text format["[ACE]: Warning in %1 module: %2 parameter is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleParameterName]; -}; - -// Set the parameter -[_parameterName , if (_logic getVariable _moduleParameterName) then {1} else {0}] call FUNC(setParameter); diff --git a/addons/common/functions/fnc_readNumericParameterFromModule.sqf b/addons/common/functions/fnc_readNumericParameterFromModule.sqf deleted file mode 100644 index a9c35f5b46..0000000000 --- a/addons/common/functions/fnc_readNumericParameterFromModule.sqf +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Author: CAA-Picard - * - * Reads a numeric value from a module, sets de ACE_Parameter. Logs if parameters are missing in the module. - * - * Arguments: - * 0: Module (Object) - * 1: ACE_Parameter name (string) - * 2: Module parameter name (string) - * - * Return Value: - * None - */ -#include "script_component.hpp" - - private ["_logic", "_parameterName", "_moduleParameterName", "_value"]; - -_logic = _this select 0; -_parameterName = _this select 1; -_moduleParameterName = _this select 2; - -// Check if the parameter is defined in the module -if (isNil {_logic getVariable _moduleParameterName}) exitWith { - diag_log text format["[ACE]: Warning in %1 module: %2 parameter is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleParameterName] -}; - -// Check if the value is defined as string for backward compatibility -_value = _logic getVariable _moduleParameterName; -if (typeName _value == "STRING") then { - _value = parseNumber _value; -}; - -// Set the parameter -[_parameterName, _value] call FUNC(setParameter); diff --git a/addons/common/functions/fnc_readSettingFromModule.sqf b/addons/common/functions/fnc_readSettingFromModule.sqf new file mode 100644 index 0000000000..0f3ab447b1 --- /dev/null +++ b/addons/common/functions/fnc_readSettingFromModule.sqf @@ -0,0 +1,27 @@ +/* + * Author: CAA-Picard + * + * Reads a setting value from a module, set it and force it. Logs if the setting is missing from the module. + * Must be called on the server, effect is global. + * + * Arguments: + * 0: Module (Object) + * 1: ACE_Parameter name (string) + * 2: Module parameter name (string) + * + * Return Value: + * None + */ +#include "script_component.hpp" + +if !(isServer) exitWith {}; + +EXPLODE_3_PVT(_this,_logic,_settingName,_moduleVariable); + +// Check if the parameter is defined in the module +if (isNil {_logic getVariable _moduleVariable}) exitWith { + diag_log text format["[ACE]: Warning in %1 module: %2 setting is missing. Probably an obsolete version of the module is used in the mission.", typeOf _logic, _moduleVariable]; +}; + +// Set the setting globally and force it +[_settingName, _logic getVariable _moduleVariable, true, true] call FUNC(setSetting); From 74d0ae95ff45c6ac672390df26448e455348bb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 02:53:02 -0300 Subject: [PATCH 031/113] Change ACE_Settings from modules --- addons/explosives/functions/fnc_module.sqf | 4 ++-- .../functions/fnc_moduleInteraction.sqf | 2 +- .../functions/fnc_blueForceTrackingModule.sqf | 4 ++-- .../functions/fnc_moduleBasicRevive.sqf | 6 ++--- .../nametags/functions/fnc_moduleNameTags.sqf | 6 ++--- addons/respawn/functions/fnc_module.sqf | 12 +++++----- addons/switchunits/functions/fnc_module.sqf | 22 +++++++++---------- .../vehiclelock/functions/fnc_moduleInit.sqf | 2 +- .../functions/fnc_initalizeModule.sqf | 2 +- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/addons/explosives/functions/fnc_module.sqf b/addons/explosives/functions/fnc_module.sqf index 415b537266..4784b7684e 100644 --- a/addons/explosives/functions/fnc_module.sqf +++ b/addons/explosives/functions/fnc_module.sqf @@ -22,7 +22,7 @@ _activated = _this select 2; if !(_activated) exitWith {}; -[_logic, QGVAR(RequireSpecialist), "RequireSpecialist" ] call EFUNC(Common,readBooleanParameterFromModule); -[_logic, QGVAR(PunishNonSpecialists), "PunishNonSpecialists" ] call EFUNC(Common,readBooleanParameterFromModule); +[_logic, QGVAR(RequireSpecialist), "RequireSpecialist" ] call EFUNC(Common,readSettingFromModule); +[_logic, QGVAR(PunishNonSpecialists), "PunishNonSpecialists" ] call EFUNC(Common,readSettingFromModule); diag_log text "[ACE]: Explosive Module Initialized."; diff --git a/addons/interaction/functions/fnc_moduleInteraction.sqf b/addons/interaction/functions/fnc_moduleInteraction.sqf index 78fd6e2acc..37b7bacba5 100644 --- a/addons/interaction/functions/fnc_moduleInteraction.sqf +++ b/addons/interaction/functions/fnc_moduleInteraction.sqf @@ -16,6 +16,6 @@ _activated = _this select 2; if !(_activated) exitWith {}; -[_logic, QGVAR(EnableTeamManagement), "EnableTeamManagement"] call EFUNC(common,readBooleanParameterFromModule); +[_logic, QGVAR(EnableTeamManagement), "EnableTeamManagement"] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: Interaction Module Initialized."; diff --git a/addons/map/functions/fnc_blueForceTrackingModule.sqf b/addons/map/functions/fnc_blueForceTrackingModule.sqf index 3951473026..cecfd348d2 100644 --- a/addons/map/functions/fnc_blueForceTrackingModule.sqf +++ b/addons/map/functions/fnc_blueForceTrackingModule.sqf @@ -21,8 +21,8 @@ _activated = _this select 2; if !(_activated) exitWith {}; GVAR(BFT_Enabled) = true; -[_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readNumericParameterFromModule); -[_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readBooleanParameterFromModule); +[_logic, QGVAR(BFT_Interval), "Interval"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: Blue Force Tracking Module initialized."; TRACE_2("[ACE]: Blue Force Tracking Module initialized.",GVAR(BFT_Interval), GVAR(BFT_HideAiGroups)); diff --git a/addons/medical/functions/fnc_moduleBasicRevive.sqf b/addons/medical/functions/fnc_moduleBasicRevive.sqf index 6d8bfa2e6c..b02d873313 100644 --- a/addons/medical/functions/fnc_moduleBasicRevive.sqf +++ b/addons/medical/functions/fnc_moduleBasicRevive.sqf @@ -15,9 +15,9 @@ _logic = _this select 0; GVAR(Module) = true; -[_logic, QGVAR(ENABLE_REVIVE_F), "enableFor" ] call EFUNC(common,readNumericParameterFromModule); -[_logic, QGVAR(REVIVE_TIMER_MAX_F), "timer" ] call EFUNC(common,readNumericParameterFromModule); -[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readNumericParameterFromModule); +[_logic, QGVAR(ENABLE_REVIVE_F), "enableFor" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(REVIVE_TIMER_MAX_F), "timer" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readSettingFromModule); [ {(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0)} diff --git a/addons/nametags/functions/fnc_moduleNameTags.sqf b/addons/nametags/functions/fnc_moduleNameTags.sqf index b701a2db8c..83087fc4ff 100644 --- a/addons/nametags/functions/fnc_moduleNameTags.sqf +++ b/addons/nametags/functions/fnc_moduleNameTags.sqf @@ -22,8 +22,8 @@ if !(_activated) exitWith {}; GVAR(Module) = true; -[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readNumericParameterFromModule); -[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(CrewInfoVisibility), "Visibility" ] call EFUNC(common,readNumericParameterFromModule); +[_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(CrewInfoVisibility), "Visibility" ] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: NameTags Module Initialized."; diff --git a/addons/respawn/functions/fnc_module.sqf b/addons/respawn/functions/fnc_module.sqf index 0a996d0acc..5ba52fd40e 100644 --- a/addons/respawn/functions/fnc_module.sqf +++ b/addons/respawn/functions/fnc_module.sqf @@ -1,17 +1,17 @@ /* Name: ACE_Respawn_fnc_module - + Author(s): KoffeinFlummi, bux578, CAA-Picard, commy2 - + Description: initializes the respawn module - + Parameters: 0: OBJECT - logic 1: ARRAY - synced units 2: BOOLEAN - activated - + Returns: VOID */ @@ -27,8 +27,8 @@ if !(_activated) exitWith {}; GVAR(Module) = true; -[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readBooleanParameterFromModule); +[_logic, QGVAR(SavePreDeathGear), "SavePreDeathGear"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(RemoveDeadBodiesDisconnected), "RemoveDeadBodiesDisconnected"] call EFUNC(common,readSettingFromModule); if (isServer) then { if (GVAR(RemoveDeadBodiesDisconnected)) then { diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index c4f5c378c2..9a50e5c435 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -1,17 +1,17 @@ /* Name: ACE_SwitchUnits_fnc_module - + Author(s): bux578 - + Description: Initializes the SwitchUnits module - + Parameters: 0: OBJECT - module logic 1: ARRAY - list of affected units 2: BOOLEAN - isActivated - + Returns: BOOLEAN (Good practice to include one) */ @@ -29,12 +29,12 @@ GVAR(Module) = true; [QGVAR(EnableSwitchUnits), true] call EFUNC(common,setParameter); -[_logic, QGVAR(SwitchToWest), "SwitchToWest"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(SwitchToEast), "SwitchToEast"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(SwitchToIndependent), "SwitchToIndependent"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(SwitchToCivilian), "SwitchToCivilian"] call EFUNC(common,readBooleanParameterFromModule); - -[_logic, QGVAR(EnableSafeZone), "EnableSafeZone"] call EFUNC(common,readBooleanParameterFromModule); -[_logic, QGVAR(SafeZoneRadius), "SafeZoneRadius"] call EFUNC(common,readNumericParameterFromModule); +[_logic, QGVAR(SwitchToWest), "SwitchToWest"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(SwitchToEast), "SwitchToEast"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(SwitchToIndependent), "SwitchToIndependent"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(SwitchToCivilian), "SwitchToCivilian"] call EFUNC(common,readSettingFromModule); + +[_logic, QGVAR(EnableSafeZone), "EnableSafeZone"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(SafeZoneRadius), "SafeZoneRadius"] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: SwitchUnits Module Initialized."; diff --git a/addons/vehiclelock/functions/fnc_moduleInit.sqf b/addons/vehiclelock/functions/fnc_moduleInit.sqf index b0ae230724..a344185ab0 100644 --- a/addons/vehiclelock/functions/fnc_moduleInit.sqf +++ b/addons/vehiclelock/functions/fnc_moduleInit.sqf @@ -29,7 +29,7 @@ _sideKeysAssignment = _logic getVariable["SideKeysAssignment", 0]; _setLockState = _logic getVariable["SetLockState", 0]; if (isServer) then { - [_logic, QGVAR(DefaultLockpickStrength), "LockpickStrength"] call EFUNC(common,readNumericParameterFromModule); + [_logic, QGVAR(DefaultLockpickStrength), "LockpickStrength"] call EFUNC(common,readSettingFromModule); }; //Run at mission start (anyone besides JIPs) diff --git a/addons/winddeflection/functions/fnc_initalizeModule.sqf b/addons/winddeflection/functions/fnc_initalizeModule.sqf index d0b9937a58..8bd2a2f1bc 100644 --- a/addons/winddeflection/functions/fnc_initalizeModule.sqf +++ b/addons/winddeflection/functions/fnc_initalizeModule.sqf @@ -15,5 +15,5 @@ if (!hasInterface) exitwith {}; // No need for this module on HC or dedicated se private ["_logic"]; _logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; if (!isNull _logic) then { - [_logic, QGVAR(EnableForAI), "forAI" ] call EFUNC(common,readBooleanParameterFromModule); + [_logic, QGVAR(EnableForAI), "forAI" ] call EFUNC(common,readSettingFromModule); }; \ No newline at end of file From 4156143ecfd5f5c8aa6f983838052a4ee3a76455 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 3 Feb 2015 00:42:34 -0600 Subject: [PATCH 032/113] Captives Progress --- addons/captives/CfgEventHandlers.hpp | 2 +- addons/captives/CfgVehicles.hpp | 46 +++++++++---------- addons/captives/XEH_preInit.sqf | 3 +- addons/captives/config.cpp | 3 ++ .../captives/functions/fnc_handleGetOut.sqf | 11 +++-- addons/captives/functions/fnc_loadCaptive.sqf | 6 +-- .../captives/functions/fnc_unloadCaptive.sqf | 10 ++-- .../captives/functions/script_component.hpp | 2 +- 8 files changed, 45 insertions(+), 38 deletions(-) diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index eb08f7e865..b8c182d1f6 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -23,7 +23,7 @@ class Extended_GetIn_EventHandlers { class Extended_GetOut_EventHandlers { class All { class GVAR(AutoDetachCaptive) { - getOut = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isCaptive', false]}) then {_this call ACE_Captives_fnc_handleGetOut}"; + getOut = QUOTE(_this call FUNC(handleGetOut)); }; }; }; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 3036ccf196..8758788b2a 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -5,62 +5,62 @@ class CfgVehicles { class ACE_SetCaptive { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = "'ACE_CableTie' in items _player && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}"; - statement = "player removeItem 'ACE_CableTie'; [_target, true] call ACE_Captives_fnc_setCaptive"; + condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}); + statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_2(_target, true)] call FUNC(setCaptive);); showDisabled = 0; priority = 2.4; - icon = "\ACE_Captives\UI\handcuff_ca.paa"; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); hotkey = "C"; }; class ACE_ReleaseCaptive { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = "_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}"; - statement = "[_target, false] call ACE_Captives_fnc_setCaptive"; + condition = QUOTE(_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}); + statement = QUOTE([ARR_2(_target, false)] call FUNC(setCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; - icon = "\ACE_Captives\UI\handcuff_ca.paa"; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); hotkey = "R"; }; class ACE_EscortCaptive { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; - condition = "_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}"; - statement = "[_target, true] call ACE_Captives_fnc_escortCaptive"; + condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}); + statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; - icon = "\ACE_Captives\UI\captive_ca.paa"; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; hotkey = "E"; }; class ACE_StopEscorting { displayName = "$STR_ACE_Captives_StopEscorting"; distance = 4; - condition = "_target getVariable ['ACE_isCaptive', false] && {_target in attachedObjects _player}"; - statement = "[_target, false] call ACE_Captives_fnc_escortCaptive"; + condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {_target in (attachedObjects _player)}); + statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; - icon = "\ACE_Captives\UI\captive_ca.paa"; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; hotkey = "E"; }; class ACE_LoadCaptive { displayName = "$STR_ACE_Captives_LoadCaptive"; distance = 4; - condition = "[_player, _target, objNull] call ACE_Captives_fnc_canLoadCaptive"; - statement = "[_player, _target, objNull] call ACE_Captives_fnc_loadCaptive"; + condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); + statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; - icon = "\ACE_Captives\UI\captive_ca.paa"; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.2; hotkey = "L"; }; class ACE_FriskPerson { displayName = "$STR_ACE_Captives_FriskPerson"; distance = 2; - condition = "[_player, _target] call ACE_Captives_fnc_canFriskPerson"; - statement = "[_player, _target] call ACE_Captives_fnc_openFriskMenu"; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(openFriskMenu)); showDisabled = 0; //icon = ""; //@todo priority = 3; @@ -71,8 +71,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_StopEscortingSelf { displayName = "$STR_ACE_Captives_StopEscorting"; - condition = "(_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false] && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}"; - statement = "[_player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;"; + condition = QUOTE(((_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}); + statement = QUOTE([ARR_2((_player getVariable ['ACE_escortedUnit', objNull]), false)] call FUNC(_escortCaptive);); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.3; @@ -95,8 +95,8 @@ class CfgVehicles { class ACE_LoadCaptive { \ displayName = "$STR_ACE_Captives_LoadCaptive"; \ distance = 4; \ - condition = "[_player, objNull, _target] call ACE_Captives_fnc_canLoadCaptive"; \ - statement = "[_player, objNull, _target] call ACE_Captives_fnc_loadCaptive"; \ + condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ + statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ showDisabled = 0; \ priority = 1.2; \ @@ -105,8 +105,8 @@ class CfgVehicles { class ACE_UnloadCaptive { \ displayName = "$STR_ACE_Captives_UnloadCaptive"; \ distance = 4; \ - condition = "[_player, _target] call ACE_Captives_fnc_canUnloadCaptive"; \ - statement = "[_player, _target] call ACE_Captives_fnc_unloadCaptive"; \ + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ + statement = QUOTE([ARR_2(_player, _target)] call FUNC(unloadCaptive)); \ showDisabled = 0; \ priority = 1.2; \ hotkey = "C"; \ diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 5e6f35bc48..7f83ce4fad 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -1,8 +1,7 @@ #include "script_component.hpp" ADDON = false; - -PREP(empty); + PREP(canFriskPerson); PREP(canLoadCaptive); PREP(canUnloadCaptive); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 7aaa310183..7e5c3382bb 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -13,6 +13,9 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgMoves.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" class ACE_Core_canInteractConditions { diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 7cc1fd6f5c..f734fa0177 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -1,9 +1,10 @@ /* * Author: commy2 - * X + * Handles when a captive unit gets out of a vehicle. * * Arguments: * 0: _vehicle + * 2: dunno * 1: _unit * * Return Value: @@ -16,14 +17,18 @@ */ #include "script_component.hpp" -PARAMS_2(_vehicle,_unit); +PARAMS_3(_vehicle,_dontcare,_unit); + +if (!local _unit) exitWith {}; +if (!(_unit getVariable ["ACE_isCaptive", false])) exitWith {}; private ["_cargoIndex"]; _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; +//If captive was not "unloaded", then move them back into the vehicle. if (_cargoIndex != -1) exitWith { _unit moveInCargo [_vehicle, _cargoIndex]; }; -[_unit, 'ACE_AmovPercMstpScapWnonDnon', 2] call EFUNC(common,doAnimation); +[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf index 255581a593..f2b1a9a0c1 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -20,9 +20,9 @@ PARAMS_1(_unit,_target,_vehicle); if (isNull _target) then { - _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); - _target = _objects select 0; + // _objects = attachedObjects _unit; + // _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + // _target = _objects select 0; }; if (isNull _vehicle) then { diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_unloadCaptive.sqf index 01e1d48e74..e6eb4b24a5 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_unloadCaptive.sqf @@ -25,11 +25,11 @@ _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turr _cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); if (count _cargo > 0) then { - _target = _cargo select 0; + _target = _cargo select 0; - _target setVariable ["ACE_Captives_CargoIndex", -1, true]; + _target setVariable ["ACE_Captives_CargoIndex", -1, true]; - moveOut _target; - [_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); - [_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc; + moveOut _target; + [_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); + [_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc; }; diff --git a/addons/captives/functions/script_component.hpp b/addons/captives/functions/script_component.hpp index 3cc9111162..e91d5c843b 100644 --- a/addons/captives/functions/script_component.hpp +++ b/addons/captives/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\blank\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\captives\script_component.hpp" \ No newline at end of file From b119d5246b502746f63ca782b19feab29439c8cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 15:46:33 -0300 Subject: [PATCH 033/113] fix in setsettings --- addons/common/functions/fnc_setSetting.sqf | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index ec83cd8c31..5b6f7945b5 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -36,13 +36,22 @@ if (count _settingData == 0) exitWith {}; if (_settingData select 6) exitWith {}; // If the type is not equal, try to cast it +_failed = false; if ((typeName _value) != (_settingData select 1)) then { - _failed = True; - if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") exitWith { - _value = _value > 0; - _failed = false; + _failed = true; + diag_log (typeName _value); + if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") then { + // If value is not 0 or 1 consider it invalid and don't set anything + if (_value == 0) then { + _value = false; + _failed = false; + }; + if (_value == 1) then { + _value = true; + _failed = false; + }; }; - if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") exitWith { + if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") then { _failed = false; }; }; From 146e87f02e0db3d8993c41b02f05dc204b418cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 15:47:17 -0300 Subject: [PATCH 034/113] nametags: slightly changed module options to use the new ACE_Settings --- addons/nametags/CfgVehicles.hpp | 50 ++++++++++--------- addons/nametags/config.cpp | 18 +++---- addons/nametags/functions/fnc_canShow.sqf | 15 ++---- .../nametags/functions/fnc_moduleNameTags.sqf | 2 +- addons/nametags/stringtable.xml | 7 +-- 5 files changed, 44 insertions(+), 48 deletions(-) diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index 444622f0ed..e3c4227834 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -15,40 +15,44 @@ class CfgVehicles { typeName = "NUMBER"; defaultValue = 5; }; - class ShowNamesForAI { + class showNamesForAI { displayName = "Show name tags for AI?"; - description = "Show the name and rank tags for friendly AI units? Default: No"; - typeName = "BOOL"; - class values { - class Yes { - name = "Yes"; - value = 1; - }; - class No { - default = 1; - name = "No"; - value = 0; - }; - }; - }; - class Visibility { - displayName = "Visibility of crew info"; - description = "Forces visibility of vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force"; - typeName = "INT"; + description = "Show the name and rank tags for friendly AI units? Default: Do not force"; + typeName = "NUMBER"; class values { class DoNotForce { default = 1; name = "Do Not Force"; + value = -1; + }; + class ForceHide { + name = "Force Hide"; + value = 0; + }; + class ForceShow { + name = "Force show"; + value = 1; + }; + }; + }; + class showVehicleCrewInfo { + displayName = "Show crew info?"; + description = "Show vehicle crew info, or by default allows players to choose it on their own. Default: Do Not Force"; + typeName = "NUMBER"; + class values { + class DoNotForce { + default = 1; + name = "Do Not Force"; + value = -1; + }; + class ForceHide { + name = "Force Hide"; value = 0; }; class ForceShow { name = "Force Show"; value = 1; }; - class ForceHide { - name = "Force Hide"; - value = -1; - }; }; }; }; diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp index 58440192c0..aa55dd2aad 100644 --- a/addons/nametags/config.cpp +++ b/addons/nametags/config.cpp @@ -33,7 +33,13 @@ class ACE_Settings { value = 1; typeName = "BOOL"; isClientSetable = 1; - displayName = "$STR_ACE_CrewInfo_ShowVehicleCrewInfo"; + displayName = "$STR_ACE_NameTags_ShowVehicleCrewInfo"; + }; + class GVAR(showNamesForAI) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_NameTags_ShowNamesForAI"; }; class GVAR(PlayerNamesViewDistance) { @@ -46,16 +52,6 @@ class ACE_Settings { typeName = "SCALAR"; isClientSetable = 0; }; - class GVAR(CrewInfoVisibility) { - value = 0; - typeName = "BOOL"; - isClientSetable = 0; - }; - class GVAR(ShowNamesForAI) { - value = 0; - typeName = "BOOL"; - isClientSetable = 0; - }; }; #include diff --git a/addons/nametags/functions/fnc_canShow.sqf b/addons/nametags/functions/fnc_canShow.sqf index 8b61352def..0e187fee0f 100644 --- a/addons/nametags/functions/fnc_canShow.sqf +++ b/addons/nametags/functions/fnc_canShow.sqf @@ -1,12 +1,12 @@ /* Author: aeroson - + Description: Might be called several times a second - - Parameters: + + Parameters: None - + Returns: true if CrewInfo can be shown, false otherwise */ @@ -17,11 +17,6 @@ private["_player"]; _player = ACE_player; -// AGM_NameTags_ShowVehicleCrewInfo: -1 force NO, 0 doesnt care, 1 force YES - vehicle _player != _player && -{ - (GVAR(CrewInfoVisibility) == 1) || - (GVAR(CrewInfoVisibility) != -1 && GVAR(showVehicleCrewInfo)) -} && +{GVAR(ShowCrewInfo)} && {!(vehicle _player isKindOf "ParachuteBase")}; diff --git a/addons/nametags/functions/fnc_moduleNameTags.sqf b/addons/nametags/functions/fnc_moduleNameTags.sqf index 83087fc4ff..24b30e5d6b 100644 --- a/addons/nametags/functions/fnc_moduleNameTags.sqf +++ b/addons/nametags/functions/fnc_moduleNameTags.sqf @@ -24,6 +24,6 @@ GVAR(Module) = true; [_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(CrewInfoVisibility), "Visibility" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(showVehicleCrewInfo), "showVehicleCrewInfo" ] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: NameTags Module Initialized."; diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index 7d085b9d44..9cd99adaef 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -58,9 +58,7 @@ Játékosok rendfokozatának mutatása (névcímke szükséges) Показать звания игроков (требует имен игроков) - - - + Show vehicle crew info Zeige Fahrzeugbesatzung Mostrar tripulantes @@ -68,5 +66,8 @@ Zobrazit info o posádce vozidla Показать экипаж + + Show name tags for AI units + From 903c41308c5023662036b7181117091cd48dc7db Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 3 Feb 2015 20:33:15 +0100 Subject: [PATCH 035/113] works in singleplayer --- addons/switchunits/XEH_clientInit.sqf | 2 -- addons/switchunits/functions/fnc_initPlayer.sqf | 3 ++- addons/switchunits/functions/fnc_markAiOnMap.sqf | 3 ++- addons/switchunits/functions/fnc_switchUnit.sqf | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/switchunits/XEH_clientInit.sqf b/addons/switchunits/XEH_clientInit.sqf index cf6873c14b..dbc239d119 100644 --- a/addons/switchunits/XEH_clientInit.sqf +++ b/addons/switchunits/XEH_clientInit.sqf @@ -25,8 +25,6 @@ if(GVAR(SwitchToEast)) then {_sides pushBack east}; if(GVAR(SwitchToIndependent)) then {_sides pushBack independent}; if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian}; -hint "TEST"; - if (player getVariable ["ACE_CanSwitchUnits", false]) then { [player, _sides] call FUNC(initPlayer); }; diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index f904a460c2..c4e2d19747 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -30,7 +30,8 @@ if (vehicle _playerUnit == _playerUnit) then { _playerUnit allowDamage false; GVAR(OriginalUnit) = _playerUnit; - GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); + //GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); + GVAR(OriginalName) = name _playerUnit; GVAR(OriginalGroup) = group _playerUnit; // remove all starting gear of a player diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index c07199dc31..ce7b575398 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -27,6 +27,7 @@ DFUNC(pfhMarkAiOnMap) = { _args = _this select 0; _sides = _args select 0; + // delete markers { deleteMarkerLocal _x; @@ -65,4 +66,4 @@ DFUNC(pfhMarkAiOnMap) = { }; }; -[FUNC(pfhMarkAiOnMap), 1, _sidesToShow] call CBA_fnc_addPerFrameHandler; +[FUNC(pfhMarkAiOnMap), 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index d5a4f39a4a..abd053ffae 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -52,7 +52,6 @@ if (_leave) exitWith { _oldUnit = player; - DFUNC(pfhSwitchUnit) = { private ["_args", "_unit", "_oldUnit", "_respawnEhId", "_oldOwner"]; @@ -61,6 +60,8 @@ DFUNC(pfhSwitchUnit) = { _unit = _args select 0; _oldUnit = _args select 1; + + if (local _unit) exitWith { _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; @@ -94,4 +95,4 @@ DFUNC(pfhSwitchUnit) = { }; }; -[FUNC(pfhSwitchBack), 0.2, [_unit, _oldUnit]] call cba_fnc_addPerFrameHandler; +[FUNC(pfhSwitchUnit), 0.2, [_unit, _oldUnit]] call cba_fnc_addPerFrameHandler; From 5f44af2341442b8b0aa85574bf2ebf83042d5c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 16:47:23 -0300 Subject: [PATCH 036/113] Missing prep --- addons/common/XEH_preInit.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index b2f5ef209d..90a774ddfe 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -87,6 +87,7 @@ PREP(isInBuilding); PREP(isPlayer); PREP(isTurnedOut); PREP(letterToCode); +PREP(loadSettingsFromProfile); PREP(loadSettingsOnServer); PREP(map); PREP(moduleCheckPBOs); From e57a135750f455638350ea0336505e258d4020fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 16:49:40 -0300 Subject: [PATCH 037/113] Missing prep --- addons/common/XEH_preInit.sqf | 1 + addons/common/functions/fnc_loadSettingsFromProfile.sqf | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index b2f5ef209d..90a774ddfe 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -87,6 +87,7 @@ PREP(isInBuilding); PREP(isPlayer); PREP(isTurnedOut); PREP(letterToCode); +PREP(loadSettingsFromProfile); PREP(loadSettingsOnServer); PREP(map); PREP(moduleCheckPBOs); diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf index 9d077359ce..1e8e9001aa 100644 --- a/addons/common/functions/fnc_loadSettingsFromProfile.sqf +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -25,7 +25,7 @@ if !(_isForced) then { _profileValue = profileNamespace getvariable _name; // If the setting is stored on the profile - if !(isNil _profileValue) then { + if !(isNil "_profileValue") then { // If the profile variable has the correct type if (typeName _profileValue == typeName (missionNamespace getvariable _name)) then { // Load the setting from the profile From d65a740b7ad85a45d5093981279008499925cb80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 17:47:25 -0300 Subject: [PATCH 038/113] WindDeflection using ace_settings --- addons/winddeflection/CfgEventHandlers.hpp | 6 --- addons/winddeflection/CfgVehicles.h | 43 ++++++++----------- addons/winddeflection/XEH_postInit.sqf | 15 ------- addons/winddeflection/config.cpp | 27 +++++++----- .../functions/fnc_initalizeModule.sqf | 2 +- 5 files changed, 36 insertions(+), 57 deletions(-) delete mode 100644 addons/winddeflection/XEH_postInit.sqf diff --git a/addons/winddeflection/CfgEventHandlers.hpp b/addons/winddeflection/CfgEventHandlers.hpp index 6cf7856ba5..4961d7dbc7 100644 --- a/addons/winddeflection/CfgEventHandlers.hpp +++ b/addons/winddeflection/CfgEventHandlers.hpp @@ -4,12 +4,6 @@ class Extended_PreInit_EventHandlers { }; }; -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE( call compile preprocessFileLineNumbers PATHTOF(XEH_postInit.sqf) ); - }; -}; - class Extended_Fired_Eventhandlers { class CaManBase { fired = QUOTE( call FUNC(handleFired) ); diff --git a/addons/winddeflection/CfgVehicles.h b/addons/winddeflection/CfgVehicles.h index fe0e31bda5..e84727b94e 100644 --- a/addons/winddeflection/CfgVehicles.h +++ b/addons/winddeflection/CfgVehicles.h @@ -1,27 +1,20 @@ class CfgVehicles { - - // TODO Stringtable usage - class Logic; - class Module_F: Logic { - class ArgumentsBaseUnits { - }; - }; - class GVAR(Module): Module_F { - scope = 2; - displayName = "Wind Deflection [ACE]"; - icon = QUOTE(PATHTOF(data\module_icon.paa)); - category = "ACE"; - function = FUNC(enableModule); - functionPriority = 1; - isGlobal = 1; - isTriggerActivated = 0; - class Arguments { - class forAI { - displayName = "Enable for AI"; - description = "Should the module be enabled for AI"; - typeName = "BOOL"; - defaultValue = 0; - }; - }; - }; + class Module_F; + class GVAR(Module): Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "Wind Deflection"; + function = FUNC(enableModule); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(data\module_icon.paa)); + class Arguments { + class EnableForAI { + displayName = "Enable for AI"; + description = "Should the module be enabled for AI"; + typeName = "BOOL"; + defaultValue = 0; + }; + }; + }; }; diff --git a/addons/winddeflection/XEH_postInit.sqf b/addons/winddeflection/XEH_postInit.sqf deleted file mode 100644 index 9c3a4bc41f..0000000000 --- a/addons/winddeflection/XEH_postInit.sqf +++ /dev/null @@ -1,15 +0,0 @@ -/** - * XEH_postInit.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -if (isnil QGVAR(EnableForAI)) then { - GVAR(EnableForAI) = false; -}; diff --git a/addons/winddeflection/config.cpp b/addons/winddeflection/config.cpp index 6e1bdbc379..f71ef251cd 100644 --- a/addons/winddeflection/config.cpp +++ b/addons/winddeflection/config.cpp @@ -1,16 +1,16 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ACE_common", "ACE_weather"}; - versionDesc = "ACE Wind Deflection"; - version = VERSION; - author[] = {$STR_ACE_Core_ACETeam, "Glowbal", "Ruthberg"}; - authorUrl = "http://csemod.com"; - }; + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ACE_common", "ACE_weather"}; + versionDesc = "ACE Wind Deflection"; + version = VERSION; + author[] = {$STR_ACE_Core_ACETeam, "Glowbal", "Ruthberg"}; + authorUrl = "http://csemod.com"; + }; }; class CfgAddons { @@ -21,4 +21,11 @@ class CfgAddons { }; }; +class ACE_Settings { + class GVAR(EnableForAI) { + value = 0; + typeName = "BOOL"; + isClientSetable = 0; + }; +}; #include "CfgVehicles.h" \ No newline at end of file diff --git a/addons/winddeflection/functions/fnc_initalizeModule.sqf b/addons/winddeflection/functions/fnc_initalizeModule.sqf index 8bd2a2f1bc..2833ecc54c 100644 --- a/addons/winddeflection/functions/fnc_initalizeModule.sqf +++ b/addons/winddeflection/functions/fnc_initalizeModule.sqf @@ -15,5 +15,5 @@ if (!hasInterface) exitwith {}; // No need for this module on HC or dedicated se private ["_logic"]; _logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; if (!isNull _logic) then { - [_logic, QGVAR(EnableForAI), "forAI" ] call EFUNC(common,readSettingFromModule); + [_logic, QGVAR(EnableForAI), "EnableForAI" ] call EFUNC(common,readSettingFromModule); }; \ No newline at end of file From 509bfefff10d0547df6a6c64afc094c96aa1bb73 Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 3 Feb 2015 21:47:48 +0100 Subject: [PATCH 039/113] fixed SwitchUnits needed to wait in initPlayer --- addons/switchunits/XEH_clientInit.sqf | 29 +++++++++----- .../switchunits/functions/fnc_initPlayer.sqf | 38 +++++++++---------- .../switchunits/functions/fnc_markAiOnMap.sqf | 6 ++- addons/switchunits/functions/fnc_module.sqf | 4 +- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/addons/switchunits/XEH_clientInit.sqf b/addons/switchunits/XEH_clientInit.sqf index dbc239d119..3075d67941 100644 --- a/addons/switchunits/XEH_clientInit.sqf +++ b/addons/switchunits/XEH_clientInit.sqf @@ -16,15 +16,24 @@ #include "script_component.hpp" -private "_sides"; +DFUNC(pfhClientInit) = { + + if (GVAR(EnableSwitchUnits)) exitWith { + + private ["_sides"]; + _sides = []; + + if(GVAR(SwitchToWest)) then {_sides pushBack west;}; + if(GVAR(SwitchToEast)) then {_sides pushBack east;}; + if(GVAR(SwitchToIndependent)) then {_sides pushBack independent;}; + if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian;}; -_sides = []; - -if(GVAR(SwitchToWest)) then {_sides pushBack west}; -if(GVAR(SwitchToEast)) then {_sides pushBack east}; -if(GVAR(SwitchToIndependent)) then {_sides pushBack independent}; -if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian}; - -if (player getVariable ["ACE_CanSwitchUnits", false]) then { - [player, _sides] call FUNC(initPlayer); + if (player getVariable ["ACE_CanSwitchUnits", false]) then { + [player, _sides] call FUNC(initPlayer); + }; + + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; }; + +[FUNC(pfhClientInit), 0.5, []] call cba_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index c4e2d19747..9c71f8cefc 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -24,28 +24,28 @@ _sides = _this select 1; if (vehicle _playerUnit == _playerUnit) then { - [_sides] call FUNC(markAiOnMap); + [_sides] call FUNC(markAiOnMap); - _playerUnit setVariable [QGVAR(IsPlayerUnit), true]; - _playerUnit allowDamage false; + _playerUnit setVariable [QGVAR(IsPlayerUnit), true]; + _playerUnit allowDamage false; - GVAR(OriginalUnit) = _playerUnit; - //GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); - GVAR(OriginalName) = name _playerUnit; - GVAR(OriginalGroup) = group _playerUnit; + GVAR(OriginalUnit) = _playerUnit; + //GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); + GVAR(OriginalName) = name _playerUnit; + GVAR(OriginalGroup) = group _playerUnit; - // remove all starting gear of a player - removeAllWeapons _playerUnit; - removeGoggles _playerUnit; - removeHeadgear _playerUnit; - removeVest _playerUnit; - removeAllAssignedItems _playerUnit; - clearAllItemsFromBackpack _playerUnit; - removeBackpack _playerUnit; - _playerUnit linkItem "ItemMap"; - removeUniform _playerUnit; + // remove all starting gear of a player + removeAllWeapons _playerUnit; + removeGoggles _playerUnit; + removeHeadgear _playerUnit; + removeVest _playerUnit; + removeAllAssignedItems _playerUnit; + clearAllItemsFromBackpack _playerUnit; + removeBackpack _playerUnit; + _playerUnit linkItem "ItemMap"; + removeUniform _playerUnit; - [_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus); + [_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus); - [_playerUnit, _sides] call FUNC(addMapFunction); + [_playerUnit, _sides] call FUNC(addMapFunction); }; diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index ce7b575398..ed94c31b0b 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -10,7 +10,7 @@ * None * * Example: - * [west, east] call FUNC(markAiOnMap) + * [[west, east]] call FUNC(markAiOnMap) * * Public: No */ @@ -34,11 +34,13 @@ DFUNC(pfhMarkAiOnMap) = { } forEach GVAR(AllMarkerNames); if (alive ACE_player && {GVAR(OriginalUnit) getVariable ["ACE_CanSwitchUnits", false]}) then { - + // create markers { if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then { private ["_markerName", "_marker", "_markerColor"]; + + hint format ["marker. %1", time]; //_markerName = format ["%1", [_x] call EFUNC(common,getName)]; _markerName = str _x; diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index 9444cb5f61..0a06f737a5 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -27,8 +27,6 @@ if !(_activated) exitWith {}; GVAR(Module) = true; -[QGVAR(EnableSwitchUnits), true] call EFUNC(common,setParameter); - [_logic, QGVAR(SwitchToWest), "SwitchToWest"] call EFUNC(common,readBooleanParameterFromModule); [_logic, QGVAR(SwitchToEast), "SwitchToEast"] call EFUNC(common,readBooleanParameterFromModule); [_logic, QGVAR(SwitchToIndependent), "SwitchToIndependent"] call EFUNC(common,readBooleanParameterFromModule); @@ -37,4 +35,6 @@ GVAR(Module) = true; [_logic, QGVAR(EnableSafeZone), "EnableSafeZone"] call EFUNC(common,readBooleanParameterFromModule); [_logic, QGVAR(SafeZoneRadius), "SafeZoneRadius"] call EFUNC(common,readNumericParameterFromModule); +[QGVAR(EnableSwitchUnits), true] call EFUNC(common,setParameter); + diag_log text "[ACE]: SwitchUnits Module Initialized."; From 47d5befd120f16b8282f8853e0ea14a2730b2f4c Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 3 Feb 2015 23:03:43 +0100 Subject: [PATCH 040/113] fcs per turrets --- addons/fcs/CfgAmmo.hpp | 32 ++ addons/fcs/CfgMagazines.hpp | 34 ++ addons/fcs/CfgOptics.hpp | 13 +- addons/fcs/CfgVehicles.hpp | 516 +++++++++++++++++++++++ addons/fcs/CfgWeapons.hpp | 24 ++ addons/fcs/XEH_clientInit.sqf | 74 +--- addons/fcs/config.cpp | 330 +-------------- addons/fcs/functions/fnc_adjustRange.sqf | 4 +- addons/fcs/functions/fnc_canResetFCS.sqf | 2 +- addons/fcs/functions/fnc_canUseFCS.sqf | 2 +- addons/fcs/functions/fnc_keyUp.sqf | 34 +- addons/fcs/functions/fnc_reset.sqf | 2 +- addons/fcs/functions/fnc_vehicleInit.sqf | 36 +- addons/fcs/initKeybinds.sqf | 73 ++++ 14 files changed, 746 insertions(+), 430 deletions(-) create mode 100644 addons/fcs/CfgAmmo.hpp create mode 100644 addons/fcs/CfgMagazines.hpp create mode 100644 addons/fcs/CfgVehicles.hpp create mode 100644 addons/fcs/CfgWeapons.hpp create mode 100644 addons/fcs/initKeybinds.sqf diff --git a/addons/fcs/CfgAmmo.hpp b/addons/fcs/CfgAmmo.hpp new file mode 100644 index 0000000000..25d02399d5 --- /dev/null +++ b/addons/fcs/CfgAmmo.hpp @@ -0,0 +1,32 @@ + +class CfgAmmo { + class B_35mm_AA; + class ACE_B_35mm_ABM: B_35mm_AA { + GVAR(Airburst) = 1; + deflecting = 0; + }; + + class B_35mm_AA_Tracer_Red; + class ACE_B_35mm_ABM_Tracer_Red: B_35mm_AA_Tracer_Red { + GVAR(Airburst) = 1; + deflecting = 0; + }; + + class B_35mm_AA_Tracer_Green; + class ACE_B_35mm_ABM_Tracer_Green: B_35mm_AA_Tracer_Green { + GVAR(Airburst) = 1; + deflecting = 0; + }; + + class B_35mm_AA_Tracer_Yellow; + class ACE_B_35mm_ABM_Tracer_Yellow: B_35mm_AA_Tracer_Yellow { + GVAR(Airburst) = 1; + deflecting = 0; + }; + + class ACE_B_35mm_ABM_Helper: B_35mm_AA { + indirectHitRange = 6; + simulation = "shotRocket"; + timeToLive = 0; + }; +}; diff --git a/addons/fcs/CfgMagazines.hpp b/addons/fcs/CfgMagazines.hpp new file mode 100644 index 0000000000..dc48e21411 --- /dev/null +++ b/addons/fcs/CfgMagazines.hpp @@ -0,0 +1,34 @@ + +class CfgMagazines { + class 680Rnd_35mm_AA_shells; + class ACE_120Rnd_35mm_ABM_shells: 680Rnd_35mm_AA_shells { + ammo = "ACE_B_35mm_ABM"; + count = 120; + displayName = "35mm ABM Shells"; + displayNameShort = "35mm ABM"; + }; + + class 680Rnd_35mm_AA_shells_Tracer_Red; + class ACE_120Rnd_35mm_ABM_shells_Tracer_Red: 680Rnd_35mm_AA_shells_Tracer_Red { + ammo = "ACE_B_35mm_ABM_Tracer_Red"; + count = 120; + displayName = "35mm ABM Shells"; + displayNameShort = "35mm ABM-T"; + }; + + class 680Rnd_35mm_AA_shells_Tracer_Green; + class ACE_120Rnd_35mm_ABM_shells_Tracer_Green: 680Rnd_35mm_AA_shells_Tracer_Green { + ammo = "ACE_B_35mm_ABM_Tracer_Green"; + count = 120; + displayName = "35mm ABM Shells"; + displayNameShort = "35mm ABM-T"; + }; + + class 680Rnd_35mm_AA_shells_Tracer_Yellow; + class ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow: 680Rnd_35mm_AA_shells_Tracer_Yellow { + ammo = "ACE_B_35mm_ABM_Tracer_Yellow"; + count = 120; + displayName = "35mm ABM Shells"; + displayNameShort = "35mm ABM-T"; + }; +}; diff --git a/addons/fcs/CfgOptics.hpp b/addons/fcs/CfgOptics.hpp index 01b997b0ee..3c17e760f0 100644 --- a/addons/fcs/CfgOptics.hpp +++ b/addons/fcs/CfgOptics.hpp @@ -1,3 +1,4 @@ + #define MACRO_RANGEFINDER \ class CA_Distance; \ class ACE_CA_Distance: CA_Distance { \ @@ -17,12 +18,12 @@ class RscInGameUI { class RscUnitInfo; class RscUnitInfo_AH64D_gunner { onLoad = ""; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinder { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; @@ -56,17 +57,17 @@ class RscInGameUI { }; class RscWeaponRangeFinderAbramsCom { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinderAbramsGun { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscWeaponRangeFinderStrykerMGSGun { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0];"; - controls[] = {"CA_Distance", "ACE_CA_Distance"}; + controls[] = {"CA_Distance","ACE_CA_Distance"}; MACRO_RANGEFINDER }; class RscOptics_crows: RscUnitInfo { @@ -88,7 +89,7 @@ class RscInGameUI { class RscWeaponRangeZeroing: RscUnitInfo { onLoad = "uiNamespace setVariable ['ACE_dlgRangefinder', _this select 0]; ((_this select 0) displayCtrl 151) ctrlSetTextColor [0, 0, 0, 0]; [""onLoad"",_this,""RscUnitInfo"",'IGUI'] call compile preprocessfilelinenumbers ""A3\ui_f\scripts\initDisplay.sqf"""; - controls[] = {"CA_Zeroing", "CA_DistanceText", "CA_Distance", "ACE_CA_Distance", "ACE_Rangehelper"}; + controls[] = {"CA_Zeroing", "CA_DistanceText", "CA_Distance","ACE_CA_Distance", "ACE_Rangehelper"}; MACRO_RANGEFINDER }; class RscOptics_sos: RscUnitInfo { diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp new file mode 100644 index 0000000000..10e1f0797d --- /dev/null +++ b/addons/fcs/CfgVehicles.hpp @@ -0,0 +1,516 @@ + +class CfgVehicles { + class All { + class Turrets; + }; + + class AllVehicles: All { + class NewTurret { + GVAR(Enabled) = 0; + GVAR(MinDistance) = 200; + GVAR(MaxDistance) = 9990; + GVAR(DistanceInterval) = 5; + class Turrets; + }; + class CargoTurret; + }; + + // LAND VEHICLES + class Land: AllVehicles {}; + + class LandVehicle: Land { + class CommanderOptics; + }; + + class Car: LandVehicle { + class ACE_SelfActions { + class ResetFCS { + displayName = $STR_ACE_FCS_ResetFCS; + enableInside = 1; + condition = QUOTE(call FUNC(canResetFCS)); + statement = QUOTE([vehicle _player] call FUNC(reset);); + showDisabled = 0; + priority = 1; + icon = ""; + }; + }; + }; + + class Tank: LandVehicle { + class ACE_SelfActions { + class ResetFCS { + displayName = $STR_ACE_FCS_ResetFCS; + enableInside = 1; + condition = QUOTE(call FUNC(canResetFCS)); + statement = QUOTE([vehicle _player] call FUNC(reset);); + showDisabled = 0; + priority = 1; + icon = ""; + }; + }; + class Turrets { + class MainTurret: NewTurret { + GVAR(Enabled) = 1; // all tracked vehicles get one by default + class Turrets { + class CommanderOptics; + }; + }; + }; + }; + + class Tank_F: Tank { + class Turrets { + class MainTurret: NewTurret { + GVAR(Enabled) = 1; // all tracked vehicles get one by default + class Turrets { + class CommanderOptics;//: CommanderOptics {}; + }; + }; + }; + }; + + class Car_F: Car { + class Turrets { + class MainTurret; + }; + }; + + class Wheeled_APC_F: Car_F { + class Turrets { + class MainTurret: NewTurret { + class Turrets { + class CommanderOptics;//: CommanderOptics {}; + }; + }; + }; + }; + + class MRAP_01_base_F: Car_F {}; + + class MRAP_01_gmg_base_F: MRAP_01_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class B_MRAP_01_F: MRAP_01_base_F { + class Turrets; + }; + + class MRAP_02_base_F: Car_F {}; + + class MRAP_02_hmg_base_F: MRAP_02_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class MRAP_02_gmg_base_F: MRAP_02_hmg_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class O_MRAP_02_F: MRAP_02_base_F { + class Turrets; + }; + + class MRAP_03_base_F: Car_F { + /*class Turrets: Turrets { + class CommanderTurret: MainTurret {}; + };*/ + }; + + class MRAP_03_hmg_base_F: MRAP_03_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + class CommanderTurret: CommanderTurret {}; + };*/ + }; + + class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + class CommanderTurret: CommanderTurret {}; + };*/ + }; + + class Offroad_01_base_F: Car_F {}; + + class Offroad_01_armed_base_F: Offroad_01_base_F { + /*class Turrets: Turrets { + class M2_Turret: MainTurret {}; + };*/ + }; + + class APC_Wheeled_01_base_F: Wheeled_APC_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + }; + }; + };*/ + }; + + class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F {}; + + class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + + class APC_Wheeled_02_base_F: Wheeled_APC_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets; + }; + + class CommanderOptics: CommanderOptics {}; + };*/ + }; + + class APC_Wheeled_03_base_F: Wheeled_APC_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class I_APC_Wheeled_03_base_F: APC_Wheeled_03_base_F {}; + + class I_APC_Wheeled_03_cannon_F: I_APC_Wheeled_03_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class APC_Tracked_01_base_F: Tank_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets; + }; + };*/ + }; + + class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; + }; + class CommanderOptics: CommanderOptics {}; + }; + }; + + class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { + //GVAR(Enabled) = 0; @todo + }; + + class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + magazines[] += {"ACE_120Rnd_35mm_ABM_shells_Tracer_Red"}; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class APC_Tracked_02_base_F: Tank_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + }; + }; + };*/ + }; + + class O_APC_Tracked_02_base_F: APC_Tracked_02_base_F {}; + + class O_APC_Tracked_02_cannon_F: O_APC_Tracked_02_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class O_APC_Tracked_02_AA_F: O_APC_Tracked_02_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + magazines[] += {"ACE_120Rnd_35mm_ABM_shells_Tracer_Green"}; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class APC_Tracked_03_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class MBT_01_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class B_MBT_01_base_F: MBT_01_base_F {}; + + class B_MBT_01_cannon_F: B_MBT_01_base_F {}; + + class MBT_01_arty_base_F: MBT_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class MBT_01_mlrs_base_F: MBT_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; + //class Turrets; + }; + }; + }; + + class MBT_02_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class MBT_02_arty_base_F: MBT_02_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class MBT_03_base_F: Tank_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + /*class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + };*/ + }; + }; + }; + + class B_MBT_01_TUSK_F: B_MBT_01_cannon_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + }; + }; + }; + }; + }; + + // SHIPS + /*class Ship: AllVehicles { + class Turrets { + class MainTurret; + }; + }; + + class Ship_F: Ship {}; + + class Boat_F: Ship_F {}; + + class Boat_Armed_01_base_F: Boat_F { + class Turrets: Turrets { + class FrontTurret; + class RearTurret: FrontTurret {}; + }; + };*/ + + /*class Boat_Armed_01_minigun_base_F: Boat_Armed_01_base_F { + class Turrets: Turrets { + class FrontTurret: FrontTurret {}; + class RearTurret: RearTurret {}; + }; + };*/ + + // AIR VEHICLES + class Air: AllVehicles {}; + + class Helicopter: Air { + class Turrets { + class MainTurret; + }; + }; + + class Plane: Air {}; + + class Helicopter_Base_F: Helicopter { + class Turrets: Turrets { + class CopilotTurret; + }; + }; + + class Helicopter_Base_H: Helicopter_Base_F { + class Turrets: Turrets { + class CopilotTurret; + }; + }; + + class Heli_Light_01_base_F: Helicopter_Base_H { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class B_Heli_Light_01_F: Heli_Light_01_base_F { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class Heli_Light_01_armed_base_F: Heli_Light_01_base_F { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class Heli_Light_02_base_F: Helicopter_Base_H { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class Plane_Base_F: Plane { + class Turrets { + class CopilotTurret; + }; + }; + + class Heli_Attack_01_base_F: Helicopter_Base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + + class Heli_Attack_02_base_F: Helicopter_Base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + + class Heli_Transport_01_base_F: Helicopter_Base_H { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + class MainTurret: MainTurret {}; + class RightDoorGun: MainTurret {}; + };*/ + }; + + class Heli_Transport_02_base_F: Helicopter_Base_H { + /*class Turrets: Turrets { + class CopilotTurret: CopilotTurret {}; + };*/ + }; + + class I_Heli_light_03_base_F: Helicopter_Base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class I_Heli_light_03_F: I_Heli_light_03_base_F { + /*class Turrets: Turrets { + class MainTurret: MainTurret {}; + };*/ + }; + + class Plane_CAS_01_base_F: Plane_Base_F { + class Turrets; + }; + + class Plane_CAS_02_base_F: Plane_Base_F { + class Turrets; + }; + + class Plane_Fighter_03_base_F: Plane_Base_F { + class Turrets; + }; +}; diff --git a/addons/fcs/CfgWeapons.hpp b/addons/fcs/CfgWeapons.hpp new file mode 100644 index 0000000000..ec72bc6f44 --- /dev/null +++ b/addons/fcs/CfgWeapons.hpp @@ -0,0 +1,24 @@ + +class CfgWeapons { + // disable locking, so it doesn't interfere with our system + class CannonCore; + class cannon_120mm: CannonCore { + canLock = 0; + ballisticsComputer = 0; + }; + class autocannon_Base_F: CannonCore { + canLock = 0; + ballisticsComputer = 0; + }; + class autocannon_35mm: CannonCore { + canLock = 0; + ballisticsComputer = 0; + magazines[] += {"ACE_120Rnd_35mm_ABM_shells","ACE_120Rnd_35mm_ABM_shells_Tracer_Red","ACE_120Rnd_35mm_ABM_shells_Tracer_Green","ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow"}; + }; + + // fix mrco having an invisible rangefinder + class ItemCore; + class optic_MRCO: ItemCore { + weaponInfoType = "RscWeaponZeroing"; + }; +}; diff --git a/addons/fcs/XEH_clientInit.sqf b/addons/fcs/XEH_clientInit.sqf index 66720ae44a..918548e71e 100644 --- a/addons/fcs/XEH_clientInit.sqf +++ b/addons/fcs/XEH_clientInit.sqf @@ -4,76 +4,4 @@ GVAR(enabled) = True; GVAR(time) = 0; GVAR(position) = [0,0,0]; -// Add keybinds -["ACE3", - localize "STR_ACE_FCS_LaseTarget", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(!GVAR(enabled) && {call FUNC(canUseRangefinder) || FUNC(canUseFCS)}) exitWith {false}; - - // Statement - [vehicle ACE_player] call FUNC(keyDown); - // Return false so it doesn't block the rest weapon action - false - }, - [15, [false, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_FCS_LaseTarget", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false}; - - // Statement - [vehicle ACE_player] call FUNC(keyUp); - false - }, - [15, [false, false, false]], - false, - "keyup" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_FCS_AdjustRangeUp", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; - - // Statement - [vehicle ACE_player, 50] call FUNC(adjustRange); - true - }, - [201, [false, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_FCS_AdjustRangeDown", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; - - // Statement - [vehicle ACE_player, -50] call FUNC(adjustRange); - true - }, - [209, [false, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; +#include "initKeybinds.sqf" diff --git a/addons/fcs/config.cpp b/addons/fcs/config.cpp index e1e8ac8901..3c7303d68b 100644 --- a/addons/fcs/config.cpp +++ b/addons/fcs/config.cpp @@ -14,329 +14,9 @@ class CfgPatches { #include "CfgEventHandlers.hpp" -class CfgVehicles { - class All { - class Turrets; - }; +#include "CfgAmmo.hpp" +#include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" - class AllVehicles: All { - GVAR(Enabled) = 0; - GVAR(MinDistance) = 200; - GVAR(MaxDistance) = 9990; - GVAR(DistanceInterval) = 5; - class NewTurret { - class Turrets; - }; - class CargoTurret; - }; - - class Land: AllVehicles {}; - - class LandVehicle: Land { - class CommanderOptics; - }; - - // WHEELED - class Car: LandVehicle { - class ACE_SelfActions { - class ResetFCS { - displayName = $STR_ACE_FCS_ResetFCS; - enableInside = 1; - condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([vehicle _player] call FUNC(reset);); - showDisabled = 0; - priority = 1; - icon = ""; - }; - }; - }; - - class Car_F: Car { - class Turrets { - class MainTurret; - }; - }; - - class Wheeled_APC_F: Car_F { - class Turrets { - class MainTurret: NewTurret { - class Turrets { - class CommanderOptics; - }; - }; - }; - }; - - class APC_Wheeled_01_base_F: Wheeled_APC_F {}; - class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F {}; - class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F { - GVAR(Enabled) = 1; - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - class APC_Wheeled_03_base_F: Wheeled_APC_F { - GVAR(Enabled) = 1; - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - // TRACKED - class Tank: LandVehicle { - GVAR(Enabled) = 1; // all tracked vehicles get one by default - class ACE_SelfActions { - class ResetFCS { - displayName = $STR_ACE_FCS_ResetFCS; - enableInside = 1; - condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([vehicle _player] call FUNC(reset);); - showDisabled = 0; - priority = 1; - icon = ""; - }; - }; - class Turrets { - class MainTurret: NewTurret { - class Turrets { - class CommanderOptics; - }; - }; - }; - }; - - class Tank_F: Tank { - class Turrets { - class MainTurret: NewTurret { - class Turrets { - class CommanderOptics; - }; - }; - }; - }; - - class MBT_01_base_F: Tank_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - class B_MBT_01_base_F: MBT_01_base_F {}; - class B_MBT_01_cannon_F: B_MBT_01_base_F {}; - class B_MBT_01_TUSK_F: B_MBT_01_cannon_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - class MBT_01_arty_base_F: MBT_01_base_F { - GVAR(Enabled) = 0; - }; - class MBT_01_mlrs_base_F: MBT_01_base_F { - GVAR(Enabled) = 0; - }; - - class MBT_02_base_F: Tank_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - class MBT_02_arty_base_F: MBT_02_base_F { - GVAR(Enabled) = 0; - }; - - class MBT_03_base_F: Tank_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - class APC_Tracked_01_base_F: Tank_F {}; - class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {}; - class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F { - GVAR(Enabled) = 0; - }; - class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { - GVAR(Enabled) = 0; - }; - class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - magazines[] += {"ACE_120Rnd_35mm_ABM_shells_Tracer_Red"}; - }; - }; - }; - - class APC_Tracked_02_base_F: Tank_F {}; - class O_APC_Tracked_02_base_F: APC_Tracked_02_base_F {}; - class O_APC_Tracked_02_AA_F: O_APC_Tracked_02_base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - magazines[] += {"ACE_120Rnd_35mm_ABM_shells_Tracer_Green"}; - }; - }; - }; - - class APC_Tracked_03_base_F: Tank_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - // HELICOPTERS - class Air: AllVehicles {}; - - class Helicopter: Air { - class ACE_SelfActions { - class ResetFCS { - displayName = $STR_ACE_FCS_ResetFCS; - enableInside = 1; - condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([vehicle _player] call FUNC(reset);); - showDisabled = 0; - priority = 1; - icon = ""; - }; - }; - class Turrets { - class MainTurret; - }; - }; - - class Helicopter_Base_F: Helicopter { - class Turrets: Turrets { - class CopilotTurret; - }; - }; - - class Heli_Attack_01_base_F: Helicopter_Base_F { - GVAR(Enabled) = 1; - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - - class Heli_Attack_02_base_F: Helicopter_Base_F { - GVAR(Enabled) = 1; - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; -}; - -class CfgWeapons { - // disable locking, so it doesn't interfere with our system - class CannonCore; - class cannon_120mm: CannonCore { - canLock = 0; - ballisticsComputer = 0; - }; - class autocannon_Base_F: CannonCore { - canLock = 0; - ballisticsComputer = 0; - }; - class autocannon_35mm: CannonCore { - canLock = 0; - ballisticsComputer = 0; - magazines[] += {"ACE_120Rnd_35mm_ABM_shells","ACE_120Rnd_35mm_ABM_shells_Tracer_Red","ACE_120Rnd_35mm_ABM_shells_Tracer_Green","ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow"}; - }; - - // fix mrco having an invisible rangefinder - class ItemCore; - class optic_MRCO: ItemCore { - weaponInfoType = "RscWeaponZeroing"; - }; -}; - -class CfgMagazines { - class 680Rnd_35mm_AA_shells; - class 680Rnd_35mm_AA_shells_Tracer_Red; - class 680Rnd_35mm_AA_shells_Tracer_Green; - class 680Rnd_35mm_AA_shells_Tracer_Yellow; - - class ACE_120Rnd_35mm_ABM_shells: 680Rnd_35mm_AA_shells { - ammo = "ACE_B_35mm_ABM"; - count = 120; - displayName = "35mm ABM Shells"; - displayNameShort = "35mm ABM"; - }; - class ACE_120Rnd_35mm_ABM_shells_Tracer_Red: 680Rnd_35mm_AA_shells_Tracer_Red { - ammo = "ACE_B_35mm_ABM_Tracer_Red"; - count = 120; - displayName = "35mm ABM Shells"; - displayNameShort = "35mm ABM-T"; - }; - class ACE_120Rnd_35mm_ABM_shells_Tracer_Green: 680Rnd_35mm_AA_shells_Tracer_Green { - ammo = "ACE_B_35mm_ABM_Tracer_Green"; - count = 120; - displayName = "35mm ABM Shells"; - displayNameShort = "35mm ABM-T"; - }; - class ACE_120Rnd_35mm_ABM_shells_Tracer_Yellow: 680Rnd_35mm_AA_shells_Tracer_Yellow { - ammo = "ACE_B_35mm_ABM_Tracer_Yellow"; - count = 120; - displayName = "35mm ABM Shells"; - displayNameShort = "35mm ABM-T"; - }; -}; - -class CfgAmmo { - class B_35mm_AA; - class B_35mm_AA_Tracer_Red; - class B_35mm_AA_Tracer_Green; - class B_35mm_AA_Tracer_Yellow; - - class ACE_B_35mm_ABM: B_35mm_AA { - GVAR(Airburst) = 1; - deflecting = 0; - }; - class ACE_B_35mm_ABM_Tracer_Red: B_35mm_AA_Tracer_Red { - GVAR(Airburst) = 1; - deflecting = 0; - }; - class ACE_B_35mm_ABM_Tracer_Green: B_35mm_AA_Tracer_Green { - GVAR(Airburst) = 1; - deflecting = 0; - }; - class ACE_B_35mm_ABM_Tracer_Yellow: B_35mm_AA_Tracer_Yellow { - GVAR(Airburst) = 1; - deflecting = 0; - }; - - class ACE_B_35mm_ABM_Helper: B_35mm_AA { - indirectHitRange = 6; - simulation = "shotRocket"; - timeToLive = 0; - }; -}; - -#include +#include "CfgOptics.hpp" diff --git a/addons/fcs/functions/fnc_adjustRange.sqf b/addons/fcs/functions/fnc_adjustRange.sqf index 1620c53375..165ac63a11 100644 --- a/addons/fcs/functions/fnc_adjustRange.sqf +++ b/addons/fcs/functions/fnc_adjustRange.sqf @@ -18,8 +18,8 @@ private ["_vehicle", "_delta", "_min", "_max", "_distance"]; _vehicle = _this select 0; _delta = _this select 1; -_min = getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> QGVAR(MinDistance)); -_max = getNumber (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> QGVAR(MaxDistance)); +_min = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance)); +_max = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance)); _distance = _vehicle getVariable [QGVAR(Distance), _min]; _distance = _distance + _delta; diff --git a/addons/fcs/functions/fnc_canResetFCS.sqf b/addons/fcs/functions/fnc_canResetFCS.sqf index 8760503cdb..8ace62a0ef 100644 --- a/addons/fcs/functions/fnc_canResetFCS.sqf +++ b/addons/fcs/functions/fnc_canResetFCS.sqf @@ -13,4 +13,4 @@ #include "script_component.hpp" ACE_player == gunner vehicle ACE_player -&& (count ((vehicle ACE_player) getVariable [QGVAR(Magazines), []]) > 1) +&& {count ((vehicle ACE_player) getVariable [QGVAR(Magazines), []]) > 1} diff --git a/addons/fcs/functions/fnc_canUseFCS.sqf b/addons/fcs/functions/fnc_canUseFCS.sqf index ef4a3f2814..a80d9599dd 100644 --- a/addons/fcs/functions/fnc_canUseFCS.sqf +++ b/addons/fcs/functions/fnc_canUseFCS.sqf @@ -13,5 +13,5 @@ #include "script_component.hpp" ACE_player == gunner vehicle ACE_player -&& {getNumber (configFile >> "CfgVehicles" >> typeOf (vehicle ACE_player) >> QGVAR(Enabled)) == 1} +&& {getNumber (configFile >> "CfgVehicles" >> typeOf vehicle ACE_player >> QGVAR(Enabled)) == 1} && {cameraView == "GUNNER"} diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index c95460e65b..31ba7ba01b 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -12,7 +12,7 @@ #include "script_component.hpp" -private ["_ammoType", "_viewDiff", "_posArrival", "_airFriction", "_timeToLive", "_maxElev", "_vehicle", "_posTarget", "_distance", "_simulationStep", "_posX", "_velocityMagnitude", "_magazines", "_movingAzimuth", "_FCSElevation", "_velocityX", "_velocityY", "_weaponDirection", "_velocityTarget", "_FCSAzimuth", "_FCSMagazines", "_dirArrival", "_i", "_magazineType", "_angleTarget", "_offset", "_timeToTarget", "_initSpeed"]; +private ["_vehicle", "_distance", "_magazines"]; _vehicle = _this select 0; _distance = call FUNC(getRange); @@ -21,12 +21,14 @@ _magazines = magazines _vehicle; if (_distance == 0) then { _distance = [ - getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(DistanceInterval)), + getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(DistanceInterval)), // @todo turret getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance)), getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance)) ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision }; +private ["_weaponDirection", "_angleTarget"]; + _weaponDirection = _vehicle weaponDirection currentWeapon _vehicle; _angleTarget = asin (_weaponDirection select 2); @@ -38,6 +40,8 @@ if (!(isNil QGVAR(backgroundCalculation)) and {!(scriptDone GVAR(backgroundCalcu terminate GVAR(backgroundCalculation); }; +private "_movingAzimuth"; + // MOVING TARGETS _movingAzimuth = 0; if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { @@ -53,8 +57,10 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { ((_posTarget select 2) - (GVAR(position) select 2)) / (time - GVAR(time)) ]; + private ["_magazineType", "_ammoType", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep"]; + // estimate time to target - _magazineType = currentMagazine _vehicle; + _magazineType = currentMagazine _vehicle; // @todo turret magazine _ammoType = getText (configFile >> "CfgMagazines" >> _magazineType >> "ammo"); _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazineType >> "initSpeed"); _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); @@ -62,10 +68,13 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { _simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "simulationStep"); if (_simulationStep != 0) then { + private ["_posX", "_velocityX", "_velocityY", "_timeToTarget"]; + _posX = 0; _velocityX = _initSpeed; _velocityY = 0; _timeToTarget = 0; + for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do { _posX = _posX + _velocityX * _simulationStep; if (_posX >= _distance) exitWith { // bullet passed the target @@ -76,12 +85,15 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { _velocityY = _velocityY + _velocityY * _velocityMagnitude * _airFriction * _simulationStep - 9.81 * _simulationStep; }; + private ["_posArrival", "_dirArrival"]; + // calculate offsets _posArrival = [ (_posTarget select 0) + (_velocityTarget select 0) * _timeToTarget, (_posTarget select 1) + (_velocityTarget select 1) * _timeToTarget, (_posTarget select 2) + (_velocityTarget select 2) * _timeToTarget ]; + _dirArrival = [ ((_posArrival select 0) - (getPos _vehicle select 0)) / (_posArrival distance (getPos _vehicle)), ((_posArrival select 1) - (getPos _vehicle select 1)) / (_posArrival distance (getPos _vehicle)), @@ -96,9 +108,12 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { GVAR(enabled) = false; GVAR(time) = -1; +private ["_viewDiff", "_FCSAzimuth", "_FCSMagazines", "_FCSElevation"]; + // CALCULATE AZIMUTH CORRECTION _viewDiff = _vehicle getVariable QGVAR(ViewDiff); _FCSAzimuth = _movingAzimuth; + if (_viewDiff != 0) then { _FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth; }; @@ -108,11 +123,16 @@ _FCSMagazines = []; _FCSElevation = []; { - _ammoType = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); + private "_ammoType"; + + _ammoType = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); + if !(getText (configFile >> "CfgAmmo" >> _ammoType >> "simulation") == "shotMissile") then { - _maxElev = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret" >> "maxElev"); - _initSpeed = getNumber (configFile >> "CfgMagazines" >> _x >> "initSpeed"); - _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); + private ["_maxElev", "_initSpeed", "_airFriction", "_offset"]; + + _maxElev = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret" >> "maxElev"); // @todo turret + _initSpeed = getNumber (configFile >> "CfgMagazines" >> _x >> "initSpeed"); + _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance]; _offset = parseNumber _offset; diff --git a/addons/fcs/functions/fnc_reset.sqf b/addons/fcs/functions/fnc_reset.sqf index f49c4c9589..9001a31c48 100644 --- a/addons/fcs/functions/fnc_reset.sqf +++ b/addons/fcs/functions/fnc_reset.sqf @@ -12,7 +12,7 @@ #include "script_component.hpp" -private ["_vehicle"]; +private "_vehicle"; _vehicle = _this select 0; diff --git a/addons/fcs/functions/fnc_vehicleInit.sqf b/addons/fcs/functions/fnc_vehicleInit.sqf index 5872b1757f..95f3d3f01b 100644 --- a/addons/fcs/functions/fnc_vehicleInit.sqf +++ b/addons/fcs/functions/fnc_vehicleInit.sqf @@ -12,25 +12,33 @@ #include "script_component.hpp" -private ["_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; +private "_vehicle"; -if (getNumber (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> QGVAR(Enabled)) == 1) then { - (_this select 0) addEventHandler ["Fired", {_this call FUNC(firedEH)}]; +_vehicle = _this select 0; - (_this select 0) setVariable [QGVAR(Distance), 0, true]; - (_this select 0) setVariable [QGVAR(Magazines), [], true]; - (_this select 0) setVariable [QGVAR(Elevation), [], true]; - (_this select 0) setVariable [QGVAR(Azimuth), 0, true]; +if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(Enabled)) == 1) then { // @todo for all turrets + _vehicle addEventHandler ["Fired", {_this call FUNC(firedEH)}]; + + _vehicle setVariable [QGVAR(Distance), 0, true]; + _vehicle setVariable [QGVAR(Magazines), [], true]; + _vehicle setVariable [QGVAR(Elevation), [], true]; + _vehicle setVariable [QGVAR(Azimuth), 0, true]; // calculate offset between gunner camera and muzzle position - if !((_this select 0) isKindOf "Air") then { - _gunBeg = getText (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> "Turrets" >> "MainTurret" >> "gunBeg"); - _gunnerView = getText (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> "Turrets" >> "MainTurret" >> "memoryPointGunnerOptics"); - _gunBegPos = ((_this select 0) selectionPosition _gunBeg) select 0; - _gunnerViewPos = ((_this select 0) selectionPosition _gunnerView) select 0; + if !(_vehicle isKindOf "Air") then { + private ["_turretConfig", "_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; + + _turretConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret"; + + _gunBeg = getText (_turretConfig >> "gunBeg"); // @todo player turret path + _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); // @todo player turret path + + _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0; + _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0; _viewDiff = _gunBegPos - _gunnerViewPos; - (_this select 0) setVariable [QGVAR(ViewDiff), _viewDiff, true]; + + _vehicle setVariable [QGVAR(ViewDiff), _viewDiff, true]; } else { - (_this select 0) setVariable [QGVAR(ViewDiff), 0, true]; + _vehicle setVariable [QGVAR(ViewDiff), 0, true]; }; }; diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf new file mode 100644 index 0000000000..c47669c1ab --- /dev/null +++ b/addons/fcs/initKeybinds.sqf @@ -0,0 +1,73 @@ + +["ACE3", + localize "STR_ACE_FCS_LaseTarget", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(!GVAR(enabled) && {call FUNC(canUseRangefinder) || FUNC(canUseFCS)}) exitWith {false}; + + // Statement + [vehicle ACE_player] call FUNC(keyDown); + // Return false so it doesn't block the rest weapon action + false + }, + [15, [false, false, false]], + false, + "keydown" +] call cba_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_FCS_LaseTarget", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false}; + + // Statement + [vehicle ACE_player] call FUNC(keyUp); + false + }, + [15, [false, false, false]], + false, + "keyup" +] call cba_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_FCS_AdjustRangeUp", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; + + // Statement + [vehicle ACE_player, 50] call FUNC(adjustRange); + true + }, + [201, [false, false, false]], + false, + "keydown" +] call cba_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_FCS_AdjustRangeDown", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; + + // Statement + [vehicle ACE_player, -50] call FUNC(adjustRange); + true + }, + [209, [false, false, false]], + false, + "keydown" +] call cba_fnc_registerKeybind; From 49f0b79962b37bf554bba6d56c150387d4f755bb Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 4 Feb 2015 03:20:55 +0100 Subject: [PATCH 041/113] fcs for turrets --- addons/common/XEH_preInit.sqf | 1 + addons/common/functions/fnc_getGunner.sqf | 28 ++++++++++++++++ addons/fcs/CfgVehicles.hpp | 4 +-- addons/fcs/functions/fnc_adjustRange.sqf | 15 +++++---- addons/fcs/functions/fnc_canResetFCS.sqf | 3 +- addons/fcs/functions/fnc_canUseFCS.sqf | 3 +- addons/fcs/functions/fnc_firedEH.sqf | 36 ++++++++++++-------- addons/fcs/functions/fnc_keyDown.sqf | 6 ++-- addons/fcs/functions/fnc_keyUp.sqf | 26 ++++++++------- addons/fcs/functions/fnc_vehicleInit.sqf | 40 ++++++++++++----------- addons/fcs/initKeybinds.sqf | 8 ++--- 11 files changed, 108 insertions(+), 62 deletions(-) create mode 100644 addons/common/functions/fnc_getGunner.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 1bd305fa02..37ff2bab6c 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -48,6 +48,7 @@ PREP(getConfigGunner); PREP(getDefaultAnim); PREP(getDoorTurrets); PREP(getForceWalkStatus); +PREP(getGunner); PREP(getHitPoints); PREP(getHitPointsWithSelections); PREP(getInPosition); diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf new file mode 100644 index 0000000000..2510c2ddc4 --- /dev/null +++ b/addons/common/functions/fnc_getGunner.sqf @@ -0,0 +1,28 @@ +/* + * Author: commy2 + * + * Get the gunner of a vehicle who uses the given weapon type. Requires every turret to have a different weapons. + * + * Argument: + * 0: The vehicle (Object) + * 1: weapon of the vehicle (String) + * + * Return value: + * The turret gunner with this weapon (Object) + */ + +private ["_vehicle", "_weapon"]; + +_vehicle = _this select 0; +_weapon = _this select 1; + +private "_gunner"; +_gunner = objNull; + +{ + if (_weapon in (_vehicle weaponsTurret _x)) exitWith { + _gunner = _vehicle turretUnit _x; + }; +} forEach allTurrets _vehicle; + +_gunner diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp index 10e1f0797d..1e8e309b55 100644 --- a/addons/fcs/CfgVehicles.hpp +++ b/addons/fcs/CfgVehicles.hpp @@ -28,7 +28,7 @@ class CfgVehicles { displayName = $STR_ACE_FCS_ResetFCS; enableInside = 1; condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([vehicle _player] call FUNC(reset);); + statement = QUOTE([ARR_2(_vehicle,[_player] call DEFUNC(common,getTurretIndex))] call FUNC(reset);); showDisabled = 0; priority = 1; icon = ""; @@ -42,7 +42,7 @@ class CfgVehicles { displayName = $STR_ACE_FCS_ResetFCS; enableInside = 1; condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([vehicle _player] call FUNC(reset);); + statement = QUOTE([ARR_2(_vehicle,[_player] call DEFUNC(common,getTurretIndex))] call FUNC(reset);); showDisabled = 0; priority = 1; icon = ""; diff --git a/addons/fcs/functions/fnc_adjustRange.sqf b/addons/fcs/functions/fnc_adjustRange.sqf index 165ac63a11..4b7f4b6b88 100644 --- a/addons/fcs/functions/fnc_adjustRange.sqf +++ b/addons/fcs/functions/fnc_adjustRange.sqf @@ -13,17 +13,20 @@ #include "script_component.hpp" -private ["_vehicle", "_delta", "_min", "_max", "_distance"]; +private ["_vehicle", "_turret", "_delta", "_turretConfig", "_min", "_max", "_distance"]; _vehicle = _this select 0; -_delta = _this select 1; +_turret = _this select 1; +_delta = _this select 2; -_min = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance)); -_max = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance)); -_distance = _vehicle getVariable [QGVAR(Distance), _min]; +_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); + +_min = getNumber (_turretConfig >> QGVAR(MinDistance)); +_max = getNumber (_turretConfig >> QGVAR(MaxDistance)); +_distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min]; _distance = _distance + _delta; _distance = _distance min _max; _distance = _distance max _min; -[_vehicle, 0, _distance] call FUNC(keyUp); +[_vehicle, _turret, _distance] call FUNC(keyUp); diff --git a/addons/fcs/functions/fnc_canResetFCS.sqf b/addons/fcs/functions/fnc_canResetFCS.sqf index 8ace62a0ef..81876b301b 100644 --- a/addons/fcs/functions/fnc_canResetFCS.sqf +++ b/addons/fcs/functions/fnc_canResetFCS.sqf @@ -12,5 +12,4 @@ #include "script_component.hpp" -ACE_player == gunner vehicle ACE_player -&& {count ((vehicle ACE_player) getVariable [QGVAR(Magazines), []]) > 1} +count ((vehicle ACE_player) getVariable [format ["%1_%2", QGVAR(Magazines), [vehicle ACE_player] call EFUNC(common,getTurretIndex)], []]) > 1 diff --git a/addons/fcs/functions/fnc_canUseFCS.sqf b/addons/fcs/functions/fnc_canUseFCS.sqf index a80d9599dd..854dcf5cec 100644 --- a/addons/fcs/functions/fnc_canUseFCS.sqf +++ b/addons/fcs/functions/fnc_canUseFCS.sqf @@ -12,6 +12,5 @@ #include "script_component.hpp" -ACE_player == gunner vehicle ACE_player -&& {getNumber (configFile >> "CfgVehicles" >> typeOf vehicle ACE_player >> QGVAR(Enabled)) == 1} +getNumber ([configFile >> "CfgVehicles" >> typeOf _vehicle, [_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1 && {cameraView == "GUNNER"} diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index e6fff694ca..a0b10795cf 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -12,38 +12,46 @@ #include "script_component.hpp" -private ["_unit", "_weaponType", "_ammoType", "_magazineType", "_round", "_FCSMagazines", "_FCSElevation", "_offset"]; +private ["_vehicle", "_weapon", "_ammo", "_magazine", "_projectile"]; -_unit = _this select 0; -_weaponType = _this select 1; -_ammoType = _this select 4; -_magazineType = _this select 5; -_round = _this select 6; +_vehicle = _this select 0; +_weapon = _this select 1; +_ammo = _this select 4; +_magazine = _this select 5; +_projectile = _this select 6; -_FCSMagazines = _unit getVariable QGVAR(Magazines); -_FCSElevation = _unit getVariable QGVAR(Elevation); +private ["_gunner", "_turret"]; -if (ACE_player != gunner _unit) exitWith {}; -if !(_magazineType in _FCSMagazines) exitWith {}; +_gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); +_turret = [_gunner] call EFUNC(common,getTurretIndex); + +if (ACE_player != _gunner) exitWith {}; + +private ["_FCSMagazines", "_FCSElevation", "_offset"]; + +_FCSMagazines = _vehicle getVariable format ["%1_%2", QGVAR(Magazines), _turret]; +_FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; + +if !(_magazine in _FCSMagazines) exitWith {}; // GET ELEVATION OFFSET OF CURRENT MAGAZINE _offset = 0; { - if (_x == _magazineType) exitWith { + if (_x == _magazine) exitWith { _offset = _FCSElevation select _forEachIndex; }; } forEach _FCSMagazines; -[_round, (_unit getVariable QGVAR(Azimuth)), _offset, 0] call EFUNC(common,changeProjectileDirection); +[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection); // Air burst missile // may need to get rewritten -if (getNumber (configFile >> "CfgAmmo" >> _ammoType >> "ACE_Airburst") == 1) then { +if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_Airburst") == 1) then { _this spawn { _vehicle = _this select 0; _projectile = _this select 6; - _distance = _vehicle getVariable [QGVAR(Distance), currentZeroing _vehicle]; + _distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle]; if (_distance < 50) exitWith {}; if (_distance > 1500) exitWith {}; diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index 086a11c03c..4cfcf7c57a 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -12,9 +12,11 @@ #include "script_component.hpp" -private ["_vehicle", "_distance", "_weaponDirection"]; +private ["_vehicle", "_turret", "_distance", "_weaponDirection"]; _vehicle = _this select 0; +_turret = _this select 1; + _distance = call FUNC(getRange); if !(call FUNC(canUseFCS)) exitWith {}; @@ -26,7 +28,7 @@ if (_distance == 0) then { _distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision }; -_weaponDirection = _vehicle weaponDirection currentWeapon _vehicle; +_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); GVAR(Position) = [ (getPos _vehicle select 0) + _distance * (_weaponDirection select 0), diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index 31ba7ba01b..78a622331f 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -12,18 +12,22 @@ #include "script_component.hpp" -private ["_vehicle", "_distance", "_magazines"]; +private ["_vehicle", "_turret", "_turretConfig", "_distance", "_magazines"]; _vehicle = _this select 0; +_turret = _this select 1; + +_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); + _distance = call FUNC(getRange); _magazines = magazines _vehicle; if (_distance == 0) then { _distance = [ - getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(DistanceInterval)), // @todo turret - getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MaxDistance)), - getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(MinDistance)) + getNumber (_turretConfig >> QGVAR(DistanceInterval)), + getNumber (_turretConfig >> QGVAR(MaxDistance)), + getNumber (_turretConfig >> QGVAR(MinDistance)) ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision }; @@ -60,7 +64,7 @@ if (time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { private ["_magazineType", "_ammoType", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep"]; // estimate time to target - _magazineType = currentMagazine _vehicle; // @todo turret magazine + _magazineType = _vehicle currentMagazineTurret _turret; _ammoType = getText (configFile >> "CfgMagazines" >> _magazineType >> "ammo"); _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazineType >> "initSpeed"); _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); @@ -111,7 +115,7 @@ GVAR(time) = -1; private ["_viewDiff", "_FCSAzimuth", "_FCSMagazines", "_FCSElevation"]; // CALCULATE AZIMUTH CORRECTION -_viewDiff = _vehicle getVariable QGVAR(ViewDiff); +_viewDiff = _vehicle getVariable format ["%1_%2", QGVAR(ViewDiff), _turret]; _FCSAzimuth = _movingAzimuth; if (_viewDiff != 0) then { @@ -130,7 +134,7 @@ _FCSElevation = []; if !(getText (configFile >> "CfgAmmo" >> _ammoType >> "simulation") == "shotMissile") then { private ["_maxElev", "_initSpeed", "_airFriction", "_offset"]; - _maxElev = getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret" >> "maxElev"); // @todo turret + _maxElev = getNumber (_turretConfig >> "maxElev"); _initSpeed = getNumber (configFile >> "CfgMagazines" >> _x >> "initSpeed"); _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); @@ -142,9 +146,9 @@ _FCSElevation = []; }; } forEach _magazines; -_vehicle setVariable [QGVAR(Distance), _distance, true]; -_vehicle setVariable [QGVAR(Magazines), _FCSMagazines, true]; -_vehicle setVariable [QGVAR(Elevation), _FCSElevation, true]; -_vehicle setVariable [QGVAR(Azimuth), _FCSAzimuth, true]; +_vehicle setVariable [format ["%1_%2", QGVAR(Distance), _turret], _distance, true]; +_vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines, true]; +_vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation, true]; +_vehicle setVariable [format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth, true]; [format ["%1: %2", localize "STR_ACE_FCS_ZeroedTo", _distance]] call EFUNC(common,displayTextStructured); diff --git a/addons/fcs/functions/fnc_vehicleInit.sqf b/addons/fcs/functions/fnc_vehicleInit.sqf index 95f3d3f01b..29de520f5d 100644 --- a/addons/fcs/functions/fnc_vehicleInit.sqf +++ b/addons/fcs/functions/fnc_vehicleInit.sqf @@ -16,29 +16,31 @@ private "_vehicle"; _vehicle = _this select 0; -if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(Enabled)) == 1) then { // @todo for all turrets - _vehicle addEventHandler ["Fired", {_this call FUNC(firedEH)}]; +{ + if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(Enabled)) == 1) then { // @todo for all turrets + _vehicle addEventHandler ["Fired", {_this call FUNC(firedEH)}]; - _vehicle setVariable [QGVAR(Distance), 0, true]; - _vehicle setVariable [QGVAR(Magazines), [], true]; - _vehicle setVariable [QGVAR(Elevation), [], true]; - _vehicle setVariable [QGVAR(Azimuth), 0, true]; + _vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true]; + _vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _x], [], true]; + _vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _x], [], true]; + _vehicle setVariable [format ["%1_%2", QGVAR(Azimuth), _x], 0, true]; - // calculate offset between gunner camera and muzzle position - if !(_vehicle isKindOf "Air") then { - private ["_turretConfig", "_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; + // calculate offset between gunner camera and muzzle position + if !(_vehicle isKindOf "Air") then { + private ["_turretConfig", "_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; - _turretConfig = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Turrets" >> "MainTurret"; + _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); - _gunBeg = getText (_turretConfig >> "gunBeg"); // @todo player turret path - _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); // @todo player turret path + _gunBeg = getText (_turretConfig >> "gunBeg"); // @todo player turret path + _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); // @todo player turret path - _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0; - _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0; - _viewDiff = _gunBegPos - _gunnerViewPos; + _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0; + _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0; + _viewDiff = _gunBegPos - _gunnerViewPos; - _vehicle setVariable [QGVAR(ViewDiff), _viewDiff, true]; - } else { - _vehicle setVariable [QGVAR(ViewDiff), 0, true]; + _vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], _viewDiff, true]; + } else { + _vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], 0, true]; + }; }; -}; +} forEach allTurrets _vehicle; diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf index c47669c1ab..444891903b 100644 --- a/addons/fcs/initKeybinds.sqf +++ b/addons/fcs/initKeybinds.sqf @@ -9,7 +9,7 @@ if !(!GVAR(enabled) && {call FUNC(canUseRangefinder) || FUNC(canUseFCS)}) exitWith {false}; // Statement - [vehicle ACE_player] call FUNC(keyDown); + [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyDown); // Return false so it doesn't block the rest weapon action false }, @@ -28,7 +28,7 @@ if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false}; // Statement - [vehicle ACE_player] call FUNC(keyUp); + [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyUp); false }, [15, [false, false, false]], @@ -46,7 +46,7 @@ if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; // Statement - [vehicle ACE_player, 50] call FUNC(adjustRange); + [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), 50] call FUNC(adjustRange); true }, [201, [false, false, false]], @@ -64,7 +64,7 @@ if !(call FUNC(canUseRangefinder) || FUNC(canUseFCS)) exitWith {false}; // Statement - [vehicle ACE_player, -50] call FUNC(adjustRange); + [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -50] call FUNC(adjustRange); true }, [209, [false, false, false]], From 4c727fbff593ff126c017ea3e948e2d91736cfd0 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 3 Feb 2015 23:13:44 -0600 Subject: [PATCH 042/113] remoteFncs -> events --- addons/captives/CfgVehicles.hpp | 286 +++++++++--------- addons/captives/XEH_postInitClient.sqf | 6 + addons/captives/functions/fnc_loadCaptive.sqf | 16 +- addons/captives/functions/fnc_setCaptive.sqf | 50 +-- .../captives/functions/fnc_unloadCaptive.sqf | 11 +- .../functions/fnc_vehicleCaptiveMoveIn.sqf | 28 ++ .../functions/fnc_vehicleCaptiveMoveOut.sqf | 24 ++ 7 files changed, 238 insertions(+), 183 deletions(-) create mode 100644 addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf create mode 100644 addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 8758788b2a..dd4f6361d7 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -1,84 +1,84 @@ class CfgVehicles { - class Man; - class CAManBase: Man { - class ACE_Actions { - class ACE_SetCaptive { - displayName = "$STR_ACE_Captives_SetCaptive"; - distance = 4; - condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}); - statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_2(_target, true)] call FUNC(setCaptive);); - showDisabled = 0; - priority = 2.4; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - hotkey = "C"; - }; - class ACE_ReleaseCaptive { - displayName = "$STR_ACE_Captives_ReleaseCaptive"; - distance = 4; - condition = QUOTE(_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(setCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.4; - icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - hotkey = "R"; - }; - class ACE_EscortCaptive { - displayName = "$STR_ACE_Captives_EscortCaptive"; - distance = 4; - condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}); - statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.3; - hotkey = "E"; - }; - class ACE_StopEscorting { - displayName = "$STR_ACE_Captives_StopEscorting"; - distance = 4; - condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {_target in (attachedObjects _player)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.3; - hotkey = "E"; - }; - class ACE_LoadCaptive { - displayName = "$STR_ACE_Captives_LoadCaptive"; - distance = 4; - condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); - statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.2; - hotkey = "L"; - }; - class ACE_FriskPerson { - displayName = "$STR_ACE_Captives_FriskPerson"; - distance = 2; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(openFriskMenu)); - showDisabled = 0; - //icon = ""; //@todo - priority = 3; - hotkey = "F"; - }; - }; + class Man; + class CAManBase: Man { + class ACE_Actions { + class ACE_SetCaptive { + displayName = "$STR_ACE_Captives_SetCaptive"; + distance = 4; + condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}); + statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3(QGVAR(SetCaptive), [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); + showDisabled = 0; + priority = 2.4; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + hotkey = "C"; + }; + class ACE_ReleaseCaptive { + displayName = "$STR_ACE_Captives_ReleaseCaptive"; + distance = 4; + condition = QUOTE(_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}); + statement = QUOTE([ARR_2(_target, false)] call FUNC(setCaptive)); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.4; + icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); + hotkey = "R"; + }; + class ACE_EscortCaptive { + displayName = "$STR_ACE_Captives_EscortCaptive"; + distance = 4; + condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}); + statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.3; + hotkey = "E"; + }; + class ACE_StopEscorting { + displayName = "$STR_ACE_Captives_StopEscorting"; + distance = 4; + condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {_target in (attachedObjects _player)}); + statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.3; + hotkey = "E"; + }; + class ACE_LoadCaptive { + displayName = "$STR_ACE_Captives_LoadCaptive"; + distance = 4; + condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); + statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.2; + hotkey = "L"; + }; + class ACE_FriskPerson { + displayName = "$STR_ACE_Captives_FriskPerson"; + distance = 2; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(openFriskMenu)); + showDisabled = 0; + //icon = ""; //@todo + priority = 3; + hotkey = "F"; + }; + }; - class ACE_SelfActions { - class ACE_StopEscortingSelf { - displayName = "$STR_ACE_Captives_StopEscorting"; - condition = QUOTE(((_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}); - statement = QUOTE([ARR_2((_player getVariable ['ACE_escortedUnit', objNull]), false)] call FUNC(_escortCaptive);); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; - showDisabled = 0; - priority = 2.3; - hotkey = "C"; - }; - /*class ACE_LoadCaptiveSelf { + class ACE_SelfActions { + class ACE_StopEscortingSelf { + displayName = "$STR_ACE_Captives_StopEscorting"; + condition = QUOTE(((_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}); + statement = QUOTE([ARR_2((_player getVariable ['ACE_escortedUnit', objNull]), false)] call FUNC(_escortCaptive);); + exceptions[] = {"ACE_Interaction_isNotEscorting"}; + showDisabled = 0; + priority = 2.3; + hotkey = "C"; + }; + /*class ACE_LoadCaptiveSelf { displayName = "$STR_ACE_Captives_LoadCaptive"; condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle"; statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle"; @@ -86,72 +86,72 @@ class CfgVehicles { showDisabled = 0; priority = 2.2; hotkey = "K"; - };*/ - }; - }; - - #define MACRO_LOADUNLOADCAPTIVE \ - class ACE_Actions { \ - class ACE_LoadCaptive { \ - displayName = "$STR_ACE_Captives_LoadCaptive"; \ - distance = 4; \ - condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ - statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ - exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "L"; \ - }; \ - class ACE_UnloadCaptive { \ - displayName = "$STR_ACE_Captives_UnloadCaptive"; \ - distance = 4; \ - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ - statement = QUOTE([ARR_2(_player, _target)] call FUNC(unloadCaptive)); \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "C"; \ - }; \ + };*/ + }; }; - class LandVehicle; - class Car: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; - class Tank: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; +#define MACRO_LOADUNLOADCAPTIVE \ + class ACE_Actions { \ + class ACE_LoadCaptive { \ + displayName = "$STR_ACE_Captives_LoadCaptive"; \ + distance = 4; \ + condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ + statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ + exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "L"; \ + }; \ + class ACE_UnloadCaptive { \ + displayName = "$STR_ACE_Captives_UnloadCaptive"; \ + distance = 4; \ + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ + statement = QUOTE([ARR_2(_player, _target)] call FUNC(unloadCaptive)); \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "C"; \ + }; \ + }; - class Air; - class Helicopter: Air { - MACRO_LOADUNLOADCAPTIVE - }; - class Plane: Air { - MACRO_LOADUNLOADCAPTIVE - }; - - class Ship; - class Ship_F: Ship { - MACRO_LOADUNLOADCAPTIVE - }; - - class StaticWeapon: LandVehicle { - MACRO_LOADUNLOADCAPTIVE - }; - - class StaticMortar; - class Mortar_01_base_F: StaticMortar { - MACRO_LOADUNLOADCAPTIVE - }; - - #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; - - class Box_NATO_Support_F; - class ACE_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(ACE_CableTie,12) + class LandVehicle; + class Car: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + class Tank: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class Air; + class Helicopter: Air { + MACRO_LOADUNLOADCAPTIVE + }; + class Plane: Air { + MACRO_LOADUNLOADCAPTIVE + }; + + class Ship; + class Ship_F: Ship { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticWeapon: LandVehicle { + MACRO_LOADUNLOADCAPTIVE + }; + + class StaticMortar; + class Mortar_01_base_F: StaticMortar { + MACRO_LOADUNLOADCAPTIVE + }; + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_CableTie,12) + }; }; - }; }; diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf index a08c5d4239..a461b36aeb 100644 --- a/addons/captives/XEH_postInitClient.sqf +++ b/addons/captives/XEH_postInitClient.sqf @@ -1,3 +1,9 @@ // by commy2 [missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler; + + + +[QGVAR(MoveIn), {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); +[QGVAR(MoveOut), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +[QGVAR(SetCaptive), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf index f2b1a9a0c1..2648255c3b 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -20,17 +20,17 @@ PARAMS_1(_unit,_target,_vehicle); if (isNull _target) then { - // _objects = attachedObjects _unit; - // _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); - // _target = _objects select 0; + _objects = attachedObjects _unit; + _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _target = _objects select 0; }; if (isNull _vehicle) then { - _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; - _vehicle = _objects select 0; + _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; + _vehicle = _objects select 0; }; -if (!isNil "_target" && {!isNil "_vehicle"}) then { - _unit setVariable ["ACE_isEscorting", false]; - [[_target, _vehicle], "{(_this select 0) moveInCargo (_this select 1); (_this select 0) assignAsCargo (_this select 1); (_this select 0) setVariable ['ACE_Captives_CargoIndex', (_this select 1) getCargoIndex (_this select 0), true];}", _target] call ACE_Core_fnc_execRemoteFnc; +if ((!isNil "_target") && {!isNil "_vehicle"}) then { + _unit setVariable ["ACE_isEscorting", false]; + [QGVAR(MoveIn), [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setCaptive.sqf index 38ce997a88..b4c047dd1b 100644 --- a/addons/captives/functions/fnc_setCaptive.sqf +++ b/addons/captives/functions/fnc_setCaptive.sqf @@ -21,39 +21,39 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", true, true]; + _unit setVariable ["ACE_isCaptive", true, true]; - // fix anim on mission start (should work on dedicated servers) - _unit spawn { - [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; + // fix anim on mission start (should work on dedicated servers) + _unit spawn { + [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; - if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { - [_this] call EFUNC(common,fixLoweredRifleAnimation); - [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); + if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { + [_this] call EFUNC(common,fixLoweredRifleAnimation); + [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); + }; }; - }; - _unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; + _unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; - if (_unit == ACE_player) then { - showHUD false; - }; + if (_unit == ACE_player) then { + showHUD false; + }; } else { - if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", false, true]; - [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; - if (vehicle _unit == _unit) then { - [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); - }; + _unit setVariable ["ACE_isCaptive", false, true]; + [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; + if (vehicle _unit == _unit) then { + [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; - if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then { - _unit setVariable ["ACE_Captives_CargoIndex", -1, true]; - }; + if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then { + _unit setVariable ["ACE_Captives_CargoIndex", -1, true]; + }; - if (_unit == ACE_player) then { - showHUD true; - }; + if (_unit == ACE_player) then { + showHUD true; + }; }; diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_unloadCaptive.sqf index e6eb4b24a5..2ede9de480 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_unloadCaptive.sqf @@ -24,12 +24,9 @@ _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turr _cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); -if (count _cargo > 0) then { +if ((count _cargo) > 0) then { _target = _cargo select 0; - - _target setVariable ["ACE_Captives_CargoIndex", -1, true]; - - moveOut _target; - [_target, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); - [_target, "{unassignVehicle _this}", _target] call ACE_Core_fnc_execRemoteFnc; + [QGVAR(MoveOut), [_target], [_target]] call EFUNC(common,targetEvent); +} else { + ERROR("No captive to unload"); }; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf new file mode 100644 index 0000000000..1eb1c2ef2b --- /dev/null +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -0,0 +1,28 @@ +/* + * Author: PabstMirror + * Loads a captive into a vehicle + * + * Arguments: + * 0: The Captive + * 1: The Vehicle + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_target,_vehicle); + +private ["_cargoIndex"]; + +_target moveInCargo _vehicle; +_target assignAsCargo _vehicle; +_cargoIndex = _vehicle getCargoIndex _target; +_target setVariable ["ACE_Captives_CargoIndex", _cargoIndex, true]; + +TRACE_3("moveinEH",_target,_vehicle,_cargoIndex); diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf new file mode 100644 index 0000000000..0a10572909 --- /dev/null +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -0,0 +1,24 @@ +/* + * Author: PabstMirror + * Unloads a captive from a vehicle. + * + * Arguments: + * 0: Captive Unit being unloaded + * + * Return Value: + * Nothing + * + * Example: + * TODO + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); + +_unit setVariable ["ACE_Captives_CargoIndex", -1, true]; + +moveOut _unit; +[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); +unassignVehicle _unit; \ No newline at end of file From 24ab11a1e2740d724d6626c6ba7497dc780d72d5 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 3 Feb 2015 23:56:51 -0600 Subject: [PATCH 043/113] More work --- addons/captives/CfgMoves.hpp | 110 +++++++++--------- addons/captives/CfgVehicles.hpp | 16 +-- addons/captives/CfgWeapons.hpp | 22 ++-- addons/captives/README.md | 14 +++ addons/captives/XEH_postInitClient.sqf | 18 ++- addons/captives/XEH_preInit.sqf | 2 + .../functions/fnc_handlePlayerChanged.sqf | 4 +- .../captives/functions/fnc_handleWokeUp.sqf | 4 +- addons/captives/functions/fnc_initPost.sqf | 4 +- addons/captives/functions/fnc_initUnit.sqf | 9 +- addons/captives/functions/fnc_loadCaptive.sqf | 4 +- .../captives/functions/fnc_openFriskMenu.sqf | 28 ++--- addons/captives/functions/fnc_surrender.sqf | 62 +++++----- .../captives/functions/fnc_unloadCaptive.sqf | 2 +- .../functions/fnc_vehicleCaptiveMoveIn.sqf | 4 +- 15 files changed, 161 insertions(+), 142 deletions(-) create mode 100644 addons/captives/README.md diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index da43b21aae..ab379de6ae 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -1,90 +1,90 @@ class CfgMovesBasic { - class Actions { - class CivilStandActions; - class ACE_CivilStandCaptiveActions: CivilStandActions { - turnL = ""; - turnR = ""; - stop = "ACE_AmovPercMstpScapWnonDnon"; - StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; - default = "ACE_AmovPercMstpScapWnonDnon"; - getOver = ""; - throwPrepare = ""; - throwGrenade[] = {"","Gesture"}; + class Actions { + class CivilStandActions; + class ACE_CivilStandCaptiveActions: CivilStandActions { + turnL = ""; + turnR = ""; + stop = "ACE_AmovPercMstpScapWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; + default = "ACE_AmovPercMstpScapWnonDnon"; + getOver = ""; + throwPrepare = ""; + throwGrenade[] = {"","Gesture"}; + }; }; - }; }; class CfgMovesMaleSdr: CfgMovesBasic { - class StandBase; - class States { - class AmovPercMstpSnonWnonDnon: StandBase { - ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; - }; + class StandBase; + class States { + class AmovPercMstpSnonWnonDnon: StandBase { + ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; - class CutSceneAnimationBase; - class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { - actions = "ACE_CivilStandCaptiveActions"; - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; - speed = 1; - looped = 0; - interpolationRestart = 2; - ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - }; + class CutSceneAnimationBase; + class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { + actions = "ACE_CivilStandCaptiveActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; + speed = 1; + looped = 0; + interpolationRestart = 2; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; - class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; - speed = 0; - ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01}; - looped = 1; - }; + class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; + speed = 0; + ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01}; + looped = 1; + }; - class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { - actions = "CivilStandActions"; - file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; - ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; - InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { + actions = "CivilStandActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; + ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + }; }; - }; }; /* player playMove "ACE_AmovPercMstpScapWnonDnon"; player switchMove "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon"; -*/ + */ /*class CfgMovesBasic; class CfgMovesMaleSdr: CfgMovesBasic { - class States { +class States { class CutSceneAnimationBase; class AmovPercMstpSnonWnonDnon_EaseIn: CutSceneAnimationBase { - head = "headDefault"; - static = 1; - disableWeapons = 0; - forceAim = 0; - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; + head = "headDefault"; + static = 1; + disableWeapons = 0; + forceAim = 0; + InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; }; class AmovPercMstpSnonWnonDnon_Ease: AmovPercMstpSnonWnonDnon_EaseIn { - looped = 1; - InterpolateTo[] = {"Unconscious",0.1}; + looped = 1; + InterpolateTo[] = {"Unconscious",0.1}; }; class AmovPercMstpSnonWnonDnon_EaseOut: AmovPercMstpSnonWnonDnon_EaseIn { - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; + InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; }; class AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; }; class AmovPercMstpSsurWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - looped = 1; - InterpolateTo[] = {"Unconscious",0.01}; + looped = 1; + InterpolateTo[] = {"Unconscious",0.01}; }; class AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; }; - }; +}; };*/ diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index dd4f6361d7..04b8d4569f 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -5,8 +5,8 @@ class CfgVehicles { class ACE_SetCaptive { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable ['ACE_isCaptive', false])}); - statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3(QGVAR(SetCaptive), [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); + condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable [ARR_2('ACE_isCaptive', false)])}); + statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3('SetCaptive', [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -15,8 +15,8 @@ class CfgVehicles { class ACE_ReleaseCaptive { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = QUOTE(_target getVariable ['ACE_isCaptive', false] && {isNull (attachedTo _target)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(setCaptive)); + condition = QUOTE(_target getVariable [ARR_2('ACE_isCaptive', false)] && {isNull (attachedTo _target)}); + statement = QUOTE([ARR_3('SetCaptive', [_target], [ARR_2(_target, false)])] call EFUNC(common,targetEvent);); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; @@ -26,7 +26,7 @@ class CfgVehicles { class ACE_EscortCaptive { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; - condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable ['ACE_isUnconscious', false])}); + condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable [ARR_2('ACE_isUnconscious', false)])}); statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; @@ -37,7 +37,7 @@ class CfgVehicles { class ACE_StopEscorting { displayName = "$STR_ACE_Captives_StopEscorting"; distance = 4; - condition = QUOTE((_target getVariable ['ACE_isCaptive', false]) && {_target in (attachedObjects _player)}); + condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {_target in (attachedObjects _player)}); statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; @@ -71,8 +71,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_StopEscortingSelf { displayName = "$STR_ACE_Captives_StopEscorting"; - condition = QUOTE(((_player getVariable ['ACE_escortedUnit', objNull]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable ['ACE_escortedUnit', objNull]) in attachedObjects _player}); - statement = QUOTE([ARR_2((_player getVariable ['ACE_escortedUnit', objNull]), false)] call FUNC(_escortCaptive);); + condition = QUOTE(((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) in attachedObjects _player}); + statement = QUOTE([ARR_2((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]), false)] call FUNC(_escortCaptive);); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.3; diff --git a/addons/captives/CfgWeapons.hpp b/addons/captives/CfgWeapons.hpp index 3005a2fa5c..be2149ca88 100644 --- a/addons/captives/CfgWeapons.hpp +++ b/addons/captives/CfgWeapons.hpp @@ -1,15 +1,15 @@ class CfgWeapons { - class ACE_ItemCore; - class InventoryItem_Base_F; + class ACE_ItemCore; + class InventoryItem_Base_F; - class ACE_CableTie: ACE_ItemCore { - displayName = "$STR_ACE_Captives_CableTie"; - descriptionShort = "$STR_ACE_Captives_CableTieDescription"; - model = QUOTE(PATHTOF(models\ace_cabletie.p3d)); - picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa)); - scope = 2; - class ItemInfo: InventoryItem_Base_F { - mass = 1; + class ACE_CableTie: ACE_ItemCore { + displayName = "$STR_ACE_Captives_CableTie"; + descriptionShort = "$STR_ACE_Captives_CableTieDescription"; + model = QUOTE(PATHTOF(models\ace_cabletie.p3d)); + picture = QUOTE(PATHTOF(UI\ace_cabletie_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + }; }; - }; }; diff --git a/addons/captives/README.md b/addons/captives/README.md new file mode 100644 index 0000000000..3938720f08 --- /dev/null +++ b/addons/captives/README.md @@ -0,0 +1,14 @@ +ace_captives +============ + +Allows taking people captive/handcuffed + +####Items: +`ACE_CableTie` - adds ability to take someone captive + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf index a461b36aeb..ccec1d39d2 100644 --- a/addons/captives/XEH_postInitClient.sqf +++ b/addons/captives/XEH_postInitClient.sqf @@ -1,9 +1,19 @@ -// by commy2 +#include "script_component.hpp" [missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler; -[QGVAR(MoveIn), {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); -[QGVAR(MoveOut), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); -[QGVAR(SetCaptive), {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); +["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["SetCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); + +//TODO: Medical Integration Events??? + +// [_unit, "knockedOut", { + // if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; +// }] call ACE_Core_fnc_addCustomEventhandler; + +// [_unit, "wokeUp", { + // if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; +// }] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 7f83ce4fad..505d57051e 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -17,5 +17,7 @@ PREP(openFriskMenu); PREP(setCaptive); PREP(surrender); PREP(unloadCaptive); +PREP(vehicleCaptiveMoveIn); +PREP(vehicleCaptiveMoveOut); ADDON = true; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index fea03cfe16..f23e380dd3 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -19,7 +19,7 @@ PARAMS_2(_unit,_oldUnit); if (_unit getVariable ["ACE_isCaptive", false]) then { - showHUD false; + showHUD false; } else { - showHUD true; + showHUD true; }; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index cbcd2a07ae..ea6a1bcb26 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -18,6 +18,6 @@ PARAMS_1(_unit); if (_unit getVariable ["ACE_isCaptive", false] && {vehicle _unit == _unit}) then { - [_unit] call EFUNC(common,fixLoweredRifleAnimation); - [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_initPost.sqf b/addons/captives/functions/fnc_initPost.sqf index 5c116be417..8e777a9717 100644 --- a/addons/captives/functions/fnc_initPost.sqf +++ b/addons/captives/functions/fnc_initPost.sqf @@ -19,6 +19,6 @@ PARAMS_1(_unit); // reset status on mission start if (_unit getVariable ["ACE_isCaptive", false]) then { - _unit setVariable ["ACE_isCaptive", false]; - [_unit, true] call ACE_Captives_fnc_setCaptive; + _unit setVariable ["ACE_isCaptive", false]; + [_unit, true] call ACE_Captives_fnc_setCaptive; }; diff --git a/addons/captives/functions/fnc_initUnit.sqf b/addons/captives/functions/fnc_initUnit.sqf index 13777dca1d..df9356ff2a 100644 --- a/addons/captives/functions/fnc_initUnit.sqf +++ b/addons/captives/functions/fnc_initUnit.sqf @@ -17,13 +17,6 @@ PARAMS_1(_unit); -[_unit, "knockedOut", { - if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; -}] call ACE_Core_fnc_addCustomEventhandler; - -[_unit, "wokeUp", { - if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; -}] call ACE_Core_fnc_addCustomEventhandler; // prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call ACE_Core_fnc_addActionEventhandler; +[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf index 2648255c3b..05f87a20c6 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -17,7 +17,7 @@ */ #include "script_component.hpp" -PARAMS_1(_unit,_target,_vehicle); +PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; @@ -32,5 +32,5 @@ if (isNull _vehicle) then { if ((!isNil "_target") && {!isNil "_vehicle"}) then { _unit setVariable ["ACE_isEscorting", false]; - [QGVAR(MoveIn), [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); + ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; diff --git a/addons/captives/functions/fnc_openFriskMenu.sqf b/addons/captives/functions/fnc_openFriskMenu.sqf index 42dda4ab66..d69dbd045c 100644 --- a/addons/captives/functions/fnc_openFriskMenu.sqf +++ b/addons/captives/functions/fnc_openFriskMenu.sqf @@ -22,7 +22,7 @@ PARAMS_2(_player,_unit); _weapon = currentWeapon _player; if (_weapon == primaryWeapon _player && {_weapon != ""}) then { - [_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation); + [_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation); }; _listedItemClasses = []; @@ -32,19 +32,19 @@ _actions = [localize "STR_ACE_Captives_FriskMenuHeader", localize "STR_ACE_Capti _allGear = []; if ((handgunWeapon _unit) != "") then { - _allGear pushBack (handgunWeapon _unit); + _allGear pushBack (handgunWeapon _unit); }; if (count (uniformItems _unit) > 0) then { - _allGear = _allGear + (uniformItems _unit); + _allGear = _allGear + (uniformItems _unit); }; if (count (vestItems _unit) > 0) then { - _allGear = _allGear + (vestItems _unit); + _allGear = _allGear + (vestItems _unit); }; if (count (backpackItems _unit) > 0) then { - _allGear = _allGear + (backpackItems _unit); + _allGear = _allGear + (backpackItems _unit); }; if (count (assignedItems _unit) > 0) then { - _allGear = _allGear + (assignedItems _unit); + _allGear = _allGear + (assignedItems _unit); }; // Handgun @@ -53,15 +53,15 @@ if (count (assignedItems _unit) > 0) then { // Backpack Items // Assigned Items { - if (!(_x in _listedItemClasses)) then { - private "_item"; - _item = configFile >> "CfgMagazines" >> _x; - if (isNil "_item" || str _item == "") then { //str _item ? - _item = configFile >> "CfgWeapons" >> _x; + if (!(_x in _listedItemClasses)) then { + private "_item"; + _item = configFile >> "CfgMagazines" >> _x; + if (isNil "_item" || str _item == "") then { //str _item ? + _item = configFile >> "CfgWeapons" >> _x; + }; + _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call ACE_Interaction_fnc_addSelectableItem; + _listedItemClasses pushBack _x; }; - _actions = [_actions, getText(_item >> "displayName"), getText(_item >> "picture"), _x] call ACE_Interaction_fnc_addSelectableItem; - _listedItemClasses pushBack _x; - }; } forEach (_allGear); [_actions, {call ACE_Interaction_fnc_hideMenu;}, {call ACE_Interaction_fnc_hideMenu;}] call ACE_Interaction_fnc_openSelectMenu; diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index b308775040..92f0ea416a 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -21,43 +21,43 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; + if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; - _unit setVariable ["ACE_isSurrender", true, true]; - [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; + _unit setVariable ["ACE_isSurrender", true, true]; + [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; - _unit spawn { - // fix for lowered rifle animation glitch - if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then { - _this playMove "amovpercmstpsraswrfldnon"; + _unit spawn { + // fix for lowered rifle animation glitch + if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then { + _this playMove "amovpercmstpsraswrfldnon"; + }; + + while {_this getVariable ["ACE_isSurrender", false]} do { + sleep 0.001; //sleep in UI + + if (isPlayer _this) then {showHUD false}; + + if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { + _this setVariable ["ACE_isSurrender", false, true]; + } else { + _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; + }; + }; + if !(_this getVariable ["ACE_isUnconscious", false]) then { + _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; + } else { + _this playMoveNow "unconscious"; + }; + + [_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus; + + if (isPlayer _this) then {showHUD true}; }; - - while {_this getVariable ["ACE_isSurrender", false]} do { - sleep 0.001; //sleep in UI - - if (isPlayer _this) then {showHUD false}; - - if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { - _this setVariable ["ACE_isSurrender", false, true]; - } else { - _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; - }; - }; - if !(_this getVariable ["ACE_isUnconscious", false]) then { - _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; - } else { - _this playMoveNow "unconscious"; - }; - - [_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus; - - if (isPlayer _this) then {showHUD true}; - }; } else { - _unit setVariable ["ACE_isSurrender", false, true]; + _unit setVariable ["ACE_isSurrender", false, true]; }; /* player playMove "AmovPercMstpSsurWnonDnon" player switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon" -*/ + */ diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_unloadCaptive.sqf index 2ede9de480..057b825d12 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_unloadCaptive.sqf @@ -26,7 +26,7 @@ _cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(commo if ((count _cargo) > 0) then { _target = _cargo select 0; - [QGVAR(MoveOut), [_target], [_target]] call EFUNC(common,targetEvent); + ["MoveOutCaptive", [_target], [_target]] call EFUNC(common,targetEvent); } else { ERROR("No captive to unload"); }; diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index 1eb1c2ef2b..fe4d0528c6 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -20,8 +20,8 @@ PARAMS_2(_target,_vehicle); private ["_cargoIndex"]; -_target moveInCargo _vehicle; -_target assignAsCargo _vehicle; +_target moveInCargo _vehicle; +_target assignAsCargo _vehicle; _cargoIndex = _vehicle getCargoIndex _target; _target setVariable ["ACE_Captives_CargoIndex", _cargoIndex, true]; From 11cd426b87162ad710e07d28566e69d24c0ef938 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 4 Feb 2015 00:35:51 -0600 Subject: [PATCH 044/113] Redo XEH --- addons/captives/CfgEventHandlers.hpp | 15 ++-------- addons/captives/XEH_preInit.sqf | 5 ++-- addons/captives/config.cpp | 10 +++---- addons/captives/functions/fnc_handleGetIn.sqf | 24 +++++++++++++++ .../captives/functions/fnc_handleGetOut.sqf | 18 ++++++------ .../captives/functions/fnc_handleKilled.sqf | 26 +++++++++++++++++ .../functions/fnc_handleUnitInitPost.sqf | 29 +++++++++++++++++++ addons/captives/functions/fnc_initPost.sqf | 24 --------------- addons/captives/functions/fnc_initUnit.sqf | 22 -------------- addons/captives/functions/fnc_loadCaptive.sqf | 2 +- 10 files changed, 100 insertions(+), 75 deletions(-) create mode 100644 addons/captives/functions/fnc_handleGetIn.sqf create mode 100644 addons/captives/functions/fnc_handleKilled.sqf create mode 100644 addons/captives/functions/fnc_handleUnitInitPost.sqf delete mode 100644 addons/captives/functions/fnc_initPost.sqf delete mode 100644 addons/captives/functions/fnc_initUnit.sqf diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index b8c182d1f6..07dbe45fb7 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers { class Extended_GetIn_EventHandlers { class All { class GVAR(AutoDetachCaptive) { - getIn = "if (local (_this select 2) && {(_this select 2) getVariable ['ACE_isEscorting', false]}) then {(_this select 2) setVariable ['ACE_isEscorting', false, true]}"; + getIn = QUOTE(_this call FUNC(handleGetIn)); }; }; }; @@ -32,16 +32,7 @@ class Extended_GetOut_EventHandlers { class Extended_Killed_EventHandlers { class CAManBase { class GVAR(AutoDetachCaptive) { - killed = "if ((_this select 0) getVariable ['ACE_isCaptive', false]) then {(_this select 0) setVariable ['ACE_isCaptive', false, true]}; if ((_this select 0) getVariable ['ACE_isEscorting', false]) then {(_this select 0) setVariable ['ACE_isEscorting', false, true]};"; - }; - }; -}; - -//handle captive and unconsciousness state -class Extended_Init_EventHandlers { - class CAManBase { - class GVAR(AutoDetachCaptive) { - init = "_this call ACE_Captives_fnc_initUnit"; + killed = QUOTE(_this call FUNC(handleKilled)); }; }; }; @@ -50,7 +41,7 @@ class Extended_Init_EventHandlers { class Extended_InitPost_EventHandlers { class CAManBase { class GVAR(InitPost) { - init = "if (local (_this select 0)) then {_this call ACE_Captives_fnc_initPost};"; + init = QUOTE(_this call FUNC(handleUnitInitPost)); }; }; }; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 505d57051e..5ff2379c0b 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -6,12 +6,13 @@ PREP(canFriskPerson); PREP(canLoadCaptive); PREP(canUnloadCaptive); PREP(escortCaptive); +PREP(handleGetIn); PREP(handleGetOut); +PREP(handleKilled); PREP(handleKnockedOut); PREP(handlePlayerChanged); PREP(handleWokeUp); -PREP(initPost); -PREP(initUnit); +PREP(handleUnitInitPost); PREP(loadCaptive); PREP(openFriskMenu); PREP(setCaptive); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 7e5c3382bb..7bef039e37 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -18,14 +18,14 @@ class CfgPatches { #include "CfgWeapons.hpp" -class ACE_Core_canInteractConditions { - class ACE_Interaction_isNotEscorting { - condition = "!(_player getVariable ['ACE_isEscorting', false])"; +class ACE_canInteractConditions { + class GVAR(isNotEscorting) { + condition = QUOTE(!(_player getVariable ['ACE_isEscorting', false])"; }; - class ACE_Interaction_isNotCaptive { + class GVAR(isNotCaptive) { condition = "!(_player getVariable ['ACE_isCaptive', false])"; }; - class ACE_Interaction_isNotSurrendering { + class GVAR(isNotSurrendering) { condition = "!(_player getVariable ['ACE_isSurrender', false])"; }; }; diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf new file mode 100644 index 0000000000..dc0b5aa5af --- /dev/null +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Handles when a unit gets in to a vehicle. Release escorted captive when entering a vehicle + * + * Arguments: + * 0: _vehicle + * 2: dunno + * 1: _unit + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_vehicle,_dontcare,_unit); + +if ((local _unit) && (_unit getVariable ["ACE_isEscorting", false])) then { + _unit setVariable ["ACE_isEscorting", false, true]; +}; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index f734fa0177..82e6417eab 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -19,16 +19,16 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if (!local _unit) exitWith {}; -if (!(_unit getVariable ["ACE_isCaptive", false])) exitWith {}; +if ((local _unit)&&(_unit getVariable ["ACE_isCaptive", false])) then { -private ["_cargoIndex"]; + private ["_cargoIndex"]; -_cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; + _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; -//If captive was not "unloaded", then move them back into the vehicle. -if (_cargoIndex != -1) exitWith { - _unit moveInCargo [_vehicle, _cargoIndex]; -}; + //If captive was not "unloaded", then move them back into the vehicle. + if (_cargoIndex != -1) exitWith { + _unit moveInCargo [_vehicle, _cargoIndex]; + }; -[_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); +}; \ No newline at end of file diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..2d476f662c --- /dev/null +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -0,0 +1,26 @@ +/* + * Author: PabstMirror + * Handles when a unit is kill. Reset captivity and escorting status when getting killed + * + * Arguments: + * 0: _oldUnit + * + * Return Value: + * None + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_oldUnit); + +if (_oldUnit getVariable ["ACE_isCaptive", false]) then { + _oldUnit setVariable ["ACE_isCaptive", false, true]; +}; + +if (_oldUnit getVariable ["ACE_isEscorting", false]) then { + _oldUnit setVariable ["ACE_isEscorting", false, true] +}; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf new file mode 100644 index 0000000000..97362b1b96 --- /dev/null +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -0,0 +1,29 @@ +/* +* Author: commy2 +* handle captive and unconsciousness state and prevent grenades +* +* Arguments: +* 0: _unit +* +* Return Value: +* The return value +* +* Example: +* TODO +* +* Public: No +*/ +#include "script_component.hpp" + +PARAMS_1(_unit); + +// prevent players from throwing grenades +[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); + +if (local _unit) then { + // reset status on mission start + if (_unit getVariable ["ACE_isCaptive", false]) then { + _unit setVariable ["ACE_isCaptive", false]; + [_unit, true] call FUNC(setCaptive); + }; +}; diff --git a/addons/captives/functions/fnc_initPost.sqf b/addons/captives/functions/fnc_initPost.sqf deleted file mode 100644 index 8e777a9717..0000000000 --- a/addons/captives/functions/fnc_initPost.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Author: commy2 - * TODO - * - * Arguments: - * 0: _unit - * - * Return Value: - * The return value - * - * Example: - * TODO - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_1(_unit); - -// reset status on mission start -if (_unit getVariable ["ACE_isCaptive", false]) then { - _unit setVariable ["ACE_isCaptive", false]; - [_unit, true] call ACE_Captives_fnc_setCaptive; -}; diff --git a/addons/captives/functions/fnc_initUnit.sqf b/addons/captives/functions/fnc_initUnit.sqf deleted file mode 100644 index df9356ff2a..0000000000 --- a/addons/captives/functions/fnc_initUnit.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Author: commy2 - * TODO - * - * Arguments: - * 0: _unit - * - * Return Value: - * The return value - * - * Example: - * TODO - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_1(_unit); - - -// prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_loadCaptive.sqf index 05f87a20c6..680fee343c 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_loadCaptive.sqf @@ -31,6 +31,6 @@ if (isNull _vehicle) then { }; if ((!isNil "_target") && {!isNil "_vehicle"}) then { - _unit setVariable ["ACE_isEscorting", false]; + _unit setVariable ["ACE_isEscorting", false, true]; ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; From 435b3b8b867922ddc0c6ac5ee4d3700809e714ca Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 4 Feb 2015 13:16:19 -0600 Subject: [PATCH 045/113] Move Code out of CfgVehicles --- addons/captives/CfgVehicles.hpp | 20 +++---- addons/captives/XEH_preInit.sqf | 16 ++++-- addons/captives/config.cpp | 8 ++- .../functions/fnc_canEscortCaptive.sqf | 24 ++++++++ .../captives/functions/fnc_canFriskPerson.sqf | 2 +- .../captives/functions/fnc_canLoadCaptive.sqf | 4 +- .../functions/fnc_canReleaseCaptive.sqf | 23 ++++++++ .../functions/fnc_canStopEscorting.sqf | 41 ++++++++++++++ .../captives/functions/fnc_canTakeCaptive.sqf | 23 ++++++++ .../functions/fnc_canUnloadCaptive.sqf | 2 +- .../functions/fnc_doEscortCaptive.sqf | 56 +++++++++++++++++++ ...penFriskMenu.sqf => fnc_doFriskPerson.sqf} | 0 ..._loadCaptive.sqf => fnc_doLoadCaptive.sqf} | 4 +- .../functions/fnc_doReleaseCaptive.sqf | 21 +++++++ .../captives/functions/fnc_doTakeCaptive.sqf | 22 ++++++++ ...oadCaptive.sqf => fnc_doUnloadCaptive.sqf} | 2 +- .../captives/functions/fnc_escortCaptive.sqf | 55 ------------------ addons/captives/functions/fnc_handleGetIn.sqf | 4 +- .../captives/functions/fnc_handleGetOut.sqf | 2 +- .../captives/functions/fnc_handleKilled.sqf | 8 +-- .../functions/fnc_handlePlayerChanged.sqf | 2 +- .../functions/fnc_handleUnitInitPost.sqf | 6 +- .../captives/functions/fnc_handleWokeUp.sqf | 2 +- addons/captives/functions/fnc_setCaptive.sqf | 10 ++-- addons/captives/functions/fnc_surrender.sqf | 10 ++-- addons/interaction/config.cpp | 9 --- 26 files changed, 265 insertions(+), 111 deletions(-) create mode 100644 addons/captives/functions/fnc_canEscortCaptive.sqf create mode 100644 addons/captives/functions/fnc_canReleaseCaptive.sqf create mode 100644 addons/captives/functions/fnc_canStopEscorting.sqf create mode 100644 addons/captives/functions/fnc_canTakeCaptive.sqf create mode 100644 addons/captives/functions/fnc_doEscortCaptive.sqf rename addons/captives/functions/{fnc_openFriskMenu.sqf => fnc_doFriskPerson.sqf} (100%) rename addons/captives/functions/{fnc_loadCaptive.sqf => fnc_doLoadCaptive.sqf} (84%) create mode 100644 addons/captives/functions/fnc_doReleaseCaptive.sqf create mode 100644 addons/captives/functions/fnc_doTakeCaptive.sqf rename addons/captives/functions/{fnc_unloadCaptive.sqf => fnc_doUnloadCaptive.sqf} (87%) delete mode 100644 addons/captives/functions/fnc_escortCaptive.sqf diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 04b8d4569f..059b07cfb8 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -5,8 +5,8 @@ class CfgVehicles { class ACE_SetCaptive { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = QUOTE(('ACE_CableTie' in (items _player)) && {alive _target} && {!(_target getVariable [ARR_2('ACE_isCaptive', false)])}); - statement = QUOTE(_player removeItem 'ACE_CableTie'; [ARR_3('SetCaptive', [_target], [ARR_2(_target, true)])] call EFUNC(common,targetEvent);); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canTakeCaptive)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doTakeCaptive)); showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -15,8 +15,8 @@ class CfgVehicles { class ACE_ReleaseCaptive { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = QUOTE(_target getVariable [ARR_2('ACE_isCaptive', false)] && {isNull (attachedTo _target)}); - statement = QUOTE([ARR_3('SetCaptive', [_target], [ARR_2(_target, false)])] call EFUNC(common,targetEvent);); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canReleaseCaptive)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doReleaseCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; @@ -26,8 +26,8 @@ class CfgVehicles { class ACE_EscortCaptive { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; - condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable [ARR_2('ACE_isUnconscious', false)])}); - statement = QUOTE([ARR_2(_target, true)] call FUNC(escortCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); + statement = QUOTE([ARR_2(_target, true)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); @@ -37,8 +37,8 @@ class CfgVehicles { class ACE_StopEscorting { displayName = "$STR_ACE_Captives_StopEscorting"; distance = 4; - condition = QUOTE((_target getVariable [ARR_2('ACE_isCaptive', false)]) && {_target in (attachedObjects _player)}); - statement = QUOTE([ARR_2(_target, false)] call FUNC(escortCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); @@ -71,8 +71,8 @@ class CfgVehicles { class ACE_SelfActions { class ACE_StopEscortingSelf { displayName = "$STR_ACE_Captives_StopEscorting"; - condition = QUOTE(((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) getVariable ['ACE_isCaptive', false]) && {(_player getVariable [ARR_2('ACE_escortedUnit', objNull)]) in attachedObjects _player}); - statement = QUOTE([ARR_2((_player getVariable [ARR_2('ACE_escortedUnit', objNull)]), false)] call FUNC(_escortCaptive);); + condition = QUOTE([ARR_2(_player, objNull)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,objNull, false)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.3; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 5ff2379c0b..b3de41ae69 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -2,22 +2,28 @@ ADDON = false; +PREP(canEscortCaptive); PREP(canFriskPerson); PREP(canLoadCaptive); +PREP(canReleaseCaptive); +PREP(canStopEscorting); +PREP(canTakeCaptive); PREP(canUnloadCaptive); -PREP(escortCaptive); +PREP(doEscortCaptive); +PREP(doFriskPerson); +PREP(doLoadCaptive); +PREP(doReleaseCaptive); +PREP(doTakeCaptive); +PREP(doUnloadCaptive); PREP(handleGetIn); PREP(handleGetOut); PREP(handleKilled); PREP(handleKnockedOut); PREP(handlePlayerChanged); -PREP(handleWokeUp); PREP(handleUnitInitPost); -PREP(loadCaptive); -PREP(openFriskMenu); +PREP(handleWokeUp); PREP(setCaptive); PREP(surrender); -PREP(unloadCaptive); PREP(vehicleCaptiveMoveIn); PREP(vehicleCaptiveMoveOut); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index 7bef039e37..d7cb36371d 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -17,15 +17,17 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#define GVARFIX(var1) getVariable [ARR_2(QUOTE(GVAR(var1)), false)] + class ACE_canInteractConditions { class GVAR(isNotEscorting) { - condition = QUOTE(!(_player getVariable ['ACE_isEscorting', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false))); }; class GVAR(isNotCaptive) { - condition = "!(_player getVariable ['ACE_isCaptive', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isCaptive),false))); }; class GVAR(isNotSurrendering) { - condition = "!(_player getVariable ['ACE_isSurrender', false])"; + condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false))); }; }; diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf new file mode 100644 index 0000000000..40a3e0d560 --- /dev/null +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -0,0 +1,24 @@ +/* + * Author: PabstMirror + * Tests if can escort target (attach) + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +(_target getVariable [QGVAR(isCaptive), false]) && +{isNull (attachedTo _target)} && +{alive _target} && +{!(_target getVariable [QGVAR(ACE_isUnconscious), false])} diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 62d5a06742..6ee44b2af5 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -18,6 +18,6 @@ PARAMS_2(_unit,_target); -_target getVariable ["ACE_isCaptive", false] +_target getVariable [QGVAR(isCaptive), false] || {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index b8021e602f..a05765b195 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -23,7 +23,7 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); _target = _objects select 0; }; @@ -32,7 +32,7 @@ if (isNull _vehicle) then { _vehicle = _objects select 0; }; -_unit getVariable ["ACE_isEscorting", false] +_unit getVariable [QGVAR(isEscorting), false] && {!isNil "_target"} && {!isNil "_vehicle"} && {_vehicle emptyPositions "cargo" > 0} diff --git a/addons/captives/functions/fnc_canReleaseCaptive.sqf b/addons/captives/functions/fnc_canReleaseCaptive.sqf new file mode 100644 index 0000000000..50b4c55310 --- /dev/null +++ b/addons/captives/functions/fnc_canReleaseCaptive.sqf @@ -0,0 +1,23 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to release a captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +//Unit is captive and not being escorted +_target getVariable [QGVAR(isCaptive), false] && +{isNull (attachedTo _target)} diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf new file mode 100644 index 0000000000..4f30e7a82a --- /dev/null +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -0,0 +1,41 @@ +/* + * Author: PabstMirror + * Tests if player can stop escorting + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_unit); +DEFAULT_PARAM(1,_target,objNull); + +private ["_isAttached"]; + + +if (isNull _target) then { + _target = _unit getVariable ["ACE_escortedUnit", objNull]; +}; + +if (isNull _target) exitWith { + ERROR("Null Target (no ACE_escortedUnit)"); + false +}; + +_isAttached = _target in (attachedObjects _unit); + +if (_isAttached && (!(_target getVariable [QGVAR(isCaptive), false]))) exitWith { + ERROR("Attached But Not Captive"); + false +}; + +_isAttached diff --git a/addons/captives/functions/fnc_canTakeCaptive.sqf b/addons/captives/functions/fnc_canTakeCaptive.sqf new file mode 100644 index 0000000000..f67f6110bf --- /dev/null +++ b/addons/captives/functions/fnc_canTakeCaptive.sqf @@ -0,0 +1,23 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to take a unit captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +("ACE_CableTie" in (items _unit)) && +{alive _target} && +{!(_target getVariable [QGVAR(isCaptive), false])} diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index b714ebc8ae..1aef4602e1 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -23,6 +23,6 @@ PARAMS_2(_unit,_vehicle); _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); count _cargo > 0 diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf new file mode 100644 index 0000000000..05dc912205 --- /dev/null +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -0,0 +1,56 @@ +/* + * Author: Nic547 + * Attaches a Captive to the _unit + * + * Arguments: + * 0: _unit-Player + * 1: target + * 2: _state + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_unit,_target,_state); + +if !("ACE_Handcuffed" in ([_target] call ACE_Core_fnc_getCaptivityStatus)) exitWith { + [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); +}; + +if (_state) then { + if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; + + [_unit, _target] call EFUNC(common,claim); + _unit setVariable [QGVAR(isEscorting), true, true]; + + _target attachTo [_unit, [0, 1, 0]]; + + _unit setVariable ["ACE_escortedUnit", _target, true]; + _actionID = _unit addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[_unit getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (_unit getVariable ['ACE_escortedUnit', objNull])"]; + + [_target, _actionID] spawn { + _target = _this select 0; + _actionID = _this select 1; + + while {_unit getVariable [QGVAR(isEscorting), false]} do { + sleep 0.2; + + if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { + _unit setVariable [QGVAR(isEscorting), false, true]; + }; + }; + [objNull, _target] call EFUNC(common,claim); + + detach _target; + _unit removeAction _actionID; + }; +} else { + _unit setVariable [QGVAR(isEscorting), false, true]; + _unit setVariable ["ACE_escortedUnit", objNull, true]; +}; diff --git a/addons/captives/functions/fnc_openFriskMenu.sqf b/addons/captives/functions/fnc_doFriskPerson.sqf similarity index 100% rename from addons/captives/functions/fnc_openFriskMenu.sqf rename to addons/captives/functions/fnc_doFriskPerson.sqf diff --git a/addons/captives/functions/fnc_loadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf similarity index 84% rename from addons/captives/functions/fnc_loadCaptive.sqf rename to addons/captives/functions/fnc_doLoadCaptive.sqf index 680fee343c..1ef650b4ee 100644 --- a/addons/captives/functions/fnc_loadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -21,7 +21,7 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); + _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); _target = _objects select 0; }; @@ -31,6 +31,6 @@ if (isNull _vehicle) then { }; if ((!isNil "_target") && {!isNil "_vehicle"}) then { - _unit setVariable ["ACE_isEscorting", false, true]; + _unit setVariable [QGVAR(isEscorting), false, true]; ["MoveInCaptive", [_target], [_target, _vehicle]] call EFUNC(common,targetEvent); }; diff --git a/addons/captives/functions/fnc_doReleaseCaptive.sqf b/addons/captives/functions/fnc_doReleaseCaptive.sqf new file mode 100644 index 0000000000..a807959565 --- /dev/null +++ b/addons/captives/functions/fnc_doReleaseCaptive.sqf @@ -0,0 +1,21 @@ +/* + * Author: PabstMirror + * Release a captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +["SetCaptive", [_target], [_target, false]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doTakeCaptive.sqf b/addons/captives/functions/fnc_doTakeCaptive.sqf new file mode 100644 index 0000000000..8deb712d09 --- /dev/null +++ b/addons/captives/functions/fnc_doTakeCaptive.sqf @@ -0,0 +1,22 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to take a unit captive + * + * Arguments: + * 0: caller (player) + * 1: target + * + * Return Value: + * The return value + * + * Example: + * - + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_target); + +_unit removeItem 'ACE_CableTie'; +["SetCaptive", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_unloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf similarity index 87% rename from addons/captives/functions/fnc_unloadCaptive.sqf rename to addons/captives/functions/fnc_doUnloadCaptive.sqf index 057b825d12..1a6b6a2d0c 100644 --- a/addons/captives/functions/fnc_unloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -22,7 +22,7 @@ private ["_cargo", "_target"]; _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable ["ACE_isCaptive", false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); if ((count _cargo) > 0) then { _target = _cargo select 0; diff --git a/addons/captives/functions/fnc_escortCaptive.sqf b/addons/captives/functions/fnc_escortCaptive.sqf deleted file mode 100644 index c3030a9d33..0000000000 --- a/addons/captives/functions/fnc_escortCaptive.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: Nic547 - * Attaches a Captive to the player - * - * Arguments: - * 0: _unit - * 1: _state - * - * Return Value: - * The return value - * - * Example: - * - - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_2(_unit,_state); - -if !("ACE_Handcuffed" in ([_unit] call ACE_Core_fnc_getCaptivityStatus)) exitWith { - [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); -}; - -if (_state) then { - if (player getVariable ["ACE_isEscorting", false]) exitWith {}; - - [player, _unit] call EFUNC(common,claim); - player setVariable ["ACE_isEscorting", true, true]; - - _unit attachTo [player, [0, 1, 0]]; - - player setVariable ["ACE_escortedUnit", _unit, true]; - _actionID = player addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[player getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (player getVariable ['ACE_escortedUnit', objNull])"]; - - [_unit, _actionID] spawn { - _unit = _this select 0; - _actionID = _this select 1; - - while {player getVariable ["ACE_isEscorting", false]} do { - sleep 0.2; - - if (!alive _unit || {!alive player} || {!canStand _unit} || {!canStand player} || {_unit getVariable ["ACE_isUnconscious", false]} || {player getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo player)}) then { - player setVariable ["ACE_isEscorting", false, true]; - }; - }; - [objNull, _unit] call EFUNC(common,claim); - - detach _unit; - player removeAction _actionID; - }; -} else { - player setVariable ["ACE_isEscorting", false, true]; - player setVariable ["ACE_escortedUnit", objNull, true]; -}; diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf index dc0b5aa5af..eb3a9ad8b1 100644 --- a/addons/captives/functions/fnc_handleGetIn.sqf +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -19,6 +19,6 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit) && (_unit getVariable ["ACE_isEscorting", false])) then { - _unit setVariable ["ACE_isEscorting", false, true]; +if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then { + _unit setVariable [QGVAR(isEscorting), false, true]; }; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 82e6417eab..84c856ed39 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -19,7 +19,7 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit)&&(_unit getVariable ["ACE_isCaptive", false])) then { +if ((local _unit)&&(_unit getVariable [QGVAR(isCaptive), false])) then { private ["_cargoIndex"]; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 2d476f662c..6e41fa801a 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -17,10 +17,10 @@ PARAMS_1(_oldUnit); -if (_oldUnit getVariable ["ACE_isCaptive", false]) then { - _oldUnit setVariable ["ACE_isCaptive", false, true]; +if (_oldUnit getVariable [QGVAR(isCaptive), false]) then { + _oldUnit setVariable [QGVAR(isCaptive), false, true]; }; -if (_oldUnit getVariable ["ACE_isEscorting", false]) then { - _oldUnit setVariable ["ACE_isEscorting", false, true] +if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { + _oldUnit setVariable [QGVAR(isEscorting), false, true] }; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index f23e380dd3..d7efa70a5f 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -18,7 +18,7 @@ PARAMS_2(_unit,_oldUnit); -if (_unit getVariable ["ACE_isCaptive", false]) then { +if (_unit getVariable [QGVAR(isCaptive), false]) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 97362b1b96..a0e76c0a10 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -18,12 +18,12 @@ PARAMS_1(_unit); // prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable ["ACE_isCaptive", false]}, {}] call EFUNC(common,addActionEventhandler); +[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isCaptive), false]}, {}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start - if (_unit getVariable ["ACE_isCaptive", false]) then { - _unit setVariable ["ACE_isCaptive", false]; + if (_unit getVariable [QGVAR(isCaptive), false]) then { + _unit setVariable [QGVAR(isCaptive), false]; [_unit, true] call FUNC(setCaptive); }; }; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index ea6a1bcb26..2973aa7f83 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -17,7 +17,7 @@ PARAMS_1(_unit); -if (_unit getVariable ["ACE_isCaptive", false] && {vehicle _unit == _unit}) then { +if (_unit getVariable [QGVAR(isCaptive), false] && {vehicle _unit == _unit}) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setCaptive.sqf index b4c047dd1b..eca34b3bac 100644 --- a/addons/captives/functions/fnc_setCaptive.sqf +++ b/addons/captives/functions/fnc_setCaptive.sqf @@ -21,15 +21,15 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if (_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", true, true]; + _unit setVariable [QGVAR(isCaptive), true, true]; // fix anim on mission start (should work on dedicated servers) _unit spawn { [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; - if (_this getVariable ["ACE_isCaptive", false] && {vehicle _this == _this}) then { + if (_this getVariable [QGVAR(isCaptive), false] && {vehicle _this == _this}) then { [_this] call EFUNC(common,fixLoweredRifleAnimation); [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); }; @@ -41,9 +41,9 @@ if (_state) then { showHUD false; }; } else { - if !(_unit getVariable ["ACE_isCaptive", false]) exitWith {}; + if !(_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - _unit setVariable ["ACE_isCaptive", false, true]; + _unit setVariable [QGVAR(isCaptive), false, true]; [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; if (vehicle _unit == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 92f0ea416a..3d3b65ec49 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -21,9 +21,9 @@ PARAMS_2(_unit,_state); if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; if (_state) then { - if (_unit getVariable ["ACE_isSurrender", false]) exitWith {}; + if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {}; - _unit setVariable ["ACE_isSurrender", true, true]; + _unit setVariable [QGVAR(isSurrender), true, true]; [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; _unit spawn { @@ -32,13 +32,13 @@ if (_state) then { _this playMove "amovpercmstpsraswrfldnon"; }; - while {_this getVariable ["ACE_isSurrender", false]} do { + while {_this getVariable [QGVAR(isSurrender), false]} do { sleep 0.001; //sleep in UI if (isPlayer _this) then {showHUD false}; if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { - _this setVariable ["ACE_isSurrender", false, true]; + _this setVariable [QGVAR(isSurrender), false, true]; } else { _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; }; @@ -54,7 +54,7 @@ if (_state) then { if (isPlayer _this) then {showHUD true}; }; } else { - _unit setVariable ["ACE_isSurrender", false, true]; + _unit setVariable [QGVAR(isSurrender), false, true]; }; /* diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index acb41d362f..3b53855eef 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -38,15 +38,6 @@ class ACE_Parameters_Boolean { }; class ACE_canInteractConditions { - class GVAR(isNotEscorting) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isEscorting', false)]) ); - }; - class GVAR(isNotCaptive) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isCaptive', false)]) ); - }; - class GVAR(isNotSurrendering) { - condition = QUOTE( !(ACE_player getVariable [ARR_2('ACE_isSurrender', false)]) ); - }; class GVAR(isNotSwimming) { condition = QUOTE( !underwater ACE_player ); }; From 122a38a6aae70cdd5b978c028a5ca6486965b9a4 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 5 Feb 2015 16:39:45 -0600 Subject: [PATCH 046/113] More Refactoring --- addons/captives/CfgVehicles.hpp | 14 +++++----- addons/captives/XEH_postInitClient.sqf | 7 ++--- addons/captives/XEH_preInit.sqf | 12 ++++---- addons/captives/config.cpp | 6 ++-- ...eCaptive.sqf => fnc_canApplyHandcuffs.sqf} | 6 ++-- .../functions/fnc_canEscortCaptive.sqf | 2 +- .../captives/functions/fnc_canFriskPerson.sqf | 2 +- .../captives/functions/fnc_canLoadCaptive.sqf | 2 +- ...Captive.sqf => fnc_canRemoveHandcuffs.sqf} | 6 ++-- .../functions/fnc_canStopEscorting.sqf | 2 +- .../functions/fnc_canUnloadCaptive.sqf | 2 +- ...keCaptive.sqf => fnc_doApplyHandcuffs.sqf} | 6 ++-- .../functions/fnc_doEscortCaptive.sqf | 2 +- .../captives/functions/fnc_doLoadCaptive.sqf | 8 ++++-- ...eCaptive.sqf => fnc_doRemoveHandcuffs.sqf} | 2 +- .../functions/fnc_doUnloadCaptive.sqf | 2 +- .../captives/functions/fnc_handleGetOut.sqf | 7 ++--- .../captives/functions/fnc_handleKilled.sqf | 4 +-- .../functions/fnc_handlePlayerChanged.sqf | 2 +- .../functions/fnc_handleUnitInitPost.sqf | 10 +++---- .../captives/functions/fnc_handleWokeUp.sqf | 2 +- ...c_setCaptive.sqf => fnc_setHandcuffed.sqf} | 28 +++++++++++-------- addons/captives/functions/fnc_surrender.sqf | 4 +-- 23 files changed, 71 insertions(+), 67 deletions(-) rename addons/captives/functions/{fnc_canTakeCaptive.sqf => fnc_canApplyHandcuffs.sqf} (62%) rename addons/captives/functions/{fnc_canReleaseCaptive.sqf => fnc_canRemoveHandcuffs.sqf} (62%) rename addons/captives/functions/{fnc_doTakeCaptive.sqf => fnc_doApplyHandcuffs.sqf} (58%) rename addons/captives/functions/{fnc_doReleaseCaptive.sqf => fnc_doRemoveHandcuffs.sqf} (76%) rename addons/captives/functions/{fnc_setCaptive.sqf => fnc_setHandcuffed.sqf} (60%) diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 059b07cfb8..b4a120bc22 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -2,21 +2,21 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_Actions { - class ACE_SetCaptive { + class ACE_ApplyHandcuffs { displayName = "$STR_ACE_Captives_SetCaptive"; distance = 4; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canTakeCaptive)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doTakeCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); hotkey = "C"; }; - class ACE_ReleaseCaptive { + class ACE_RemoveHandcuffs { displayName = "$STR_ACE_Captives_ReleaseCaptive"; distance = 4; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canReleaseCaptive)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doReleaseCaptive)); + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; priority = 2.4; @@ -27,7 +27,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); - statement = QUOTE([ARR_2(_target, true)] call FUNC(doEscortCaptive)); + statement = QUOTE([ARR_3(_target, _target, true)] call FUNC(doEscortCaptive)); exceptions[] = {"ACE_Interaction_isNotEscorting"}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf index ccec1d39d2..b55c9eb10c 100644 --- a/addons/captives/XEH_postInitClient.sqf +++ b/addons/captives/XEH_postInitClient.sqf @@ -1,12 +1,9 @@ #include "script_component.hpp" -[missionNamespace, "playerChanged", {_this call ACE_Captives_fnc_handlePlayerChanged}] call ACE_Core_fnc_addCustomEventhandler; - - - +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); ["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); ["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); -["SetCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); //TODO: Medical Integration Events??? diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index b3de41ae69..e894cd1c31 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -1,19 +1,19 @@ #include "script_component.hpp" ADDON = false; - + +PREP(canApplyHandcuffs); PREP(canEscortCaptive); PREP(canFriskPerson); PREP(canLoadCaptive); -PREP(canReleaseCaptive); +PREP(canRemoveHandcuffs); PREP(canStopEscorting); -PREP(canTakeCaptive); PREP(canUnloadCaptive); +PREP(doApplyHandcuffs); PREP(doEscortCaptive); PREP(doFriskPerson); PREP(doLoadCaptive); -PREP(doReleaseCaptive); -PREP(doTakeCaptive); +PREP(doRemoveHandcuffs); PREP(doUnloadCaptive); PREP(handleGetIn); PREP(handleGetOut); @@ -22,7 +22,7 @@ PREP(handleKnockedOut); PREP(handlePlayerChanged); PREP(handleUnitInitPost); PREP(handleWokeUp); -PREP(setCaptive); +PREP(setHandcuffed); PREP(surrender); PREP(vehicleCaptiveMoveIn); PREP(vehicleCaptiveMoveOut); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index d7cb36371d..bceeda3b2b 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -17,15 +17,13 @@ class CfgPatches { #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" -#define GVARFIX(var1) getVariable [ARR_2(QUOTE(GVAR(var1)), false)] - class ACE_canInteractConditions { class GVAR(isNotEscorting) { condition = QUOTE(!(GETVAR(player,QGVAR(isEscorting),false))); }; - class GVAR(isNotCaptive) { - condition = QUOTE(!(GETVAR(player,QGVAR(isCaptive),false))); + class GVAR(isNotHandcuffed) { + condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false))); }; class GVAR(isNotSurrendering) { condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false))); diff --git a/addons/captives/functions/fnc_canTakeCaptive.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf similarity index 62% rename from addons/captives/functions/fnc_canTakeCaptive.sqf rename to addons/captives/functions/fnc_canApplyHandcuffs.sqf index f67f6110bf..8a3d143e96 100644 --- a/addons/captives/functions/fnc_canTakeCaptive.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Checks the conditions for being able to take a unit captive + * Checks the conditions for being able to apply handcuffs * * Arguments: * 0: caller (player) @@ -18,6 +18,8 @@ PARAMS_2(_unit,_target); +//Player has cableTie, target is alive and not already handcuffed + ("ACE_CableTie" in (items _unit)) && {alive _target} && -{!(_target getVariable [QGVAR(isCaptive), false])} +{!(_target getVariable [QGVAR(isHandcuffed), false])} diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 40a3e0d560..9bcb1d258a 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -18,7 +18,7 @@ PARAMS_2(_unit,_target); -(_target getVariable [QGVAR(isCaptive), false]) && +(_target getVariable [QGVAR(isHandcuffed), false]) && {isNull (attachedTo _target)} && {alive _target} && {!(_target getVariable [QGVAR(ACE_isUnconscious), false])} diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 6ee44b2af5..9bbf5389c3 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -18,6 +18,6 @@ PARAMS_2(_unit,_target); -_target getVariable [QGVAR(isCaptive), false] +_target getVariable [QGVAR(isHandcuffed), false] || {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index a05765b195..3b1521e2be 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -23,7 +23,7 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); + _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); _target = _objects select 0; }; diff --git a/addons/captives/functions/fnc_canReleaseCaptive.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf similarity index 62% rename from addons/captives/functions/fnc_canReleaseCaptive.sqf rename to addons/captives/functions/fnc_canRemoveHandcuffs.sqf index 50b4c55310..f36488fbf1 100644 --- a/addons/captives/functions/fnc_canReleaseCaptive.sqf +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Checks the conditions for being able to release a captive + * Checks the conditions for being able to remove handcuffs * * Arguments: * 0: caller (player) @@ -18,6 +18,6 @@ PARAMS_2(_unit,_target); -//Unit is captive and not being escorted -_target getVariable [QGVAR(isCaptive), false] && +//Unit is handcuffed and not currently being escorted +_target getVariable [QGVAR(isHandcuffed), false] && {isNull (attachedTo _target)} diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index 4f30e7a82a..66cf12c9fc 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -33,7 +33,7 @@ if (isNull _target) exitWith { _isAttached = _target in (attachedObjects _unit); -if (_isAttached && (!(_target getVariable [QGVAR(isCaptive), false]))) exitWith { +if (_isAttached && (!(_target getVariable [QGVAR(isHandcuffed), false]))) exitWith { ERROR("Attached But Not Captive"); false }; diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index 1aef4602e1..3e014d72c7 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -23,6 +23,6 @@ PARAMS_2(_unit,_vehicle); _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); count _cargo > 0 diff --git a/addons/captives/functions/fnc_doTakeCaptive.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf similarity index 58% rename from addons/captives/functions/fnc_doTakeCaptive.sqf rename to addons/captives/functions/fnc_doApplyHandcuffs.sqf index 8deb712d09..9ae82916f7 100644 --- a/addons/captives/functions/fnc_doTakeCaptive.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Checks the conditions for being able to take a unit captive + * Checks the conditions for being able to apply handcuffs * * Arguments: * 0: caller (player) @@ -18,5 +18,5 @@ PARAMS_2(_unit,_target); -_unit removeItem 'ACE_CableTie'; -["SetCaptive", [_target], [_target, true]] call EFUNC(common,targetEvent); +_unit removeItem "ACE_CableTie"; +["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index 05dc912205..d782bd8c62 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -19,7 +19,7 @@ PARAMS_3(_unit,_target,_state); -if !("ACE_Handcuffed" in ([_target] call ACE_Core_fnc_getCaptivityStatus)) exitWith { +if !("ACE_Handcuffed" in ([_target] call EFUNC(common,getCaptivityStatus))) exitWith { [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); }; diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index 1ef650b4ee..92d1adecf8 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -21,14 +21,16 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; - _objects = [_objects, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); - _target = _objects select 0; + _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); + if ((count _objects) > 0) then {_target = _objects select 0;}; }; +if (isNull _target) exitWith {}; if (isNull _vehicle) then { _objects = nearestObjects [_unit, ["Car_F", "Tank_F", "Helicopter_F", "Boat_F", "Plane_F"], 10]; - _vehicle = _objects select 0; + if ((count _objects) > 0) then {_vehicle = _objects select 0;}; }; +if (isNull _vehicle) exitWith {}; if ((!isNil "_target") && {!isNil "_vehicle"}) then { _unit setVariable [QGVAR(isEscorting), false, true]; diff --git a/addons/captives/functions/fnc_doReleaseCaptive.sqf b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf similarity index 76% rename from addons/captives/functions/fnc_doReleaseCaptive.sqf rename to addons/captives/functions/fnc_doRemoveHandcuffs.sqf index a807959565..01ca4ef436 100644 --- a/addons/captives/functions/fnc_doReleaseCaptive.sqf +++ b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf @@ -18,4 +18,4 @@ PARAMS_2(_unit,_target); -["SetCaptive", [_target], [_target, false]] call EFUNC(common,targetEvent); +["SetHandcuffed", [_target], [_target, false]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doUnloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf index 1a6b6a2d0c..b4814fc564 100644 --- a/addons/captives/functions/fnc_doUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -22,7 +22,7 @@ private ["_cargo", "_target"]; _cargo = crew _vehicle; // Can also unload from driver, gunner, commander, turret positions. They shouldn't be there anyway. -_cargo = [_cargo, {_this getVariable [QGVAR(isCaptive), false]}] call EFUNC(common,filter); +_cargo = [_cargo, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); if ((count _cargo) > 0) then { _target = _cargo select 0; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 84c856ed39..00368532e7 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -19,12 +19,11 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit)&&(_unit getVariable [QGVAR(isCaptive), false])) then { - +if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { private ["_cargoIndex"]; - + _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; - + //If captive was not "unloaded", then move them back into the vehicle. if (_cargoIndex != -1) exitWith { _unit moveInCargo [_vehicle, _cargoIndex]; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 6e41fa801a..5ac2935a2e 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -17,8 +17,8 @@ PARAMS_1(_oldUnit); -if (_oldUnit getVariable [QGVAR(isCaptive), false]) then { - _oldUnit setVariable [QGVAR(isCaptive), false, true]; +if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then { + _oldUnit setVariable [QGVAR(isHandcuffed), false, true]; }; if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index d7efa70a5f..c3e148d6c4 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -18,7 +18,7 @@ PARAMS_2(_unit,_oldUnit); -if (_unit getVariable [QGVAR(isCaptive), false]) then { +if (_unit getVariable [QGVAR(isHandcuffed), false]) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index a0e76c0a10..4450378129 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -17,13 +17,13 @@ PARAMS_1(_unit); -// prevent players from throwing grenades -[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isCaptive), false]}, {}] call EFUNC(common,addActionEventhandler); +// prevent players from throwing grenades (added to all units) +[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start - if (_unit getVariable [QGVAR(isCaptive), false]) then { - _unit setVariable [QGVAR(isCaptive), false]; - [_unit, true] call FUNC(setCaptive); + if (_unit getVariable [QGVAR(isHandcuffed), false]) then { + _unit setVariable [QGVAR(isHandcuffed), false]; + [_unit, true] call FUNC(setHandcuffed); }; }; diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index 2973aa7f83..af59b5c56e 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -17,7 +17,7 @@ PARAMS_1(_unit); -if (_unit getVariable [QGVAR(isCaptive), false] && {vehicle _unit == _unit}) then { +if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_setCaptive.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf similarity index 60% rename from addons/captives/functions/fnc_setCaptive.sqf rename to addons/captives/functions/fnc_setHandcuffed.sqf index eca34b3bac..94967dfb20 100644 --- a/addons/captives/functions/fnc_setCaptive.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -1,6 +1,6 @@ /* * Author: Nic547, commy2 - * Makes a civilian unable to move. + * Handcuffs a unit * * Arguments: * 0: Unit @@ -18,18 +18,26 @@ PARAMS_2(_unit,_state); -if (!local _unit) exitWith {[[_unit, _state, true], _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; +systemChat format ["set %1", _this]; + +if (!local _unit) exitWith { + ERROR("setHandcuffed unit not local"); +}; + +systemChat format ["set %1 %2 ", _state, (_unit getVariable [QGVAR(isHandcuffed), false])]; + +if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith { + ERROR("new state equals current"); +}; if (_state) then { - if (_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - - _unit setVariable [QGVAR(isCaptive), true, true]; + _unit setVariable [QGVAR(isHandcuffed), true, true]; // fix anim on mission start (should work on dedicated servers) _unit spawn { - [_this, "ACE_Handcuffed", true] call ACE_Core_fnc_setCaptivityStatus; + [_this, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); - if (_this getVariable [QGVAR(isCaptive), false] && {vehicle _this == _this}) then { + if (_this getVariable [QGVAR(isHandcuffed), false] && {vehicle _this == _this}) then { [_this] call EFUNC(common,fixLoweredRifleAnimation); [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); }; @@ -41,10 +49,8 @@ if (_state) then { showHUD false; }; } else { - if !(_unit getVariable [QGVAR(isCaptive), false]) exitWith {}; - - _unit setVariable [QGVAR(isCaptive), false, true]; - [_unit, "ACE_Handcuffed", false] call ACE_Core_fnc_setCaptivityStatus; + _unit setVariable [QGVAR(isHandcuffed), false, true]; + [_unit, "ACE_Handcuffed", false] call EFUNC(common,setCaptivityStatus); if (vehicle _unit == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 3d3b65ec49..69098c19a1 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -24,7 +24,7 @@ if (_state) then { if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {}; _unit setVariable [QGVAR(isSurrender), true, true]; - [_unit, "ACE_Surrendered", true] call ACE_Core_fnc_setCaptivityStatus; + [_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus); _unit spawn { // fix for lowered rifle animation glitch @@ -49,7 +49,7 @@ if (_state) then { _this playMoveNow "unconscious"; }; - [_this, "ACE_Surrendered", false] call ACE_Core_fnc_setCaptivityStatus; + [_this, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus); if (isPlayer _this) then {showHUD true}; }; From 82a8fc8ca315d21fee1ccf53a204ee093e976bc5 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 5 Feb 2015 23:11:28 -0600 Subject: [PATCH 047/113] exceptions --- addons/captives/CfgVehicles.hpp | 17 ++++--- .../functions/fnc_canEscortCaptive.sqf | 2 + .../functions/fnc_canStopEscorting.sqf | 2 +- .../functions/fnc_doEscortCaptive.sqf | 49 +++++++++---------- .../captives/functions/fnc_setHandcuffed.sqf | 5 +- addons/interaction/XEH_clientInit.sqf | 8 +-- 6 files changed, 41 insertions(+), 42 deletions(-) diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index b4a120bc22..8bd97b0b58 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -7,6 +7,7 @@ class CfgVehicles { distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); + exceptions[] = {}; showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -17,7 +18,7 @@ class CfgVehicles { distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {}; showDisabled = 0; priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); @@ -27,8 +28,8 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_EscortCaptive"; distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); - statement = QUOTE([ARR_3(_target, _target, true)] call FUNC(doEscortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive)); + exceptions[] = {}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; @@ -39,7 +40,7 @@ class CfgVehicles { distance = 4; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting)); statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; @@ -50,7 +51,7 @@ class CfgVehicles { distance = 4; condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.2; @@ -73,7 +74,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_StopEscorting"; condition = QUOTE([ARR_2(_player, objNull)] call FUNC(canStopEscorting)); statement = QUOTE([ARR_3(_player,objNull, false)] call FUNC(doEscortCaptive)); - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; priority = 2.3; hotkey = "C"; @@ -82,7 +83,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_LoadCaptive"; condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle"; statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle"; - exceptions[] = {"ACE_Interaction_isNotEscorting"}; + exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; priority = 2.2; hotkey = "K"; @@ -97,7 +98,7 @@ class CfgVehicles { distance = 4; \ condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ - exceptions[] = {"ACE_Interaction_isNotEscorting"}; \ + exceptions[] = {QGVAR(isNotEscorting)}; \ showDisabled = 0; \ priority = 1.2; \ hotkey = "L"; \ diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 9bcb1d258a..2d2fd5abe4 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -18,6 +18,8 @@ PARAMS_2(_unit,_target); +//Alive, handcuffed, not being escored, and not unconsious + (_target getVariable [QGVAR(isHandcuffed), false]) && {isNull (attachedTo _target)} && {alive _target} && diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index 66cf12c9fc..bb48244a25 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -23,7 +23,7 @@ private ["_isAttached"]; if (isNull _target) then { - _target = _unit getVariable ["ACE_escortedUnit", objNull]; + _target = _unit getVariable [QGVAR(escortedUnit), objNull]; }; if (isNull _target) exitWith { diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index d782bd8c62..72a0cd0c6c 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -19,38 +19,37 @@ PARAMS_3(_unit,_target,_state); -if !("ACE_Handcuffed" in ([_target] call EFUNC(common,getCaptivityStatus))) exitWith { - [localize "STR_ACE_Captives_NoCaptive"] call EFUNC(common,displayTextStructured); -}; - if (_state) then { - if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; + if (_unit getVariable [QGVAR(isEscorting), false]) exitWith {}; - [_unit, _target] call EFUNC(common,claim); - _unit setVariable [QGVAR(isEscorting), true, true]; + [_unit, _target] call EFUNC(common,claim); + _unit setVariable [QGVAR(isEscorting), true, true]; - _target attachTo [_unit, [0, 1, 0]]; + _target attachTo [_unit, [0, 1, 0]]; - _unit setVariable ["ACE_escortedUnit", _target, true]; - _actionID = _unit addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], "[_unit getVariable ['ACE_escortedUnit', objNull], false] call ACE_Captives_fnc_escortCaptive;", nil, 20, false, true, "", "!isNull (_unit getVariable ['ACE_escortedUnit', objNull])"]; + _unit setVariable [QGVAR(escortedUnit), _target, true]; - [_target, _actionID] spawn { - _target = _this select 0; - _actionID = _this select 1; + //Add Actionmenu to release captive + _actionID = _unit addAction [format ["%1", localize "STR_ACE_Captives_StopEscorting"], + {[(_this select 0), ((_this select 0) getVariable [QGVAR(escortedUnit), objNull]), false] call FUNC(doEscortCaptive);}, + nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))]; - while {_unit getVariable [QGVAR(isEscorting), false]} do { - sleep 0.2; + [_unit, _target, _actionID] spawn { + PARAMS_3(_unit,_target,_actionID); - if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { - _unit setVariable [QGVAR(isEscorting), false, true]; - }; + while {_unit getVariable [QGVAR(isEscorting), false]} do { + sleep 0.2; + + if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { + _unit setVariable [QGVAR(isEscorting), false, true]; + }; + }; + [objNull, _target] call EFUNC(common,claim); + + detach _target; + _unit removeAction _actionID; }; - [objNull, _target] call EFUNC(common,claim); - - detach _target; - _unit removeAction _actionID; - }; } else { - _unit setVariable [QGVAR(isEscorting), false, true]; - _unit setVariable ["ACE_escortedUnit", objNull, true]; + _unit setVariable [QGVAR(isEscorting), false, true]; + _unit setVariable [QGVAR(escortedUnit), objNull, true]; }; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 94967dfb20..c28a26909f 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -18,14 +18,11 @@ PARAMS_2(_unit,_state); -systemChat format ["set %1", _this]; if (!local _unit) exitWith { ERROR("setHandcuffed unit not local"); }; -systemChat format ["set %1 %2 ", _state, (_unit getVariable [QGVAR(isHandcuffed), false])]; - if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith { ERROR("new state equals current"); }; @@ -50,7 +47,7 @@ if (_state) then { }; } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; - [_unit, "ACE_Handcuffed", false] call EFUNC(common,setCaptivityStatus); + [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); if (vehicle _unit == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; diff --git a/addons/interaction/XEH_clientInit.sqf b/addons/interaction/XEH_clientInit.sqf index bcc3f47def..71be601ac7 100644 --- a/addons/interaction/XEH_clientInit.sqf +++ b/addons/interaction/XEH_clientInit.sqf @@ -20,7 +20,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenu", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(isNull (findDisplay 1713999)) exitWith {false}; @@ -38,7 +38,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenu", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; @@ -56,7 +56,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenuSelf", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(isNull (findDisplay 1713999)) exitWith {false}; @@ -74,7 +74,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenuSelf", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", "ACE_Interaction_isNotEscorting", "ACE_Interaction_isNotSwimming"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; From 7a3029b9fdbdc5ac21cf546ccac5ea0130f9b17f Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 03:38:27 -0600 Subject: [PATCH 048/113] replace spawns --- addons/captives/CfgEventHandlers.hpp | 2 +- addons/captives/CfgVehicles.hpp | 8 ++-- addons/captives/XEH_postInit.sqf | 32 +++++++++++++ addons/captives/XEH_postInitClient.sqf | 16 ------- .../functions/fnc_canApplyHandcuffs.sqf | 4 +- .../functions/fnc_canEscortCaptive.sqf | 6 +-- .../captives/functions/fnc_canLoadCaptive.sqf | 15 ++++--- .../functions/fnc_canRemoveHandcuffs.sqf | 2 +- .../functions/fnc_doApplyHandcuffs.sqf | 2 +- .../functions/fnc_doEscortCaptive.sqf | 22 +++++---- .../captives/functions/fnc_handleGetOut.sqf | 6 +-- .../captives/functions/fnc_handleKilled.sqf | 4 +- .../functions/fnc_handlePlayerChanged.sqf | 8 ++-- .../functions/fnc_handleUnitInitPost.sqf | 30 ++++++------- .../captives/functions/fnc_setHandcuffed.sqf | 23 +++++----- addons/captives/functions/fnc_surrender.sqf | 45 ++++++++----------- .../functions/fnc_vehicleCaptiveMoveIn.sqf | 2 +- .../functions/fnc_vehicleCaptiveMoveOut.sqf | 2 +- 18 files changed, 123 insertions(+), 106 deletions(-) create mode 100644 addons/captives/XEH_postInit.sqf delete mode 100644 addons/captives/XEH_postInitClient.sqf diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index 07dbe45fb7..722750f915 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -6,7 +6,7 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient)); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 8bd97b0b58..65d574fab0 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -50,7 +50,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_LoadCaptive"; distance = 4; condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); - statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(loadCaptive)); + statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive)); exceptions[] = {QGVAR(isNotEscorting)}; showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); @@ -61,7 +61,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_FriskPerson"; distance = 2; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(openFriskMenu)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFriskPerson)); showDisabled = 0; //icon = ""; //@todo priority = 3; @@ -97,7 +97,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_LoadCaptive"; \ distance = 4; \ condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ - statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(loadCaptive)); \ + statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \ exceptions[] = {QGVAR(isNotEscorting)}; \ showDisabled = 0; \ priority = 1.2; \ @@ -107,7 +107,7 @@ class CfgVehicles { displayName = "$STR_ACE_Captives_UnloadCaptive"; \ distance = 4; \ condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ - statement = QUOTE([ARR_2(_player, _target)] call FUNC(unloadCaptive)); \ + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \ showDisabled = 0; \ priority = 1.2; \ hotkey = "C"; \ diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf new file mode 100644 index 0000000000..9d1a242d4d --- /dev/null +++ b/addons/captives/XEH_postInit.sqf @@ -0,0 +1,32 @@ +#include "script_component.hpp" + +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); +["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); +["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); + +//Handles when someone starts escorting and then disconnects, leaving the captive attached +//This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC +if (isServer) then { + addMissionEventHandler ["HandleDisconnect", { + PARAMS_1(_disconnectedPlayer); + _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull]; + if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then { + detach _escortedUnit; + systemChat "debug: DC detach"; + }; + if (_disconnectedPlayer getVariable [QGVAR(isEscorting), false]) then { + _disconnectedPlayer setVariable [QGVAR(isEscorting), false, true]; + }; + }]; +}; + +//TODO: Medical Integration Events??? + +// [_unit, "knockedOut", { +// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; +// }] call ACE_Core_fnc_addCustomEventhandler; + +// [_unit, "wokeUp", { +// if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; +// }] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/XEH_postInitClient.sqf b/addons/captives/XEH_postInitClient.sqf deleted file mode 100644 index b55c9eb10c..0000000000 --- a/addons/captives/XEH_postInitClient.sqf +++ /dev/null @@ -1,16 +0,0 @@ -#include "script_component.hpp" - -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); -["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); -["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); - -//TODO: Medical Integration Events??? - -// [_unit, "knockedOut", { - // if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleKnockedOut}; -// }] call ACE_Core_fnc_addCustomEventhandler; - -// [_unit, "wokeUp", { - // if (local (_this select 0)) then {_this call ACE_Captives_fnc_handleWokeUp}; -// }] call ACE_Core_fnc_addCustomEventhandler; diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index 8a3d143e96..8f503d8fd0 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -20,6 +20,6 @@ PARAMS_2(_unit,_target); //Player has cableTie, target is alive and not already handcuffed -("ACE_CableTie" in (items _unit)) && -{alive _target} && +("ACE_CableTie" in (items _unit)) && +{alive _target} && {!(_target getVariable [QGVAR(isHandcuffed), false])} diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 2d2fd5abe4..3d026e3d54 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -20,7 +20,7 @@ PARAMS_2(_unit,_target); //Alive, handcuffed, not being escored, and not unconsious -(_target getVariable [QGVAR(isHandcuffed), false]) && -{isNull (attachedTo _target)} && -{alive _target} && +(_target getVariable [QGVAR(isHandcuffed), false]) && +{isNull (attachedTo _target)} && +{alive _target} && {!(_target getVariable [QGVAR(ACE_isUnconscious), false])} diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index 3b1521e2be..902ec36331 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -4,8 +4,8 @@ * * Arguments: * 0: Unit that wants to load a captive - * 1: A captive. ObjNull for the first escorted captive - * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle + * 1: A captive. ObjNull for the first escorted captive (may be null) + * 2: Vehicle to load the captive into. ObjNull for the nearest vehicle (may be null) * * Return Value: * The return value @@ -24,15 +24,16 @@ PARAMS_3(_unit,_target,_vehicle); if (isNull _target) then { _objects = attachedObjects _unit; _objects = [_objects, {_this getVariable [QGVAR(isHandcuffed), false]}] call EFUNC(common,filter); - _target = _objects select 0; + if ((count _objects) > 0) then {_target = _objects select 0;}; }; if (isNull _vehicle) then { _objects = nearestObjects [_unit, ["Car", "Tank", "Helicopter", "Plane", "Ship_F"], 10]; - _vehicle = _objects select 0; + if ((count _objects) > 0) then {_vehicle = _objects select 0;}; }; -_unit getVariable [QGVAR(isEscorting), false] -&& {!isNil "_target"} -&& {!isNil "_vehicle"} +(!isNull _target) +&& {!isNull _vehicle} +&& {_unit getVariable [QGVAR(isEscorting), false]} +&& {_target getVariable [QGVAR(isHandcuffed), false]} && {_vehicle emptyPositions "cargo" > 0} diff --git a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf index f36488fbf1..d36042b0ab 100644 --- a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -19,5 +19,5 @@ PARAMS_2(_unit,_target); //Unit is handcuffed and not currently being escorted -_target getVariable [QGVAR(isHandcuffed), false] && +_target getVariable [QGVAR(isHandcuffed), false] && {isNull (attachedTo _target)} diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index 9ae82916f7..6c44df3dc5 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -18,5 +18,5 @@ PARAMS_2(_unit,_target); -_unit removeItem "ACE_CableTie"; +_unit removeItem "ACE_CableTie"; ["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index 72a0cd0c6c..fbbcd09947 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -34,21 +34,25 @@ if (_state) then { {[(_this select 0), ((_this select 0) getVariable [QGVAR(escortedUnit), objNull]), false] call FUNC(doEscortCaptive);}, nil, 20, false, true, "", QUOTE(!isNull (GETVAR(_target,QGVAR(escortedUnit),objNull)))]; - [_unit, _target, _actionID] spawn { - PARAMS_3(_unit,_target,_actionID); - - while {_unit getVariable [QGVAR(isEscorting), false]} do { - sleep 0.2; - + private "_escortFnc"; + _escortFnc = { + EXPLODE_3_PVT((_this select 0),_unit,_target,_actionID); + if (_unit getVariable [QGVAR(isEscorting), false]) then { if (!alive _target || {!alive _unit} || {!canStand _target} || {!canStand _unit} || {_target getVariable ["ACE_isUnconscious", false]} || {_unit getVariable ["ACE_isUnconscious", false]} || {!isNull (attachedTo _unit)}) then { _unit setVariable [QGVAR(isEscorting), false, true]; }; }; - [objNull, _target] call EFUNC(common,claim); - detach _target; - _unit removeAction _actionID; + if (!(_unit getVariable [QGVAR(isEscorting), false])) then { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + [objNull, _target] call EFUNC(common,claim); + detach _target; + _unit removeAction _actionID; + _unit setVariable [QGVAR(escortedUnit), objNull, true]; + }; }; + [_escortFnc, 0.2, [_unit, _target, _actionID]] call CBA_fnc_addPerFrameHandler; + } else { _unit setVariable [QGVAR(isEscorting), false, true]; _unit setVariable [QGVAR(escortedUnit), objNull, true]; diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index 00368532e7..b212377dd2 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -21,9 +21,9 @@ PARAMS_3(_vehicle,_dontcare,_unit); if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { private ["_cargoIndex"]; - - _cargoIndex = _unit getVariable ["ACE_Captives_CargoIndex", -1]; - + + _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1]; + //If captive was not "unloaded", then move them back into the vehicle. if (_cargoIndex != -1) exitWith { _unit moveInCargo [_vehicle, _cargoIndex]; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 5ac2935a2e..219bd2eb60 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -1,6 +1,6 @@ /* * Author: PabstMirror - * Handles when a unit is kill. Reset captivity and escorting status when getting killed + * Handles when a unit is kill. Reset captivity and escorting status * * Arguments: * 0: _oldUnit @@ -22,5 +22,5 @@ if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then { }; if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { - _oldUnit setVariable [QGVAR(isEscorting), false, true] + _oldUnit setVariable [QGVAR(isEscorting), false, true]; }; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index c3e148d6c4..af6472c211 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -1,9 +1,9 @@ /* * Author: commy2 - * TODO + * Handles playerChanged. Resets "showHUD" based on handcuff status * * Arguments: - * 0: _unit + * 0: _newUnit * 1: _oldUnit * * Return Value: @@ -16,9 +16,9 @@ */ #include "script_component.hpp" -PARAMS_2(_unit,_oldUnit); +PARAMS_2(_newUnit,_oldUnit); -if (_unit getVariable [QGVAR(isHandcuffed), false]) then { +if (_newUnit getVariable [QGVAR(isHandcuffed), false]) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 4450378129..d34eebeb4a 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -1,24 +1,24 @@ /* -* Author: commy2 -* handle captive and unconsciousness state and prevent grenades -* -* Arguments: -* 0: _unit -* -* Return Value: -* The return value -* -* Example: -* TODO -* -* Public: No -*/ + * Author: commy2 + * handle captive and unconsciousness state and prevent grenades + * + * Arguments: + * 0: _unit + * + * Return Value: + * The return value + * + * Example: + * TODO + * + * Public: No + */ #include "script_component.hpp" PARAMS_1(_unit); // prevent players from throwing grenades (added to all units) -[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {}] call EFUNC(common,addActionEventhandler); +[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {hint format ["%1 - debug throw prevented",time];}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index c28a26909f..98a12168d3 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -29,31 +29,34 @@ if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith if (_state) then { _unit setVariable [QGVAR(isHandcuffed), true, true]; + [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); // fix anim on mission start (should work on dedicated servers) - _unit spawn { - [_this, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); - if (_this getVariable [QGVAR(isHandcuffed), false] && {vehicle _this == _this}) then { - [_this] call EFUNC(common,fixLoweredRifleAnimation); - [_this, "ACE_AmovPercMstpScapWnonDnon", 0] spawn EFUNC(common,doAnimation); + _fixAnimationFnc = { + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); }; }; - _unit setVariable ["ACE_Captives_CargoIndex", vehicle _unit getCargoIndex _unit, true]; + [_fixAnimationFnc, [_unit], 0.05, 0] call EFUNC(common,waitAndExecute); + + _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; if (_unit == ACE_player) then { showHUD false; }; } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; - [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); - if (vehicle _unit == _unit) then { + [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); + if ((vehicle _unit) == _unit) then { [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; - if (_unit getVariable ["ACE_Captives_CargoIndex", -1] != -1) then { - _unit setVariable ["ACE_Captives_CargoIndex", -1, true]; + if (_unit getVariable [QGVAR(CargoIndex), -1] != -1) then { + _unit setVariable [QGVAR(CargoIndex), -1, true]; }; if (_unit == ACE_player) then { diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 69098c19a1..7c5adc08de 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -26,38 +26,31 @@ if (_state) then { _unit setVariable [QGVAR(isSurrender), true, true]; [_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus); - _unit spawn { - // fix for lowered rifle animation glitch - if (currentWeapon _this != "" && {currentWeapon _this == primaryWeapon _this} && {weaponLowered _this} && {stance _this == "STAND"}) then { - _this playMove "amovpercmstpsraswrfldnon"; - }; - while {_this getVariable [QGVAR(isSurrender), false]} do { - sleep 0.001; //sleep in UI - - if (isPlayer _this) then {showHUD false}; - - if (!alive _this || {_this getVariable ["ACE_isUnconscious", false]}) then { - _this setVariable [QGVAR(isSurrender), false, true]; + private "_surrenderFnc"; + _surrenderFnc = { + EXPLODE_1_PVT((_this select 0),_unit); + if (_unit getVariable [QGVAR(isSurrender), false]) then { + if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { + _unit setVariable [QGVAR(isSurrender), false, true]; } else { - _this playMove "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon"; + [_unit, "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon", 0] call EFUNC(common,doAnimation); }; }; - if !(_this getVariable ["ACE_isUnconscious", false]) then { - _this playMoveNow "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; - } else { - _this playMoveNow "unconscious"; + + if (!(_unit getVariable [QGVAR(isSurrender), false])) then { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + + if !(_unit getVariable ["ACE_isUnconscious", false]) then { + [_unit, "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 1] call EFUNC(common,doAnimation); + } else { + [_unit, "unconscious", 1] call EFUNC(common,doAnimation); + }; + [_unit, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus); + if (isPlayer _unit) then {showHUD true}; }; - - [_this, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus); - - if (isPlayer _this) then {showHUD true}; }; + [_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; } else { _unit setVariable [QGVAR(isSurrender), false, true]; }; - -/* -player playMove "AmovPercMstpSsurWnonDnon" -player switchMove "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon" - */ diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index fe4d0528c6..dd3b6e6818 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -23,6 +23,6 @@ private ["_cargoIndex"]; _target moveInCargo _vehicle; _target assignAsCargo _vehicle; _cargoIndex = _vehicle getCargoIndex _target; -_target setVariable ["ACE_Captives_CargoIndex", _cargoIndex, true]; +_target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; TRACE_3("moveinEH",_target,_vehicle,_cargoIndex); diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf index 0a10572909..4210e8da15 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -17,7 +17,7 @@ PARAMS_1(_unit); -_unit setVariable ["ACE_Captives_CargoIndex", -1, true]; +_unit setVariable [QGVAR(CargoIndex), -1, true]; moveOut _unit; [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); From 98564fae683a212798f3c29542972cbefa40d20e Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 15:54:26 -0600 Subject: [PATCH 049/113] Surrendering --- addons/captives/CfgMoves.hpp | 79 ++++++++----------- addons/captives/CfgVehicles.hpp | 25 +++--- addons/captives/XEH_preInit.sqf | 1 + addons/captives/config.cpp | 2 +- .../captives/functions/fnc_canSurrender.sqf | 22 ++++++ .../functions/fnc_handleUnitInitPost.sqf | 7 +- .../captives/functions/fnc_setHandcuffed.sqf | 1 - addons/captives/functions/fnc_surrender.sqf | 51 ++++++------ addons/captives/stringtable.xml | 12 ++- addons/interaction/XEH_clientInit.sqf | 4 +- 10 files changed, 121 insertions(+), 83 deletions(-) create mode 100644 addons/captives/functions/fnc_canSurrender.sqf diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index ab379de6ae..bb6b8669e0 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -1,7 +1,7 @@ class CfgMovesBasic { class Actions { class CivilStandActions; - class ACE_CivilStandCaptiveActions: CivilStandActions { + class ACE_CivilStandHandcuffedActions: CivilStandActions { turnL = ""; turnR = ""; stop = "ACE_AmovPercMstpScapWnonDnon"; @@ -11,6 +11,11 @@ class CfgMovesBasic { throwPrepare = ""; throwGrenade[] = {"","Gesture"}; }; + class ACE_CivilStandSurrenderActions: ACE_CivilStandHandcuffedActions { + stop = "ACE_AmovPercMstpScapWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; + default = "ACE_AmovPercMstpScapWnonDnon"; + }; }; }; @@ -18,12 +23,14 @@ class CfgMovesMaleSdr: CfgMovesBasic { class StandBase; class States { class AmovPercMstpSnonWnonDnon: StandBase { - ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; + ConnectTo[] += {"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; }; class CutSceneAnimationBase; + + //Handcuffed Anims: class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon: CutSceneAnimationBase { - actions = "ACE_CivilStandCaptiveActions"; + actions = "ACE_CivilStandHandcuffedActions"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_EaseIn"; speed = 1; looped = 0; @@ -31,7 +38,6 @@ class CfgMovesMaleSdr: CfgMovesBasic { ConnectTo[] = {"ACE_AmovPercMstpScapWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; }; - class ACE_AmovPercMstpScapWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_Ease"; speed = 0; @@ -39,52 +45,37 @@ class CfgMovesMaleSdr: CfgMovesBasic { InterpolateTo[] = {"Unconscious",0.01}; looped = 1; }; - class ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon { actions = "CivilStandActions"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\amovpercmstpsnonwnondnon_easeout"; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpScapWnonDnon",0.1}; }; + + //Surrender Anims: + class ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { + actions = "ACE_CivilStandSurrenderActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\non\non\AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon"; + speed = 1; + looped = 0; + interpolationRestart = 2; + ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + }; + class ACE_AmovPercMstpSsurWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon"; + speed = 0; + looped = 1; + ConnectTo[] = {"ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01}; + }; + class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { + speed = 0.4; //for gameplay reasons, slow this down + actions = "CivilStandActions"; + file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; + ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; + InterpolateTo[] = {"Unconscious",0.01,"ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; + }; }; }; -/* -player playMove "ACE_AmovPercMstpScapWnonDnon"; -player switchMove "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon"; - */ - -/*class CfgMovesBasic; -class CfgMovesMaleSdr: CfgMovesBasic { -class States { - class CutSceneAnimationBase; - class AmovPercMstpSnonWnonDnon_EaseIn: CutSceneAnimationBase { - head = "headDefault"; - static = 1; - disableWeapons = 0; - forceAim = 0; - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseOut",0.02,"Unconscious",0.1}; - }; - class AmovPercMstpSnonWnonDnon_Ease: AmovPercMstpSnonWnonDnon_EaseIn { - looped = 1; - InterpolateTo[] = {"Unconscious",0.1}; - }; - class AmovPercMstpSnonWnonDnon_EaseOut: AmovPercMstpSnonWnonDnon_EaseIn { - InterpolateTo[] = {"AmovPercMstpSnonWnonDnon_EaseIn",0.02,"Unconscious",0.1}; - }; - - class AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon: CutSceneAnimationBase { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon",0.1}; - }; - - class AmovPercMstpSsurWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - looped = 1; - InterpolateTo[] = {"Unconscious",0.01}; - }; - - class AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - InterpolateTo[] = {"Unconscious",0.01,"AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon",0.1}; - }; -}; -};*/ - diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 65d574fab0..934e1215d2 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -78,16 +78,23 @@ class CfgVehicles { showDisabled = 0; priority = 2.3; hotkey = "C"; + }; + class ACE_StartSurrenderingSelf { + displayName = "$STR_ACE_Captives_StartSurrendering"; + condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender)); + statement = QUOTE([ARR_2(_player, true)] call FUNC(surrender)); + exceptions[] = {}; + showDisabled = 0; + priority = 0; + }; + class ACE_StopSurrenderingSelf { + displayName = "$STR_ACE_Captives_StopSurrendering"; + condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender)); + statement = QUOTE([ARR_2(_player, false)] call FUNC(surrender)); + exceptions[] = {QGVAR(isNotSurrendering)}; + showDisabled = 0; + priority = 0; }; - /*class ACE_LoadCaptiveSelf { - displayName = "$STR_ACE_Captives_LoadCaptive"; - condition = "[_player, objNull, objNull] call ACE_Captives_fnc_canLoadCaptiveIntoVehicle"; - statement = "[_player, objNull, objNull] call ACE_Captives_fnc_loadCaptiveIntoVehicle"; - exceptions[] = {QGVAR(isNotEscorting)}; - showDisabled = 0; - priority = 2.2; - hotkey = "K"; - };*/ }; }; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index e894cd1c31..a98bf73443 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -8,6 +8,7 @@ PREP(canFriskPerson); PREP(canLoadCaptive); PREP(canRemoveHandcuffs); PREP(canStopEscorting); +PREP(canSurrender); PREP(canUnloadCaptive); PREP(doApplyHandcuffs); PREP(doEscortCaptive); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index bceeda3b2b..c0a34e3222 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -26,6 +26,6 @@ class ACE_canInteractConditions { condition = QUOTE(!(GETVAR(player,QGVAR(isHandcuffed),false))); }; class GVAR(isNotSurrendering) { - condition = QUOTE(!(GETVAR(player,QGVAR(isSurrender),false))); + condition = QUOTE(!(GETVAR(player,QGVAR(isSurrendering),false))); }; }; diff --git a/addons/captives/functions/fnc_canSurrender.sqf b/addons/captives/functions/fnc_canSurrender.sqf new file mode 100644 index 0000000000..60dcd7c938 --- /dev/null +++ b/addons/captives/functions/fnc_canSurrender.sqf @@ -0,0 +1,22 @@ +/* + * Author: PabstMirror + * Checks the conditions for being able to surrender + * + * Arguments: + * 0: caller (player) + * 1: New Surrender State to test + * + * Return Value: + * The return value + * + * Example: + * [player, true] call ACE_captives_fnc_canSurrender; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_newSurrenderState); + +//TODO: any other conditions?? +(!((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _newSurrenderState)) diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index d34eebeb4a..635d7b0439 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -18,7 +18,7 @@ PARAMS_1(_unit); // prevent players from throwing grenades (added to all units) -[_unit, "Throw", {(_this select 1) getVariable [QGVAR(isHandcuffed), false]}, {hint format ["%1 - debug throw prevented",time];}] call EFUNC(common,addActionEventhandler); +[_unit, "Throw", {((_this select 1) getVariable [QGVAR(isHandcuffed), false]) || {(_this select 1) getVariable [QGVAR(isSurrendering), false]}}, {}] call EFUNC(common,addActionEventhandler); if (local _unit) then { // reset status on mission start @@ -26,4 +26,9 @@ if (local _unit) then { _unit setVariable [QGVAR(isHandcuffed), false]; [_unit, true] call FUNC(setHandcuffed); }; + + if (_unit getVariable [QGVAR(isSurrendering), false]) then { + _unit setVariable [QGVAR(isSurrendering), false]; + [_unit, true] call FUNC(surrender); + }; }; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 98a12168d3..1be72ca7c9 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -32,7 +32,6 @@ if (_state) then { [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); // fix anim on mission start (should work on dedicated servers) - _fixAnimationFnc = { PARAMS_1(_unit); if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 7c5adc08de..bb782d85da 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -1,6 +1,6 @@ /* - * Author: commy2 - * TODO + * Author: commy2 PabstMirror + * Lets a unit surrender * * Arguments: * 0: Unit @@ -18,39 +18,42 @@ PARAMS_2(_unit,_state); -if (!local _unit) exitWith {[_this, _fnc_scriptName, _unit] call ACE_Core_fnc_execRemoteFnc}; - if (_state) then { - if (_unit getVariable [QGVAR(isSurrender), false]) exitWith {}; - - _unit setVariable [QGVAR(isSurrender), true, true]; - [_unit, "ACE_Surrendered", true] call EFUNC(common,setCaptivityStatus); + if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith {}; + _unit setVariable [QGVAR(isSurrendering), true, true]; + [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); + [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); private "_surrenderFnc"; _surrenderFnc = { EXPLODE_1_PVT((_this select 0),_unit); - if (_unit getVariable [QGVAR(isSurrender), false]) then { + + if (_unit getVariable [QGVAR(isSurrendering), false]) then { if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { - _unit setVariable [QGVAR(isSurrender), false, true]; - } else { - [_unit, "amovpercmstpsnonwnondnon_amovpercmstpssurwnondnon", 0] call EFUNC(common,doAnimation); + [_unit, false] call FUNC(surrender); + [(_this select 1)] call cba_fnc_removePerFrameHandler; }; - }; - - if (!(_unit getVariable [QGVAR(isSurrender), false])) then { + } else { [(_this select 1)] call cba_fnc_removePerFrameHandler; - - if !(_unit getVariable ["ACE_isUnconscious", false]) then { - [_unit, "AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 1] call EFUNC(common,doAnimation); - } else { - [_unit, "unconscious", 1] call EFUNC(common,doAnimation); - }; - [_unit, "ACE_Surrendered", false] call EFUNC(common,setCaptivityStatus); - if (isPlayer _unit) then {showHUD true}; }; }; [_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; } else { - _unit setVariable [QGVAR(isSurrender), false, true]; + _unit setVariable [QGVAR(isSurrendering), false, true]; + + if !(_unit getVariable ["ACE_isUnconscious", false]) then { + //Break out of hands up animation loop + //don't want to step on animations from medical (TODO: testing medical integration) + [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; + + [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + + if (_unit == ACE_player) then { + //only enable if not handcuffed + if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { + showHUD true; + }; + }; }; diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index eaf63b2d41..7d8096b3e6 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -71,6 +71,7 @@ Naložit zajatce Fogoly berakása Загрузить пленного + Embarcar Prisioneiro Unload Captive @@ -81,6 +82,7 @@ Vyložit zajatce Fogoly kivevése Выгрузить пленного + Desembarcar Prisioneiro Cable Tie @@ -115,6 +117,7 @@ Inventář prohledávané osoby Ekwipunek rewidowanej osoby Инвентарь обысканных лиц + Inventário da pessoa revistada Frisk person @@ -125,6 +128,13 @@ Rewiduj osobę Motozás Обыскать человека + Revistar + + + Surrender + + + Stop Surrendering \ No newline at end of file diff --git a/addons/interaction/XEH_clientInit.sqf b/addons/interaction/XEH_clientInit.sqf index 71be601ac7..1c314078a4 100644 --- a/addons/interaction/XEH_clientInit.sqf +++ b/addons/interaction/XEH_clientInit.sqf @@ -56,7 +56,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenuSelf", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(isNull (findDisplay 1713999)) exitWith {false}; @@ -74,7 +74,7 @@ GVAR(isOpeningDoor) = false; localize "STR_ACE_Interaction_InteractionMenuSelf", { // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; + _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming"]; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific if !(!isNull (findDisplay 1713999) && {profileNamespace getVariable [QGVAR(AutoCloseMenu), 0] > 0}) exitWith {false}; From c117e9bf160e293239561946014e0b244928bcca Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 17:03:56 -0600 Subject: [PATCH 050/113] Header Examples --- addons/captives/functions/fnc_canApplyHandcuffs.sqf | 2 +- addons/captives/functions/fnc_canEscortCaptive.sqf | 4 ++-- addons/captives/functions/fnc_canFriskPerson.sqf | 2 +- addons/captives/functions/fnc_canLoadCaptive.sqf | 2 +- addons/captives/functions/fnc_canRemoveHandcuffs.sqf | 2 +- addons/captives/functions/fnc_canStopEscorting.sqf | 3 +-- addons/captives/functions/fnc_canSurrender.sqf | 2 +- addons/captives/functions/fnc_canUnloadCaptive.sqf | 2 +- addons/captives/functions/fnc_doApplyHandcuffs.sqf | 2 +- addons/captives/functions/fnc_doEscortCaptive.sqf | 2 +- addons/captives/functions/fnc_doFriskPerson.sqf | 2 +- addons/captives/functions/fnc_doLoadCaptive.sqf | 2 +- addons/captives/functions/fnc_doRemoveHandcuffs.sqf | 7 +++---- addons/captives/functions/fnc_doUnloadCaptive.sqf | 2 +- addons/captives/functions/fnc_handleGetIn.sqf | 2 +- addons/captives/functions/fnc_handleGetOut.sqf | 4 ++-- addons/captives/functions/fnc_handleKilled.sqf | 6 +++++- .../captives/functions/fnc_handlePlayerChanged.sqf | 4 ++-- addons/captives/functions/fnc_handleUnitInitPost.sqf | 2 +- addons/captives/functions/fnc_handleWokeUp.sqf | 2 +- addons/captives/functions/fnc_setHandcuffed.sqf | 2 +- addons/captives/functions/fnc_surrender.sqf | 12 +++++++++--- .../captives/functions/fnc_vehicleCaptiveMoveIn.sqf | 4 +--- .../captives/functions/fnc_vehicleCaptiveMoveOut.sqf | 4 ++-- 24 files changed, 42 insertions(+), 36 deletions(-) diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf index 8f503d8fd0..f69bb2544d 100644 --- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canApplyHandcuffs * * Public: No */ diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index 3d026e3d54..cbb098881f 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -4,13 +4,13 @@ * * Arguments: * 0: caller (player) - * 1: target + * 1: target * * Return Value: * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canEscortCaptive * * Public: No */ diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 9bbf5389c3..28a9ee0134 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canFriskPerson * * Public: No */ diff --git a/addons/captives/functions/fnc_canLoadCaptive.sqf b/addons/captives/functions/fnc_canLoadCaptive.sqf index 902ec36331..04b33ad42d 100644 --- a/addons/captives/functions/fnc_canLoadCaptive.sqf +++ b/addons/captives/functions/fnc_canLoadCaptive.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canLoadCaptive * * Public: No */ diff --git a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf index d36042b0ab..4642cd90fd 100644 --- a/addons/captives/functions/fnc_canRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_canRemoveHandcuffs.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canRemoveHandcuffs * * Public: No */ diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index bb48244a25..e6a5a0e568 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_canStopEscorting * * Public: No */ @@ -21,7 +21,6 @@ DEFAULT_PARAM(1,_target,objNull); private ["_isAttached"]; - if (isNull _target) then { _target = _unit getVariable [QGVAR(escortedUnit), objNull]; }; diff --git a/addons/captives/functions/fnc_canSurrender.sqf b/addons/captives/functions/fnc_canSurrender.sqf index 60dcd7c938..238087c62b 100644 --- a/addons/captives/functions/fnc_canSurrender.sqf +++ b/addons/captives/functions/fnc_canSurrender.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * [player, true] call ACE_captives_fnc_canSurrender; + * [Jean, true] call ACE_captives_fnc_canSurrender; * * Public: No */ diff --git a/addons/captives/functions/fnc_canUnloadCaptive.sqf b/addons/captives/functions/fnc_canUnloadCaptive.sqf index 3e014d72c7..a86bdae588 100644 --- a/addons/captives/functions/fnc_canUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_canUnloadCaptive.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [player, bob, car1] call ACE_captives_fnc_canUnloadCaptive; * * Public: No */ diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index 6c44df3dc5..8abf8c836c 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * - + * [player, bob] call ACE_captives_fnc_doApplyHandcuffs; * * Public: No */ diff --git a/addons/captives/functions/fnc_doEscortCaptive.sqf b/addons/captives/functions/fnc_doEscortCaptive.sqf index fbbcd09947..299aa81631 100644 --- a/addons/captives/functions/fnc_doEscortCaptive.sqf +++ b/addons/captives/functions/fnc_doEscortCaptive.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [player, bob, true] call ACE_captives_fnc_doEscorteCaptive; * * Public: No */ diff --git a/addons/captives/functions/fnc_doFriskPerson.sqf b/addons/captives/functions/fnc_doFriskPerson.sqf index d69dbd045c..14b18ffd0e 100644 --- a/addons/captives/functions/fnc_doFriskPerson.sqf +++ b/addons/captives/functions/fnc_doFriskPerson.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [player, bob] call ACE_captives_fnc_doFristPerson; * * Public: No */ diff --git a/addons/captives/functions/fnc_doLoadCaptive.sqf b/addons/captives/functions/fnc_doLoadCaptive.sqf index 92d1adecf8..9fd65a130d 100644 --- a/addons/captives/functions/fnc_doLoadCaptive.sqf +++ b/addons/captives/functions/fnc_doLoadCaptive.sqf @@ -11,7 +11,7 @@ * Nothing * * Example: - * TODO + * [bob, tom, car] call ACE_captives_fnc_doLoadCaptive * * Public: No */ diff --git a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf index 01ca4ef436..a69decf620 100644 --- a/addons/captives/functions/fnc_doRemoveHandcuffs.sqf +++ b/addons/captives/functions/fnc_doRemoveHandcuffs.sqf @@ -1,16 +1,15 @@ /* * Author: PabstMirror - * Release a captive + * Remove handcuffs from a target * * Arguments: - * 0: caller (player) - * 1: target + * 0: target * * Return Value: * The return value * * Example: - * - + * [bob, false] call ACE_captives_fnc_doRemoveHandcuffs * * Public: No */ diff --git a/addons/captives/functions/fnc_doUnloadCaptive.sqf b/addons/captives/functions/fnc_doUnloadCaptive.sqf index b4814fc564..b7fa57a7bb 100644 --- a/addons/captives/functions/fnc_doUnloadCaptive.sqf +++ b/addons/captives/functions/fnc_doUnloadCaptive.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [bob, car] call ACE_captives_fnc_doUnloadCaptive * * Public: No */ diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf index eb3a9ad8b1..54133e2362 100644 --- a/addons/captives/functions/fnc_handleGetIn.sqf +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [car2, x, player] call ACE_captives_fnc_handleGetIn * * Public: No */ diff --git a/addons/captives/functions/fnc_handleGetOut.sqf b/addons/captives/functions/fnc_handleGetOut.sqf index b212377dd2..4bf9a1fa19 100644 --- a/addons/captives/functions/fnc_handleGetOut.sqf +++ b/addons/captives/functions/fnc_handleGetOut.sqf @@ -11,7 +11,7 @@ * The return value * * Example: - * - + * [car2, x, player] call ACE_captives_fnc_handleGetOut * * Public: No */ @@ -30,4 +30,4 @@ if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { }; [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); -}; \ No newline at end of file +}; diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf index 219bd2eb60..9e9c5e1ac8 100644 --- a/addons/captives/functions/fnc_handleKilled.sqf +++ b/addons/captives/functions/fnc_handleKilled.sqf @@ -9,7 +9,7 @@ * None * * Example: - * - + * [bob1] call ACE_captives_fnc_handleKilled * * Public: No */ @@ -24,3 +24,7 @@ if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then { if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { _oldUnit setVariable [QGVAR(isEscorting), false, true]; }; + +if (_oldUnit getVariable [QGVAR(isSurrendering), false]) then { + _oldUnit setVariable [QGVAR(isSurrendering), false, true]; +}; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index af6472c211..9c4f02546f 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -10,7 +10,7 @@ * The return value * * Example: - * TODO + * [bob1, bob2] call ACE_captives_fnc_handlePlayerChange * * Public: No */ @@ -18,7 +18,7 @@ PARAMS_2(_newUnit,_oldUnit); -if (_newUnit getVariable [QGVAR(isHandcuffed), false]) then { +if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then { showHUD false; } else { showHUD true; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 635d7b0439..1a5a8f2ecd 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -9,7 +9,7 @@ * The return value * * Example: - * TODO + * [bob] call ACE_captives_fnc_handleUnitInitPost * * Public: No */ diff --git a/addons/captives/functions/fnc_handleWokeUp.sqf b/addons/captives/functions/fnc_handleWokeUp.sqf index af59b5c56e..9bf2e1a2bc 100644 --- a/addons/captives/functions/fnc_handleWokeUp.sqf +++ b/addons/captives/functions/fnc_handleWokeUp.sqf @@ -9,7 +9,7 @@ * The return value * * Example: - * TODO + * [bob] call ACE_captives_fnc_handleWokeUp * * Public: No */ diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 1be72ca7c9..cf03704a85 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [bob, true] call ACE_captives_fnc_setHandcuffed; * * Public: No */ diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index bb782d85da..8b9d870cd5 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [Pierre, true] call ACE_captives_fnc_surrender; * * Public: No */ @@ -19,12 +19,18 @@ PARAMS_2(_unit,_state); if (_state) then { - if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith {}; + if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith { + ERROR("Already Surrendering"); + }; _unit setVariable [QGVAR(isSurrendering), true, true]; [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); + if (_unit == ACE_player) then { + showHUD false; + }; + private "_surrenderFnc"; _surrenderFnc = { EXPLODE_1_PVT((_this select 0),_unit); @@ -49,7 +55,7 @@ if (_state) then { }; [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); - + if (_unit == ACE_player) then { //only enable if not handcuffed if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf index dd3b6e6818..626a0b34e4 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveIn.sqf @@ -10,7 +10,7 @@ * Nothing * * Example: - * TODO + * [bob, car1] call ACE_captives_fnc_vehicleCaptiveMoveIn; * * Public: No */ @@ -24,5 +24,3 @@ _target moveInCargo _vehicle; _target assignAsCargo _vehicle; _cargoIndex = _vehicle getCargoIndex _target; _target setVariable [QGVAR(CargoIndex), _cargoIndex, true]; - -TRACE_3("moveinEH",_target,_vehicle,_cargoIndex); diff --git a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf index 4210e8da15..5ef6f01406 100644 --- a/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf +++ b/addons/captives/functions/fnc_vehicleCaptiveMoveOut.sqf @@ -9,7 +9,7 @@ * Nothing * * Example: - * TODO + * [bob] call ACE_captives_fnc_vehicleCaptiveMoveOut; * * Public: No */ @@ -21,4 +21,4 @@ _unit setVariable [QGVAR(CargoIndex), -1, true]; moveOut _unit; [_unit, "ACE_AmovPercMstpScapWnonDnon", 2] call EFUNC(common,doAnimation); -unassignVehicle _unit; \ No newline at end of file +unassignVehicle _unit; From ed3f28ec6d1633a48ee3bc41a37f8497fb5719b6 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 22:24:27 -0600 Subject: [PATCH 051/113] Minor Cleanup --- addons/captives/CfgMoves.hpp | 2 +- .../functions/fnc_canEscortCaptive.sqf | 4 +- .../captives/functions/fnc_canFriskPerson.sqf | 1 + .../captives/functions/fnc_setHandcuffed.sqf | 35 +++++++-------- addons/captives/functions/fnc_surrender.sqf | 45 ++++++++++++------- 5 files changed, 49 insertions(+), 38 deletions(-) diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index bb6b8669e0..288d153d7b 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -70,7 +70,7 @@ class CfgMovesMaleSdr: CfgMovesBasic { InterpolateTo[] = {"Unconscious",0.01}; }; class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - speed = 0.4; //for gameplay reasons, slow this down + speed = 0.333; //for gameplay reasons, slow this down actions = "CivilStandActions"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; diff --git a/addons/captives/functions/fnc_canEscortCaptive.sqf b/addons/captives/functions/fnc_canEscortCaptive.sqf index cbb098881f..85bd8bbd3e 100644 --- a/addons/captives/functions/fnc_canEscortCaptive.sqf +++ b/addons/captives/functions/fnc_canEscortCaptive.sqf @@ -18,9 +18,9 @@ PARAMS_2(_unit,_target); -//Alive, handcuffed, not being escored, and not unconsious +//Alive, handcuffed, not being escored, and not unconscious (_target getVariable [QGVAR(isHandcuffed), false]) && {isNull (attachedTo _target)} && {alive _target} && -{!(_target getVariable [QGVAR(ACE_isUnconscious), false])} +{!(_target getVariable ["ACE_isUnconscious", false])} diff --git a/addons/captives/functions/fnc_canFriskPerson.sqf b/addons/captives/functions/fnc_canFriskPerson.sqf index 28a9ee0134..5eecc453d4 100644 --- a/addons/captives/functions/fnc_canFriskPerson.sqf +++ b/addons/captives/functions/fnc_canFriskPerson.sqf @@ -19,5 +19,6 @@ PARAMS_2(_unit,_target); _target getVariable [QGVAR(isHandcuffed), false] +|| {_target getVariable [QGVAR(isSurrendering), false]} || {_target getVariable ["ACE_isSearchable", false]} || {_target getVariable ["ACE_isUnconscious", false]} diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index cf03704a85..912b00662f 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -1,6 +1,6 @@ /* * Author: Nic547, commy2 - * Handcuffs a unit + * Handcuffs a unit. * * Arguments: * 0: Unit @@ -18,39 +18,38 @@ PARAMS_2(_unit,_state); - -if (!local _unit) exitWith { - ERROR("setHandcuffed unit not local"); +// We only want this function to work on local machines +if (!local _unit) exitwith { + [_this, QUOTE(FUNC(setHandcuffed)), _unit] call EFUNC(common,execRemoteFnc); + TRACE_2("running setHandcuffed on remote unit",_unit,_state); }; -if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) exitWith { - ERROR("new state equals current"); +if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) then { + LOG("setHandcuffed: current state same as new"); }; if (_state) then { _unit setVariable [QGVAR(isHandcuffed), true, true]; [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); - - // fix anim on mission start (should work on dedicated servers) - _fixAnimationFnc = { - PARAMS_1(_unit); - if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { - [_unit] call EFUNC(common,fixLoweredRifleAnimation); - [_unit, "ACE_AmovPercMstpScapWnonDnon", 0] call EFUNC(common,doAnimation); - }; - }; - - [_fixAnimationFnc, [_unit], 0.05, 0] call EFUNC(common,waitAndExecute); - _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; if (_unit == ACE_player) then { showHUD false; }; + + // fix anim on mission start (should work on dedicated servers) + [{ + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + }; + }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); if ((vehicle _unit) == _unit) then { + //Break out of hands up animation loop (doAnimation handles Unconscious prioity) [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf index 8b9d870cd5..1f0e232926 100644 --- a/addons/captives/functions/fnc_surrender.sqf +++ b/addons/captives/functions/fnc_surrender.sqf @@ -18,46 +18,57 @@ PARAMS_2(_unit,_state); -if (_state) then { - if (_unit getVariable [QGVAR(isSurrendering), false]) exitWith { - ERROR("Already Surrendering"); - }; +// We only want this function to work on local machines +if (!local _unit) exitwith { + [_this, QUOTE(FUNC(surrender)), _unit] call EFUNC(common,execRemoteFnc); + TRACE_2("running surrender on remote unit",_unit,_state); +}; +if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) then { + LOG("Surrender: current state same as new"); +}; + +if (_state) then { _unit setVariable [QGVAR(isSurrendering), true, true]; [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); - [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); if (_unit == ACE_player) then { showHUD false; }; - private "_surrenderFnc"; - _surrenderFnc = { - EXPLODE_1_PVT((_this select 0),_unit); + // fix anim on mission start (should work on dedicated servers) + [{ + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isSurrendering), false] && {vehicle _unit == _unit}) then { + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); + }; + }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); + //PFEH - (TODO: move to event system?) + [{ + EXPLODE_1_PVT((_this select 0),_unit); if (_unit getVariable [QGVAR(isSurrendering), false]) then { + //If unit dies, gets knocked out, or is handcuffed then end surrender if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { [_unit, false] call FUNC(surrender); - [(_this select 1)] call cba_fnc_removePerFrameHandler; + [(_this select 1)] call CBA_fnc_removePerFrameHandler; }; } else { [(_this select 1)] call cba_fnc_removePerFrameHandler; }; - }; - [_surrenderFnc, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; + }, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; } else { _unit setVariable [QGVAR(isSurrendering), false, true]; + [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); - if !(_unit getVariable ["ACE_isUnconscious", false]) then { - //Break out of hands up animation loop - //don't want to step on animations from medical (TODO: testing medical integration) + if ((vehicle _unit) == _unit) then { + //Break out of hands up animation loop (doAnimation handles Unconscious prioity) [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); }; - [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); - if (_unit == ACE_player) then { - //only enable if not handcuffed + //only re-enable HUD if not handcuffed if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { showHUD true; }; From fcf39a39164eeef998f71a1ee1582b937a32c515 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 6 Feb 2015 23:23:33 -0600 Subject: [PATCH 052/113] #118 Sound Effect from CSE --- .../captives/functions/fnc_doApplyHandcuffs.sqf | 3 +++ addons/captives/sounds/cable_tie_zipping.ogg | Bin 0 -> 17543 bytes 2 files changed, 3 insertions(+) create mode 100644 addons/captives/sounds/cable_tie_zipping.ogg diff --git a/addons/captives/functions/fnc_doApplyHandcuffs.sqf b/addons/captives/functions/fnc_doApplyHandcuffs.sqf index 8abf8c836c..0d15f503e8 100644 --- a/addons/captives/functions/fnc_doApplyHandcuffs.sqf +++ b/addons/captives/functions/fnc_doApplyHandcuffs.sqf @@ -19,4 +19,7 @@ PARAMS_2(_unit,_target); _unit removeItem "ACE_CableTie"; + +playSound3D [QUOTE(PATHTO_R(sounds\cable_tie_zipping.ogg)), objNull, false, (getPosASL _target), 1, 1, 10]; + ["SetHandcuffed", [_target], [_target, true]] call EFUNC(common,targetEvent); diff --git a/addons/captives/sounds/cable_tie_zipping.ogg b/addons/captives/sounds/cable_tie_zipping.ogg new file mode 100644 index 0000000000000000000000000000000000000000..4f76037eb1cd1809e68c2d977e17aedcc759f18e GIT binary patch literal 17543 zcmeIZc{r5c`#Ap07-KM)VKCOl7#ds62uYTiF?PxxD$Ag($xf*TLt_mgNoC*nP$5nB zNC<@%ilR+Qd*b(~*XR9vzdzUay1t+5`hNfVUB5GD&T^mo-1j;6x$krC=gc$vj~=xH zpuj)jo|@9>tzr+-xdr#tt$`od>MTfnU!MZ;vqFpkr=fzJcC)>Ljv;8kwv{ z(!`N9bTrj8wZ@utiUJ_v4$K#k+fOm-7F%PhhT@VO0{R@!=8@-Qt z26=gh=z-ikL2hJ_8yOei%lJDE6o?V%;TII*#s~rX=mj3vP#4;Q`5psd5#Ax8;9&Gf zk|4-4DDXHqHb#K=U)<0wWU_B)P#}c+FEJ&Wp(6x9000wjiS1>MWjFu;$e^%xckao- zTi>3YjIA`moMdm67HUn#POxu+rIlM1k|&2jSSU`zOB4WL08y?GwbqJ?)($l8@(l2gn%1$CB7&s)=Yl}fG6m8(j#ZOzplx`eLW;&~eSf%+ZCLeW4X|CRii2M!zy z2=w{`+@k!K-rs5A0469Bz$_Cp+$23REJWBbfiPunKc&;!cwNrR_JX@-Btm-?LN@a9?7fAoRY{(8a#Oi(~nr z_sx*`Wq(W2!k2jJsvdwaiKPO;ehCi{&-Xz-Pt}YQ*w=Y1|5fEp3|LCazO=pdru|=f ze~5Pr0%* zD_MDnc;B#`szw({T@^Qvet(#DrKO8E0z7V zC~#46UKv!l#2@=e%nJdnqA-r{-xqF`Fp8EL|F<~$Q5sa{zxw<~nH>&91Ug>`e|$aR z@O1dxqf>K_(%i%oy`6LaBmSK_I1^yYoc@?&HY1fhP!PY5#`|}H|FImCV9Y?K^xaH? zMKi(bf$GR7js0sH<03|&y4Z;x9v2Ot5c9UvIy|B2J>lRz72!S8=6&$`Dd)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YK0Ppy41%hwmtGEE*y+|4^W)RYVdb?A!Or(J z2O1(GBfp&i5l;ZuKmt0s(Z8b4d?T%XT_GD71aVEQcS2XcZfphFf%Wxu-PMha9h^0= d#sh*^?mYhW>(^dj^w+Nro)2IM9(xt|{{T~b6N~@= literal 0 HcmV?d00001 From 6d534e88466dfce5414f4522666600fe3fbdaadb Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 7 Feb 2015 15:20:51 -0600 Subject: [PATCH 053/113] #130 - Surrender Module Prototype --- addons/captives/CfgVehicles.hpp | 30 +++++++++++- addons/captives/XEH_preInit.sqf | 1 + addons/captives/config.cpp | 2 +- .../functions/fnc_handlePlayerChanged.sqf | 6 ++- .../functions/fnc_moduleSurrender.sqf | 46 +++++++++++++++++++ 5 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 addons/captives/functions/fnc_moduleSurrender.sqf diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 934e1215d2..d292402bcf 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -78,7 +78,7 @@ class CfgVehicles { showDisabled = 0; priority = 2.3; hotkey = "C"; - }; + }; class ACE_StartSurrenderingSelf { displayName = "$STR_ACE_Captives_StartSurrendering"; condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender)); @@ -86,7 +86,7 @@ class CfgVehicles { exceptions[] = {}; showDisabled = 0; priority = 0; - }; + }; class ACE_StopSurrenderingSelf { displayName = "$STR_ACE_Captives_StopSurrendering"; condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender)); @@ -162,4 +162,30 @@ class CfgVehicles { MACRO_ADDITEM(ACE_CableTie,12) }; }; + + + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits {}; + class ModuleDescription {}; + }; + + class GVAR(ModuleSurrender): Module_F { + author = "$STR_ACE_Common_ACETeam"; + category = "ACE"; + displayName = "Make Unit Surrender"; + function = QUOTE(DFUNC(moduleSurrender)); + scope = 2; //show in editor + scopeCurator = 2; //show in zeus + curatorCost = 0; //??? + isGlobal = 1; //run global + isTriggerActivated = 1; //Wait for triggers + // icon = QUOTE(PATHTOF(ui\todo.paa)); + functionPriority = 0; + class Arguments {}; + class ModuleDescription: ModuleDescription { + description = "Sync a unit to make them surrender.
Source: ace_captives"; + sync[] = {"AnyAI"}; + }; + }; }; diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index a98bf73443..75ee77e9bc 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -23,6 +23,7 @@ PREP(handleKnockedOut); PREP(handlePlayerChanged); PREP(handleUnitInitPost); PREP(handleWokeUp); +PREP(moduleSurrender); PREP(setHandcuffed); PREP(surrender); PREP(vehicleCaptiveMoveIn); diff --git a/addons/captives/config.cpp b/addons/captives/config.cpp index c0a34e3222..27b7c4ec60 100644 --- a/addons/captives/config.cpp +++ b/addons/captives/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {}; + units[] = {QGVAR(ModuleSurrender)}; weapons[] = {"ACE_CableTie"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ACE_Interaction"}; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index 9c4f02546f..13e284ef80 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -18,8 +18,10 @@ PARAMS_2(_newUnit,_oldUnit); -if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then { - showHUD false; +if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then { + TRACE_1("Player Change (showHUD false)",_newUnit); + showHUD false; } else { + TRACE_1("Player Change (showHUD true)",_newUnit); showHUD true; }; diff --git a/addons/captives/functions/fnc_moduleSurrender.sqf b/addons/captives/functions/fnc_moduleSurrender.sqf new file mode 100644 index 0000000000..5cbf43aacc --- /dev/null +++ b/addons/captives/functions/fnc_moduleSurrender.sqf @@ -0,0 +1,46 @@ +/* + * Author: PabstMirror + * Module Function to make a unit surrender (can be called from editor, or placed with zeus) + * + * Arguments: + * 0: The Module Logic Object + * 1: synced objects + * 2: Activated + * + * Return Value: + * Nothing + * + * Example: + * Called from module + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_3(_logic,_units,_activated); + +if (!_activated) exitWith {}; + +if (local _logic) then { + if ((!isnull curatorcamera) && {((count curatorMouseOver) == 2) && {(curatorMouseOver select 1) == _logic}}) then {//in zeus interface and we placed the module + _bisMouseOver = missionNamespace getVariable ["bis_fnc_curatorObjectPlaced_mouseOver", []];//bis caches the previous curatorMouseOver + if ((count _bisMouseOver) == 2) then {//check what mouse was over before the module was placed + _mouseOverObject = _bisMouseOver select 1; + if ((_mouseOverObject isKindOf "CAManBase") && {(vehicle _mouseOverObject) == _mouseOverObject}) then { + systemChat format ["Debug - module surrendering %1", (name _mouseOverObject)]; + [_mouseOverObject, true] call FUNC(surrender); + } else { + systemChat format ["Only use on dismounted inf"]; + }; + } else { + systemChat format ["Nothing under mouse"]; + }; + } else {//an editor module + { + systemChat format ["Debug - module surrendering %1", (name _x)]; + [_x, true] call FUNC(surrender); + } forEach _units; + }; + + deleteVehicle _logic; +}; From 3f6ffa6ac2eb4d425005afc75c7de260d1213f5a Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 8 Feb 2015 13:48:53 -0600 Subject: [PATCH 054/113] Mag Repack - Keep Progress prototype Ideas from AGM and CSE Keeps Progress While Repacking if interrupted Added sounds from CSE --- addons/magazinerepack/CfgEventHandlers.hpp | 1 - addons/magazinerepack/CfgSounds.hpp | 15 +++ addons/magazinerepack/CfgVehicles.hpp | 29 +++-- addons/magazinerepack/README.md | 2 +- addons/magazinerepack/XEH_preInit.sqf | 5 +- addons/magazinerepack/config.cpp | 1 + .../functions/fnc_magazineRepack.sqf | 77 ------------- .../functions/fnc_magazineRepackCallback.sqf | 106 ------------------ .../functions/fnc_magazineRepackProgress.sqf | 70 ++++++++++++ .../functions/fnc_openSelectMagazineUI.sqf | 69 +++++++----- .../functions/fnc_simulateRepackEvents.sqf | 52 +++++++++ .../functions/fnc_startRepackingMagazine.sqf | 39 +++++++ addons/magazinerepack/script_component.hpp | 2 + .../sounds/magrepack_finished.wav | Bin 0 -> 152166 bytes .../sounds/magrepack_single.wav | Bin 0 -> 95466 bytes 15 files changed, 235 insertions(+), 233 deletions(-) create mode 100644 addons/magazinerepack/CfgSounds.hpp delete mode 100644 addons/magazinerepack/functions/fnc_magazineRepack.sqf delete mode 100644 addons/magazinerepack/functions/fnc_magazineRepackCallback.sqf create mode 100644 addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf create mode 100644 addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf create mode 100644 addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf create mode 100644 addons/magazinerepack/sounds/magrepack_finished.wav create mode 100644 addons/magazinerepack/sounds/magrepack_single.wav diff --git a/addons/magazinerepack/CfgEventHandlers.hpp b/addons/magazinerepack/CfgEventHandlers.hpp index f0a9f14d91..b928bc2de6 100644 --- a/addons/magazinerepack/CfgEventHandlers.hpp +++ b/addons/magazinerepack/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/magazinerepack/CfgSounds.hpp b/addons/magazinerepack/CfgSounds.hpp new file mode 100644 index 0000000000..bc1d0fe0ee --- /dev/null +++ b/addons/magazinerepack/CfgSounds.hpp @@ -0,0 +1,15 @@ +class CfgSounds +{ + class GVAR(soundMagazineFinished) + { + name = QGVAR(soundMagazineFinished); + sound[]={QUOTE(PATHTOF(sounds\magrepack_finished.wav)),1,1}; + titles[]={}; + }; + class GVAR(soundRoundFinished) + { + name = QGVAR(soundRoundFinished); + sound[] = {QUOTE(PATHTOF(sounds\magrepack_single.wav)),1,1}; + titles[] = {}; + }; +}; \ No newline at end of file diff --git a/addons/magazinerepack/CfgVehicles.hpp b/addons/magazinerepack/CfgVehicles.hpp index ecb732f8fd..acd1c76c3d 100644 --- a/addons/magazinerepack/CfgVehicles.hpp +++ b/addons/magazinerepack/CfgVehicles.hpp @@ -1,18 +1,17 @@ - class CfgVehicles { - class Man; - class CAManBase: Man { - class ACE_SelfActions { - class ACE_RepackMagazines { - displayName = "$STR_ACE_MagazineRepack_RepackMagazines"; - condition = QUOTE(true); - statement = QUOTE([_player] call FUNC(magazineRepack)); - showDisabled = 0; - priority = -2; - icon = PATHTOF(UI\repack_ca.paa); - hotkey = "R"; - enableInside = 1; - }; + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_RepackMagazines { + displayName = "$STR_ACE_MagazineRepack_RepackMagazines"; + condition = QUOTE(true); + statement = QUOTE([_player] call FUNC(openSelectMagazineUI)); + showDisabled = 0; + priority = -2; + icon = QUOTE(PATHTOF(UI\repack_ca.paa)); + hotkey = "R"; + enableInside = 1; + }; + }; }; - }; }; diff --git a/addons/magazinerepack/README.md b/addons/magazinerepack/README.md index 49a3c9d531..28b7c3115a 100644 --- a/addons/magazinerepack/README.md +++ b/addons/magazinerepack/README.md @@ -3,10 +3,10 @@ ace_magazinerepack Adds the ability to consolidate multiple half-empty magazines. - ## Maintainers The people responsible for merging changes to this component or answering potential questions. - [commy2](https://github.com/commy2) - [esteldunedain](https://github.com/esteldunedain) +- [PabstMirror](https://github.com/PabstMirror) diff --git a/addons/magazinerepack/XEH_preInit.sqf b/addons/magazinerepack/XEH_preInit.sqf index 5caba1ffac..e2dfd721f3 100644 --- a/addons/magazinerepack/XEH_preInit.sqf +++ b/addons/magazinerepack/XEH_preInit.sqf @@ -2,8 +2,9 @@ ADDON = false; -PREP(magazineRepack); -PREP(magazineRepackCallback); +PREP(magazineRepackProgress); PREP(openSelectMagazineUI); +PREP(simulateRepackEvents); +PREP(startRepackingMagazine); ADDON = true; diff --git a/addons/magazinerepack/config.cpp b/addons/magazinerepack/config.cpp index 5f2c6edc7d..2df0d62bff 100644 --- a/addons/magazinerepack/config.cpp +++ b/addons/magazinerepack/config.cpp @@ -13,6 +13,7 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgSounds.hpp" #include "CfgVehicles.hpp" class ACE_Parameters_Numeric { diff --git a/addons/magazinerepack/functions/fnc_magazineRepack.sqf b/addons/magazinerepack/functions/fnc_magazineRepack.sqf deleted file mode 100644 index 472b80e2bd..0000000000 --- a/addons/magazinerepack/functions/fnc_magazineRepack.sqf +++ /dev/null @@ -1,77 +0,0 @@ -// by commy2, esteldunedain -#include "script_component.hpp" - -private ["_unit", "_magazines", "_ammos", "_repackTime", "_magazine", "_ammo", "_count", "_index", "_i", "_j", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; - -_unit = _this select 0; - -_magazines = []; -_ammos = []; -_repackTime = []; - -// get all mags and ammo count -{ - _magazine = _x select 0; - _ammo = _x select 1; - - _count = getNumber (configfile >> "CfgMagazines" >> _magazine >> "count"); - - if (_ammo != _count && {_count > 1}) then { // additional checks here - if !(_magazine in _magazines) then { - _index = count _magazines; - _magazines set [_index, _magazine]; - _ammos set [_index, [_ammo]]; - } else { - _index = _magazines find _magazine; - _ammos set [_index, (_ammos select _index) + [_ammo]]; - }; - }; -} forEach magazinesAmmoFull _unit; - -// Remove invalid magazines -{ - if (count _x < 2) then { - _magazines set [_forEachIndex, -1]; - _ammos set [_forEachIndex, [-1]]; - }; -} forEach _ammos; -_magazines = _magazines - [-1]; -_ammos = _ammos - [[-1]]; - -{ - // Calculate actual ammo to transfer during repack - _count = getNumber (configfile >> "CfgMagazines" >> (_magazines select _forEachIndex) >> "count"); - - // Sort Ascending - _list = _x call BIS_fnc_sortNum; - - ["MagazineRepack", _list] call EFUNC(common,log); - - _i = 0; - _j = count _x - 1; - _ammoToTransfer = 0; - _ammoAvailable = 0; - while {_i < _j} do { - _ammoNeeded = _count - (_list select _j); - _exit = false; - while {_i < _j && {!_exit}} do { - _ammoAvailable = _list select _i; - if (_ammoAvailable >= _ammoNeeded) then { - _list set [_i, _ammoAvailable - _ammoNeeded]; - _ammoToTransfer = _ammoToTransfer + _ammoNeeded; - _exit = true; - } else { - _ammoNeeded = _ammoNeeded - _ammoAvailable; - _ammoToTransfer = _ammoToTransfer + _ammoAvailable; - _i = _i + 1; - }; - }; - _j = _j - 1; - }; - - _repackTime set [_forEachIndex, _ammoToTransfer * GVAR(TimePerAmmo) + (count _x) * GVAR(TimePerMagazine)]; -} forEach _ammos; - -["MagazineRepack", [_magazines, _repackTime]] call EFUNC(common,log); - -[_unit, _magazines, _repackTime] call FUNC(openSelectMagazineUI); diff --git a/addons/magazinerepack/functions/fnc_magazineRepackCallback.sqf b/addons/magazinerepack/functions/fnc_magazineRepackCallback.sqf deleted file mode 100644 index f209806f9c..0000000000 --- a/addons/magazinerepack/functions/fnc_magazineRepackCallback.sqf +++ /dev/null @@ -1,106 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_unit", "_magazine", "_ammo", "_ammoCount", "_fullMagazinesCount", "_restAmmo", "_isLoaded", "_weapon", "_reloadAction", "_text", "_picture"]; - -_unit = ACE_player; //_this select 0; -_magazine = _this select 1; - -// exit if the last magazine of this type was taken out of the backpack -if !(_magazine in magazines _unit) exitWith {}; - -// get current ammo count -_ammo = 0; -{ - if (_x select 0 == _magazine) then { - _ammo = _ammo + (_x select 1); - }; -} forEach magazinesAmmoFull _unit; - -// how many rounds fit in one mag -_ammoCount = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count"); - -// calculate new vaules -_fullMagazinesCount = floor (_ammo / _ammoCount); -_restAmmo = _ammo - _fullMagazinesCount * _ammoCount; - -// remove old magazines -_unit removeMagazines _magazine; - -_isLoaded = false; -// reload rifle -if (_magazine in primaryWeaponMagazine _unit) then { - _weapon = primaryWeapon _unit; - - if (_fullMagazinesCount > 0) then { - _unit setAmmo [_weapon, _ammoCount]; - _fullMagazinesCount = _fullMagazinesCount - 1; - } else { - _unit setAmmo [_weapon, _restAmmo]; - _restAmmo = 0; - }; - - if (_weapon == currentWeapon _unit) then { - _reloadAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); - _unit playActionNow _reloadAction; - }; - - _isLoaded = true; -}; - -// reload pistol -if (_magazine in handgunMagazine _unit) then { - _weapon = handgunWeapon _unit; - - if (_fullMagazinesCount > 0) then { - _unit setAmmo [_weapon, _ammoCount]; - _fullMagazinesCount = _fullMagazinesCount - 1; - } else { - _unit setAmmo [_weapon, _restAmmo]; - _restAmmo = 0; - }; - - if (_weapon == currentWeapon _unit) then { - _reloadAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); - _unit playActionNow _reloadAction; - }; - - _isLoaded = true; -}; - -// reload rocket launcher (just in case ...) -if (_magazine in secondaryWeaponMagazine _unit) then { - _weapon = secondaryWeapon _unit; - - if (_fullMagazinesCount > 0) then { - _unit setAmmo [_weapon, _ammoCount]; - _fullMagazinesCount = _fullMagazinesCount - 1; - } else { - _unit setAmmo [_weapon, _restAmmo]; - _restAmmo = 0; - }; - - if (_weapon == currentWeapon _unit) then { - _reloadAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); - _unit playActionNow _reloadAction; - }; - - _isLoaded = true; -}; - -// add new magazines -for "_a" from 1 to _fullMagazinesCount do { - _unit addMagazine _magazine; -}; - -if (_restAmmo > 0) then { - _unit addMagazine [_magazine, _restAmmo]; -}; - -// display text if successful -_text = format [localize "STR_ACE_MagazineRepack_RepackedMagazinesDetail", [_fullMagazinesCount, _fullMagazinesCount + 1] select _isLoaded, _restAmmo]; -_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); - -_text = parseText format ["
%2
%3", _picture, localize "STR_ACE_MagazineRepack_RepackedMagazines", _text]; - -[_text] call EFUNC(common,displayTextStructured); diff --git a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf new file mode 100644 index 0000000000..f965305eda --- /dev/null +++ b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf @@ -0,0 +1,70 @@ +// by commy2, esteldunedain +#include "script_component.hpp" + +PARAMS_3(_args,_elapsedTime,_totalTime); +EXPLODE_3_PVT(_args,_magazineClassname,_lastAmmoCount,_simEvents); + +if ((count _simEvents) == 0) exitWith {ERROR("No Event"); false}; +EXPLODE_3_PVT((_simEvents select 0),_nextEventTime,_nextEventType,_nextEventMags); + + + +if (_nextEventTime > _elapsedTime) exitWith {true};//waiting on next event +systemChat format ["Event %1-%2-%3", _nextEventTime,_nextEventType,_nextEventMags]; + + +//Verify we aren't missing any ammo +_currentAmmoCount = []; +{ + EXPLODE_2_PVT(_x,_xClassname,_xCount); + if (_xClassname == _magazineClassname) then { + _currentAmmoCount pushBack _xCount; + }; +} forEach (magazinesAmmo ACE_player); //only inventory mags + +_addedMagazines = +_currentAmmoCount; +_missingAmmo = false; +{ + if (_x > 0) then { + _index = _addedMagazines find _x; + if (_index != -1) then { + _addedMagazines deleteAt _index; + } else { + _missingAmmo = true; + }; + }; +} forEach _lastAmmoCount; + +if (_missingAmmo) exitWith {false}; //something removed ammo that was being repacked +if ((count _addedMagazines) > 0) then { + TRACE_1("Added Magazine While Repacking",_addedMagazines); +}; + +_updateMagazinesOnPlayer = { + systemChat format ["Updating mags"]; + _newMagazineList = _addedMagazines + _nextEventMags; + ACE_player removeMagazines _magazineClassname; + { + if (_x > 0) then { + ACE_player addMagazine [_magazineClassname, _x]; + }; + } forEach _newMagazineList; + _args set [1, _nextEventMags]; +}; + + +if (_nextEventType == 0) then { + systemChat "reloading bullet"; + playSound QGVAR(soundMagazineFinished); + if (((count _simEvents) % 3) == 0) then { + call _updateMagazinesOnPlayer; + }; +} else { + systemChat "Moving to next mag"; + playSound QGVAR(soundRoundFinished); + call _updateMagazinesOnPlayer; +}; + +_simEvents deleteAt 0; //pop off the event + +true; diff --git a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf index b1a31c266c..931a0149cf 100644 --- a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf +++ b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf @@ -1,40 +1,47 @@ -// by commy2 +// by commy2, esteldunedain #include "script_component.hpp" -private ["_unit", "_magazines", "_repackTime", "_listIDC", "_count", "_index", "_magazine", "_time", "_displayName", "_picture"]; +private ["_unit", "_magazines", "_ammos", "_repackTime", "_magazine", "_ammo", "_count", "_index", "_i", "_j", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; -_unit = _this select 0; -_magazines = _this select 1; -_repackTime = _this select 2; +PARAMS_1(_unit); -_count = count _magazines; +_unitMagazines = []; +_unitMagCounts = []; + +// get all mags and ammo count +{ + _xClassname = _x select 0; + _xCount = _x select 1; + _fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _xClassname >> "count"); + + if ((_xCount != _fullMagazineCount) && {_xCount > 1}) then {//for every partial magazine + _index = _unitMagazines find _xClassname; + if (_index == -1) then { + _unitMagazines pushBack _xClassname; + _unitMagCounts pushBack [_xCount]; + } else { + (_unitMagCounts select _index) pushBack _xCount; + }; + }; +} forEach magazinesAmmoFull _unit; _actions = [localize "STR_ACE_MagazineRepack_SelectMagazineMenu", localize "STR_ACE_MagazineRepack_SelectMagazine"] call EFUNC(interaction,prepareSelectMenu); -for "_index" from 0 to (_count - 1) do { - _magazine = _magazines select _index; - _time = _repackTime select _index; - _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "displayName"); - _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); - _actions = [ - _actions, - _displayName, - _picture, - [str _unit, _magazine, _time] - ] call EFUNC(interaction,addSelectableItem); -}; + +systemChat format ["%1 - %2", _unitMagazines, _unitMagCounts]; + +{ + if ((count (_unitMagCounts select _forEachIndex)) >= 2) then {// Ignore invalid magazines types (need 2+ partial mags to do anything) + _displayName = getText (configFile >> "CfgMagazines" >> _x >> "displayName"); + _picture = getText (configFile >> "CfgMagazines" >> _x >> "picture"); + _actions = [_actions, _displayName, _picture, _x] call EFUNC(interaction,addSelectableItem); + }; +} forEach _unitMagazines; [ - _actions, - { - _data = _this; - call EFUNC(interaction,hideMenu); - if (isNil "_data") exitWith {}; - _data set [2, [_data select 2] call EFUNC(common,toNumber)]; - [(_data select 2), _data, {(_this select 0) call FUNC(magazineRepackCallback)}, {}, (localize "STR_ACE_MagazineRepack_RepackingMagazine")] call EFUNC(common,progressBar); - [ACE_player] call EFUNC(common,goKneeling); - }, - { - call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; - } +_actions, +{ [ACE_player, _this] call FUNC(startRepackingMagazine); }, +{ + call EFUNC(interaction,hideMenu); + if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; +} ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf new file mode 100644 index 0000000000..9df248bd6c --- /dev/null +++ b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf @@ -0,0 +1,52 @@ +#include "script_component.hpp" + +private ["_fullMagazineCount", "_magazines", "_newMag", "_time", "_events", "_swapAmmo", "_ammoSwaped", "_lowIndex", "_highIndex", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; + +PARAMS_2(_magazineClassname,_arrayOfAmmoCounts); + +// Calculate actual ammo to transfer during repack +_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); + +// Sort Ascending - Don't modify orginal +_arrayOfAmmoCounts = (+_arrayOfAmmoCounts) call BIS_fnc_sortNum; + +_newMag = { + _time = _time + GVAR(TimePerMagazine); + _events pushBack [_time, 1, +_arrayOfAmmoCounts]; +}; +_swapAmmo = { + for "_swapProgress" from 1 to _ammoSwaped do { + _time = _time + GVAR(TimePerAmmo); + _arrayOfAmmoCounts set [_lowIndex, ((_arrayOfAmmoCounts select _lowIndex) - 1)]; + _arrayOfAmmoCounts set [_highIndex, ((_arrayOfAmmoCounts select _highIndex) + 1)]; + _events pushBack [_time, 0, +_arrayOfAmmoCounts]; + }; +}; + +_lowIndex = 0; +_highIndex = (count _arrayOfAmmoCounts) - 1; +_ammoToTransfer = 0; +_ammoAvailable = 0; + +_time = 0; +_events = []; + +while {_lowIndex < _highIndex} do { + _ammoNeeded = _fullMagazineCount - (_arrayOfAmmoCounts select _highIndex); + _ammoAvailable = _arrayOfAmmoCounts select _lowIndex; + + if (_ammoAvailable == 0) then { + _lowIndex = _lowIndex + 1; + call _newMag; + } else { + if (_ammoNeeded == 0) then { + _highIndex = _highIndex - 1; + call _newMag; + } else { + _ammoSwaped = _ammoAvailable min _ammoNeeded; + call _swapAmmo; + }; + }; +}; + +_events diff --git a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf new file mode 100644 index 0000000000..8e5075e17e --- /dev/null +++ b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf @@ -0,0 +1,39 @@ +// by commy2, esteldunedain +#include "script_component.hpp" + +private ["_unit", "_magazines", "_ammos", "_repackTime", "_magazine", "_ammo", "_count", "_index", "_i", "_j", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; + +PARAMS_2(_unit,_magazineClassname); +if (isNil "_magazineClassname" || {_magazineClassname == ""}) exitWith {ERROR("Bad Mag Classname");}; + +[_unit] call EFUNC(common,goKneeling); +call EFUNC(interaction,hideMenu); + +_startingAmmoCounts = []; +{ + EXPLODE_4_PVT(_x,_xClassname,_xCount,_xLoaded,_xType); + if (_xClassname == _magazineClassname) then { + if (_xLoaded) then { + //Try to Remove from weapon and add to inventory, otherwise ignore + if (_unit canAdd _magazineClassname) then { + switch (_xType) do { + case (1): {_unit removePrimaryWeaponItem _magazineClassname;}; + case (2): {_unit removeHandgunItem _magazineClassname;}; + case (4): {_unit removeSecondaryWeaponItem _magazineClassname;}; + default {ERROR("Loaded Location Invalid");}; + }; + _unit addMagazine [_magazineClassname, _xCount]; + _startingAmmoCounts pushBack _xCount; + }; + } else { + _startingAmmoCounts pushBack _xCount; + }; + }; +} forEach (magazinesAmmoFull _unit); + +if ((count _startingAmmoCounts) == 0) exitwith {ERROR("No Mags");}; + +_simEvents = [_magazineClassname, _startingAmmoCounts] call FUNC(simulateRepackEvents); +_totalTime = (_simEvents select ((count _simEvents) - 1) select 0); + +[_totalTime, [_magazineClassname, _startingAmmoCounts, _simEvents], {hint "done"}, {hint "fail"}, (localize "STR_ACE_MagazineRepack_RepackingMagazine"), {_this call FUNC(magazineRepackProgress)}] call EFUNC(common,progressBar); diff --git a/addons/magazinerepack/script_component.hpp b/addons/magazinerepack/script_component.hpp index 7b390f7126..15563f0fe8 100644 --- a/addons/magazinerepack/script_component.hpp +++ b/addons/magazinerepack/script_component.hpp @@ -1,3 +1,5 @@ +#define DEBUG_MODE_FULL + #define COMPONENT magazinerepack #include "\z\ace\addons\main\script_mod.hpp" diff --git a/addons/magazinerepack/sounds/magrepack_finished.wav b/addons/magazinerepack/sounds/magrepack_finished.wav new file mode 100644 index 0000000000000000000000000000000000000000..ab73615a558f3aa60f97dfa47d6bd0773e40f4b0 GIT binary patch literal 152166 zcmdSi2b3Ju)i3(4>Yf>m21$q@k^q4KlSR%shzufph%CT>0RuJ$42YbK4H&RNfHA=& zfe8i-m|%&Vj0qCK1Y3Y4BqRhVOzQ5ce*4#UeM^gl?a%kVd*6EfUu(LjyXu^Mc0T)@ zs@iL(;lmHvD=m%Odf)AjI{xG#3zkZyq?DGnySG$Y@WHfHDJ@t!;;@qs`~9A2{PKVI z)%eHj|75R8jP~EXkWm~n|L5Yn|F7Qv!Jhwq`*(C0>;DwVm0KRe#*KRs{$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f!W*NK5grBZm%EQrR^RLbL~I2KIg$6E8(d<26t}0{j+V)-dtzUYpu^VnA-N< z+lDV%lZV!>q0ydadtL+A==F~)?0GFdA)Xp|YT&7Xrv{!HcxvFOfu{zZ8hC2psez{k zo*H;+;HiP92A&#tYT&7Xrv{!HcxvFOfu{zZ8hC2psez{ko*H;+;HiP92A&#tYT&7X zrv{!HcxvFOfu{zZ8hC2psez{ko*H;+;HiPnTLb^5r|Z~f8_e)!9OaqIoy?|uL8 i|KNw;|K&fs^}qj1U;pr5|C?X?_22mV7k=TZul^rOd=6{? literal 0 HcmV?d00001 diff --git a/addons/magazinerepack/sounds/magrepack_single.wav b/addons/magazinerepack/sounds/magrepack_single.wav new file mode 100644 index 0000000000000000000000000000000000000000..5d94e215fdf9894487afb000569c829a903484d8 GIT binary patch literal 95466 zcmagn37q9sbtmw8ud1thrJJ1)Vo+oeMR3ayjS)~p;+B{Q?h1-x5`%F8Bq*{Ol}W%j zAFlr?XYToY>i+-to_qFl z?*0G&uicDjq6BE6O{>0-xJ~6TG>i)#k#JY(Wo${(v zjxHQ+pMqa5{&I0k!KQ+JC-$81`0axI3r;F{ zNx?%3`UQ6_-nIC{g4GkNCw`~kw#C~P&nkFB!36~`Ecigdbp+-qX5ku1-jc>csQ3dn=!{R@sLcu>I~6+Efn$pz;Z zoKrylor^n1{H|HNX7T$4|50##0sh}AK>yZ)URm$K1rIHFbb)@)g89Yy#a|Unl||8h zLIHUu3x2%#5cwlMT zo7k{8hP4xGM|OO~#3LpiSHO;9)L!QU6W zy?|byEcj5tM+^Q(!8-~rEqHGMTaZuOkmkA~4xKo);1dP^tKhu_Zz~XQ_T>Q@wKQge9SQqnR=}QIpt4-#Z3i$580``~7Hy6lXw8cN)(OC^8t84M~l>+vH1AK6K~l1H4-U(T|b*kU)a^T!2p_OA-~TU^mm9H>9W)Xb+8urqs- z`JW2-0bey%zK~7-&jtUpfXx3`z@~s6;-9VIv9J0-Z+=frCf_3q9#-I*+~SWck&*1; zk?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i servers or HC --- addons/common/XEH_postInit.sqf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index a645d48293..0767e42737 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -2,7 +2,9 @@ #include "script_component.hpp" // Load settings from profile -call FUNC(loadSettingsFromProfile); +if (hasInterface) then { + call FUNC(loadSettingsFromProfile); +}; // Listens for global "SettingChanged" events, to update the force status locally ["SettingChanged", { From 8a26fbc95716c50584bf8ab5dc6143f99949401c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 8 Feb 2015 18:36:00 -0300 Subject: [PATCH 056/113] ace_settings: remove debug stuff --- addons/common/functions/fnc_setSetting.sqf | 1 - addons/common/functions/fnc_setSettingFromConfig.sqf | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_setSetting.sqf b/addons/common/functions/fnc_setSetting.sqf index 5b6f7945b5..ae4b1d6655 100644 --- a/addons/common/functions/fnc_setSetting.sqf +++ b/addons/common/functions/fnc_setSetting.sqf @@ -39,7 +39,6 @@ if (_settingData select 6) exitWith {}; _failed = false; if ((typeName _value) != (_settingData select 1)) then { _failed = true; - diag_log (typeName _value); if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") then { // If value is not 0 or 1 consider it invalid and don't set anything if (_value == 0) then { diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index 6054942485..4151f3e0e4 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -18,7 +18,7 @@ _fnc_getValueWithType = { EXPLODE_2_PVT(_this,_optionEntry,_typeName); _value = getNumber (_optionEntry >> "value"); - diag_log text format ["%1 %2: %3", configName _optionEntry, _typeName, _value]; + TRACE_3("_fnc_getValueWithType:", configName _optionEntry, _typeName, _value); if (_typeName == "BOOL") exitWith { _value > 0 }; From e770a74630ccde688abee32e8a47728a1b9b7bba Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 8 Feb 2015 16:36:58 -0600 Subject: [PATCH 057/113] Headers --- .../functions/fnc_magazineRepackProgress.sqf | 49 +++++++++++-------- .../functions/fnc_openSelectMagazineUI.sqf | 30 ++++++++---- .../functions/fnc_simulateRepackEvents.sqf | 43 ++++++++++------ .../functions/fnc_startRepackingMagazine.sqf | 34 ++++++++++--- 4 files changed, 106 insertions(+), 50 deletions(-) diff --git a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf index f965305eda..3c829a8933 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf @@ -1,17 +1,31 @@ -// by commy2, esteldunedain +/* + * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) + * Handles each frame durring the repack progressBar. + * On each event (repacked bullet or move to new mag) it plays a sound and syncs up the new magazines to the player. + * + * Arguments: + * 0: Arguments [classname,lastAmmoStatus,events] + * 1: Elapsed Time + * 2: Total Time Repacking Will Take + * + * Return Value: + * Keep going (on missing mags return false) + * + * Example: + * (args from progressBar) call ace_magazinerepack_fnc_magazineRepackProgress + * + * Public: No + */ #include "script_component.hpp" +private ["_currentAmmoCount", "_addedMagazines", "_missingAmmo", "_index", "_updateMagazinesOnPlayerFnc"]; + PARAMS_3(_args,_elapsedTime,_totalTime); EXPLODE_3_PVT(_args,_magazineClassname,_lastAmmoCount,_simEvents); - if ((count _simEvents) == 0) exitWith {ERROR("No Event"); false}; -EXPLODE_3_PVT((_simEvents select 0),_nextEventTime,_nextEventType,_nextEventMags); - - +EXPLODE_3_PVT((_simEvents select 0),_nextEventTime,_nextEventIsBullet,_nextEventMags); if (_nextEventTime > _elapsedTime) exitWith {true};//waiting on next event -systemChat format ["Event %1-%2-%3", _nextEventTime,_nextEventType,_nextEventMags]; - //Verify we aren't missing any ammo _currentAmmoCount = []; @@ -40,29 +54,24 @@ if ((count _addedMagazines) > 0) then { TRACE_1("Added Magazine While Repacking",_addedMagazines); }; -_updateMagazinesOnPlayer = { - systemChat format ["Updating mags"]; - _newMagazineList = _addedMagazines + _nextEventMags; - ACE_player removeMagazines _magazineClassname; +_updateMagazinesOnPlayerFnc = { + ACE_player removeMagazines _magazineClassname; //remove inventory magazines { if (_x > 0) then { ACE_player addMagazine [_magazineClassname, _x]; }; - } forEach _newMagazineList; - _args set [1, _nextEventMags]; + } forEach (_addedMagazines + _nextEventMags); + _args set [1, _nextEventMags]; //store the new magazine }; - -if (_nextEventType == 0) then { - systemChat "reloading bullet"; +if (_nextEventIsBullet) then { playSound QGVAR(soundMagazineFinished); - if (((count _simEvents) % 3) == 0) then { - call _updateMagazinesOnPlayer; + if ((((count _simEvents) % 3) == 0) || {(count _simEvents) == 1}) then { + call _updateMagazinesOnPlayerFnc; }; } else { - systemChat "Moving to next mag"; playSound QGVAR(soundRoundFinished); - call _updateMagazinesOnPlayer; + call _updateMagazinesOnPlayerFnc; }; _simEvents deleteAt 0; //pop off the event diff --git a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf index 931a0149cf..9d99ad56b5 100644 --- a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf +++ b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf @@ -1,7 +1,22 @@ -// by commy2, esteldunedain +/* + * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) + * Opens the selectMenu UI to chose which magazine to repack. + * Only shows classnames that have 2+ partial magazines + * + * Arguments: + * 0: Unit (player) + * + * Return Value: + * Nothing + * + * Example: + * [_player] call ace_magazinerepack_fnc_openSelectMagazineUI + * + * Public: No + */ #include "script_component.hpp" -private ["_unit", "_magazines", "_ammos", "_repackTime", "_magazine", "_ammo", "_count", "_index", "_i", "_j", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; +private ["_unitMagazines", "_unitMagCounts", "_xFullMagazineCount", "_index", "_actions", "_displayName", "_picture"]; PARAMS_1(_unit); @@ -10,11 +25,10 @@ _unitMagCounts = []; // get all mags and ammo count { - _xClassname = _x select 0; - _xCount = _x select 1; - _fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _xClassname >> "count"); + EXPLODE_2_PVT(_x,_xClassname,_xCount); + _xFullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _xClassname >> "count"); - if ((_xCount != _fullMagazineCount) && {_xCount > 1}) then {//for every partial magazine + if ((_xCount != _xFullMagazineCount) && {_xCount > 0}) then {//for every partial magazine _index = _unitMagazines find _xClassname; if (_index == -1) then { _unitMagazines pushBack _xClassname; @@ -27,8 +41,6 @@ _unitMagCounts = []; _actions = [localize "STR_ACE_MagazineRepack_SelectMagazineMenu", localize "STR_ACE_MagazineRepack_SelectMagazine"] call EFUNC(interaction,prepareSelectMenu); -systemChat format ["%1 - %2", _unitMagazines, _unitMagCounts]; - { if ((count (_unitMagCounts select _forEachIndex)) >= 2) then {// Ignore invalid magazines types (need 2+ partial mags to do anything) _displayName = getText (configFile >> "CfgMagazines" >> _x >> "displayName"); @@ -39,7 +51,7 @@ systemChat format ["%1 - %2", _unitMagazines, _unitMagCounts]; [ _actions, -{ [ACE_player, _this] call FUNC(startRepackingMagazine); }, +{ [_this] call FUNC(startRepackingMagazine); }, { call EFUNC(interaction,hideMenu); if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; diff --git a/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf index 9df248bd6c..2b8b383a9a 100644 --- a/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf +++ b/addons/magazinerepack/functions/fnc_simulateRepackEvents.sqf @@ -1,25 +1,40 @@ +/* + * Author: PabstMirror + * Simulates repacking a set of magazines. + * Returns the timing and magazines counts at every stage. + * + * Arguments: + * 0: How many rounds in a full magazine + * 1: Array of rounds in magazines + * + * Return Value: + * Array in format [time, isBullet, array of ammo counts] + * + * Example: + * [5, [1,2,3,8]] call ace_magazinerepack_fnc_simulateRepackEvents = + * [[1.5,true,[0,2,3,9]],[3.5,false,[0,2,3,9]],[5,true,[0,1,3,10]],[7,false,[0,1,3,10]],[8.5,true,[0,0,4,10]],[10.5,false,[0,0,4,10]]] + * + * Public: No + */ #include "script_component.hpp" -private ["_fullMagazineCount", "_magazines", "_newMag", "_time", "_events", "_swapAmmo", "_ammoSwaped", "_lowIndex", "_highIndex", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; +private ["_newMagFnc", "_time", "_events", "_swapAmmoFnc", "_ammoSwaped", "_lowIndex", "_highIndex", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; -PARAMS_2(_magazineClassname,_arrayOfAmmoCounts); +PARAMS_2(_fullMagazineCount,_arrayOfAmmoCounts); -// Calculate actual ammo to transfer during repack -_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); - -// Sort Ascending - Don't modify orginal +// Sort Ascending - Don't modify original _arrayOfAmmoCounts = (+_arrayOfAmmoCounts) call BIS_fnc_sortNum; -_newMag = { +_newMagFnc = { _time = _time + GVAR(TimePerMagazine); - _events pushBack [_time, 1, +_arrayOfAmmoCounts]; + _events pushBack [_time, false, +_arrayOfAmmoCounts]; }; -_swapAmmo = { - for "_swapProgress" from 1 to _ammoSwaped do { +_swapAmmoFnc = { + for "_swapProgress" from 0 to (_ammoSwaped - 1) do { _time = _time + GVAR(TimePerAmmo); _arrayOfAmmoCounts set [_lowIndex, ((_arrayOfAmmoCounts select _lowIndex) - 1)]; _arrayOfAmmoCounts set [_highIndex, ((_arrayOfAmmoCounts select _highIndex) + 1)]; - _events pushBack [_time, 0, +_arrayOfAmmoCounts]; + _events pushBack [_time, true, +_arrayOfAmmoCounts]; }; }; @@ -37,14 +52,14 @@ while {_lowIndex < _highIndex} do { if (_ammoAvailable == 0) then { _lowIndex = _lowIndex + 1; - call _newMag; + call _newMagFnc; } else { if (_ammoNeeded == 0) then { _highIndex = _highIndex - 1; - call _newMag; + call _newMagFnc; } else { _ammoSwaped = _ammoAvailable min _ammoNeeded; - call _swapAmmo; + call _swapAmmoFnc; }; }; }; diff --git a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf index 8e5075e17e..c93a1bad59 100644 --- a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf +++ b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf @@ -1,18 +1,38 @@ -// by commy2, esteldunedain +/* + * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) + * Starts repacking a specific magazine classname. + * Precalcs all the event timings and starts the progressBar. + * + * Arguments: + * 0: Magazine Classname + * + * Return Value: + * Nothing + * + * Example: + * ["30Rnd_65x39_caseless_mag"] call ace_magazinerepack_fnc_startRepackingMagazine + * + * Public: No + */ #include "script_component.hpp" -private ["_unit", "_magazines", "_ammos", "_repackTime", "_magazine", "_ammo", "_count", "_index", "_i", "_j", "_ammoToTransfer", "_ammoAvailable", "_ammoNeeded"]; +private ["_unit", "_fullMagazineCount", "_startingAmmoCounts", "_simEvents", "_totalTime"]; -PARAMS_2(_unit,_magazineClassname); +PARAMS_1(_magazineClassname); if (isNil "_magazineClassname" || {_magazineClassname == ""}) exitWith {ERROR("Bad Mag Classname");}; -[_unit] call EFUNC(common,goKneeling); +_unit = ACE_player; + +[ACE_player] call EFUNC(common,goKneeling); call EFUNC(interaction,hideMenu); +// Calculate actual ammo to transfer during repack +_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); + _startingAmmoCounts = []; { EXPLODE_4_PVT(_x,_xClassname,_xCount,_xLoaded,_xType); - if (_xClassname == _magazineClassname) then { + if ((_xClassname == _magazineClassname) && {(_xCount != _fullMagazineCount) && {_xCount > 0}}) then { if (_xLoaded) then { //Try to Remove from weapon and add to inventory, otherwise ignore if (_unit canAdd _magazineClassname) then { @@ -31,9 +51,9 @@ _startingAmmoCounts = []; }; } forEach (magazinesAmmoFull _unit); -if ((count _startingAmmoCounts) == 0) exitwith {ERROR("No Mags");}; +if ((count _startingAmmoCounts) < 2) exitwith {ERROR("Not Enough Mags to Repack");}; -_simEvents = [_magazineClassname, _startingAmmoCounts] call FUNC(simulateRepackEvents); +_simEvents = [_fullMagazineCount, _startingAmmoCounts] call FUNC(simulateRepackEvents); _totalTime = (_simEvents select ((count _simEvents) - 1) select 0); [_totalTime, [_magazineClassname, _startingAmmoCounts, _simEvents], {hint "done"}, {hint "fail"}, (localize "STR_ACE_MagazineRepack_RepackingMagazine"), {_this call FUNC(magazineRepackProgress)}] call EFUNC(common,progressBar); From 80778cf8dbd087cad269ff8e588dd201f8a6ba95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 8 Feb 2015 19:54:12 -0300 Subject: [PATCH 058/113] overheating: updated headers --- .../functions/fnc_checkTemperature.sqf | 11 +++++++---- addons/overheating/functions/fnc_clearJam.sqf | 15 ++++++++------- addons/overheating/functions/fnc_cooldown.sqf | 11 ++++++----- .../functions/fnc_displayTemperature.sqf | 6 +++--- addons/overheating/functions/fnc_jamWeapon.sqf | 7 ++++--- addons/overheating/functions/fnc_overheat.sqf | 16 +++++++++------- addons/overheating/functions/fnc_swapBarrel.sqf | 7 ++++--- .../functions/fnc_swapBarrelCallback.sqf | 7 ++++--- 8 files changed, 45 insertions(+), 35 deletions(-) diff --git a/addons/overheating/functions/fnc_checkTemperature.sqf b/addons/overheating/functions/fnc_checkTemperature.sqf index 92b6d1727e..02747b0129 100644 --- a/addons/overheating/functions/fnc_checkTemperature.sqf +++ b/addons/overheating/functions/fnc_checkTemperature.sqf @@ -1,15 +1,18 @@ /* * Author: Commy2 and CAA-Picard - * * Make the player check the temperature of his weapon * * Arguments: - * 0: _player - * 1: _weapon + * 0: Player + * 1: Weapon * - * Return Values: + * Return Value: * None * + * Example: + * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf index 2340c6c890..76941d75ac 100644 --- a/addons/overheating/functions/fnc_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -1,15 +1,16 @@ /* * Author: Commy2 + * Make the unit clear the jam from a weapon * - * Clears the jam from a weapon + * Arguments: + * 0: Player + * 1: Weapon + * 2: Skip anim? * - * Argument: - * 0: Last temperature (number) - * 1: Barrel mass (number) - * 2: Time (number) + * Return Value: + * None * - * Return value: - * New temperature (number) + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_cooldown.sqf b/addons/overheating/functions/fnc_cooldown.sqf index 13d53c7327..718c77474f 100644 --- a/addons/overheating/functions/fnc_cooldown.sqf +++ b/addons/overheating/functions/fnc_cooldown.sqf @@ -1,15 +1,16 @@ /* * Author: CAA-Picard - * * Calculate cooling down of the weapon. * * Argument: - * 0: Last temperature (number) - * 1: Barrel mass (number) - * 2: Time (number) + * 0: Last temperature + * 1: Barrel mass + * 2: Time * * Return value: - * New temperature (number) + * New temperature + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_displayTemperature.sqf b/addons/overheating/functions/fnc_displayTemperature.sqf index 130eec5f39..9af817f8fd 100644 --- a/addons/overheating/functions/fnc_displayTemperature.sqf +++ b/addons/overheating/functions/fnc_displayTemperature.sqf @@ -1,15 +1,15 @@ /* * Author: Commy2 and CAA-Picard - * * Displays the weapon temperature * * Arguments: - * 0: _player - * 1: _weapon + * 0: Player + * 1: Weapon * * Return Values: * None * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index beb3a1925b..f11b72688c 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -1,14 +1,15 @@ /* * Author: Commy2, based on KK_fnc_playerWeaponMulfunction from KillzoneKid - * * Jam the weapon * * Argument: - * 0: unit - * 1: weapon + * 0: Unit + * 1: Weapon * * Return value: * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 05a286cfa2..9f26d51869 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -1,17 +1,19 @@ /* * Author: Commy2 and CAA-Picard - * - * Heat up the weapon + * Handle weapon fire, heat up the weapon * * Argument: - * 0: unit - * 1: weapon - * 2: ammo - * 3: projectile - * 4: velocity + * 0: Unit + * 1: Weapon + * 3: Muzzle + * 4: Ammo + * 5: Magazine + * 6: Projectile * * Return value: * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_swapBarrel.sqf b/addons/overheating/functions/fnc_swapBarrel.sqf index 6bacbe5049..2384fb470e 100644 --- a/addons/overheating/functions/fnc_swapBarrel.sqf +++ b/addons/overheating/functions/fnc_swapBarrel.sqf @@ -1,14 +1,15 @@ /* * Author: Commy2 - * * Make a unit start swapping it's barrel * * Argument: - * 0: unit - * 1: weapon + * 0: Unit + * 1: Weapon * * Return value: * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf index 88201dc9f4..e626bf2aea 100644 --- a/addons/overheating/functions/fnc_swapBarrelCallback.sqf +++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf @@ -1,14 +1,15 @@ /* * Author: Commy2 - * * Swap barrel callback * * Argument: - * 0: unit - * 1: weapon + * 0: Unit + * 1: Weapon * * Return value: * None + * + * Public: No */ #include "\z\ace\addons\overheating\script_component.hpp" From a2b1cf125996b97a3bb4b2f678ca61860143f090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 8 Feb 2015 19:58:41 -0300 Subject: [PATCH 059/113] g-forces: updated headers --- .../gforces/functions/fnc_pfhUpdateGForces.sqf | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf index f45d629760..839110fd2b 100644 --- a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf +++ b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf @@ -1,5 +1,17 @@ -// by KoffeinFlummi and CAA-Picard -#include "script_component.hpp" +/* + * Author: KoffeinFlummi and CAA-Picard + * Calculates average g-forces and triggers g-effects + * + * Argument: + * 0: Arguments + * 1: pfh_id + * + * Return value: + * None + * + * Public: No + */ + #include "script_component.hpp" EXPLODE_2_PVT(_this,_params,_pfhId); From da9fc39103fd2c7e172984bd2fde1b155a7107a2 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 8 Feb 2015 17:35:21 -0600 Subject: [PATCH 060/113] Headers and Finish Notice --- addons/magazinerepack/XEH_preInit.sqf | 1 + .../functions/fnc_magazineRepackFinish.sqf | 52 +++++++++++++++++++ .../functions/fnc_startRepackingMagazine.sqf | 9 +++- addons/magazinerepack/stringtable.xml | 11 +++- 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf diff --git a/addons/magazinerepack/XEH_preInit.sqf b/addons/magazinerepack/XEH_preInit.sqf index e2dfd721f3..7cd7107f54 100644 --- a/addons/magazinerepack/XEH_preInit.sqf +++ b/addons/magazinerepack/XEH_preInit.sqf @@ -2,6 +2,7 @@ ADDON = false; +PREP(magazineRepackFinish); PREP(magazineRepackProgress); PREP(openSelectMagazineUI); PREP(simulateRepackEvents); diff --git a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf new file mode 100644 index 0000000000..50817bcfe7 --- /dev/null +++ b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf @@ -0,0 +1,52 @@ +/* + * Author: PabstMirror + * Simulates repacking a set of magazines. + * Returns the timing and magazines counts at every stage. + * + * Arguments: + * 0: Arguments [classname,lastAmmoStatus,events] + * 1: Elapsed Time + * 2: Total Time Repacking Will Take + * 3: Error Code + * + * Return Value: + * Nothing + * + * Example: + * (args from progressBar) call ace_magazinerepack_fnc_magazineRepackFinish + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_4(_args,_elapsedTime,_totalTime,_errorCode); +EXPLODE_2_PVT(_args,_magazineClassname,_lastAmmoCount); +_fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); + +_structuredOutputText = + +if (_errorCode == 0) then { + format ["%1
", (localize "STR_ACE_MagazineRepack_RepackComplete")]; +} else { + format ["%1
", (localize "STR_ACE_MagazineRepack_RepackInterrupted")]; +}; + +_picture = getText (configFile >> "CfgMagazines" >> _magazineClassname >> "picture"); +_structuredOutputText = _structuredOutputText + format ["
", _picture]; + +_fullMags = 0; +_partialMags = 0; +{ + EXPLODE_2_PVT(_x,_xClassname,_xCount); + if ((_xClassname == _magazineClassname) && {_xCount > 0}) then { + if (_xCount == _fullMagazineCount) then { + _fullMags = _fullMags + 1; + } else { + _partialMags = _partialMags + 1; + }; + }; +} forEach (magazinesAmmoFull ACE_player); + +_structuredOutputText = _structuredOutputText + format [("" + (localize "STR_ACE_MagazineRepack_RepackedMagazinesCount") + ""), _fullMags, _partialMags]; + +[parseText _structuredOutputText] call EFUNC(common,displayTextStructured); diff --git a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf index c93a1bad59..d83cc649b0 100644 --- a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf +++ b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf @@ -56,4 +56,11 @@ if ((count _startingAmmoCounts) < 2) exitwith {ERROR("Not Enough Mags to Repack" _simEvents = [_fullMagazineCount, _startingAmmoCounts] call FUNC(simulateRepackEvents); _totalTime = (_simEvents select ((count _simEvents) - 1) select 0); -[_totalTime, [_magazineClassname, _startingAmmoCounts, _simEvents], {hint "done"}, {hint "fail"}, (localize "STR_ACE_MagazineRepack_RepackingMagazine"), {_this call FUNC(magazineRepackProgress)}] call EFUNC(common,progressBar); +[ +_totalTime, +[_magazineClassname, _startingAmmoCounts, _simEvents], +{_this call FUNC(magazineRepackFinish)}, +{_this call FUNC(magazineRepackFinish)}, +(localize "STR_ACE_MagazineRepack_RepackingMagazine"), +{_this call FUNC(magazineRepackProgress)} +] call EFUNC(common,progressBar); diff --git a/addons/magazinerepack/stringtable.xml b/addons/magazinerepack/stringtable.xml index 5ea62e3a18..2e3d9500e0 100644 --- a/addons/magazinerepack/stringtable.xml +++ b/addons/magazinerepack/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -74,5 +74,14 @@ %1 tejles tár és %2 extra lőszer. %1 полных магазина(ов) и %2 патрона(ов) + + Repacking Finished + + + Repacking Interrupted + + + %1 Full and %2 Partial + \ No newline at end of file From 24bd515814a35aa8d8d47e2d5d979b8858c51f53 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 8 Feb 2015 22:44:23 -0600 Subject: [PATCH 061/113] Commenting and some stringtables --- addons/magazinerepack/CfgSounds.hpp | 2 +- addons/magazinerepack/config.cpp | 2 +- .../magazinerepack/functions/fnc_magazineRepackFinish.sqf | 2 +- .../functions/fnc_magazineRepackProgress.sqf | 7 +++---- .../magazinerepack/functions/fnc_openSelectMagazineUI.sqf | 4 ++-- .../functions/fnc_startRepackingMagazine.sqf | 3 ++- addons/magazinerepack/script_component.hpp | 2 -- addons/magazinerepack/stringtable.xml | 6 ++++++ 8 files changed, 16 insertions(+), 12 deletions(-) diff --git a/addons/magazinerepack/CfgSounds.hpp b/addons/magazinerepack/CfgSounds.hpp index bc1d0fe0ee..15104d905d 100644 --- a/addons/magazinerepack/CfgSounds.hpp +++ b/addons/magazinerepack/CfgSounds.hpp @@ -12,4 +12,4 @@ class CfgSounds sound[] = {QUOTE(PATHTOF(sounds\magrepack_single.wav)),1,1}; titles[] = {}; }; -}; \ No newline at end of file +}; diff --git a/addons/magazinerepack/config.cpp b/addons/magazinerepack/config.cpp index 2df0d62bff..3a95c10643 100644 --- a/addons/magazinerepack/config.cpp +++ b/addons/magazinerepack/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common","ace_interaction"}; + requiredAddons[] = {"ace_interaction"}; author[] = {"commy2","CAA-Picard"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; diff --git a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf index 50817bcfe7..038b7fb151 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackFinish.sqf @@ -1,5 +1,5 @@ /* - * Author: PabstMirror + * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) * Simulates repacking a set of magazines. * Returns the timing and magazines counts at every stage. * diff --git a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf index 3c829a8933..1d3b5ec6cf 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf @@ -36,6 +36,7 @@ _currentAmmoCount = []; }; } forEach (magazinesAmmo ACE_player); //only inventory mags +//Go through mags we currently have and check off the ones we should have _addedMagazines = +_currentAmmoCount; _missingAmmo = false; { @@ -49,10 +50,7 @@ _missingAmmo = false; }; } forEach _lastAmmoCount; -if (_missingAmmo) exitWith {false}; //something removed ammo that was being repacked -if ((count _addedMagazines) > 0) then { - TRACE_1("Added Magazine While Repacking",_addedMagazines); -}; +if (_missingAmmo) exitWith {false}; //something removed ammo that was being repacked (could be other players or scripts) _updateMagazinesOnPlayerFnc = { ACE_player removeMagazines _magazineClassname; //remove inventory magazines @@ -67,6 +65,7 @@ _updateMagazinesOnPlayerFnc = { if (_nextEventIsBullet) then { playSound QGVAR(soundMagazineFinished); if ((((count _simEvents) % 3) == 0) || {(count _simEvents) == 1}) then { + //For performance - only update mags every 3 bullets (or if it's the last event) call _updateMagazinesOnPlayerFnc; }; } else { diff --git a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf index 9d99ad56b5..e96e84e9a1 100644 --- a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf +++ b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf @@ -37,7 +37,7 @@ _unitMagCounts = []; (_unitMagCounts select _index) pushBack _xCount; }; }; -} forEach magazinesAmmoFull _unit; +} forEach (magazinesAmmoFull _unit); _actions = [localize "STR_ACE_MagazineRepack_SelectMagazineMenu", localize "STR_ACE_MagazineRepack_SelectMagazine"] call EFUNC(interaction,prepareSelectMenu); @@ -53,7 +53,7 @@ _actions = [localize "STR_ACE_MagazineRepack_SelectMagazineMenu", localize "STR_ _actions, { [_this] call FUNC(startRepackingMagazine); }, { - call EFUNC(interaction,hideMenu); + call EFUNC(interaction,hideMenu); //ToDo: Self Interaction Integration if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf index d83cc649b0..06c0f0a137 100644 --- a/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf +++ b/addons/magazinerepack/functions/fnc_startRepackingMagazine.sqf @@ -1,6 +1,7 @@ /* * Author: PabstMirror (based on repack from commy2, esteldunedain, Ruthberg) * Starts repacking a specific magazine classname. + * If room in inventory, unload magazine from weapon to be repacked. * Precalcs all the event timings and starts the progressBar. * * Arguments: @@ -24,7 +25,7 @@ if (isNil "_magazineClassname" || {_magazineClassname == ""}) exitWith {ERROR("B _unit = ACE_player; [ACE_player] call EFUNC(common,goKneeling); -call EFUNC(interaction,hideMenu); +call EFUNC(interaction,hideMenu);//ToDo: Self Interaction Integration // Calculate actual ammo to transfer during repack _fullMagazineCount = getNumber (configfile >> "CfgMagazines" >> _magazineClassname >> "count"); diff --git a/addons/magazinerepack/script_component.hpp b/addons/magazinerepack/script_component.hpp index 15563f0fe8..7b390f7126 100644 --- a/addons/magazinerepack/script_component.hpp +++ b/addons/magazinerepack/script_component.hpp @@ -1,5 +1,3 @@ -#define DEBUG_MODE_FULL - #define COMPONENT magazinerepack #include "\z\ace\addons\main\script_mod.hpp" diff --git a/addons/magazinerepack/stringtable.xml b/addons/magazinerepack/stringtable.xml index 2e3d9500e0..937cfcbf9a 100644 --- a/addons/magazinerepack/stringtable.xml +++ b/addons/magazinerepack/stringtable.xml @@ -76,12 +76,18 @@ Repacking Finished + Wiederverpacken Fertig + Reembalaje Finalizado Repacking Interrupted + Umpacken Unterbrochen + Reempaque Interrupted %1 Full and %2 Partial + %1 Vollständigen und %2 Teilweisen + %1 Total y %2 Parcial \ No newline at end of file From f163e307c80f8f3866e9ffa3ecab7aef88dba580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Mon, 9 Feb 2015 22:59:43 -0300 Subject: [PATCH 062/113] ace_common: throttledPublicVariable function --- addons/common/XEH_preInit.sqf | 1 + .../functions/fnc_throttledPublicVariable.sqf | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 addons/common/functions/fnc_throttledPublicVariable.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 94a0a490bf..9b8964df1b 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -127,6 +127,7 @@ PREP(toBin); PREP(toBitmask); PREP(toHex); PREP(toNumber); +PREP(throttledPublicVariable); PREP(unmuteUnit); PREP(waitAndExecute); diff --git a/addons/common/functions/fnc_throttledPublicVariable.sqf b/addons/common/functions/fnc_throttledPublicVariable.sqf new file mode 100644 index 0000000000..6953d39fb5 --- /dev/null +++ b/addons/common/functions/fnc_throttledPublicVariable.sqf @@ -0,0 +1,49 @@ +/* + * Author: CAA-Picard + * Schedules the publishment of an object variable to reduce network overhead + * + * Arguments: + * 0: Unit . + * 1: Variable name + * 2: Maximum delay + * + * Return Value: + * None + * + * Example: + * None + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_3_PVT(_this,_unit,_varName,_maxDelay); + +// Create the publish scheduler PFH the first time +if (isNil QGVAR(publishSchedId)) then { + + GVAR(publishVarNames) = []; + GVAR(publishNextTime) = 1e7; + + GVAR(publishSchedId) = [{ + + if (diag_tickTime > GVAR(publishNextTime)) then { + { + EXPLODE_2_PVT(_x,_unit,_varName); + _unit setVariable [_varName, (_unit getVariable _varName), true]; + } forEach GVAR(publishVarNames); + + GVAR(publishVarNames) = []; + GVAR(publishNextTime) = 1e7; + }; + }, 0, []] call cba_fnc_addPerFrameHandler; +}; + +// If the variable is not on the list +if (GVAR(publishVarNames) find [_unit,_varName] == -1) exitWith { + GVAR(publishVarNames) pushBack [_unit,_varName]; + GVAR(publishNextTime) = GVAR(publishNextTime) min (diag_tickTime + _maxDelay); +}; + +// If the variable is on the list +GVAR(publishNextTime) = GVAR(publishNextTime) min (diag_tickTime + _maxDelay); \ No newline at end of file From eadcd8236649bfc4e73fdde5535a5ac102144ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Mon, 9 Feb 2015 23:00:40 -0300 Subject: [PATCH 063/113] scopes: fixed errors, throttled sync of scope adjustment to all client and local calculation of deflections. --- addons/scopes/CfgEventHandlers.hpp | 2 +- addons/scopes/RscTitles.hpp | 2 +- addons/scopes/XEH_postInit.sqf | 2 ++ addons/scopes/XEH_preInit.sqf | 1 + addons/scopes/functions/fnc_adjustScope.sqf | 22 +++++++--------- .../scopes/functions/fnc_canAdjustScope.sqf | 7 ++--- addons/scopes/functions/fnc_firedEH.sqf | 14 ++++++---- .../scopes/functions/fnc_inventoryCheck.sqf | 9 ++++--- addons/scopes/functions/fnc_showZeroing.sqf | 26 +++++++++++++++++++ addons/scopes/scripts/script_component.hpp | 1 - addons/scopes/scripts/zeroingOnLoad.sqf | 20 -------------- 11 files changed, 59 insertions(+), 47 deletions(-) create mode 100644 addons/scopes/functions/fnc_showZeroing.sqf delete mode 100644 addons/scopes/scripts/script_component.hpp delete mode 100644 addons/scopes/scripts/zeroingOnLoad.sqf diff --git a/addons/scopes/CfgEventHandlers.hpp b/addons/scopes/CfgEventHandlers.hpp index 204f2e267e..286a08598d 100644 --- a/addons/scopes/CfgEventHandlers.hpp +++ b/addons/scopes/CfgEventHandlers.hpp @@ -13,7 +13,7 @@ class Extended_PostInit_EventHandlers { class Extended_Fired_EventHandlers { class CAManBase { class ADDON { - clientFired = QUOTE(if (_this select 0 == ACE_player) then { _this call FUNC(firedEH);};); + fired = QUOTE(_this call FUNC(firedEH);); }; }; }; diff --git a/addons/scopes/RscTitles.hpp b/addons/scopes/RscTitles.hpp index 79de7e8214..9da0a04a14 100644 --- a/addons/scopes/RscTitles.hpp +++ b/addons/scopes/RscTitles.hpp @@ -4,7 +4,7 @@ class RscTitles { movingEnable = 0; enableSimulation = 1; enableDisplay = 1; - onLoad = QUOTE(_this spawn compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(scripts\zeroingOnLoad.sqf))); uiNamespace setVariable [ARR_2('ACE_Scopes_Debug', _this)];); + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(ZeroingDisplay)),_this select 0)];); duration = 1e+011; fadein = 0; fadeout = 0; diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index b7fd4bfc3a..30cc7d9384 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -15,6 +15,8 @@ if !(hasInterface) exitWith {}; while {True} do { waitUntil {[ACE_player, 0,0] call FUNC(canAdjustScope)}; _layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false]; + call FUNC(showZeroing); + sleep 3; _layer cutFadeOut 2; diff --git a/addons/scopes/XEH_preInit.sqf b/addons/scopes/XEH_preInit.sqf index 9dc7450c94..b0c4a50c1c 100644 --- a/addons/scopes/XEH_preInit.sqf +++ b/addons/scopes/XEH_preInit.sqf @@ -8,6 +8,7 @@ PREP(firedEH); PREP(getOptics); PREP(hideZeroing); PREP(inventoryCheck); +PREP(showZeroing); GVAR(fadeScript) = scriptNull; diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 7db640590a..b50da5322b 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" - + private ["_unit", "_weapons", "_zeroing", "_pitchbankyaw", "_pitch", "_bank", "_yaw", "_hint"]; _unit = _this select 0; @@ -23,15 +23,18 @@ _weapons = [ handgunWeapon _unit ]; -if (isNil QGVAR(Adjustment)) then { - GVAR(Adjustment) = [[0,0], [0,0], [0,0]]; +_adjustment = _unit getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + _adjustment = [[0,0], [0,0], [0,0]]; }; -_zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon _unit)); +_zeroing = _adjustment select (_weapons find (currentWeapon _unit)); _zeroing set [0, (round (((_zeroing select 0) + (_this select 1)) * 10)) / 10]; _zeroing set [1, (round (((_zeroing select 1) + (_this select 2)) * 10)) / 10]; -GVAR(Adjustment) set [_weapons find (currentWeapon _unit), _zeroing]; +_adjustment set [_weapons find (currentWeapon _unit), _zeroing]; +_unit setVariable [QGVAR(Adjustment), _adjustment]; +[_unit, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3); @@ -46,14 +49,6 @@ if (cameraView == "GUNNER") then { [_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw) }; -_display = uiNamespace getVariable [QGVAR(ZeroingDisplay), displayNull]; -if !(isNull _display) then { - _vertical = _display displayCtrl 925002; - _horizontal = _display displayCtrl 925003; - _vertical ctrlSetText (str (_zeroing select 1)); - _horizontal ctrlSetText (str (_zeroing select 0)); -}; - if (!isNull (missionNamespace getVariable [QGVAR(fadeScript), scriptNull])) then { terminate GVAR(fadeScript); }; @@ -61,6 +56,7 @@ if (cameraView != "GUNNER") then { GVAR(fadeScript) = 0 spawn { _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; _layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false]; + call FUNC(showZeroing); sleep 3; _layer cutFadeOut 2; }; diff --git a/addons/scopes/functions/fnc_canAdjustScope.sqf b/addons/scopes/functions/fnc_canAdjustScope.sqf index 8aea2ff9e4..3bf4a74e21 100644 --- a/addons/scopes/functions/fnc_canAdjustScope.sqf +++ b/addons/scopes/functions/fnc_canAdjustScope.sqf @@ -25,15 +25,16 @@ _weapons = [ if !(currentWeapon _unit in _weapons) exitWith {false}; -if (isNil QGVAR(Adjustment)) then { - GVAR(Adjustment) = [[0,0], [0,0], [0,0]]; +_adjustment = _unit getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + _adjustment = [[0,0], [0,0], [0,0]]; }; if (isNil QGVAR(Optics)) then { GVAR(Optics) = ["", "", ""]; }; -_zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon _unit)); +_zeroing = _adjustment select (_weapons find (currentWeapon _unit)); _zeroX = (_zeroing select 0) + (_this select 1); _zeroY = (_zeroing select 1) + (_this select 2); diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 4414f617d6..097a81fca6 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -1,5 +1,5 @@ /* - * Author: KoffeinFlummi + * Author: KoffeinFlummi and CAA-Picard * * Adjusts the flight path of the bullet according to the zeroing * @@ -12,13 +12,17 @@ #include "script_component.hpp" -private ["_unit", "_weaponType", "_ammoType", "_magazineType", "_round", "_weapons", "_zeroing", "_direction", "_azimuth", "_altitude", "_velocity"]; +private ["_unit", "_weaponType", "_round", "_weapons", "_zeroing", "_adjustment"]; _unit = _this select 0; + +_adjustment = _unit getVariable QGVAR(Adjustment); +if (isNil "_adjustment") exitWith {}; + +if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; + _weaponType = _this select 1; -_ammoType = _this select 4; _round = _this select 5; -_magazineType = _this select 6; _weapons = [ primaryWeapon _unit, @@ -27,7 +31,7 @@ _weapons = [ ]; if !(_weaponType in _weapons) exitWith {}; -_zeroing = GVAR(Adjustment) select (_weapons find _weaponType); +_zeroing = _adjustment select (_weapons find _weaponType); // convert zeroing from mils to degrees _zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map); diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index 23971098d6..1e1efa2c14 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -10,13 +10,16 @@ if (isNil QGVAR(Optics)) then { GVAR(Optics) = ["", "", ""]; }; -if (isNil QGVAR(Adjustment)) then { - GVAR(Adjustment) = [[0,0], [0,0], [0,0]]; +_adjustment = ACE_player getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + ACE_player setVariable [QGVAR(Adjustment), [[0,0], [0,0], [0,0]]]; + [ACE_player, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); }; { if (_new select _forEachIndex != _x) then { - GVAR(Adjustment) set [_forEachIndex, [0,0]]; + _adjustment set [_forEachIndex, [0,0]]; + [ACE_player, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); }; } forEach GVAR(Optics); diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf new file mode 100644 index 0000000000..76d4927ae9 --- /dev/null +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -0,0 +1,26 @@ + +#include "script_component.hpp" + +disableSerialization; + +_display = uiNamespace getVariable [QGVAR(ZeroingDisplay), displayNull]; +if (isNull _display) exitWith {}; + +_weapons = [ + primaryWeapon ACE_player, + secondaryWeapon ACE_player, + handgunWeapon ACE_player +]; + +if !((currentWeapon ACE_player) in _weapons) exitWith {}; + +_adjustment = ACE_player getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + _adjustment = [[0,0], [0,0], [0,0]]; +}; + +_zeroing = _adjustment select (_weapons find (currentWeapon ACE_player)); +_vertical = _display displayCtrl 925002; +_horizontal = _display displayCtrl 925003; +_vertical ctrlSetText (str (_zeroing select 1)); +_horizontal ctrlSetText (str (_zeroing select 0)); diff --git a/addons/scopes/scripts/script_component.hpp b/addons/scopes/scripts/script_component.hpp deleted file mode 100644 index acca51b4b5..0000000000 --- a/addons/scopes/scripts/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\scopes\script_component.hpp" diff --git a/addons/scopes/scripts/zeroingOnLoad.sqf b/addons/scopes/scripts/zeroingOnLoad.sqf deleted file mode 100644 index 591b5fc07b..0000000000 --- a/addons/scopes/scripts/zeroingOnLoad.sqf +++ /dev/null @@ -1,20 +0,0 @@ -#include "script_component.hpp" - -disableSerialization; - -_display = _this select 0; -uiNamespace setVariable [QGVAR(ZeroingDisplay, _display]; -_vertical = _display displayCtrl 925002; -_horizontal = _display displayCtrl 925003; - -_weapons = [ - primaryWeapon player, - secondaryWeapon player, - handgunWeapon player -]; - -if ((currentWeapon ACE_player) in _weapons) then { - _zeroing = GVAR(Adjustment) select (_weapons find (currentWeapon ACE_player)); - _horizontal ctrlSetText (str (_zeroing select 0)); - _vertical ctrlSetText (str (_zeroing select 1)); -}; From ff5c5a5bac845b1fe998891d1b1f0c2ff1bc30ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 10 Feb 2015 01:22:10 -0300 Subject: [PATCH 064/113] scopes: Code cleaned up, removed spawns, added standard headers. --- addons/common/XEH_postInit.sqf | 4 +- addons/scopes/CfgEventHandlers.hpp | 32 ----------- addons/scopes/XEH_postInit.sqf | 41 ++++++-------- addons/scopes/XEH_preInit.sqf | 2 +- addons/scopes/config.cpp | 4 +- addons/scopes/functions/fnc_adjustScope.sqf | 45 ++++++--------- .../scopes/functions/fnc_canAdjustScope.sqf | 30 +++++----- addons/scopes/functions/fnc_firedEH.sqf | 37 +++++++------ addons/scopes/functions/fnc_getOptics.sqf | 15 ++--- .../scopes/functions/fnc_getWeaponIndex.sqf | 23 ++++++++ addons/scopes/functions/fnc_hideZeroing.sqf | 27 --------- .../scopes/functions/fnc_inventoryCheck.sqf | 44 ++++++++++----- addons/scopes/functions/fnc_showZeroing.sqf | 55 +++++++++++++++---- 13 files changed, 178 insertions(+), 181 deletions(-) create mode 100644 addons/scopes/functions/fnc_getWeaponIndex.sqf delete mode 100644 addons/scopes/functions/fnc_hideZeroing.sqf diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 0767e42737..dbb665d446 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -82,7 +82,7 @@ enableCamShake true; }] call FUNC(addEventhandler); -GVAR(OldPlayerInventory) = ACE_player call FUNC(getAllGear); +GVAR(OldPlayerInventory) = [ACE_player] call FUNC(getAllGear); GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player; GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312); GVAR(OldCameraView) = cameraView; @@ -93,7 +93,7 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); [{ // "playerInventoryChanged" event - _newPlayerInventory = ACE_player call FUNC(getAllGear); + _newPlayerInventory = [ACE_player] call FUNC(getAllGear); if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then { // Raise ACE event locally GVAR(OldPlayerInventory) = _newPlayerInventory; diff --git a/addons/scopes/CfgEventHandlers.hpp b/addons/scopes/CfgEventHandlers.hpp index 286a08598d..b3d70a2861 100644 --- a/addons/scopes/CfgEventHandlers.hpp +++ b/addons/scopes/CfgEventHandlers.hpp @@ -17,35 +17,3 @@ class Extended_Fired_EventHandlers { }; }; }; - -class Extended_Take_EventHandlers { - class CAManBase { - class ADDON { - clientTake = QUOTE(if (_this select 0 == ACE_player) then{ _this call FUNC(inventoryCheck);};); - }; - }; -}; - -class Extended_Put_EventHandlers { - class CAManBase { - class ADDON { - clientPut = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(inventoryCheck);};); - }; - }; -}; - -class Extended_InitPost_EventHandlers { - class CAManBase { - class ADDON { - init = QUOTE(if (_this select 0 == call EFUNC(common,player)) then{ _this call FUNC(inventoryCheck);};); - }; - }; -}; - -class Extended_Respawn_EventHandlers { - class CAManBase { - class ADDON { - respawn = QUOTE(if (_this select 0 == call EFUNC(common,player)) then{ _this call FUNC(inventoryCheck);};); - }; - }; -}; diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index 30cc7d9384..8de7ff8af0 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -9,34 +9,27 @@ if !(hasInterface) exitWith {}; -// show overlay after changing weapon/optic -0 spawn { - _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; - while {True} do { - waitUntil {[ACE_player, 0,0] call FUNC(canAdjustScope)}; - _layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false]; - call FUNC(showZeroing); +// Check inventory when it changes +["playerInventoryChanged", { + [ACE_player] call FUNC(inventoryCheck); +}] call EFUNC(common,addEventhandler); - sleep 3; - _layer cutFadeOut 2; - _weapon = currentWeapon ACE_player; - _optics = [ACE_player] call FUNC(getOptics); - waitUntil {sleep 0.05; !(_optics isEqualTo ([ACE_player] call FUNC(getOptics))) or (currentWeapon ACE_player != _weapon)}; - }; -}; - -// instantly hide when scoping in -0 spawn { - _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; - while {True} do { - waitUntil {sleep 0.05; cameraView == "GUNNER"}; - if !(isNull GVAR(fadeScript)) then { - terminate GVAR(fadeScript); - }; +// Instantly hide knobs when scoping in +["cameraViewChanged", { + EXPLODE_2_PVT(_this,_player,_newCameraView); + if (_newCameraView == "GUNNER") then { + private "_layer"; + _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; _layer cutText ["", "PLAIN", 0]; + + + if !(isNil QGVAR(fadePFH)) then { + [GVAR(fadePFH)] call cba_fnc_removePerFrameHandler; + GVAR(fadePFH) = nil; + }; }; -}; +}] call EFUNC(common,addEventhandler); // Add keybinds diff --git a/addons/scopes/XEH_preInit.sqf b/addons/scopes/XEH_preInit.sqf index b0c4a50c1c..5dd7153263 100644 --- a/addons/scopes/XEH_preInit.sqf +++ b/addons/scopes/XEH_preInit.sqf @@ -6,7 +6,7 @@ PREP(adjustScope); PREP(canAdjustScope); PREP(firedEH); PREP(getOptics); -PREP(hideZeroing); +PREP(getWeaponIndex); PREP(inventoryCheck); PREP(showZeroing); diff --git a/addons/scopes/config.cpp b/addons/scopes/config.cpp index 9d2ddbeacb..50ff6528d0 100644 --- a/addons/scopes/config.cpp +++ b/addons/scopes/config.cpp @@ -5,8 +5,8 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { "ace_main", "ace_common" }; - author[] = {"KoffeinFlummi"}; + requiredAddons[] = { "ace_common" }; + author[] = {"KoffeinFlummi", "CAA-Picard"}; authorUrl = "https://github.com/KoffeinFlummi"; VERSION_CONFIG; }; diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index b50da5322b..cf4d7e7146 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -1,45 +1,44 @@ /* * Author: KoffeinFlummi - * * Changes the adjustment for the current scope * - * Arguments: - * 0: Horizontal adjustment - * 1: Vertical adjustment + * Argument: + * 0: Unit + * 1: Horizontal adjustment + * 2: Vertical adjustment * - * Return Value: - * True + * Return value: + * True + * + * Public: No */ - #include "script_component.hpp" private ["_unit", "_weapons", "_zeroing", "_pitchbankyaw", "_pitch", "_bank", "_yaw", "_hint"]; _unit = _this select 0; -_weapons = [ - primaryWeapon _unit, - secondaryWeapon _unit, - handgunWeapon _unit -]; +_weaponIndex = [_unit, currentWeapon _unit] call FUNC(getWeaponIndex); _adjustment = _unit getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { _adjustment = [[0,0], [0,0], [0,0]]; + _unit setVariable [QGVAR(Adjustment), _adjustment]; }; -_zeroing = _adjustment select (_weapons find (currentWeapon _unit)); +_zeroing = _adjustment select _weaponIndex; _zeroing set [0, (round (((_zeroing select 0) + (_this select 1)) * 10)) / 10]; _zeroing set [1, (round (((_zeroing select 1) + (_this select 2)) * 10)) / 10]; -_adjustment set [_weapons find (currentWeapon _unit), _zeroing]; -_unit setVariable [QGVAR(Adjustment), _adjustment]; +// Change the adjustment array +_adjustment set [_weaponIndex, _zeroing]; [_unit, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3); // slightly rotate the player if looking through optic if (cameraView == "GUNNER") then { + _pitchbankyaw = [_unit] call EFUNC(common,getPitchBankYaw); // these are not exact mil-to-degree conversions, but instead chosen // to minimize the effect of rounding errors @@ -47,19 +46,11 @@ if (cameraView == "GUNNER") then { _bank = _pitchbankyaw select 1; _yaw = (_pitchbankyaw select 2) + ((_this select 1) * -0.04); [_unit, _pitch, _bank, _yaw] call EFUNC(common,setPitchBankYaw) -}; -if (!isNull (missionNamespace getVariable [QGVAR(fadeScript), scriptNull])) then { - terminate GVAR(fadeScript); -}; -if (cameraView != "GUNNER") then { - GVAR(fadeScript) = 0 spawn { - _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; - _layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false]; - call FUNC(showZeroing); - sleep 3; - _layer cutFadeOut 2; - }; +} else { + + [] call FUNC(showZeroing); + }; true diff --git a/addons/scopes/functions/fnc_canAdjustScope.sqf b/addons/scopes/functions/fnc_canAdjustScope.sqf index 3bf4a74e21..75d5dd73a7 100644 --- a/addons/scopes/functions/fnc_canAdjustScope.sqf +++ b/addons/scopes/functions/fnc_canAdjustScope.sqf @@ -1,29 +1,25 @@ /* * Author: KoffeinFlummi - * * Checks if a player can adjust his optic in the given way. * - * Arguments: - * 0: Horizontal adjustment - * 1: Vertical adjustment + * Argument: + * 0: Unit + * 1: Horizontal adjustment + * 2: Vertical adjustment * - * Return Value: - * Can adjustment be done? (Bool) + * Return value: + * Can adjustment be done? + * + * Public: No */ - #include "script_component.hpp" -private ["_unit", "_weapons", "_zeroing", "_optic", "_maxHorizontal", "_maxVertical"]; +private ["_unit", "_weaponIndex", "_zeroing", "_optic", "_maxHorizontal", "_maxVertical"]; _unit = _this select 0; -_weapons = [ - primaryWeapon _unit, - secondaryWeapon _unit, - handgunWeapon _unit -]; - -if !(currentWeapon _unit in _weapons) exitWith {false}; +_weaponIndex = [_unit, currentWeapon _unit] call FUNC(getWeaponIndex); +if (_weaponIndex < 0) exitWith {false}; _adjustment = _unit getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { @@ -34,11 +30,11 @@ if (isNil QGVAR(Optics)) then { GVAR(Optics) = ["", "", ""]; }; -_zeroing = _adjustment select (_weapons find (currentWeapon _unit)); +_zeroing = _adjustment select _weaponIndex; _zeroX = (_zeroing select 0) + (_this select 1); _zeroY = (_zeroing select 1) + (_this select 2); -_optic = GVAR(Optics) select (_weapons find (currentWeapon _unit)); +_optic = GVAR(Optics) select _weaponIndex; _maxHorizontal = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Horizontal"); _maxVertical = getArray (configFile >> "CfgWeapons" >> _optic >> "ACE_ScopeAdjust_Vertical"); if ((count _maxHorizontal < 2) or (count _maxVertical < 2)) exitWith {false}; diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 097a81fca6..b6da3c7a9e 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -1,39 +1,42 @@ /* * Author: KoffeinFlummi and CAA-Picard - * * Adjusts the flight path of the bullet according to the zeroing * - * Arguments: - * Fired EH + * Argument: + * 0: Unit + * 1: Weapon + * 3: Muzzle + * 4: Magazine + * 5: Ammo + * 6: Projectile * - * Return Value: + * Return value: * None + * + * Public: No */ - #include "script_component.hpp" -private ["_unit", "_weaponType", "_round", "_weapons", "_zeroing", "_adjustment"]; +private ["_unit", "_adjustment", "_weapon", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"]; _unit = _this select 0; +// Exit if the unit doesn't have any adjusment variable _adjustment = _unit getVariable QGVAR(Adjustment); if (isNil "_adjustment") exitWith {}; +// Exit if the unit isn't a player if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; -_weaponType = _this select 1; -_round = _this select 5; +_weapon = _this select 1; +_projectile = _this select 5; -_weapons = [ - primaryWeapon _unit, - secondaryWeapon _unit, - handgunWeapon _unit -]; -if !(_weaponType in _weapons) exitWith {}; +_weaponIndex = [_unit, currentWeapon _unit] call FUNC(getWeaponIndex); +if (_weaponIndex < 0) exitWith {}; -_zeroing = _adjustment select (_weapons find _weaponType); +_zeroing = _adjustment select _weaponIndex; -// convert zeroing from mils to degrees +// Convert zeroing from mils to degrees _zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map); -[_round, _zeroing select 0, _zeroing select 1, 0] call EFUNC(common,changeProjectileDirection); +[_projectile, _zeroing select 0, _zeroing select 1, 0] call EFUNC(common,changeProjectileDirection); diff --git a/addons/scopes/functions/fnc_getOptics.sqf b/addons/scopes/functions/fnc_getOptics.sqf index 7ff2c7ea1d..289ed5e7bd 100644 --- a/addons/scopes/functions/fnc_getOptics.sqf +++ b/addons/scopes/functions/fnc_getOptics.sqf @@ -1,21 +1,22 @@ /* * Author: commy2 - * * Gets the optic classnames of all currently equipped weapons. * * Arguments: - * 0: Unit (Object) + * 0: Unit * * Return Value: - * [optic of primary, optic of secondary, optic of handgun] (Array) + * 0: Optic of primary + * 1: Optic of secondary + * 2: Optic of handgun + * + * Public: No */ - #include "script_component.hpp" -private ["_unit", "_array"]; - -_unit = _this select 0; +EXPLODE_1_PVT(_this,_unit); +private ["_array"]; _array = ["", "", ""]; if !(_unit isKindOf "CAManBase") exitWith {_array}; diff --git a/addons/scopes/functions/fnc_getWeaponIndex.sqf b/addons/scopes/functions/fnc_getWeaponIndex.sqf new file mode 100644 index 0000000000..05c1202795 --- /dev/null +++ b/addons/scopes/functions/fnc_getWeaponIndex.sqf @@ -0,0 +1,23 @@ +/* + * Author: commy2 + * Get the index of the weapon. + * 0 = primary, 1 = secondary, 2 = handgun, -1 = other + * + * Argument: + * 0: Unit + * 1: Weapon + * + * Return value: + * Weapon index + * + * Public: No + */ + #include "script_component.hpp" + + EXPLODE_2_PVT(_this,_unit,_weapon); + +[ + primaryWeapon _unit, + secondaryWeapon _unit, + handgunWeapon _unit +] find _weapon diff --git a/addons/scopes/functions/fnc_hideZeroing.sqf b/addons/scopes/functions/fnc_hideZeroing.sqf deleted file mode 100644 index b41fd1dab6..0000000000 --- a/addons/scopes/functions/fnc_hideZeroing.sqf +++ /dev/null @@ -1,27 +0,0 @@ -// by commy2 - -#include "script_component.hpp" - -private ["_state", "_ctrl"]; - -_state = _this select 0; - -disableSerialization; -_ctrl = (uiNamespace getVariable ['ACE_dlgWeaponZeroing', displayNull]) displayCtrl 168; - -if (_state) then { - _ctrl ctrlSetPosition [0,0,0,0]; -} else { - private "_config"; - - _config = configFile >> "RscInGameUI" >> "RscWeaponZeroing" >> "CA_Zeroing"; - - _ctrl ctrlSetPosition [ - getNumber (_config >> "x"), - getNumber (_config >> "y"), - getNumber (_config >> "w"), - getNumber (_config >> "h") - ]; -}; - -_ctrl ctrlCommit 0; diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index 1e1efa2c14..dba446912d 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -1,26 +1,42 @@ -// by KoffeinFlummi / commy2 - +/* + * Author: KoffeinFlummi and Commy2 + * Check if weapon optics changed and reset zeroing if needed + * + * Arguments: + * 0: Player + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private "_new"; +EXPLODE_1_PVT(_this,_player); -_new = _this call FUNC(getOptics); +private ["_newOptics", "_adjustment"]; + +_adjustment = ACE_player getVariable QGVAR(Adjustment); +if (isNil "_adjustment") then { + _adjustment = [[0,0], [0,0], [0,0]]; + ACE_player setVariable [QGVAR(Adjustment), _adjustment]; + [ACE_player, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); +}; if (isNil QGVAR(Optics)) then { GVAR(Optics) = ["", "", ""]; }; - -_adjustment = ACE_player getVariable QGVAR(Adjustment); -if (isNil "_adjustment") then { - ACE_player setVariable [QGVAR(Adjustment), [[0,0], [0,0], [0,0]]]; - [ACE_player, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); -}; +_newOptics = [_player] call FUNC(getOptics); { - if (_new select _forEachIndex != _x) then { - _adjustment set [_forEachIndex, [0,0]]; - [ACE_player, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); + if (_newOptics select _forEachIndex != _x) then { + // The optic for this weapon changed, set adjustment to zero + if !((_adjustment select _foreachindex) isEqualTo [0,0]) then { + _adjustment set [_forEachIndex, [0,0]]; + [ACE_player, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); + }; }; } forEach GVAR(Optics); -GVAR(Optics) = _new; +_adjustment = ACE_player getVariable QGVAR(Adjustment); +GVAR(Optics) = _newOptics; diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf index 76d4927ae9..3d729e81db 100644 --- a/addons/scopes/functions/fnc_showZeroing.sqf +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -1,26 +1,59 @@ - +/* + * Author: KoffeinFlummi and CAA-Picard + * Display the adjustment knobs, update their value and fade them out later + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" disableSerialization; -_display = uiNamespace getVariable [QGVAR(ZeroingDisplay), displayNull]; -if (isNull _display) exitWith {}; +private ["_weaponIndex","_adjustment","_layer","_display","_zeroing","_vertical","_horizontal"]; -_weapons = [ - primaryWeapon ACE_player, - secondaryWeapon ACE_player, - handgunWeapon ACE_player -]; - -if !((currentWeapon ACE_player) in _weapons) exitWith {}; +_weaponIndex = [ACE_player, currentWeapon ACE_player] call FUNC(getWeaponIndex); +if (_weaponIndex < 0) exitWith {}; _adjustment = ACE_player getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { _adjustment = [[0,0], [0,0], [0,0]]; }; -_zeroing = _adjustment select (_weapons find (currentWeapon ACE_player)); +// Display the adjustment knobs +_layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; +_layer cutRsc [QGVAR(Zeroing), "PLAIN", 0, false]; + +// Find the display +_display = uiNamespace getVariable [QGVAR(ZeroingDisplay), displayNull]; +if (isNull _display) exitWith {}; + +// Update values +_zeroing = _adjustment select _weaponIndex; _vertical = _display displayCtrl 925002; _horizontal = _display displayCtrl 925003; _vertical ctrlSetText (str (_zeroing select 1)); _horizontal ctrlSetText (str (_zeroing select 0)); + +// Set the time when to hide the knobs +GVAR(timeToHide) = diag_tickTime + 3.0; + +if !(isNil QGVAR(fadePFH)) exitWith {}; + +// Launch a PFH to wait and fade out the knobs +GVAR(fadePFH) = [{ + + if (diag_tickTime >= GVAR(timeToHide)) exitWith { + private "_layer"; + _layer = [QGVAR(Zeroing)] call BIS_fnc_rscLayer; + _layer cutFadeOut 2; + + GVAR(fadePFH) = nil; + [_this select 1] call cba_fnc_removePerFrameHandler; + }; + +}, 0.1, []] call CBA_fnc_addPerFrameHandler From b3f68467bb7d7f396623851897eb251484b47a34 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 9 Feb 2015 23:33:50 -0600 Subject: [PATCH 065/113] Wrong Actions in CfgMoves --- addons/captives/CfgMoves.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index 288d153d7b..6e67f3615b 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -7,14 +7,16 @@ class CfgMovesBasic { stop = "ACE_AmovPercMstpScapWnonDnon"; StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; default = "ACE_AmovPercMstpScapWnonDnon"; + PutDown = ""; getOver = ""; throwPrepare = ""; throwGrenade[] = {"","Gesture"}; }; class ACE_CivilStandSurrenderActions: ACE_CivilStandHandcuffedActions { - stop = "ACE_AmovPercMstpScapWnonDnon"; - StopRelaxed = "ACE_AmovPercMstpScapWnonDnon"; - default = "ACE_AmovPercMstpScapWnonDnon"; + stop = "ACE_AmovPercMstpSsurWnonDnon"; + StopRelaxed = "ACE_AmovPercMstpSsurWnonDnon"; + default = "ACE_AmovPercMstpSsurWnonDnon"; + PutDown = ""; }; }; }; From 3f8f08cc8b6dee07cefb15e42faf869f74b50eac Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 11 Feb 2015 14:51:21 +0100 Subject: [PATCH 066/113] no holding key with fcs --- addons/common/functions/fnc_getGunner.sqf | 2 +- addons/fcs/CfgEventHandlers.hpp | 4 +- addons/fcs/CfgVehicles.hpp | 4 +- addons/fcs/initKeybinds.sqf | 8 +++ addons/vector/XEH_postInit.sqf | 76 +-------------------- addons/vector/initKeybinds.sqf | 83 +++++++++++++++++++++++ 6 files changed, 97 insertions(+), 80 deletions(-) create mode 100644 addons/vector/initKeybinds.sqf diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf index 2510c2ddc4..0c82066e4b 100644 --- a/addons/common/functions/fnc_getGunner.sqf +++ b/addons/common/functions/fnc_getGunner.sqf @@ -1,7 +1,7 @@ /* * Author: commy2 * - * Get the gunner of a vehicle who uses the given weapon type. Requires every turret to have a different weapons. + * Get the gunner of a vehicle who uses the given weapon type. Requires every turret to have a different weapon. * * Argument: * 0: The vehicle (Object) diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index 0d507b359d..28e1bd4a85 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -1,12 +1,12 @@ class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit) ); + clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); }; }; diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp index 1e8e309b55..16902d9ee0 100644 --- a/addons/fcs/CfgVehicles.hpp +++ b/addons/fcs/CfgVehicles.hpp @@ -28,7 +28,7 @@ class CfgVehicles { displayName = $STR_ACE_FCS_ResetFCS; enableInside = 1; condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([ARR_2(_vehicle,[_player] call DEFUNC(common,getTurretIndex))] call FUNC(reset);); + statement = QUOTE([ARR_2(_vehicle,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset);); showDisabled = 0; priority = 1; icon = ""; @@ -42,7 +42,7 @@ class CfgVehicles { displayName = $STR_ACE_FCS_ResetFCS; enableInside = 1; condition = QUOTE(call FUNC(canResetFCS)); - statement = QUOTE([ARR_2(_vehicle,[_player] call DEFUNC(common,getTurretIndex))] call FUNC(reset);); + statement = QUOTE([ARR_2(_vehicle,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset);); showDisabled = 0; priority = 1; icon = ""; diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf index 444891903b..bc3cf33bf5 100644 --- a/addons/fcs/initKeybinds.sqf +++ b/addons/fcs/initKeybinds.sqf @@ -1,3 +1,4 @@ +// by commy2 ["ACE3", localize "STR_ACE_FCS_LaseTarget", @@ -8,6 +9,10 @@ // Conditions: specific if !(!GVAR(enabled) && {call FUNC(canUseRangefinder) || FUNC(canUseFCS)}) exitWith {false}; + // prevent holding down + if (GETGVAR(isDownStateKey1,false)) exitWith {false}; + GVAR(isDownStateKey1) = true; + // Statement [vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyDown); // Return false so it doesn't block the rest weapon action @@ -21,6 +26,9 @@ ["ACE3", localize "STR_ACE_FCS_LaseTarget", { + // prevent holding down + GVAR(isDownStateKey1) = false; + // Conditions: canInteract _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; diff --git a/addons/vector/XEH_postInit.sqf b/addons/vector/XEH_postInit.sqf index 0a8f031347..8bbf7d7aa6 100644 --- a/addons/vector/XEH_postInit.sqf +++ b/addons/vector/XEH_postInit.sqf @@ -1,78 +1,4 @@ // by commy2 #include "script_component.hpp" -["ACE3", - localize "STR_ACE_Vector_AzimuthKey", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"} && {!(GETGVAR(isDownStateKeyAzimuth,false))}) exitWith {false}; - - GVAR(isDownStateKeyAzimuth) = true; - - // Statement - ["azimuth"] call FUNC(onKeyDown); - true - }, - [15, [false, false, false]], - false, - "keydown" -] call CBA_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Vector_AzimuthKey", - { - GVAR(isDownStateKeyAzimuth) = false; - - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - - // Statement - ["azimuth"] call FUNC(onKeyUp); - true - }, - [15, [false, false, false]], - false, - "keyup" -] call CBA_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Vector_DistanceKey", - { - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"} && {!(GETGVAR(isDownStateKeyDistance,false))}) exitWith {false}; - - GVAR(isDownStateKeyDistance) = true; - - // Statement - ["distance"] call FUNC(onKeyDown); - true - }, - [19, [false, false, false]], - false, - "keydown" -] call CBA_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Vector_DistanceKey", - { - GVAR(isDownStateKeyDistance) = false; - - // Conditions: canInteract - _exceptions = []; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - - // Statement - ["distance"] call FUNC(onKeyUp); - true - }, - [19, [false, false, false]], - false, - "keyup" -] call CBA_fnc_registerKeybind; +#include "initKeybinds.sqf" diff --git a/addons/vector/initKeybinds.sqf b/addons/vector/initKeybinds.sqf new file mode 100644 index 0000000000..f81c280905 --- /dev/null +++ b/addons/vector/initKeybinds.sqf @@ -0,0 +1,83 @@ +// by commy2 + +["ACE3", + localize "STR_ACE_Vector_AzimuthKey", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false}; + + // prevent holding down + if (GETGVAR(isDownStateKey1,false)) exitWith {false}; + GVAR(isDownStateKey1) = true; + + // Statement + ["azimuth"] call FUNC(onKeyDown); + true + }, + [15, [false, false, false]], + false, + "keydown" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_AzimuthKey", + { + // prevent holding down + GVAR(isDownStateKey1) = false; + + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + + // Statement + ["azimuth"] call FUNC(onKeyUp); + true + }, + [15, [false, false, false]], + false, + "keyup" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_DistanceKey", + { + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if !(currentWeapon ACE_player == "ACE_Vector" && {ACE_player == cameraOn} && {cameraView == "GUNNER"}) exitWith {false}; + + // prevent holding down + if (GETGVAR(isDownStateKey2,false)) exitWith {false}; + GVAR(isDownStateKey2) = true; + + // Statement + ["distance"] call FUNC(onKeyDown); + true + }, + [19, [false, false, false]], + false, + "keydown" +] call CBA_fnc_registerKeybind; + +["ACE3", + localize "STR_ACE_Vector_DistanceKey", + { + // prevent holding down + GVAR(isDownStateKey2) = false; + + // Conditions: canInteract + _exceptions = []; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + + // Statement + ["distance"] call FUNC(onKeyUp); + true + }, + [19, [false, false, false]], + false, + "keyup" +] call CBA_fnc_registerKeybind; From 7360277d09cfc09d90fb1d0f4b9f22d15ff0bf28 Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 11 Feb 2015 15:29:42 +0100 Subject: [PATCH 067/113] fix error in canUseFCS --- addons/fcs/CfgEventHandlers.hpp | 22 +++++++++++++++++++++- addons/fcs/functions/fnc_canUseFCS.sqf | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index 28e1bd4a85..59956f2702 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -11,7 +11,27 @@ class Extended_PostInit_EventHandlers { }; class Extended_Init_EventHandlers { - class AllVehicles { + class Tank { + class ADDON { + clientInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Car { + class ADDON { + clientInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Helicopter { + class ADDON { + clientInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Plane { + class ADDON { + clientInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Ship_F { class ADDON { clientInit = QUOTE(_this call FUNC(vehicleInit)); }; diff --git a/addons/fcs/functions/fnc_canUseFCS.sqf b/addons/fcs/functions/fnc_canUseFCS.sqf index 854dcf5cec..cb4a1b608d 100644 --- a/addons/fcs/functions/fnc_canUseFCS.sqf +++ b/addons/fcs/functions/fnc_canUseFCS.sqf @@ -12,5 +12,5 @@ #include "script_component.hpp" -getNumber ([configFile >> "CfgVehicles" >> typeOf _vehicle, [_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1 +getNumber ([configFile >> "CfgVehicles" >> typeOf vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1 && {cameraView == "GUNNER"} From 3568d0d72e6f4dad4cb6afe0402fc8dedcd45a7f Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 11 Feb 2015 16:35:42 +0100 Subject: [PATCH 068/113] fix in fcs vehicleInit --- addons/fcs/CfgEventHandlers.hpp | 28 ++++++++++++++++++++++++ addons/fcs/functions/fnc_vehicleInit.sqf | 13 +++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index 59956f2702..ff0812420a 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -37,3 +37,31 @@ class Extended_Init_EventHandlers { }; }; }; + +class Extended_FiredBIS_EventHandlers { + class Tank { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Car { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Helicopter { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Plane { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Ship_F { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; +}; diff --git a/addons/fcs/functions/fnc_vehicleInit.sqf b/addons/fcs/functions/fnc_vehicleInit.sqf index 29de520f5d..fa808c7c27 100644 --- a/addons/fcs/functions/fnc_vehicleInit.sqf +++ b/addons/fcs/functions/fnc_vehicleInit.sqf @@ -17,9 +17,10 @@ private "_vehicle"; _vehicle = _this select 0; { - if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(Enabled)) == 1) then { // @todo for all turrets - _vehicle addEventHandler ["Fired", {_this call FUNC(firedEH)}]; + private "_turretConfig"; + _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); + if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then { _vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true]; _vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _x], [], true]; _vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _x], [], true]; @@ -27,12 +28,10 @@ _vehicle = _this select 0; // calculate offset between gunner camera and muzzle position if !(_vehicle isKindOf "Air") then { - private ["_turretConfig", "_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; + private ["_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; - _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); - - _gunBeg = getText (_turretConfig >> "gunBeg"); // @todo player turret path - _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); // @todo player turret path + _gunBeg = getText (_turretConfig >> "gunBeg"); + _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0; _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0; From 4695376f55f5b4164577dbf7fd887756411ed29e Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 11 Feb 2015 18:49:14 +0100 Subject: [PATCH 069/113] fix eventhandler name --- addons/fcs/CfgEventHandlers.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index ff0812420a..409267a8c8 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -41,27 +41,27 @@ class Extended_Init_EventHandlers { class Extended_FiredBIS_EventHandlers { class Tank { class ADDON { - clientInit = QUOTE(_this call FUNC(firedEH)); + firedBIS = QUOTE(_this call FUNC(firedEH)); }; }; class Car { class ADDON { - clientInit = QUOTE(_this call FUNC(firedEH)); + firedBIS = QUOTE(_this call FUNC(firedEH)); }; }; class Helicopter { class ADDON { - clientInit = QUOTE(_this call FUNC(firedEH)); + firedBIS = QUOTE(_this call FUNC(firedEH)); }; }; class Plane { class ADDON { - clientInit = QUOTE(_this call FUNC(firedEH)); + firedBIS = QUOTE(_this call FUNC(firedEH)); }; }; class Ship_F { class ADDON { - clientInit = QUOTE(_this call FUNC(firedEH)); + firedBIS = QUOTE(_this call FUNC(firedEH)); }; }; }; From 0d3e103de199989549d18a4598982a766b6de33b Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 11 Feb 2015 20:59:41 +0100 Subject: [PATCH 070/113] fcs work around for weaponDirection with commander turrets --- addons/fcs/functions/fnc_keyDown.sqf | 10 +++++++++- addons/fcs/functions/fnc_keyUp.sqf | 13 +++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index 4cfcf7c57a..5a3febf6ea 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -28,7 +28,15 @@ if (_distance == 0) then { _distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision }; -_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); +_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets + +if (_turret isEqualTo ([typeOf _vehicle] call EFUNC(common,getTurretCommander))) then { + _weaponDirection = eyeDirection _vehicle; +}; + +if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turrets + _weaponDirection = [1,0,0]; +}; GVAR(Position) = [ (getPos _vehicle select 0) + _distance * (_weaponDirection select 0), diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index 78a622331f..96e85714fd 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -21,7 +21,7 @@ _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call E _distance = call FUNC(getRange); -_magazines = magazines _vehicle; +_magazines = _vehicle magazinesTurret _turret; if (_distance == 0) then { _distance = [ @@ -33,7 +33,16 @@ if (_distance == 0) then { private ["_weaponDirection", "_angleTarget"]; -_weaponDirection = _vehicle weaponDirection currentWeapon _vehicle; +_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets + +if (_turret isEqualTo ([typeOf _vehicle] call EFUNC(common,getTurretCommander))) then { + _weaponDirection = eyeDirection _vehicle; +}; + +if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turrets + _weaponDirection = [1,0,0]; +}; + _angleTarget = asin (_weaponDirection select 2); if (count _this > 2) then { From d18f470394d9ddfce5a15b861d83cda42a578d6f Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 11 Feb 2015 22:39:31 +0100 Subject: [PATCH 071/113] allow rangefinder while the fcs is active --- addons/fcs/XEH_clientInit.sqf | 2 +- addons/fcs/functions/fnc_keyDown.sqf | 2 +- addons/fcs/initKeybinds.sqf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/fcs/XEH_clientInit.sqf b/addons/fcs/XEH_clientInit.sqf index 918548e71e..17faa70f17 100644 --- a/addons/fcs/XEH_clientInit.sqf +++ b/addons/fcs/XEH_clientInit.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -GVAR(enabled) = True; +GVAR(enabled) = false; GVAR(time) = 0; GVAR(position) = [0,0,0]; diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index 5a3febf6ea..7699b82a20 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -19,7 +19,7 @@ _turret = _this select 1; _distance = call FUNC(getRange); -if !(call FUNC(canUseFCS)) exitWith {}; +if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {}; GVAR(Enabled) = true; GVAR(Time) = time; diff --git a/addons/fcs/initKeybinds.sqf b/addons/fcs/initKeybinds.sqf index bc3cf33bf5..dd1a94b78e 100644 --- a/addons/fcs/initKeybinds.sqf +++ b/addons/fcs/initKeybinds.sqf @@ -7,7 +7,7 @@ _exceptions = []; if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; // Conditions: specific - if !(!GVAR(enabled) && {call FUNC(canUseRangefinder) || FUNC(canUseFCS)}) exitWith {false}; + if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; // prevent holding down if (GETGVAR(isDownStateKey1,false)) exitWith {false}; From 7545a6c3d88d8aa57b81fdc2a336a56dd6cbee5b Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 11 Feb 2015 15:43:08 -0600 Subject: [PATCH 072/113] Code cleanup --- addons/magazinerepack/CfgSounds.hpp | 9 +++------ addons/magazinerepack/config.cpp | 12 +++++++++--- .../functions/fnc_magazineRepackProgress.sqf | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/addons/magazinerepack/CfgSounds.hpp b/addons/magazinerepack/CfgSounds.hpp index 15104d905d..1390397e5e 100644 --- a/addons/magazinerepack/CfgSounds.hpp +++ b/addons/magazinerepack/CfgSounds.hpp @@ -1,13 +1,10 @@ -class CfgSounds -{ - class GVAR(soundMagazineFinished) - { +class CfgSounds { + class GVAR(soundMagazineFinished) { name = QGVAR(soundMagazineFinished); sound[]={QUOTE(PATHTOF(sounds\magrepack_finished.wav)),1,1}; titles[]={}; }; - class GVAR(soundRoundFinished) - { + class GVAR(soundRoundFinished) { name = QGVAR(soundRoundFinished); sound[] = {QUOTE(PATHTOF(sounds\magrepack_single.wav)),1,1}; titles[] = {}; diff --git a/addons/magazinerepack/config.cpp b/addons/magazinerepack/config.cpp index 3a95c10643..514a74350a 100644 --- a/addons/magazinerepack/config.cpp +++ b/addons/magazinerepack/config.cpp @@ -16,7 +16,13 @@ class CfgPatches { #include "CfgSounds.hpp" #include "CfgVehicles.hpp" -class ACE_Parameters_Numeric { - GVAR(TimePerAmmo) = 1.5; - GVAR(TimePerMagazine) = 2.0; +class ACE_Settings { + class GVAR(TimePerAmmo) { + value = 1.5; + typeName = "SCALAR"; + }; + class GVAR(TimePerMagazine) { + value = 2.0; + typeName = "SCALAR"; + }; }; diff --git a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf index 1d3b5ec6cf..64ce05d12d 100644 --- a/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf +++ b/addons/magazinerepack/functions/fnc_magazineRepackProgress.sqf @@ -63,13 +63,13 @@ _updateMagazinesOnPlayerFnc = { }; if (_nextEventIsBullet) then { - playSound QGVAR(soundMagazineFinished); + playSound QGVAR(soundRoundFinished); if ((((count _simEvents) % 3) == 0) || {(count _simEvents) == 1}) then { //For performance - only update mags every 3 bullets (or if it's the last event) call _updateMagazinesOnPlayerFnc; }; } else { - playSound QGVAR(soundRoundFinished); + playSound QGVAR(soundMagazineFinished); call _updateMagazinesOnPlayerFnc; }; From 67b3442d17dda3bfbff7d27c2c9a9496228a746c Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 11 Feb 2015 23:49:41 +0100 Subject: [PATCH 073/113] getting the fcs to work in MP --- addons/fcs/CfgEventHandlers.hpp | 38 ++++++++++++++++++++++++---- addons/fcs/functions/fnc_firedEH.sqf | 2 +- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index 409267a8c8..961a05b27d 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -13,27 +13,55 @@ class Extended_PostInit_EventHandlers { class Extended_Init_EventHandlers { class Tank { class ADDON { - clientInit = QUOTE(_this call FUNC(vehicleInit)); + serverInit = QUOTE(_this call FUNC(vehicleInit)); }; }; class Car { class ADDON { - clientInit = QUOTE(_this call FUNC(vehicleInit)); + serverInit = QUOTE(_this call FUNC(vehicleInit)); }; }; class Helicopter { class ADDON { - clientInit = QUOTE(_this call FUNC(vehicleInit)); + serverInit = QUOTE(_this call FUNC(vehicleInit)); }; }; class Plane { class ADDON { - clientInit = QUOTE(_this call FUNC(vehicleInit)); + serverInit = QUOTE(_this call FUNC(vehicleInit)); }; }; class Ship_F { class ADDON { - clientInit = QUOTE(_this call FUNC(vehicleInit)); + serverInit = QUOTE(_this call FUNC(vehicleInit)); + }; + }; +}; + +class Extended_Respawn_EventHandlers { + class Tank { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Car { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Helicopter { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Plane { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); + }; + }; + class Ship_F { + class ADDON { + respawn = QUOTE(_this call FUNC(vehicleInit)); }; }; }; diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index a0b10795cf..22371a26f4 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -25,7 +25,7 @@ private ["_gunner", "_turret"]; _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); _turret = [_gunner] call EFUNC(common,getTurretIndex); -if (ACE_player != _gunner) exitWith {}; +//if (ACE_player != _gunner) exitWith {}; // global private ["_FCSMagazines", "_FCSElevation", "_offset"]; From ff0348a169a096a73a90d9ac52dbd9fed400dff4 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 12 Feb 2015 13:23:38 +0100 Subject: [PATCH 074/113] add common_fnc_setVariablePublic --- addons/common/XEH_preInit.sqf | 1 + .../functions/fnc_setVariablePublic.sqf | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 addons/common/functions/fnc_setVariablePublic.sqf diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 94a0a490bf..faf0362779 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -119,6 +119,7 @@ PREP(setName); PREP(setParameter); PREP(setPitchBankYaw); PREP(setVariableJIP); +PREP(setVariablePublic); PREP(setSetting); PREP(setSettingFromConfig); PREP(stringToColoredText); diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf new file mode 100644 index 0000000000..cbdf0dc31d --- /dev/null +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -0,0 +1,53 @@ +/* + * Author: commy2 + * + * Sets a public variable, but wait a certain amount of time to transfer the value over the network. Changing the value by calling this function again resets the windup timer. + * + * Argument: + * 0: Object the variable should be assigned to (Object) + * 1: Name of the variable (String) + * 2: Value of the variable (Any) + * 3: Windup time (Number, optional. Default: 1) + * + * Return value: + * Nothing. + */ +#include "script_component.hpp" + +private ["_object", "_varName", "_value", "_sync"]; + +_object = _this select 0; +_varName = _this select 1; +_value = _this select 2; +_sync = _this select 3; + +if (isNil "_sync") then { + _sync = 1; +}; + +// set value locally +_object setVariable [_varName, _value]; + +// "duh" +if (!isMultiplayer) exitWith {}; + +// generate stacked eventhandler id +private "_idName"; +_idName = format ["ACE_setVariablePublic_%1", _varName]; + +// when to push the value +private "_syncTime"; +_syncTime = diag_tickTime + _sync; + +// add eventhandler. should the value change, then overwrite the previous eventhandler +[_idName, "onEachFrame", { + // wait to sync the variable + if (diag_tickTime > _this select 3) then { + // set value public + (_this select 0) setVariable [_this select 1, _this select 2, true]; + + // remove eventhandler + [_this select 4, "onEachFrame"] call BIS_fnc_removeStackedEventHandler + }; +}, [_object, _varName, _value, _syncTime, _idName]] call BIS_fnc_addStackedEventHandler; +nil From b32849a68e5b05106a1a81da30bcb90b34b36840 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 12 Feb 2015 14:18:34 +0100 Subject: [PATCH 075/113] no left hand - weapon IK when swag walking (combat pace) --- addons/movement/CfgMoves.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/movement/CfgMoves.hpp b/addons/movement/CfgMoves.hpp index 9d32d4e856..677ad3dc94 100644 --- a/addons/movement/CfgMoves.hpp +++ b/addons/movement/CfgMoves.hpp @@ -77,6 +77,15 @@ class CfgMovesMaleSdr: CfgMovesBasic { class AmovPercMwlkSlowWrflDr: AmovPercMwlkSlowWrflDf { leftHandIKCurve[] = {}; }; + class AmovPercMwlkSlowWrflDf_v1: AmovPercMwlkSlowWrflDf { + leftHandIKCurve[] = {}; + }; + class AidlPercMwlkSrasWrflDf: AmovPercMwlkSlowWrflDf { + leftHandIKCurve[] = {}; + }; + class AmovPercMtacSlowWrflDf: AmovPercMwlkSlowWrflDf { + leftHandIKCurve[] = {}; + }; // enable optics in prone left and right stance class AidlPpneMstpSrasWrflDnon_G0S; From a4815cb8acf3365e9b02dbea18db99df97fc2785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Thu, 12 Feb 2015 11:51:17 -0300 Subject: [PATCH 076/113] scopes: reduce control numbers --- addons/scopes/RscTitles.hpp | 6 +++--- addons/scopes/functions/fnc_showZeroing.sqf | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/scopes/RscTitles.hpp b/addons/scopes/RscTitles.hpp index 9da0a04a14..a9c43aedaf 100644 --- a/addons/scopes/RscTitles.hpp +++ b/addons/scopes/RscTitles.hpp @@ -13,7 +13,7 @@ class RscTitles { class RscText; class controls { class ACE_Scopes_Zeroing_BG : RscPicture { - idc = 925001; + idc = 11; type = 0; text = PATHTOF(UI\scopes_bg.paa); style = 48 + 0x800; @@ -30,7 +30,7 @@ class RscTitles { h = 0.3 * safezoneH; }; class ACE_Scopes_Zeroing_Vertical : RscText { - idc = 925002; + idc = 12; type = 0; style = 2; sizeEx = 0.04; @@ -47,7 +47,7 @@ class RscTitles { h = 0.025 * safezoneH; }; class ACE_Scopes_Zeroing_Horizontal : RscText { - idc = 925003; + idc = 13; type = 0; style = 0; sizeEx = 0.04; diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf index 3d729e81db..f00ca5fedb 100644 --- a/addons/scopes/functions/fnc_showZeroing.sqf +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -34,8 +34,8 @@ if (isNull _display) exitWith {}; // Update values _zeroing = _adjustment select _weaponIndex; -_vertical = _display displayCtrl 925002; -_horizontal = _display displayCtrl 925003; +_vertical = _display displayCtrl 12; +_horizontal = _display displayCtrl 13; _vertical ctrlSetText (str (_zeroing select 1)); _horizontal ctrlSetText (str (_zeroing select 0)); From 7c8840df565964291bbcc70937e6f4b2c2fce7c0 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 12 Feb 2015 15:56:57 +0100 Subject: [PATCH 077/113] transfer value even if it changed --- .../common/functions/fnc_setVariablePublic.sqf | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf index cbdf0dc31d..81093a2679 100644 --- a/addons/common/functions/fnc_setVariablePublic.sqf +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -35,19 +35,25 @@ if (!isMultiplayer) exitWith {}; private "_idName"; _idName = format ["ACE_setVariablePublic_%1", _varName]; +// exit now if an eh for that variable already exists +private "_allIdNames"; +_allIdNames = [GETMVAR(BIS_stackedEventHandlers_onEachFrame,[]), {_this select 0}] call FUNC(map); + +if (_idName in _allIdNames) exitWith {}; + // when to push the value private "_syncTime"; _syncTime = diag_tickTime + _sync; -// add eventhandler. should the value change, then overwrite the previous eventhandler +// add eventhandler [_idName, "onEachFrame", { // wait to sync the variable - if (diag_tickTime > _this select 3) then { + if (diag_tickTime > _this select 2) then { // set value public - (_this select 0) setVariable [_this select 1, _this select 2, true]; + (_this select 0) setVariable [_this select 1, (_this select 0) getVariable (_this select 1), true]; // remove eventhandler - [_this select 4, "onEachFrame"] call BIS_fnc_removeStackedEventHandler + [_this select 3, "onEachFrame"] call BIS_fnc_removeStackedEventHandler }; -}, [_object, _varName, _value, _syncTime, _idName]] call BIS_fnc_addStackedEventHandler; +}, [_object, _varName, _syncTime, _idName]] call BIS_fnc_addStackedEventHandler; nil From a3dc1df109928918cbaa96f8bf60b5773a248859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Thu, 12 Feb 2015 11:57:55 -0300 Subject: [PATCH 078/113] scopes: moved getWeaponIndex to common --- addons/common/XEH_preInit.sqf | 1 + addons/{scopes => common}/functions/fnc_getWeaponIndex.sqf | 2 ++ addons/scopes/XEH_preInit.sqf | 1 - addons/scopes/functions/fnc_adjustScope.sqf | 2 +- addons/scopes/functions/fnc_canAdjustScope.sqf | 2 +- addons/scopes/functions/fnc_firedEH.sqf | 2 +- addons/scopes/functions/fnc_showZeroing.sqf | 2 +- 7 files changed, 7 insertions(+), 5 deletions(-) rename addons/{scopes => common}/functions/fnc_getWeaponIndex.sqf (92%) diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 9b8964df1b..a186d2ddbe 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -75,6 +75,7 @@ PREP(getVehicleCargo); PREP(getVehicleCodriver); PREP(getVehicleCrew); PREP(getWeaponAzimuthAndInclination); +PREP(getWeaponIndex); PREP(getWeaponType); PREP(getWindDirection); PREP(goKneeling); diff --git a/addons/scopes/functions/fnc_getWeaponIndex.sqf b/addons/common/functions/fnc_getWeaponIndex.sqf similarity index 92% rename from addons/scopes/functions/fnc_getWeaponIndex.sqf rename to addons/common/functions/fnc_getWeaponIndex.sqf index 05c1202795..6cac6d244e 100644 --- a/addons/scopes/functions/fnc_getWeaponIndex.sqf +++ b/addons/common/functions/fnc_getWeaponIndex.sqf @@ -16,6 +16,8 @@ EXPLODE_2_PVT(_this,_unit,_weapon); +if (_weapon = "") exitWith {-1}; + [ primaryWeapon _unit, secondaryWeapon _unit, diff --git a/addons/scopes/XEH_preInit.sqf b/addons/scopes/XEH_preInit.sqf index 5dd7153263..e574cc72d4 100644 --- a/addons/scopes/XEH_preInit.sqf +++ b/addons/scopes/XEH_preInit.sqf @@ -6,7 +6,6 @@ PREP(adjustScope); PREP(canAdjustScope); PREP(firedEH); PREP(getOptics); -PREP(getWeaponIndex); PREP(inventoryCheck); PREP(showZeroing); diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index cf4d7e7146..031ff3a820 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -18,7 +18,7 @@ private ["_unit", "_weapons", "_zeroing", "_pitchbankyaw", "_pitch", "_bank", "_ _unit = _this select 0; -_weaponIndex = [_unit, currentWeapon _unit] call FUNC(getWeaponIndex); +_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); _adjustment = _unit getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { diff --git a/addons/scopes/functions/fnc_canAdjustScope.sqf b/addons/scopes/functions/fnc_canAdjustScope.sqf index 75d5dd73a7..eda08dc0ee 100644 --- a/addons/scopes/functions/fnc_canAdjustScope.sqf +++ b/addons/scopes/functions/fnc_canAdjustScope.sqf @@ -18,7 +18,7 @@ private ["_unit", "_weaponIndex", "_zeroing", "_optic", "_maxHorizontal", "_maxV _unit = _this select 0; -_weaponIndex = [_unit, currentWeapon _unit] call FUNC(getWeaponIndex); +_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {false}; _adjustment = _unit getVariable QGVAR(Adjustment); diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index b6da3c7a9e..371d1e5f33 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -31,7 +31,7 @@ if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; _weapon = _this select 1; _projectile = _this select 5; -_weaponIndex = [_unit, currentWeapon _unit] call FUNC(getWeaponIndex); +_weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {}; _zeroing = _adjustment select _weaponIndex; diff --git a/addons/scopes/functions/fnc_showZeroing.sqf b/addons/scopes/functions/fnc_showZeroing.sqf index f00ca5fedb..836f69b2df 100644 --- a/addons/scopes/functions/fnc_showZeroing.sqf +++ b/addons/scopes/functions/fnc_showZeroing.sqf @@ -16,7 +16,7 @@ disableSerialization; private ["_weaponIndex","_adjustment","_layer","_display","_zeroing","_vertical","_horizontal"]; -_weaponIndex = [ACE_player, currentWeapon ACE_player] call FUNC(getWeaponIndex); +_weaponIndex = [ACE_player, currentWeapon ACE_player] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {}; _adjustment = ACE_player getVariable QGVAR(Adjustment); From 4a70d16f95aed2c3d67a2748fd4ffa3aac9453c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Thu, 12 Feb 2015 12:21:46 -0300 Subject: [PATCH 079/113] scopes: switch throttledPublicVariable by setVariablePublic --- addons/scopes/functions/fnc_adjustScope.sqf | 2 +- addons/scopes/functions/fnc_inventoryCheck.sqf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 031ff3a820..6e71a391aa 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -32,7 +32,7 @@ _zeroing set [1, (round (((_zeroing select 1) + (_this select 2)) * 10)) / 10]; // Change the adjustment array _adjustment set [_weaponIndex, _zeroing]; -[_unit, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); +[_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); playSound (["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_Click_3"] select floor random 3); diff --git a/addons/scopes/functions/fnc_inventoryCheck.sqf b/addons/scopes/functions/fnc_inventoryCheck.sqf index dba446912d..c83112c8a6 100644 --- a/addons/scopes/functions/fnc_inventoryCheck.sqf +++ b/addons/scopes/functions/fnc_inventoryCheck.sqf @@ -20,7 +20,7 @@ _adjustment = ACE_player getVariable QGVAR(Adjustment); if (isNil "_adjustment") then { _adjustment = [[0,0], [0,0], [0,0]]; ACE_player setVariable [QGVAR(Adjustment), _adjustment]; - [ACE_player, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); + [ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); }; if (isNil QGVAR(Optics)) then { @@ -33,7 +33,7 @@ _newOptics = [_player] call FUNC(getOptics); // The optic for this weapon changed, set adjustment to zero if !((_adjustment select _foreachindex) isEqualTo [0,0]) then { _adjustment set [_forEachIndex, [0,0]]; - [ACE_player, QGVAR(Adjustment), 0.5] call EFUNC(common,throttledPublicVariable); + [ACE_player, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); }; }; } forEach GVAR(Optics); From d0b0a0e066d00bda367db0e2193ddfa7010c6d39 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 12 Feb 2015 20:43:50 -0600 Subject: [PATCH 080/113] Missing = --- addons/common/functions/fnc_getWeaponIndex.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_getWeaponIndex.sqf b/addons/common/functions/fnc_getWeaponIndex.sqf index 6cac6d244e..f2b8bce9f2 100644 --- a/addons/common/functions/fnc_getWeaponIndex.sqf +++ b/addons/common/functions/fnc_getWeaponIndex.sqf @@ -16,7 +16,7 @@ EXPLODE_2_PVT(_this,_unit,_weapon); -if (_weapon = "") exitWith {-1}; +if (_weapon == "") exitWith {-1}; [ primaryWeapon _unit, From d4163223a95816efb4eda07604300fbf0d8b6c80 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 05:05:02 +0100 Subject: [PATCH 081/113] fcs in MP --- addons/fcs/functions/fnc_keyUp.sqf | 8 ++++---- addons/fcs/functions/fnc_reset.sqf | 8 ++++---- addons/fcs/functions/fnc_vehicleInit.sqf | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index 96e85714fd..1e5878f0b5 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -155,9 +155,9 @@ _FCSElevation = []; }; } forEach _magazines; -_vehicle setVariable [format ["%1_%2", QGVAR(Distance), _turret], _distance, true]; -_vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines, true]; -_vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation, true]; -_vehicle setVariable [format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth, true]; +[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic); [format ["%1: %2", localize "STR_ACE_FCS_ZeroedTo", _distance]] call EFUNC(common,displayTextStructured); diff --git a/addons/fcs/functions/fnc_reset.sqf b/addons/fcs/functions/fnc_reset.sqf index 9001a31c48..f2b434ab34 100644 --- a/addons/fcs/functions/fnc_reset.sqf +++ b/addons/fcs/functions/fnc_reset.sqf @@ -16,9 +16,9 @@ private "_vehicle"; _vehicle = _this select 0; -_vehicle setVariable [QGVAR(Distance), 0, true]; -_vehicle setVariable [QGVAR(Magazines), [], true]; -_vehicle setVariable [QGVAR(Elevation), 0, true]; -_vehicle setVariable [QGVAR(Azimuth), 0, true]; +[_vehicle, QGVAR(Distance), 0] call EFUNC(common,setVariablePublic); +[_vehicle, QGVAR(Magazines), []] call EFUNC(common,setVariablePublic); +[_vehicle, QGVAR(Elevation), 0] call EFUNC(common,setVariablePublic); +[_vehicle, QGVAR(Azimuth), 0] call EFUNC(common,setVariablePublic); [localize "STR_ACE_FCS_HasBeenReset"] call EFUNC(common,displayTextStructured); diff --git a/addons/fcs/functions/fnc_vehicleInit.sqf b/addons/fcs/functions/fnc_vehicleInit.sqf index fa808c7c27..8ac23073f6 100644 --- a/addons/fcs/functions/fnc_vehicleInit.sqf +++ b/addons/fcs/functions/fnc_vehicleInit.sqf @@ -1,7 +1,7 @@ /* - * Author: KoffeinFlummi + * Author: KoffeinFlummi, commy2 * - * Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler + * Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler. Execute on server. * * Arguments: * 0: Vehicle From f83d83a82029add45d66dd2ba23611daa50df090 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 13 Feb 2015 22:09:29 -0600 Subject: [PATCH 082/113] Fix from AGM FFV-holster bug --- .../fnc_fixLoweredRifleAnimation.sqf | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf b/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf index 55bc6865b0..411fdd2eb3 100644 --- a/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf +++ b/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf @@ -1,10 +1,22 @@ -// by commy2 +/* + * Author: commy2 + * Fixes the lowered rifle animation + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [_player] call ace_common_fnc_fixLoweredRifleAnimation + * + * Public: No + */ #include "script_component.hpp" -private "_unit"; +PARAMS_1(_unit); -_unit = _this select 0; - -if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"}) then { +if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {(vehicle _unit) == _unit}) then { [_unit, "amovpercmstpsraswrfldnon", 0] call FUNC(doAnimation); }; From 60a7d1d1e6ff04302476f15efa4beb75d126177f Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 06:38:01 +0100 Subject: [PATCH 083/113] fix, fcs reset was broken --- addons/fcs/functions/fnc_canResetFCS.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/fcs/functions/fnc_canResetFCS.sqf b/addons/fcs/functions/fnc_canResetFCS.sqf index 81876b301b..488f1eebf4 100644 --- a/addons/fcs/functions/fnc_canResetFCS.sqf +++ b/addons/fcs/functions/fnc_canResetFCS.sqf @@ -12,4 +12,4 @@ #include "script_component.hpp" -count ((vehicle ACE_player) getVariable [format ["%1_%2", QGVAR(Magazines), [vehicle ACE_player] call EFUNC(common,getTurretIndex)], []]) > 1 +count ((vehicle ACE_player) getVariable [format ["%1_%2", QGVAR(Magazines), [ACE_player] call EFUNC(common,getTurretIndex)], []]) > 1 From fb3a610649132c30cc5837a3c90580fba060d1da Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 13 Feb 2015 23:09:52 -0600 Subject: [PATCH 084/113] Fix bad STR_ACE_Common_ACETeam --- addons/logistics_wirecutter/CfgWeapons.hpp | 2 +- addons/vehiclelock/CfgWeapons.hpp | 2 +- addons/winddeflection/config.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/logistics_wirecutter/CfgWeapons.hpp b/addons/logistics_wirecutter/CfgWeapons.hpp index f2d35337a2..76b1003f34 100644 --- a/addons/logistics_wirecutter/CfgWeapons.hpp +++ b/addons/logistics_wirecutter/CfgWeapons.hpp @@ -3,7 +3,7 @@ class CfgWeapons { class ACE_ItemCore; class ACE_wirecutter: ACE_ItemCore { - author = "$STR_ACE_Core_ACETeam"; + author = "$STR_ACE_Common_ACETeam"; displayName = "$STR_ACE_logistics_wirecutter_wirecutterName"; descriptionShort = "$STR_ACE_logistics_wirecutter_wirecutterDescription"; model = "\A3\weapons_F\ammo\mag_univ.p3d"; diff --git a/addons/vehiclelock/CfgWeapons.hpp b/addons/vehiclelock/CfgWeapons.hpp index c7df1116f8..157fb4bf60 100644 --- a/addons/vehiclelock/CfgWeapons.hpp +++ b/addons/vehiclelock/CfgWeapons.hpp @@ -3,7 +3,7 @@ class CfgWeapons { class ACE_ItemCore; class ACE_key_master: ACE_ItemCore { - author = "$STR_ACE_Core_ACETeam"; + author = "$STR_ACE_Common_ACETeam"; displayName = "Vehicle Key: Master"; descriptionShort = "$STR_ACE_Vehicle_Item_Master_Description"; model = "\A3\weapons_F\ammo\mag_univ.p3d"; diff --git a/addons/winddeflection/config.cpp b/addons/winddeflection/config.cpp index f71ef251cd..0e721846ad 100644 --- a/addons/winddeflection/config.cpp +++ b/addons/winddeflection/config.cpp @@ -8,7 +8,7 @@ class CfgPatches { requiredAddons[] = {"ACE_common", "ACE_weather"}; versionDesc = "ACE Wind Deflection"; version = VERSION; - author[] = {$STR_ACE_Core_ACETeam, "Glowbal", "Ruthberg"}; + author[] = {$STR_ACE_Common_ACETeam, "Glowbal", "Ruthberg"}; authorUrl = "http://csemod.com"; }; }; From 1a611480538b0f4df11bcf6e1b863001d65b9aae Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 14 Feb 2015 00:39:01 -0600 Subject: [PATCH 085/113] Grenades Cleanup Shouldn't be any change to functionality Headers Formating simplifying (waitAndExecute) exceptions/canInteract for keybind --- addons/grenades/CfgAmmo.hpp | 168 +++++++++--------- addons/grenades/CfgEventHandlers.hpp | 20 +-- addons/grenades/CfgMagazines.hpp | 114 ++++++------ addons/grenades/CfgVehicles.hpp | 66 +++---- addons/grenades/CfgWeapons.hpp | 38 ++-- addons/grenades/XEH_postInit.sqf | 28 +++ addons/grenades/XEH_postInitClient.sqf | 13 -- addons/grenades/XEH_preInit.sqf | 3 - addons/grenades/config.cpp | 18 +- .../functions/fnc_flashbangEffectStages.sqf | 57 ------ .../functions/fnc_flashbangExplosionEH.sqf | 150 +++++++++------- .../functions/fnc_flashbangThrownFuze.sqf | 33 ++-- addons/grenades/functions/fnc_nextMode.sqf | 37 ++-- .../grenades/functions/fnc_throwGrenade.sqf | 85 +++++---- 14 files changed, 413 insertions(+), 417 deletions(-) create mode 100644 addons/grenades/XEH_postInit.sqf delete mode 100644 addons/grenades/XEH_postInitClient.sqf delete mode 100644 addons/grenades/functions/fnc_flashbangEffectStages.sqf diff --git a/addons/grenades/CfgAmmo.hpp b/addons/grenades/CfgAmmo.hpp index 7b0a24740d..0f86230784 100644 --- a/addons/grenades/CfgAmmo.hpp +++ b/addons/grenades/CfgAmmo.hpp @@ -1,89 +1,89 @@ class CfgAmmo { - class FlareCore; - class FlareBase: FlareCore { - intensity = 20000; - flareSize = 12; - }; - class F_40mm_White: FlareBase { - intensity = 40000; - flareSize = 12; - }; - class F_20mm_White: FlareBase { - intensity = 20000; - flareSize = 12; - }; - class F_Signal_Green: FlareBase { - intensity = 20000; - flareSize = 12; - }; - class Flare_82mm_AMOS_White: FlareCore { - intensity = 80000; - flareSize = 12; - }; + class FlareCore; + class FlareBase: FlareCore { + intensity = 20000; + flareSize = 12; + }; + class F_40mm_White: FlareBase { + intensity = 40000; + flareSize = 12; + }; + class F_20mm_White: FlareBase { + intensity = 20000; + flareSize = 12; + }; + class F_Signal_Green: FlareBase { + intensity = 20000; + flareSize = 12; + }; + class Flare_82mm_AMOS_White: FlareCore { + intensity = 80000; + flareSize = 12; + }; - class F_20mm_Red: F_20mm_White {}; - class F_20mm_Green: F_20mm_White {}; - class F_20mm_Yellow: F_20mm_White {}; + class F_20mm_Red: F_20mm_White {}; + class F_20mm_Green: F_20mm_White {}; + class F_20mm_Yellow: F_20mm_White {}; - class ACE_F_Hand_White: F_20mm_White { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Red: F_20mm_Red { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Green: F_20mm_Green { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; - class ACE_F_Hand_Yellow: F_20mm_Yellow { - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - }; + class ACE_F_Hand_White: F_20mm_White { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Red: F_20mm_Red { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Green: F_20mm_Green { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; + class ACE_F_Hand_Yellow: F_20mm_Yellow { + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + }; - class ACE_G_M84: F_20mm_Yellow { - useFlare = 0; - flareSize = 0; - intensity = 0; - grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; - soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; - SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; - SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; - SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; - SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; - SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; - timeToLive = 60; - fuseDistance = 2.3; - model = PATHTOF(models\ACE_m84_thrown.p3d); - }; + class ACE_G_M84: F_20mm_Yellow { + useFlare = 0; + flareSize = 0; + intensity = 0; + grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5}; + soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5}; + SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100}; + SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100}; + SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100}; + SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70}; + SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70}; + timeToLive = 60; + fuseDistance = 2.3; + model = PATHTOF(models\ACE_m84_thrown.p3d); + }; }; diff --git a/addons/grenades/CfgEventHandlers.hpp b/addons/grenades/CfgEventHandlers.hpp index 02f1ac5553..2587bdf86f 100644 --- a/addons/grenades/CfgEventHandlers.hpp +++ b/addons/grenades/CfgEventHandlers.hpp @@ -1,19 +1,19 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); - }; + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; }; class Extended_PostInit_EventHandlers { - class ADDON { - clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) ); - }; + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + }; }; class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) ); + class CAManBase { + class ADDON { + clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) ); + }; }; - }; }; diff --git a/addons/grenades/CfgMagazines.hpp b/addons/grenades/CfgMagazines.hpp index 5775302d2c..33392f41ee 100644 --- a/addons/grenades/CfgMagazines.hpp +++ b/addons/grenades/CfgMagazines.hpp @@ -1,60 +1,60 @@ class CfgMagazines { - class HandGrenade; - class ACE_HandFlare_Base: HandGrenade { - value = 2; - nameSoundWeapon = "smokeshell"; - nameSound = "smokeshell"; - mass = 4; - initSpeed = 22; - }; - class ACE_HandFlare_White: ACE_HandFlare_Base { - ammo = "ACE_F_Hand_White"; - displayname = "$STR_ACE_Grenades_M127A1_White_Name"; - descriptionshort = "$STR_ACE_Grenades_M127A1_White_Description"; - displayNameShort = "$STR_ACE_Grenades_M127A1_White_NameShort"; - model = "\A3\weapons_f\ammo\flare_white"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; - }; - class ACE_HandFlare_Red: ACE_HandFlare_Base { - ammo = "ACE_F_Hand_Red"; - displayname = "$STR_ACE_Grenades_M127A1_Red_Name"; - descriptionshort = "$STR_ACE_Grenades_M127A1_Red_Description"; - displayNameShort = "$STR_ACE_Grenades_M127A1_Red_NameShort"; - model = "\A3\weapons_f\ammo\flare_red"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; - }; - class ACE_HandFlare_Green: ACE_HandFlare_Base { - ammo = "ACE_F_Hand_Green"; - displayname = "$STR_ACE_Grenades_M127A1_Green_Name"; - descriptionshort = "$STR_ACE_Grenades_M127A1_Green_Description"; - displayNameShort = "$STR_ACE_Grenades_M127A1_Green_NameShort"; - model = "\A3\weapons_f\ammo\flare_green"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; - }; - class ACE_HandFlare_Yellow: ACE_HandFlare_Base { - ammo = "ACE_F_Hand_Yellow"; - displayname = "$STR_ACE_Grenades_M127A1_Yellow_Name"; - descriptionshort = "$STR_ACE_Grenades_M127A1_Yellow_Description"; - displayNameShort = "$STR_ACE_Grenades_M127A1_Yellow_NameShort"; - model = "\A3\weapons_f\ammo\flare_yellow"; - picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; - }; - class ACE_M84: HandGrenade { - ammo = "ACE_G_M84"; - displayname = "$STR_ACE_Grenades_M84_Name"; - descriptionshort = "$STR_ACE_Grenades_M84_Description"; - displayNameShort = "M84"; - model = PATHTOF(models\ACE_m84.p3d); - picture = PATHTOF(UI\ACE_m84_x_ca.paa); - }; + class HandGrenade; + class ACE_HandFlare_Base: HandGrenade { + value = 2; + nameSoundWeapon = "smokeshell"; + nameSound = "smokeshell"; + mass = 4; + initSpeed = 22; + }; + class ACE_HandFlare_White: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_White"; + displayname = "$STR_ACE_Grenades_M127A1_White_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_White_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_White_NameShort"; + model = "\A3\weapons_f\ammo\flare_white"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa"; + }; + class ACE_HandFlare_Red: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Red"; + displayname = "$STR_ACE_Grenades_M127A1_Red_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Red_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Red_NameShort"; + model = "\A3\weapons_f\ammo\flare_red"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa"; + }; + class ACE_HandFlare_Green: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Green"; + displayname = "$STR_ACE_Grenades_M127A1_Green_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Green_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Green_NameShort"; + model = "\A3\weapons_f\ammo\flare_green"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa"; + }; + class ACE_HandFlare_Yellow: ACE_HandFlare_Base { + ammo = "ACE_F_Hand_Yellow"; + displayname = "$STR_ACE_Grenades_M127A1_Yellow_Name"; + descriptionshort = "$STR_ACE_Grenades_M127A1_Yellow_Description"; + displayNameShort = "$STR_ACE_Grenades_M127A1_Yellow_NameShort"; + model = "\A3\weapons_f\ammo\flare_yellow"; + picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa"; + }; + class ACE_M84: HandGrenade { + ammo = "ACE_G_M84"; + displayname = "$STR_ACE_Grenades_M84_Name"; + descriptionshort = "$STR_ACE_Grenades_M84_Description"; + displayNameShort = "M84"; + model = PATHTOF(models\ACE_m84.p3d); + picture = PATHTOF(UI\ACE_m84_x_ca.paa); + }; - class 3Rnd_UGL_FlareGreen_F; - class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F { - ammo = "F_40mm_Green"; - initSpeed = 120; - }; - class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F { - ammo = "F_40mm_Red"; - initSpeed = 120; - }; + class 3Rnd_UGL_FlareGreen_F; + class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F { + ammo = "F_40mm_Green"; + initSpeed = 120; + }; + class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F { + ammo = "F_40mm_Red"; + initSpeed = 120; + }; }; diff --git a/addons/grenades/CfgVehicles.hpp b/addons/grenades/CfgVehicles.hpp index 9a0164e24f..d4ff039bf7 100644 --- a/addons/grenades/CfgVehicles.hpp +++ b/addons/grenades/CfgVehicles.hpp @@ -1,45 +1,45 @@ #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; + name = #ITEM; \ + count = COUNT; \ + }; class CfgVehicles { - class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class Box_NATO_Support_F; + class NATO_Box_Base; + class EAST_Box_Base; + class IND_Box_Base; + class Box_NATO_Support_F; - class Box_NATO_Grenades_F: NATO_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_HandFlare_White,12) - MACRO_ADDITEM(ACE_HandFlare_Green,12) - MACRO_ADDITEM(ACE_M84,12) + class Box_NATO_Grenades_F: NATO_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_White,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_M84,12) + }; }; - }; - class Box_East_Grenades_F: EAST_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_HandFlare_Yellow,12) - MACRO_ADDITEM(ACE_HandFlare_Red,12) - MACRO_ADDITEM(ACE_M84,12) + class Box_East_Grenades_F: EAST_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_HandFlare_Red,12) + MACRO_ADDITEM(ACE_M84,12) + }; }; - }; - class Box_IND_Grenades_F: IND_Box_Base { - class TransportItems { - MACRO_ADDITEM(ACE_HandFlare_Yellow,12) - MACRO_ADDITEM(ACE_HandFlare_Green,12) - MACRO_ADDITEM(ACE_M84,12) + class Box_IND_Grenades_F: IND_Box_Base { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_M84,12) + }; }; - }; - class ACE_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(ACE_HandFlare_White,12) - MACRO_ADDITEM(ACE_HandFlare_Red,12) - MACRO_ADDITEM(ACE_HandFlare_Green,12) - MACRO_ADDITEM(ACE_HandFlare_Yellow,12) - MACRO_ADDITEM(ACE_M84,12) + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_HandFlare_White,12) + MACRO_ADDITEM(ACE_HandFlare_Red,12) + MACRO_ADDITEM(ACE_HandFlare_Green,12) + MACRO_ADDITEM(ACE_HandFlare_Yellow,12) + MACRO_ADDITEM(ACE_M84,12) + }; }; - }; }; diff --git a/addons/grenades/CfgWeapons.hpp b/addons/grenades/CfgWeapons.hpp index fa28ca4ef0..4edc6e6d12 100644 --- a/addons/grenades/CfgWeapons.hpp +++ b/addons/grenades/CfgWeapons.hpp @@ -1,23 +1,23 @@ class CfgWeapons { - class GrenadeLauncher; + class GrenadeLauncher; - class Throw: GrenadeLauncher { - muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"}; - class ThrowMuzzle; - class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle { - magazines[] = {"ACE_HandFlare_White"}; + class Throw: GrenadeLauncher { + muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"}; + class ThrowMuzzle; + class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_White"}; + }; + class ACE_HandFlare_RedMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Red"}; + }; + class ACE_HandFlare_GreenMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Green"}; + }; + class ACE_HandFlare_YellowMuzzle: ThrowMuzzle { + magazines[] = {"ACE_HandFlare_Yellow"}; + }; + class ACE_M84Muzzle: ThrowMuzzle { + magazines[] = {"ACE_M84"}; + }; }; - class ACE_HandFlare_RedMuzzle: ThrowMuzzle { - magazines[] = {"ACE_HandFlare_Red"}; - }; - class ACE_HandFlare_GreenMuzzle: ThrowMuzzle { - magazines[] = {"ACE_HandFlare_Green"}; - }; - class ACE_HandFlare_YellowMuzzle: ThrowMuzzle { - magazines[] = {"ACE_HandFlare_Yellow"}; - }; - class ACE_M84Muzzle: ThrowMuzzle { - magazines[] = {"ACE_M84"}; - }; - }; }; diff --git a/addons/grenades/XEH_postInit.sqf b/addons/grenades/XEH_postInit.sqf new file mode 100644 index 0000000000..0b6bb16ffb --- /dev/null +++ b/addons/grenades/XEH_postInit.sqf @@ -0,0 +1,28 @@ +// by commy2 + +#include "script_component.hpp" + +["flashbangExplosion", {_this call FUNC(flashbangExplosionEH)}] call EFUNC(common,addEventHandler); + +if !(hasInterface) exitWith {}; + +GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265]; +GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; + +// Add keybinds +["ACE3", + localize "STR_ACE_Grenades_SwitchGrenadeMode", + { + // Conditions: canInteract + _exceptions = [QEGVAR(captives,isNotEscorting)]; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false}; + + // Statement + [] call FUNC(nextMode); + }, + [9, [false, false, false]], //8 key + false, + "keydown" +] call cba_fnc_registerKeybind; diff --git a/addons/grenades/XEH_postInitClient.sqf b/addons/grenades/XEH_postInitClient.sqf deleted file mode 100644 index 5f5b569050..0000000000 --- a/addons/grenades/XEH_postInitClient.sqf +++ /dev/null @@ -1,13 +0,0 @@ -// by commy2 - -#include "script_component.hpp" - -GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265]; -GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; - -["ACE3", -localize "STR_ACE_Grenades_SwitchGrenadeMode", -{_this call FUNC(nextMode)}, -[9, [false, false, false]], //8 key -false, -"keydown"] call cba_fnc_registerKeybind; diff --git a/addons/grenades/XEH_preInit.sqf b/addons/grenades/XEH_preInit.sqf index 569cbfa8f6..0df2e235fd 100644 --- a/addons/grenades/XEH_preInit.sqf +++ b/addons/grenades/XEH_preInit.sqf @@ -2,12 +2,9 @@ ADDON = false; -PREP(flashbangEffectStages); PREP(flashbangExplosionEH); PREP(flashbangThrownFuze); PREP(nextMode); PREP(throwGrenade); -["flashbangExplosion", { _this call DFUNC(flashbangExplosionEH) }] call EFUNC(common,addEventHandler); - ADDON = true; diff --git a/addons/grenades/config.cpp b/addons/grenades/config.cpp index 74d1038ecc..c2a899d66c 100644 --- a/addons/grenades/config.cpp +++ b/addons/grenades/config.cpp @@ -1,15 +1,15 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi"}; - authorUrl = "https://github.com/commy2/"; - VERSION_CONFIG; - }; + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"commy2", "KoffeinFlummi"}; + authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; + }; }; #include "CfgEventHandlers.hpp" diff --git a/addons/grenades/functions/fnc_flashbangEffectStages.sqf b/addons/grenades/functions/fnc_flashbangEffectStages.sqf deleted file mode 100644 index c2ee7a6841..0000000000 --- a/addons/grenades/functions/fnc_flashbangEffectStages.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* -* Author: KoffeinFlummi, Pabst Mirror -* -* Handles the different stages of the flash bang effect recovery -* -* Arguments: -* ARRAY[ -* 0-ARRAY - PARAMS: -* 0: NUMBER - Stage, controls a case statement -* 1: NUMBER - Time To Wait Until -* 2: VARIES - Stage's Variable -* 1-NUMBER perFrame handle -* Return Value: -* None -*/ - -#include "script_component.hpp" - -private ["_stage", "_waitUntilTime"]; - -_stage = (_this select 0) select 0; -_waitUntilTime = (_this select 0) select 1; - -if (_waitUntilTime > time) exitWith {}; - -//remove frameEH -[(_this select 1)] call cba_fnc_removePerFrameHandler; - -switch (_stage) do { - case(EFFECT_STAGE_RESETAI): { - private "_unit"; - _unit = (_this select 0) select 2; - _unit enableAI "MOVE"; - _unit enableAI "ANIM"; - _unit enableAI "AUTOTARGET"; - _unit enableAI "TARGET"; - _unit enableAI "FSM"; - _unit setSkill (skill _unit * 50); - }; - case(EFFECT_STAGE_DELETELIGHT): { - private "_light"; - _light = (_this select 0) select 2; - deleteVehicle _light; - }; - case(EFFECT_STAGE_PARTIALRECOVERY): { - private "_strength"; - _strength = (_this select 0) select 2; - GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; - GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); - }; - case(EFFECT_STAGE_FULLRECOVERY): { - GVAR(flashbangPPEffectCC) ppEffectEnable false; - }; - default { - TRACE_1("EffectStage Bad Stage", _stage); - }; -}; diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index 1ef7ea1484..3868994bee 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -1,85 +1,109 @@ /* -* Author: KoffeinFlummi -* -* Creates the flashbang effect and knock out AI units. -* -* Arguments: -* 0: The grenade (Object) -* -* Return Value: -* None -*/ - + * Author: KoffeinFlummi + * Creates the flashbang effect and knock out AI units. + * + * Arguments: + * 0: The grenade + * + * Return Value: + * Nothing + * + * Example: + * [theGrenade] call ace_grenades_fnc_flashbangExplosionEH + * + * Public: No + */ #include "script_component.hpp" -private ["_grenade", "_affected", "_strength", "_posGrenade", "_posUnit", "_angleGrenade", "_angleView", "_angleDiff", "_light"]; +private ["_affected", "_strength", "_posGrenade", "_posUnit", "_angleGrenade", "_angleView", "_angleDiff", "_light"]; -_grenade = _this select 0; +PARAMS_1(_grenade); _affected = _grenade nearEntities ["CAManBase", 50]; { - if ((local _x) && {alive _x}) then { + if ((local _x) && {alive _x}) then { - _strength = 1 - ((_x distance _grenade) min 15) / 15; + _strength = 1 - ((_x distance _grenade) min 15) / 15; - if (_x != ACE_player) then { - //must be AI - _x disableAI "MOVE"; - _x disableAI "ANIM"; - _x disableAI "AUTOTARGET"; - _x disableAI "TARGET"; - _x disableAI "FSM"; - _x setSkill ((skill _x) / 50); + if (_x != ACE_player) then { + //must be AI + _x disableAI "MOVE"; + _x disableAI "ANIM"; + _x disableAI "AUTOTARGET"; + _x disableAI "TARGET"; + _x disableAI "FSM"; + _x setSkill ((skill _x) / 50); - [FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_RESETAI, (time + (7 * _strength)), _x]] call CBA_fnc_addPerFrameHandler; - } else { - //Do effects for player - // is there line of sight to the grenade? - _posGrenade = getPosASL _grenade; - _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground - if (lineIntersects [_posGrenade, getPosASL _x, _grenade, _x]) then { - _strength = _strength / 10; - }; + [{ + PARAMS_1(_unit); + _unit enableAI "MOVE"; + _unit enableAI "ANIM"; + _unit enableAI "AUTOTARGET"; + _unit enableAI "TARGET"; + _unit enableAI "FSM"; + _unit setSkill (skill _unit * 50); + }, [_x], (7 * _strength), 0.1] call EFUNC(common,waitAndExecute); //0.1 precision is fine for AI + } else { + //Do effects for player + // is there line of sight to the grenade? + _posGrenade = getPosASL _grenade; + _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground + if (lineIntersects [_posGrenade, getPosASL _x, _grenade, _x]) then { + _strength = _strength / 10; + }; - // beeeeeeeeeeeeeeeeeeeeeeeeeeeeep - if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then { - [_x, 0.5 + (_strength / 2)] call EFUNC(hearing,earRinging); - }; + // beeeeeeeeeeeeeeeeeeeeeeeeeeeeep + if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then { + [_x, 0.5 + (_strength / 2)] call EFUNC(hearing,earRinging); + }; - // account for people looking away by slightly - // reducing the effect for visual effects. - _posUnit = getPos _x; - _posGrenade = getPos _grenade; - _angleGrenade = ((_posGrenade select 0) - (_posUnit select 0)) atan2 ((_posGrenade select 1) - (_posUnit select 1)); - _angleGrenade = (_angleGrenade + 360) % 360; + // account for people looking away by slightly + // reducing the effect for visual effects. + _posUnit = getPos _x; + _posGrenade = getPos _grenade; + _angleGrenade = ((_posGrenade select 0) - (_posUnit select 0)) atan2 ((_posGrenade select 1) - (_posUnit select 1)); + _angleGrenade = (_angleGrenade + 360) % 360; - _angleView = (eyeDirection player select 0) atan2 (eyeDirection player select 1); - _angleView = (_angleView + 360) % 360; + _angleView = (eyeDirection ACE_player select 0) atan2 (eyeDirection ACE_player select 1); + _angleView = (_angleView + 360) % 360; - _angleDiff = 180 - abs (abs (_angleGrenade - _angleView) - 180); - _angleDiff = ((_angleDiff - 45) max 0); + _angleDiff = 180 - abs (abs (_angleGrenade - _angleView) - 180); + _angleDiff = ((_angleDiff - 45) max 0); - _strength = _strength - _strength * (_angleDiff / 135); + _strength = _strength - _strength * (_angleDiff / 135); - // create flash to illuminate environment - _light = "#lightpoint" createVehicleLocal getPos _grenade; - _light setLightBrightness 200; - _light setLightAmbient [1,1,1]; - _light setLightColor [1,1,1]; - _light setLightDayLight true; + // create flash to illuminate environment + _light = "#lightpoint" createVehicleLocal (getPos _grenade); + _light setLightBrightness 200; + _light setLightAmbient [1,1,1]; + _light setLightColor [1,1,1]; + _light setLightDayLight true; - [FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_DELETELIGHT, (time + (0.1)), _light]] call CBA_fnc_addPerFrameHandler; + //Delete the light after 0.1 seconds + [{ + PARAMS_1(_light); + deleteVehicle _light; + }, [_light], 0.1, 0] call EFUNC(common,waitAndExecute); - // blind player - if (_strength > 0.1) then { - GVAR(flashbangPPEffectCC) ppEffectEnable true; - GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; - GVAR(flashbangPPEffectCC) ppEffectCommit 0.01; + // blind player + if (_strength > 0.1) then { + GVAR(flashbangPPEffectCC) ppEffectEnable true; + GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; + GVAR(flashbangPPEffectCC) ppEffectCommit 0.01; - [FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_PARTIALRECOVERY, (time + (7 * _strength)), _strength]] call CBA_fnc_addPerFrameHandler; - [FUNC(flashbangEffectStages), 0, [ EFFECT_STAGE_FULLRECOVERY, (time + (17 * _strength))]] call CBA_fnc_addPerFrameHandler; - }; + //PARTIALRECOVERY - start decreasing effect over time + [{ + PARAMS_1(_strength); + GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]]; + GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength); + }, [_strength], (7 * _strength), 0] call EFUNC(common,waitAndExecute); + + //FULLRECOVERY - end effect + [{ + GVAR(flashbangPPEffectCC) ppEffectEnable false; + }, [], (17 * _strength), 0] call EFUNC(common,waitAndExecute); + }; + }; }; - }; } forEach _affected; diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index aec10301ab..a83c81e660 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -1,18 +1,25 @@ -//Waits for the grenade fuze to trigger and 'explode' - +/* + * Author: commy2 + * Waits for the flashbang grenade fuze to trigger and 'explode' + * + * Arguments: + * 0: projectile - Flashbang Grenade + * + * Return Value: + * Nothing + * + * Example: + * [theFlashbang] call ace_grenades_fnc_flashbangThrownFuze + * + * Public: No + */ #include "script_component.hpp" -_projectile = (_this select 0) select 0; -_waitUntilTime = (_this select 0) select 1; - -if (_waitUntilTime > time) exitWith {}; - -//remove frameEH -[(_this select 1)] call cba_fnc_removePerFrameHandler; +PARAMS_1(_projectile); if (alive _projectile) then { - playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - - _affected = _projectile nearEntities ["CAManBase", 50]; - ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); + playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; + + _affected = _projectile nearEntities ["CAManBase", 50]; + ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); }; diff --git a/addons/grenades/functions/fnc_nextMode.sqf b/addons/grenades/functions/fnc_nextMode.sqf index da8392b6ab..7663e790f6 100644 --- a/addons/grenades/functions/fnc_nextMode.sqf +++ b/addons/grenades/functions/fnc_nextMode.sqf @@ -1,40 +1,41 @@ /* * Author: commy2 - * * Select the next throwing mode and display message. - * - * Argument: - * Nothing - * - * Return value: + * + * Arguments: * Nothing + * + * Return Value: + * Handeled + * + * Example: + * [] call ace_grenades_fnc_nextMode + * + * Public: No */ - #include "script_component.hpp" - -private ["_mode", "_hint"]; -if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false}; +private ["_mode", "_hint"]; _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode == 4) then { - _mode = 0; + _mode = 0; } else { - _mode = _mode + 1; + _mode = _mode + 1; }; // ROLL GRENADE DOESN'T WORK RIGHT NOW if (_mode == 3) then { - _mode = 4; + _mode = 4; }; _hint = [ - localize "STR_ACE_Grenades_NormalThrow", - localize "STR_ACE_Grenades_HighThrow", - localize "STR_ACE_Grenades_PreciseThrow", - localize "STR_ACE_Grenades_RollGrenade", - localize "STR_ACE_Grenades_DropGrenade" +localize "STR_ACE_Grenades_NormalThrow", +localize "STR_ACE_Grenades_HighThrow", +localize "STR_ACE_Grenades_PreciseThrow", +localize "STR_ACE_Grenades_RollGrenade", +localize "STR_ACE_Grenades_DropGrenade" ] select _mode; [_hint] call EFUNC(common,displayTextStructured); diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index e725ebd426..c7bc09a261 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -1,15 +1,24 @@ /* -* Author: commy2 -* -* Adjust the grenades throwing direction and speed to the selected throwing mode. -* -* Argument: -* input from "Fired" eventhandler -* -* Return value: -* Nothing -*/ - + * Author: commy2 + * Adjust the grenades throwing direction and speed to the selected throwing mode. + * + * Arguments: + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot + * + * Return Value: + * Nothing + * + * Example: + * [clientFiredBIS-XEH] call ace_grenades_fnc_throwGrenade + * + * Public: No + */ #include "script_component.hpp" private ["_unit", "_weapon", "_projectile", "_mode", "_fuzeTime"]; @@ -24,38 +33,38 @@ if (_weapon != "Throw") exitWith {}; _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode != 0) then { - private "_velocity"; + private "_velocity"; - _velocity = velocity _projectile; + _velocity = velocity _projectile; - switch (_mode) do { - //high throw - case 1 : { - _velocity = [ - 0.5 * (_velocity select 0), - 0.5 * (_velocity select 1), - [0, 0, 0] distance (_velocity vectorMultiply 0.5) - ]; + switch (_mode) do { + //high throw + case 1 : { + _velocity = [ + 0.5 * (_velocity select 0), + 0.5 * (_velocity select 1), + [0, 0, 0] distance (_velocity vectorMultiply 0.5) + ]; + }; + //precise throw + case 2 : { + _velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity); + }; + //roll grande + case 3 : { + //@todo + }; + //drop grenade + case 4 : { + _velocity = [0, 0, 0]; + }; }; - //precise throw - case 2 : { - _velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity); - }; - //roll grande - case 3 : { - //@todo - }; - //drop grenade - case 4 : { - _velocity = [0, 0, 0]; - }; - }; - _projectile setVelocity _velocity; + _projectile setVelocity _velocity; }; if (typeOf _projectile == "ACE_G_M84") then { - _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance"); - // _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance - [FUNC(flashbangThrownFuze), 0, [_projectile, (time + _fuzeTime)]] call CBA_fnc_addPerFrameHandler; + _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance"); + // _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance + [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute); }; From 983b44c02a9add3fdd5e2a3e0888d6ae86a971a7 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 07:51:13 +0100 Subject: [PATCH 086/113] air burst ammo PFH --- addons/fcs/XEH_preInit.sqf | 1 + addons/fcs/functions/fnc_firedEH.sqf | 26 ++++++------------- .../fnc_handleAirBurstAmmunitionPFH.sqf | 21 +++++++++++++++ 3 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf diff --git a/addons/fcs/XEH_preInit.sqf b/addons/fcs/XEH_preInit.sqf index 18729ca54f..78a2fd091c 100644 --- a/addons/fcs/XEH_preInit.sqf +++ b/addons/fcs/XEH_preInit.sqf @@ -9,6 +9,7 @@ PREP(canUseRangefinder); PREP(firedEH); PREP(getAngle); PREP(getRange); +PREP(handleAirBurstAmmunitionPFH); PREP(keyDown); PREP(keyUp); PREP(reset); diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 22371a26f4..38e2c90f3c 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -45,26 +45,16 @@ _offset = 0; [_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection); // Air burst missile -// may need to get rewritten -if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_Airburst") == 1) then { - _this spawn { - _vehicle = _this select 0; - _projectile = _this select 6; - _distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle]; +// handle locally only +if (!local _gunner) exitWith {}; - if (_distance < 50) exitWith {}; - if (_distance > 1500) exitWith {}; +if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(Airburst)) == 1) then { + private "_zeroing"; + _zeroing = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle]; - waitUntil {_projectile distance _vehicle > _distance || {!alive _projectile}}; - if (!alive _projectile) exitWith {}; + if (_zeroing < 50) exitWith {}; + if (_zeroing > 1500) exitWith {}; - _position = getPosATL _projectile; - - _subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"]; - _subMunition setPosATL _position; - _subMunition setVelocity [0, 0, -10]; - - deleteVehicle _projectile; - }; + [FUNC(handleAirBurstAmmunitionPFH), 0, [_vehicle, _projectile, _zeroing]] call CBA_fnc_addPerFrameHandler; }; diff --git a/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf b/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf new file mode 100644 index 0000000000..7e8480ce18 --- /dev/null +++ b/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf @@ -0,0 +1,21 @@ +// by commy2 + +_vehicle = _this select 0 select 0; +_projectile = _this select 0 select 1; +_zeroing = _this select 0 select 2; + +if (isNull _projectile || {!alive _projectile}) exitWith { + [_this select 1] call CBA_fnc_removePerFrameHandler; +}; + +if (_projectile distance _vehicle < _zeroing) exitWith {}; + +_position = getPosATL _projectile; + +_subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"]; +_subMunition setPosATL _position; +_subMunition setVelocity [0, 0, -10]; + +deleteVehicle _projectile; + +[_this select 1] call CBA_fnc_removePerFrameHandler; From 19cf05314e48ab9f9add73b9c0a99b3ff7012fed Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 08:09:52 +0100 Subject: [PATCH 087/113] fcs reset was still broken --- addons/fcs/config.cpp | 2 +- addons/fcs/functions/fnc_reset.sqf | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/fcs/config.cpp b/addons/fcs/config.cpp index 3c7303d68b..20ae063c70 100644 --- a/addons/fcs/config.cpp +++ b/addons/fcs/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {ace_common, ace_interaction}; - author[] = {"KoffeinFlummi","BadGuy (simon84)"}; + author[] = {"KoffeinFlummi","BadGuy (simon84)","commy2"}; authorUrl = "https://github.com/KoffeinFlummi/"; VERSION_CONFIG; }; diff --git a/addons/fcs/functions/fnc_reset.sqf b/addons/fcs/functions/fnc_reset.sqf index f2b434ab34..a23a759fa3 100644 --- a/addons/fcs/functions/fnc_reset.sqf +++ b/addons/fcs/functions/fnc_reset.sqf @@ -12,13 +12,14 @@ #include "script_component.hpp" -private "_vehicle"; +private ["_vehicle", "_turret"]; _vehicle = _this select 0; +_turret = _this select 1; -[_vehicle, QGVAR(Distance), 0] call EFUNC(common,setVariablePublic); -[_vehicle, QGVAR(Magazines), []] call EFUNC(common,setVariablePublic); -[_vehicle, QGVAR(Elevation), 0] call EFUNC(common,setVariablePublic); -[_vehicle, QGVAR(Azimuth), 0] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], 0] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], []] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], 0] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], 0] call EFUNC(common,setVariablePublic); [localize "STR_ACE_FCS_HasBeenReset"] call EFUNC(common,displayTextStructured); From e72742da3112f655642a1a177fd94d2b635aba69 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 08:26:30 +0100 Subject: [PATCH 088/113] add macros for transport cargo config --- addons/flashsuppressors/CfgVehicles.hpp | 5 ----- addons/magazines/CfgVehicles.hpp | 5 ----- addons/main/script_macros.hpp | 16 ++++++++++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/addons/flashsuppressors/CfgVehicles.hpp b/addons/flashsuppressors/CfgVehicles.hpp index 40dc505d64..a973518b91 100644 --- a/addons/flashsuppressors/CfgVehicles.hpp +++ b/addons/flashsuppressors/CfgVehicles.hpp @@ -1,9 +1,4 @@ -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ -} - class CfgVehicles { class NATO_Box_Base; class Box_NATO_Support_F: NATO_Box_Base { diff --git a/addons/magazines/CfgVehicles.hpp b/addons/magazines/CfgVehicles.hpp index b78eb71abc..a7c2654d71 100644 --- a/addons/magazines/CfgVehicles.hpp +++ b/addons/magazines/CfgVehicles.hpp @@ -1,9 +1,4 @@ -#define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \ - magazine = #MAGAZINE; \ - count = COUNT; \ -} - class CfgVehicles { class NATO_Box_Base; class Box_NATO_Wps_F: NATO_Box_Base { diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 3b59e8b373..cc589aac3e 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -199,6 +199,22 @@ #define GETEGVAR(var1,var2,var3) GETMVAR(EGVAR(var1,var2),var3) +#define MACRO_ADDWEAPON(WEAPON,COUNT) class _xx_##WEAPON { \ + weapon = #WEAPON; \ + count = COUNT; \ +} + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ +} + +#define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \ + magazine = #MAGAZINE; \ + count = COUNT; \ +} + + #ifdef DISABLE_COMPILE_CACHE #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) #else From 20f161a9da1f16447708cace8e1232046ee189a1 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 09:36:35 +0100 Subject: [PATCH 089/113] aircraft, remove redundant config entries, documentation --- addons/aircraft/CfgAmmo.hpp | 285 +------------------- addons/aircraft/config/config.cpp | 13 + addons/aircraft/config/script_component.hpp | 1 + 3 files changed, 27 insertions(+), 272 deletions(-) create mode 100644 addons/aircraft/config/config.cpp create mode 100644 addons/aircraft/config/script_component.hpp diff --git a/addons/aircraft/CfgAmmo.hpp b/addons/aircraft/CfgAmmo.hpp index 2c9d6a91e6..177753223f 100644 --- a/addons/aircraft/CfgAmmo.hpp +++ b/addons/aircraft/CfgAmmo.hpp @@ -1,302 +1,43 @@ class CfgAmmo { - class BulletBase; - class B_20mm: BulletBase { - deflecting = 3; - hit = 100; - indirectHit = 10; - indirectHitRange = 2; - model = "\A3\Weapons_f\Data\bullettracer\tracer_red"; - }; - + // adjust minigun caliber and deflection to other ammo class SubmunitionBullet; class B_65x39_Minigun_Caseless: SubmunitionBullet { - hit = 10; - indirectHit = 0; - indirectHitRange = 0; caliber = 1; - deflecting = 5; - typicalSpeed = 850; + deflecting = 15; }; class B_762x51_Minigun_Tracer_Red: SubmunitionBullet { - hit = 12; - indirectHit = 0; - indirectHitRange = 0; - model = "\A3\Weapons_f\Data\bullettracer\tracer_red"; caliber = 1.6; - deflecting = 5; - typicalSpeed = 850; - }; - - class M_Titan_AA; - class M_Zephyr: M_Titan_AA { - proxyShape = "\A3\Weapons_F\Ammo\Missile_AA_02_F.p3d"; - model = "\A3\Weapons_F\Ammo\Missile_AA_02_fly_F.p3d"; - airFriction = 0.078; - sideAirFriction = 0.18; - maneuvrability = 24; - class CamShakeFire {}; - class CamShakePlayerFire {}; - }; - - class M_Zephyr_Mi06: M_Zephyr { - maverickWeaponIndexOffset = 6; - }; - - class MissileBase; - class M_Air_AA: MissileBase { - model = "\A3\Weapons_F\Ammo\Missile_AT_02_fly_F"; - proxyShape = "\A3\Weapons_F\Ammo\Missile_AT_02_F"; - hit = 280; - indirectHit = 85; - indirectHitRange = 10; - maneuvrability = 27; - simulationStep = 0.002; - airLock = 1; - irLock = 1; - cost = 1500; - //maxSpeed = 2400; - timeToLive = 40; - airFriction = 0.05; - sideAirFriction = 0.1; - trackOversteer = 1; - trackLead = 1; - initTime = 0; - thrustTime = 12; - thrust = 340; - fuseDistance = 500; - weaponLockSystem = "2 + 16"; - maxControlRange = 8000; - class CamShakeExplode {}; - class CamShakeHit {}; - class CamShakeFire {}; - class CamShakePlayerFire {}; - }; - - class Missile_AA_04_F: MissileBase { - hit = 800; - indirectHit = 60; - indirectHitRange = 12; - airLock = 2; - irLock = 1; - laserLock = 0; - nvLock = 0; - weaponLockSystem = "2 + 16"; - cmimmunity = 0.8; - initTime = 0; - thrust = 380; - thrustTime = 9.5; - airFriction = 0.04; - sideAirFriction = 0.08; - //maxSpeed = 2600; - maneuvrability = 14; - simulationStep = 0.002; - fuseDistance = 500; - timeToLive = 19; - trackLead = 1; - trackOversteer = 1; + deflecting = 15; }; + // also adjust tracer, "muh lightshow"; also adjust splash damage radius + class BulletBase; class Gatling_30mm_HE_Plane_CAS_01_F: BulletBase { - model = "\A3\Weapons_f\Data\bullettracer\tracer_red.p3d"; - cost = 20; hit = 80; indirectHit = 12; - indirectHitRange = 3; + indirectHitRange = 3; //2; caliber = 1.4; - explosive = 0.6; - airlock = 1; deflecting = 3; - airFriction = -0.00042; - typicalSpeed = 960; - visibleFire = 32; - audibleFire = 32; - visibleFireTime = 3; fuseDistance = 3; - tracerScale = 2.5; tracerStartTime = 0.02; - tracerEndTime = 4.7; - multiSoundHit[] = {"soundHit1",0.2,"soundHit2",0.2,"soundHit3",0.2,"soundHit4",0.1,"soundHit5",0.15,"soundHit6",0.15}; - soundFly[] = {"A3\Sounds_F\weapons\Explosion\cannon_fly",1,1,50}; - explosionSoundEffect = "DefaultExplosion"; - explosionEffects = "ExploAmmoExplosion"; - craterEffects = "ExploAmmoCrater"; - soundHit1[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_1",3.16228,1,1600}; - soundHit2[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_2",3.16228,1,1600}; - soundHit3[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_3",3.16228,1,1600}; - soundHit4[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_4",3.16228,1,1600}; - soundHit5[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_5",3.16228,1,1600}; - soundHit6[] = {"A3\Sounds_F\weapons\Explosion\gr_explosion_6",3.16228,1,1600}; - class CamShakeExplode {}; - class CamShakeHit {}; - class CamShakeFire {}; - class CamShakePlayerFire {}; }; + + // helper projectiles to simulate a rof > fps class ACE_Gatling_30mm_HE_Plane_CAS_01_Deploy: Gatling_30mm_HE_Plane_CAS_01_F { simulation = "shotSubmunitions"; triggerTime = 0; submunitionAmmo = "ACE_Gatling_30mm_HE_Plane_CAS_01_Sub"; submunitionConeType[] = {"custom", {{0,0}, {0,0}, {0,0}} }; }; - class ACE_Gatling_30mm_HE_Plane_CAS_01_Sub: Gatling_30mm_HE_Plane_CAS_01_F { - }; + class ACE_Gatling_30mm_HE_Plane_CAS_01_Sub: Gatling_30mm_HE_Plane_CAS_01_F {}; + + // adjust damage and splash damage, closer to bluefor gatling with same caliber class Cannon_30mm_HE_Plane_CAS_02_F: Gatling_30mm_HE_Plane_CAS_01_F { - model = "\A3\Weapons_f\Data\bullettracer\tracer_green.p3d"; - hit = 70; - indirectHit = 11; + hit = 70; //40; + indirectHit = 11; //14; indirectHitRange = 3; - caliber = 2; - explosive = 0.6; }; - - class Missile_AGM_02_F: MissileBase { - model = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_02_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_02_F.p3d"; - maverickWeaponIndexOffset = 2; - cost = 1500; - hit = 2100; - indirectHit = 85; - indirectHitRange = 8; - manualControl = 0; - maxControlRange = 8000; - airLock = 0; - irLock = 1; - laserLock = 0; - nvLock = 0; - weaponLockSystem = "2 + 16"; - cmimmunity = 0.8; - initTime = 0; - thrust = 240; - thrustTime = 5; - airFriction = 0.05; - sideAirFriction = 0.1; - maxSpeed = 828; - maneuvrability = 27; - simulationStep = 0.002; - fuseDistance = 500; - timeToLive = 40; - trackLead = 1; - trackOversteer = 1; - craterEffects = "AAMissileCrater"; - effectsMissile = "missile3"; - explosionEffects = "AAMissileExplosion"; - muzzleEffect = "BIS_fnc_effectFiredHeliRocket"; - whistleDist = 20; - class CamShakeExplode {}; - class CamShakeHit {}; - class CamShakeFire {}; - class CamShakePlayerFire {}; - }; - - class LaserBombCore; - class Bomb_04_F: LaserBombCore { - model = "\A3\Weapons_F_EPC\Ammo\Bomb_04_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Bomb_04_F.p3d"; - maverickWeaponIndexOffset = 8; - hit = 6000; - indirectHit = 1400; - indirectHitRange = 15; - nvLock = 1; - weaponLockSystem = "2 + 16 + 4"; - maneuvrability = 20; - fuseDistance = 35; - trackLead = 0.95; - trackOversteer = 1; - craterEffects = "BombCrater"; - explosionEffects = "BombExplosion"; - explosionSoundEffect = "DefaultExplosion"; - explosionTime = 2; - multiSoundHit[] = {"soundHit1",0.2,"soundHit2",0.2,"soundHit3",0.2,"soundHit4",0.2,"soundHit5",0.2}; - soundHit1[] = {"\A3\Sounds_F\weapons\Explosion\expl_big_1",2.51189,1,2400}; - soundHit2[] = {"\A3\Sounds_F\weapons\Explosion\expl_big_2",2.51189,1,2400}; - soundHit3[] = {"\A3\Sounds_F\weapons\Explosion\expl_big_3",2.51189,1,2400}; - soundHit4[] = {"\A3\Sounds_F\weapons\Explosion\expl_shell_1",2.51189,1,2400}; - soundHit5[] = {"\A3\Sounds_F\weapons\Explosion\expl_shell_2",2.51189,1,2400}; - whistleDist = 24; - }; - - class Rocket_04_HE_F: MissileBase { - model = "\A3\Weapons_F_EPC\Ammo\Rocket_04_HE_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Rocket_04_HE_F.p3d"; - maverickWeaponIndexOffset = 12; - cost = 500; - hit = 210; - indirectHit = 55; - indirectHitRange = 15; - manualControl = 0; - maxControlRange = 8000; - airLock = 0; - irLock = 1; - laserLock = 0; - nvLock = 0; - weaponLockSystem = 0; - cmimmunity = 1; - initTime = 0.002; - thrust = 1600; - thrustTime = 0.7; - airFriction = 0.0046; - sideAirFriction = 0.005; - maxSpeed = 610; - maneuvrability = 0; - fuseDistance = 50; - timeToLive = 60; - effectsMissileInit = "MissileDAR1"; - whistleDist = 30; - class CamShakeExplode {}; - class CamShakeHit {}; - class CamShakeFire {}; - class CamShakePlayerFire {}; - }; - - class Rocket_04_AP_F: Rocket_04_HE_F { - model = "\A3\Weapons_F_EPC\Ammo\Rocket_04_AP_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Rocket_04_AP_F.p3d"; - maverickWeaponIndexOffset = 19; - hit = 400; - indirectHit = 20; - indirectHitRange = 10; - }; - - class Missile_AA_03_F: Missile_AA_04_F { - model = "\A3\Weapons_F_EPC\Ammo\Missile_AA_03_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Missile_AA_03_F.p3d"; - maverickWeaponIndexOffset = 0; - hit = 900; - indirectHit = 50; - indirectHitRange = 15; - }; - - class Missile_AGM_01_F: Missile_AGM_02_F { - model = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_01_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Missile_AGM_01_F.p3d"; - maverickWeaponIndexOffset = 2; - hit = 2200; - indirectHit = 90; - indirectHitRange = 10; - }; - - class Bomb_03_F: Bomb_04_F { - model = "\A3\Weapons_F_EPC\Ammo\Bomb_03_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Bomb_03_F.p3d"; - maverickWeaponIndexOffset = 6; - hit = 6400; - indirectHit = 1400; - indirectHitRange = 16; - }; - - class Rocket_03_HE_F: Rocket_04_HE_F { - model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Rocket_03_HE_F.p3d"; - maverickWeaponIndexOffset = 8; - }; - - class Rocket_03_AP_F: Rocket_04_AP_F { - model = "\A3\Weapons_F_EPC\Ammo\Rocket_03_AP_fly_F.p3d"; - proxyShape = "\A3\Weapons_F_EPC\Ammo\Rocket_03_AP_F.p3d"; - maverickWeaponIndexOffset = 28; - }; - - class RocketBase; }; diff --git a/addons/aircraft/config/config.cpp b/addons/aircraft/config/config.cpp new file mode 100644 index 0000000000..7ac4cf3bad --- /dev/null +++ b/addons/aircraft/config/config.cpp @@ -0,0 +1,13 @@ +#include "script_component.hpp" + +class CfgPatches { + class DOUBLES(ADDON,heli1) { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {QUOTE(ADDON)}; + author[] = {"commy2"}; + authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; + }; +}; diff --git a/addons/aircraft/config/script_component.hpp b/addons/aircraft/config/script_component.hpp new file mode 100644 index 0000000000..7368add67c --- /dev/null +++ b/addons/aircraft/config/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\aircraft\script_component.hpp" \ No newline at end of file From b1a1c855d99ffa1cee9bb6bc314a87dd9e78aee1 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 09:47:03 +0100 Subject: [PATCH 090/113] fix wrong class inheritance in laser selfdesignate --- addons/laser_selfdesignate/CfgVehicles.hpp | 60 ++++++++++------------ 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/addons/laser_selfdesignate/CfgVehicles.hpp b/addons/laser_selfdesignate/CfgVehicles.hpp index eed000544c..cb9d5a094c 100644 --- a/addons/laser_selfdesignate/CfgVehicles.hpp +++ b/addons/laser_selfdesignate/CfgVehicles.hpp @@ -1,35 +1,29 @@ class CfgVehicles { - class AllVehicles; - - class Air: AllVehicles { - class Turrets; - }; - class Helicopter: Air - { - class Turrets: Turrets { - class MainTurret; - }; - // TODO: move these to a different HUD addon - // commanderCanSee = 2+32; - // gunnerCanSee = 2+32; - // driverCanSee = 2+32; + class AllVehicles; + class Air: AllVehicles { + class Turrets; + }; - }; - class Helicopter_Base_F: Helicopter { - class Turrets: Turrets { - class MainTurret: MainTurret {}; - }; - }; - class Heli_Attack_01_base_F: Helicopter_Base_F { - class Turrets: Turrets { - class MainTurret: MainTurret {}; - }; - }; - class B_Heli_Attack_01_F: Heli_Attack_01_base_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - stabilizedInAxes = 4; // This stablizes the turret a bit more for laser designation - }; - }; - }; -}; \ No newline at end of file + class Helicopter: Air { + class Turrets { + class MainTurret; + }; + + // TODO: move these to a different HUD addon + // commanderCanSee = 2+32; + // gunnerCanSee = 2+32; + // driverCanSee = 2+32; + + }; + class Helicopter_Base_F: Helicopter {}; + + class Heli_Attack_01_base_F: Helicopter_Base_F {}; + + class B_Heli_Attack_01_F: Heli_Attack_01_base_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + stabilizedInAxes = 4; // This stablizes the turret a bit more for laser designation + }; + }; + }; +}; From 3d4c43c6134e2058271e6cecf0399509a7e8df9c Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 09:50:26 +0100 Subject: [PATCH 091/113] replace tabs with spaces --- .../laser_selfdesignate/CfgEventhandlers.hpp | 32 +++++++-------- addons/laser_selfdesignate/CfgUI.hpp | 40 +++++++++---------- addons/laser_selfdesignate/CfgVehicles.hpp | 1 + addons/laser_selfdesignate/CfgWeapons.hpp | 19 ++++----- addons/laser_selfdesignate/config.cpp | 16 ++++---- 5 files changed, 55 insertions(+), 53 deletions(-) diff --git a/addons/laser_selfdesignate/CfgEventhandlers.hpp b/addons/laser_selfdesignate/CfgEventhandlers.hpp index 74deb4bcf6..ea33d05bcb 100644 --- a/addons/laser_selfdesignate/CfgEventhandlers.hpp +++ b/addons/laser_selfdesignate/CfgEventhandlers.hpp @@ -1,27 +1,27 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_pre_init)); - }; + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_pre_init)); + }; }; class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_post_init)); - }; + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_post_init)); + }; }; class Extended_GetIn_EventHandlers { - class B_Heli_Attack_01_F { - class ADDON { - getIn = QUOTE(call FUNC(onGetin)); - }; - }; + class B_Heli_Attack_01_F { + class ADDON { + getIn = QUOTE(call FUNC(onGetin)); + }; + }; }; class Extended_GetOut_EventHandlers { - class B_Heli_Attack_01_F { - class ADDON { - getOut = QUOTE(call FUNC(onGetout)); - }; - }; + class B_Heli_Attack_01_F { + class ADDON { + getOut = QUOTE(call FUNC(onGetout)); + }; + }; }; diff --git a/addons/laser_selfdesignate/CfgUI.hpp b/addons/laser_selfdesignate/CfgUI.hpp index 11fab908d7..e8823e04f8 100644 --- a/addons/laser_selfdesignate/CfgUI.hpp +++ b/addons/laser_selfdesignate/CfgUI.hpp @@ -4,29 +4,29 @@ class RscControlsGroupNoScrollbars; /* This disables air radar. We need to make this a seperate HUD addon class RscInGameUI { - class RscUnitInfo - { - class CA_Radar: RscControlsGroupNoScrollbars - { - class controls - { - class CA_RadarBackground: RscPicture { - colorText[] = {0,0,0,0}; - text = ""; - }; - class CA_RadarIcon: RscPicture { - colorText[] = {0,0,0,0}; - }; - class CA_Heading: RscText { - colorText[] = {0,0,0,0}; - }; - }; - }; - }; + class RscUnitInfo + { + class CA_Radar: RscControlsGroupNoScrollbars + { + class controls + { + class CA_RadarBackground: RscPicture { + colorText[] = {0,0,0,0}; + text = ""; + }; + class CA_RadarIcon: RscPicture { + colorText[] = {0,0,0,0}; + }; + class CA_Heading: RscText { + colorText[] = {0,0,0,0}; + }; + }; + }; + }; }; class CfgInGameUI { - + }; */ \ No newline at end of file diff --git a/addons/laser_selfdesignate/CfgVehicles.hpp b/addons/laser_selfdesignate/CfgVehicles.hpp index cb9d5a094c..5b2fdd7d28 100644 --- a/addons/laser_selfdesignate/CfgVehicles.hpp +++ b/addons/laser_selfdesignate/CfgVehicles.hpp @@ -15,6 +15,7 @@ class CfgVehicles { // driverCanSee = 2+32; }; + class Helicopter_Base_F: Helicopter {}; class Heli_Attack_01_base_F: Helicopter_Base_F {}; diff --git a/addons/laser_selfdesignate/CfgWeapons.hpp b/addons/laser_selfdesignate/CfgWeapons.hpp index a966144b10..a62974ce40 100644 --- a/addons/laser_selfdesignate/CfgWeapons.hpp +++ b/addons/laser_selfdesignate/CfgWeapons.hpp @@ -1,10 +1,11 @@ class CfgWeapons { - class LauncherCore; - - class RocketPods: LauncherCore { - canLock = 1; // Disable locking unless newb mode - }; - class missiles_DAGR: RocketPods { - canLock = 1; // Disable locking unless newb mode - }; -}; \ No newline at end of file + // Disable locking unless newb mode + class LauncherCore; + class RocketPods: LauncherCore { + canLock = 1; + }; + + class missiles_DAGR: RocketPods { + canLock = 1; + }; +}; diff --git a/addons/laser_selfdesignate/config.cpp b/addons/laser_selfdesignate/config.cpp index 5452ee4e22..e19e438da0 100644 --- a/addons/laser_selfdesignate/config.cpp +++ b/addons/laser_selfdesignate/config.cpp @@ -1,17 +1,17 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { "ace_main", "ace_laser" }; - version = VERSION; - }; + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_main", "ace_laser"}; + version = VERSION; + }; }; #include "CfgUI.hpp" #include "CfgEventhandlers.hpp" #include "CfgWeapons.hpp" -#include "CfgVehicles.hpp" \ No newline at end of file +#include "CfgVehicles.hpp" From 06efab0082d8148f358ecd908f12c00448b21e4f Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 10:04:50 +0100 Subject: [PATCH 092/113] fix inheritance, new little bird unarmed base class in 1.38 --- addons/aircraft/CfgVehicles.hpp | 4 +++- addons/fcs/CfgVehicles.hpp | 4 +++- addons/realisticnames/config.cpp | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/aircraft/CfgVehicles.hpp b/addons/aircraft/CfgVehicles.hpp index 18be36b9e8..bea27c85ff 100644 --- a/addons/aircraft/CfgVehicles.hpp +++ b/addons/aircraft/CfgVehicles.hpp @@ -55,7 +55,9 @@ class CfgVehicles { }; }; - class B_Heli_Light_01_F: Heli_Light_01_base_F { + class Heli_Light_01_unarmed_base_F: Heli_Light_01_base_F {}; + + class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F { /*class Turrets: Turrets { class CopilotTurret: CopilotTurret {}; diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp index 16902d9ee0..4cc010f917 100644 --- a/addons/fcs/CfgVehicles.hpp +++ b/addons/fcs/CfgVehicles.hpp @@ -432,7 +432,9 @@ class CfgVehicles { };*/ }; - class B_Heli_Light_01_F: Heli_Light_01_base_F { + class Heli_Light_01_unarmed_base_F: Heli_Light_01_base_F {}; + + class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F { /*class Turrets: Turrets { class CopilotTurret: CopilotTurret {}; };*/ diff --git a/addons/realisticnames/config.cpp b/addons/realisticnames/config.cpp index 347d0c1b2e..ea1318686b 100644 --- a/addons/realisticnames/config.cpp +++ b/addons/realisticnames/config.cpp @@ -292,8 +292,8 @@ class CfgVehicles { displayName = "$STR_ACE_RealisticNames_Heli_Attack_01_Name"; }; - class Heli_Light_01_base_F; - class B_Heli_Light_01_F: Heli_Light_01_base_F { + class Heli_Light_01_unarmed_base_F; + class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F { displayName = "$STR_ACE_RealisticNames_Heli_Light_01_Name"; }; @@ -302,7 +302,7 @@ class CfgVehicles { displayName = "$STR_ACE_RealisticNames_Heli_Light_01_armed_Name"; }; - class Heli_Light_01_civil_base_F: Heli_Light_01_base_F { + class Heli_Light_01_civil_base_F: Heli_Light_01_unarmed_base_F { displayName = "$STR_ACE_RealisticNames_Heli_Light_01_civil_Name"; }; From 8a348b002407f3973d93c155b0fd3656ef77275d Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 10:26:52 +0100 Subject: [PATCH 093/113] aircraft, remove old/redundant mag configs --- addons/aircraft/CfgMagazines.hpp | 193 +------------------------------ 1 file changed, 3 insertions(+), 190 deletions(-) diff --git a/addons/aircraft/CfgMagazines.hpp b/addons/aircraft/CfgMagazines.hpp index 7328eda091..0c306f8f04 100644 --- a/addons/aircraft/CfgMagazines.hpp +++ b/addons/aircraft/CfgMagazines.hpp @@ -1,202 +1,15 @@ class CfgMagazines { + // shoot helper object to tripple rof class VehicleMagazine; - class 24Rnd_PG_missiles; - - class 12Rnd_PG_missiles: 24Rnd_PG_missiles { - count = 12; - displayName = "$STR_A3_CfgMagazines_12Rnd_PG_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_12Rnd_PG_missiles_dns"; - descriptionShort = "$STR_A3_CfgMagazines_12Rnd_PG_missiles1"; - }; - class 12Rnd_missiles: VehicleMagazine { - scope = 2; - count = 12; - ammo = "M_AT"; - displayName = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles_dns"; - descriptionShort = "$STR_A3_CfgMagazines_24Rnd_PuG_missiles0"; - initSpeed = 44; - maxLeadSpeed = 800; - nameSound = "rockets"; - sound[] = {"A3\sounds_f\weapons\rockets\explosion_missile_01",1,1,1200}; - reloadSound[] = {"",0.000316228,1}; - }; - - //minigun magazines, muzzle velocities and tracercounts - class 200Rnd_65x39_Belt: VehicleMagazine {}; - class 2000Rnd_65x39_Belt: 200Rnd_65x39_Belt {}; - class 2000Rnd_65x39_Belt_Tracer_Red: 2000Rnd_65x39_Belt { - }; - class 2000Rnd_65x39_Belt_Green: 2000Rnd_65x39_Belt {}; - class 2000Rnd_65x39_Belt_Tracer_Green: 2000Rnd_65x39_Belt_Green { - tracersEvery = 1; - }; - class 2000Rnd_65x39_Belt_Yellow: 2000Rnd_65x39_Belt { - tracersEvery = 1; - }; - class 2000Rnd_65x39_Belt_Tracer_Yellow: 2000Rnd_65x39_Belt_Yellow { - tracersEvery = 1; - }; - - class 5000Rnd_762x51_Belt: 2000Rnd_65x39_Belt { - tracersEvery = 1; - count = 5000; - }; - class 5000Rnd_762x51_Yellow_Belt: 5000Rnd_762x51_Belt {}; - class 4000Rnd_762x51_M134 : 5000Rnd_762x51_Belt { - count = 4000; - tracersEvery = 1; - }; - class 2000Rnd_762x51_M134 : 4000Rnd_762x51_M134 { - count = 2000; - tracersEvery = 1; - }; - - class 2Rnd_AAA_missiles: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_2Rnd_AAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_2Rnd_AAA_missiles_dns"; - ammo = "M_Air_AA"; - count = 2; - maxLeadSpeed = 950; - nameSound = "missiles"; - }; - class 2Rnd_AAA_missiles_MI02: 2Rnd_AAA_missiles { - ammo = "M_Air_AA_MI02"; - }; - class 4Rnd_AAA_missiles: 2Rnd_AAA_missiles { - displayName = "$STR_A3_CfgMagazines_4Rnd_AAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_4Rnd_AAA_missiles_dns"; - count = 4; - }; - class 4Rnd_AAA_missiles_MI02: 4Rnd_AAA_missiles { - ammo = "M_Air_AA_MI02"; - }; - - class 4Rnd_GAA_missiles: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_4Rnd_GAA_missiles0"; - displayNameShort = "$STR_A3_CfgMagazines_4Rnd_GAA_missiles_dns"; - count = 4; - ammo = "M_Zephyr"; - maxLeadSpeed = 950; - nameSound = "missiles"; - }; - - class 300Rnd_20mm_shells: VehicleMagazine { - scope = 2; - displayName = "$STR_A3_CfgMagazines_300Rnd_20mm_shells0"; - displayNameShort = "$STR_A3_CfgMagazines_300Rnd_20mm_shells_dns"; - ammo = "B_20mm"; - count = 300; - deflecting = 3; - maxLeadSpeed = 300; - tracersEvery = 5; - nameSound = "cannon"; - }; - class 1000Rnd_Gatling_30mm_Plane_CAS_01_F: VehicleMagazine { - scope = 2; - displayNameShort = ""; ammo = "ACE_Gatling_30mm_HE_Plane_CAS_01_Deploy"; count = 1170; - //count = 390; - //initSpeed = 3852; - maxLeadSpeed = 300; - nameSound = "cannon"; - tracersEvery = 1; - }; - - class 2Rnd_Missile_AA_04_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_4RND_AAA_MISSILES_DNS"; - ammo = "Missile_AA_04_F"; - count = 2; - maxLeadSpeed = 220; - nameSound = "missiles"; - }; - class 6Rnd_Missile_AGM_02_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_02_F"; - count = 6; - maxLeadSpeed = 450; - nameSound = "missiles"; - }; - class 2Rnd_Missile_AGM_02_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_02_F"; - count = 2; - maxLeadSpeed = 450; - nameSound = "missiles"; - }; - - class 7Rnd_Rocket_04_HE_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGMAGAZINES_40RND_20MM_G_BELT_DNS"; - ammo = "Rocket_04_HE_F"; - count = 7; - maxLeadSpeed = 200; - nameSound = "rockets"; - }; - class 7Rnd_Rocket_04_AP_F: 7Rnd_Rocket_04_HE_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_TITAN_AP_DNS"; - ammo = "Rocket_04_AP_F"; - }; - - class 4Rnd_Bomb_04_F: VehicleMagazine { - scope = 2; - displayNameShort = "$STR_A3_CFGVEHICLES_BOMB0"; - ammo = "Bomb_04_F"; - count = 4; - maxLeadSpeed = 1000; - nameSound = "cannon"; - }; - - class 500Rnd_Cannon_30mm_Plane_CAS_02_F: 1000Rnd_Gatling_30mm_Plane_CAS_01_F { - displayNameShort = ""; - ammo = "Cannon_30mm_HE_Plane_CAS_02_F"; - count = 500; - }; - - class 2Rnd_Missile_AA_03_F: 2Rnd_Missile_AA_04_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_4RND_AAA_MISSILES_DNS"; - ammo = "Missile_AA_03_F"; - count = 2; - }; - class 4Rnd_Missile_AGM_01_F: 6Rnd_Missile_AGM_02_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_38RND_80MM_ROCKETS_DNS"; - ammo = "Missile_AGM_01_F"; - count = 4; - }; - - class 20Rnd_Rocket_03_HE_F: 7Rnd_Rocket_04_HE_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_40RND_20MM_G_BELT_DNS"; - ammo = "Rocket_03_HE_F"; - count = 20; - }; - class 20Rnd_Rocket_03_AP_F: 7Rnd_Rocket_04_AP_F { - displayNameShort = "$STR_A3_CFGMAGAZINES_TITAN_AP_DNS"; - ammo = "Rocket_03_AP_F"; - count = 20; - }; - - class 2Rnd_Bomb_03_F: 4Rnd_Bomb_04_F { - displayNameShort = "$STR_A3_CFGVEHICLES_BOMB0"; - ammo = "Bomb_03_F"; - count = 2; }; + // an extended magazine for the comanche + class 300Rnd_20mm_shells; class ACE_500Rnd_20mm_shells_Comanche: 300Rnd_20mm_shells { - displayName = "20mm"; - displayNameShort = "20mm"; - ammo = "B_20mm"; count = 500; - deflecting = 3; - initSpeed = 1030; - maxLeadSpeed = 300; - tracersEvery = 5; }; }; From f358d099e62c96bddf7cc3346d62740c0c099b14 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 10:58:10 +0100 Subject: [PATCH 094/113] aircraft config cleanup --- addons/aircraft/CfgVehicles.hpp | 114 +++++++++++--------------------- 1 file changed, 38 insertions(+), 76 deletions(-) diff --git a/addons/aircraft/CfgVehicles.hpp b/addons/aircraft/CfgVehicles.hpp index bea27c85ff..5f419506c0 100644 --- a/addons/aircraft/CfgVehicles.hpp +++ b/addons/aircraft/CfgVehicles.hpp @@ -8,12 +8,9 @@ class CfgVehicles { class NewTurret { class Turrets; }; - class CargoTurret; }; - class Air: AllVehicles { - class AnimationSources; - }; + class Air: AllVehicles {}; class Helicopter: Air { class Turrets { @@ -33,6 +30,7 @@ class CfgVehicles { class Turrets: Turrets { class CopilotTurret; }; + class AnimationSources; }; class Helicopter_Base_H: Helicopter_Base_F { @@ -46,7 +44,7 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -60,11 +58,6 @@ class CfgVehicles { class B_Heli_Light_01_F: Heli_Light_01_unarmed_base_F { /*class Turrets: Turrets { class CopilotTurret: CopilotTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; - class CargoTurret_03: CargoTurret_02 {}; - class CargoTurret_04: CargoTurret_01 {}; };*/ }; @@ -72,7 +65,7 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -86,7 +79,8 @@ class CfgVehicles { driverCanEject = 1; lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; - magazines[] = {"2000Rnd_762x51_Belt_T_Green", "12Rnd_PG_missiles", "168Rnd_CMFlare_Chaff_Magazine"}; + magazines[] = {"2000Rnd_762x51_Belt_T_Green","12Rnd_PG_missiles","168Rnd_CMFlare_Chaff_Magazine"}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -105,36 +99,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; - class AnimationSources: AnimationSources { - class HitGlass1 { - source = "Hit"; - hitpoint = "HitGlass1"; - raw = 1; - }; - class HitGlass2: HitGlass1 { - hitpoint = "HitGlass2"; - }; - class HitGlass3: HitGlass1 { - hitpoint = "HitGlass3"; - }; - class HitGlass4: HitGlass1 { - hitpoint = "HitGlass4"; - }; - class Gatling { - source = "revolving"; - weapon = "ACE_gatling_20mm_Comanche"; - }; - class Hide { - source = "user"; - animPeriod = 0; - initPhase = 0; - }; - class Muzzle_flash { - source = "ammorandom"; - weapon = "ACE_gatling_20mm_Comanche"; - }; - }; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -143,6 +108,15 @@ class CfgVehicles { magazines[] = {"ACE_500Rnd_20mm_shells_Comanche","4Rnd_AAA_missiles","24Rnd_PG_missiles"}; }; }; + + class AnimationSources: AnimationSources { + class Gatling { + weapon = "ACE_gatling_20mm_Comanche"; + }; + class Muzzle_flash { + weapon = "ACE_gatling_20mm_Comanche"; + }; + }; }; class B_Heli_Attack_01_F: Heli_Attack_01_base_F {}; @@ -151,6 +125,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -162,6 +137,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -176,6 +152,7 @@ class CfgVehicles { canEject = 1; }; }; + /*class UserActions { class DoorL1_Open { available = 1; @@ -197,16 +174,14 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; showHMD = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; + /*class UserActions: UserActions { class DoorL1_Open { available = 1; @@ -248,9 +223,9 @@ class CfgVehicles { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; - //class MFD {}; weapons[] = {"M134_minigun","missiles_DAR","CMFlareLauncher"}; magazines[] = {"5000Rnd_762x51_Yellow_Belt","24Rnd_missiles","168Rnd_CMFlare_Chaff_Magazine"}; + class Turrets: Turrets { class MainTurret: MainTurret { canEject = 1; @@ -270,36 +245,37 @@ class CfgVehicles { class I_Heli_light_03_F: I_Heli_light_03_base_F { class Turrets: Turrets { class MainTurret: MainTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; - class I_Heli_light_03_unarmed_base_F: I_Heli_light_03_base_F { - //class MFD {}; - }; + class I_Heli_light_03_unarmed_base_F: I_Heli_light_03_base_F {}; + class I_Heli_light_03_unarmed_F: I_Heli_light_03_unarmed_base_F {}; class Plane_CAS_01_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; - //class MFD {}; + class Turrets; + #include }; class Plane_CAS_02_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; + class Turrets; + #include }; class Plane_Fighter_03_base_F: Plane_Base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; + class Turrets; + #include }; @@ -310,34 +286,34 @@ class CfgVehicles { }; class UAV_02_base_F: UAV { + weapons[] = {}; + magazines[] = {}; + class Turrets { class MainTurret; }; - weapons[] = {}; - magazines[] = {}; }; class UAV_02_CAS_base_F: UAV_02_base_F { + weapons[] = {}; + magazines[] = {}; + /*class Turrets: Turrets { class MainTurret: MainTurret {}; };*/ - weapons[] = {}; - magazines[] = {}; }; class B_Heli_Transport_03_base_F: Helicopter_Base_H { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; }; //class MainTurret: MainTurret {}; class RightDoorGun: MainTurret {}; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; @@ -348,9 +324,6 @@ class CfgVehicles { }; //class MainTurret: MainTurret {}; //class RightDoorGun: MainTurret {}; - - //class CargoTurret_01: CargoTurret {}; - //class CargoTurret_02: CargoTurret_01 {}; }; }; @@ -358,6 +331,7 @@ class CfgVehicles { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; + class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; @@ -376,15 +350,6 @@ class CfgVehicles { class LoadmasterTurret: LoadmasterTurret { canEject = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; - class CargoTurret_03: CargoTurret_01 {}; - class CargoTurret_04: CargoTurret_01 {}; - class CargoTurret_05: CargoTurret_01 {}; - class CargoTurret_06: CargoTurret_05 {}; - class CargoTurret_07: CargoTurret_05 {}; - class CargoTurret_08: CargoTurret_05 {}; }; }; @@ -396,9 +361,6 @@ class CfgVehicles { class LoadmasterTurret: LoadmasterTurret { canEject = 1; }; - - class CargoTurret_01: CargoTurret {}; - class CargoTurret_02: CargoTurret_01 {}; }; }; }; From 075556c233bf32a893830582571dec35178a66c6 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 11:36:54 +0100 Subject: [PATCH 095/113] author aircraft --- addons/aircraft/config.cpp | 2 +- addons/aircraft/config/config.cpp | 13 ------------- addons/aircraft/config/script_component.hpp | 1 - 3 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 addons/aircraft/config/config.cpp delete mode 100644 addons/aircraft/config/script_component.hpp diff --git a/addons/aircraft/config.cpp b/addons/aircraft/config.cpp index 93e4eb8efe..86135c4bc9 100644 --- a/addons/aircraft/config.cpp +++ b/addons/aircraft/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"KoffeinFlummi","Crusty"}; + author[] = {"KoffeinFlummi","Crusty","commy2"}; authorUrl = "https://github.com/KoffeinFlummi/"; VERSION_CONFIG; }; diff --git a/addons/aircraft/config/config.cpp b/addons/aircraft/config/config.cpp deleted file mode 100644 index 7ac4cf3bad..0000000000 --- a/addons/aircraft/config/config.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class DOUBLES(ADDON,heli1) { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {QUOTE(ADDON)}; - author[] = {"commy2"}; - authorUrl = "https://github.com/commy2/"; - VERSION_CONFIG; - }; -}; diff --git a/addons/aircraft/config/script_component.hpp b/addons/aircraft/config/script_component.hpp deleted file mode 100644 index 7368add67c..0000000000 --- a/addons/aircraft/config/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\aircraft\script_component.hpp" \ No newline at end of file From 57f8595e9ccdc8f1afa05b13cea71b41832bfde5 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 12:47:33 +0100 Subject: [PATCH 096/113] clean up aircraft weapons config --- addons/aircraft/CfgWeapons.hpp | 192 ++++++-------------------------- addons/aircraft/stringtable.xml | 14 ++- 2 files changed, 49 insertions(+), 157 deletions(-) diff --git a/addons/aircraft/CfgWeapons.hpp b/addons/aircraft/CfgWeapons.hpp index 321df4a3af..c5f22fc3a2 100644 --- a/addons/aircraft/CfgWeapons.hpp +++ b/addons/aircraft/CfgWeapons.hpp @@ -4,15 +4,10 @@ class Mode_Burst; class Mode_FullAuto; class CfgWeapons { - class MGunCore; - class MGun: MGunCore {}; - - class LMG_RCWS: MGun {}; - // Manual Switching Of Flare Mode class SmokeLauncher; class CMFlareLauncher: SmokeLauncher { - modes[] = {"Single", "Burst", "AIBurst"}; + modes[] = {"Single","Burst","AIBurst"}; class Single: Mode_SemiAuto { reloadTime = 0.1; }; @@ -21,13 +16,15 @@ class CfgWeapons { }; }; + // bigger mag for comanche class CannonCore; class gatling_20mm: CannonCore { - magazines[] = {"2000Rnd_20mm_shells","1000Rnd_20mm_shells","300Rnd_20mm_shells","ACE_500Rnd_20mm_shells_Comanche"}; + magazines[] += {"ACE_500Rnd_20mm_shells_Comanche"}; + // buff gatling rof class manual: CannonCore { - reloadTime = 0.023; - dispersion = 0.006; + reloadTime = 0.023; //0.04; + dispersion = 0.006; //0.0022; }; class close: manual {}; class short: close {}; @@ -36,21 +33,14 @@ class CfgWeapons { }; class ACE_gatling_20mm_Comanche: gatling_20mm { - displayName = "XM301"; - class close: close { - reloadTime = 0.04; - dispersion = 0.0022; - }; - class far: far { - reloadTime = 0.04; - dispersion = 0.0022; - }; + displayName = "$STR_ACE_Aircraft_gatling_20mm_Name"; + class manual: manual { reloadTime = 0.04; dispersion = 0.0022; - displayName = "XM301"; + displayName = "$STR_ACE_Aircraft_gatling_20mm_Name"; }; - class medium: medium { + class close: close { reloadTime = 0.04; dispersion = 0.0022; }; @@ -58,38 +48,53 @@ class CfgWeapons { reloadTime = 0.04; dispersion = 0.0022; }; + class medium: medium { + reloadTime = 0.04; + dispersion = 0.0022; + }; + class far: far { + reloadTime = 0.04; + dispersion = 0.0022; + }; }; + // buff gatling rof + class MGunCore; + class MGun: MGunCore {}; + + class LMG_RCWS: MGun {}; + class LMG_Minigun: LMG_RCWS { - magazines[] = {"1000Rnd_65x39_Belt","1000Rnd_65x39_Belt_Green","1000Rnd_65x39_Belt_Tracer_Green","1000Rnd_65x39_Belt_Tracer_Red","1000Rnd_65x39_Belt_Tracer_Yellow","1000Rnd_65x39_Belt_Yellow","2000Rnd_65x39_Belt","2000Rnd_65x39_Belt_Green","2000Rnd_65x39_Belt_Tracer_Green","2000Rnd_65x39_Belt_Tracer_Green_Splash","2000Rnd_65x39_Belt_Tracer_Red","2000Rnd_65x39_Belt_Tracer_Yellow","2000Rnd_65x39_Belt_Tracer_Yellow_Splash","2000Rnd_65x39_Belt_Yellow","2000Rnd_762x51_Belt_T_Green","2000Rnd_762x51_Belt_T_Red","2000Rnd_762x51_Belt_T_Yellow","200Rnd_65x39_Belt","200Rnd_65x39_Belt_Tracer_Green","200Rnd_65x39_Belt_Tracer_Red","200Rnd_65x39_Belt_Tracer_Yellow","5000Rnd_762x51_Belt","5000Rnd_762x51_Yellow_Belt"}; class manual: MGun { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.075; //0.015; + dispersion = 0.00093; //0.006; }; class close: manual {}; class short: close {}; class medium: close {}; class far: close {}; }; + class LMG_Minigun_heli: LMG_Minigun { showAimCursorInternal = 0; class manual: manual { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.033; Note: This is a way to fast ROF (requires over 60 FPS) @todo + dispersion = 0.006; //0.0087; }; class close: manual {}; class short: close {}; class medium: close {}; class far: close {}; }; + class M134_minigun: MGunCore { class LowROF: Mode_FullAuto { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.03; same as above @todo + dispersion = 0.006; //0.0023; }; class HighROF: LowROF { - reloadTime = 0.015; - dispersion = 0.006; + reloadTime = 0.015; //0.03; + dispersion = 0.006; //0.0023; }; class close: HighROF {}; class short: close {}; @@ -100,19 +105,10 @@ class CfgWeapons { class Gatling_30mm_Plane_CAS_01_F: CannonCore { autoFire = 1; burst = 1; - reloadTime = 0.0154; class LowROF: Mode_FullAuto { autoFire = 0; - //burst = 65; - burst = 22; - //reloadTime = 0.0154; - reloadTime = 0.0462; - //sound[] = {"A3\Sounds_F_epc\weapons\cas_02_cannon",1.77828,1,3800}; - sound[] = {"A3\Sounds_F_EPC\Weapons\gau_03_burst",2.51189,1,4500,{25704,32159}}; - weaponSoundEffect = "DefaultRifle"; - dispersion = 0.005; - soundContinuous = 1; - textureType = "burst"; + burst = 22; //65; + reloadTime = 0.0462; //0.0154; //0.034; multiplier = 3; }; class close: LowROF {}; @@ -121,120 +117,4 @@ class CfgWeapons { class medium: close {}; class far: close {}; }; - - class RocketPods; - class Missile_AA_04_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 2; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - autoFire = 0; - cursor = "EmptyCursor"; - cursorAim = "missile"; - nameSound = "MissileLauncher"; - textureType = "fullAuto"; - weaponLockDelay = 3; - minRange = 300; - minRangeProbab = 0.25; - midRange = 2500; - midRangeProbab = 0.9; - maxRange = 9000; - maxRangeProbab = 0.01; - }; - - class MissileLauncher; - class Missile_AGM_02_Plane_CAS_01_F: MissileLauncher { - holdsterAnimValue = 3; - magazineReloadTime = 30; - reloadTime = 0.001; - textureType = "semi"; - weaponLockDelay = 3; - weaponSoundEffect = "DefaultRifle"; - }; - - class Rocket_04_HE_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 4; - canLock = 1; - modes[] = {"Far_AI","Medium_AI","Close_AI","Burst"}; - weaponLockDelay = 0; - class Far_AI: RocketPods { - canLock = 1; - weaponLockDelay = 0; - showToPlayer = 0; - minRange = 800; - minRangeProbab = 0.31; - midRange = 2500; - midRangeProbab = 0.71; - maxRange = 3200; - maxRangeProbab = 0.1; - burst = 1; - reloadTime = 0.001; - autoFire = 0; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - }; - class Medium_AI: Far_AI {}; - class Close_AI: Far_AI {}; - class Burst: RocketPods { - burst = 1; - reloadTime = 0.002; - minRange = 300; - minRangeProbab = 0.25; - midRange = 400; - midRangeProbab = 0.7; - maxRange = 1300; - maxRangeProbab = 0.1; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - autoFire = 0; - soundContinuous = 0; - textureType = "fullAuto"; - weaponSoundEffect = "DefaultRifle"; - }; - }; - - class Rocket_04_AP_Plane_CAS_01_F: Rocket_04_HE_Plane_CAS_01_F { - holdsterAnimValue = 5; - }; - - class Bomb_04_Plane_CAS_01_F: RocketPods { - holdsterAnimValue = 6; - aiRateOfFire = 5; - aiRateOfFireDistance = 500; - missileLockCone = 180; - nameSound = ""; - textureType = "fullAuto"; - weaponLockDelay = 1; - }; - - class Cannon_30mm_Plane_CAS_02_F: CannonCore { - scope = 1; - holdsterAnimValue = 1; - ballisticsComputer = 2; - canLock = 1; - modes[] = {"LowROF","close","near","short","medium","far"}; - nameSound = "cannon"; - shotFromTurret = 0; - muzzlePos = "Cannon_muzzleflash"; - muzzleEnd = "Cannon_barrel_end"; - selectionFireAnim = "Cannon_muzzleflash"; - autoFire = 1; - burst = 5; - reloadTime = 0.04; - class GunParticles { - class Effect { - effectName = "MachineGun2"; - positionName = "Cannon_barrel_start"; - directionName = "Cannon_barrel_end"; - }; - }; - class LowROF: Mode_FullAuto { - dispersion = 0.0055; - reloadTime = 0.04; - }; - class close: LowROF {}; - class near: close {}; - class short: close {}; - class medium: close {}; - class far: close {}; - }; }; diff --git a/addons/aircraft/stringtable.xml b/addons/aircraft/stringtable.xml index da013cac5e..4d1c49fff6 100644 --- a/addons/aircraft/stringtable.xml +++ b/addons/aircraft/stringtable.xml @@ -14,6 +14,18 @@ Rajada Raffica + + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + XM301 + Open Cargo Door Laderampe öffnen @@ -35,4 +47,4 @@ Закрыть грузовой отсек - \ No newline at end of file + From 0ae41609c2db42373540a40319bdebaa0fca202d Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 20:20:03 +0100 Subject: [PATCH 097/113] no fcs for ais --- addons/fcs/functions/fnc_firedEH.sqf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 38e2c90f3c..237b68fc87 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -25,7 +25,8 @@ private ["_gunner", "_turret"]; _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); _turret = [_gunner] call EFUNC(common,getTurretIndex); -//if (ACE_player != _gunner) exitWith {}; // global +// Exit if the unit isn't a player +if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; private ["_FCSMagazines", "_FCSElevation", "_offset"]; From df23b44df55e19f7f1b5bed04ce7ea37df89c9f4 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 14 Feb 2015 23:13:43 +0100 Subject: [PATCH 098/113] oops --- addons/fcs/functions/fnc_firedEH.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 237b68fc87..f17693d33e 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -26,7 +26,7 @@ _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); _turret = [_gunner] call EFUNC(common,getTurretIndex); // Exit if the unit isn't a player -if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; +if !([_gunner] call EFUNC(common,isPlayer)) exitWith {}; private ["_FCSMagazines", "_FCSElevation", "_offset"]; From ac54e8dfd797e94c2629628e04396743f8c21025 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 15 Feb 2015 12:44:34 +0100 Subject: [PATCH 099/113] Added UAV exchange battery sound --- addons/logistics_uavbattery/CfgSounds.hpp | 7 +++++++ addons/logistics_uavbattery/config.cpp | 1 + .../functions/fnc_refuelUAV.sqf | 1 + .../sounds/exchange_battery.ogg | Bin 0 -> 34349 bytes 4 files changed, 9 insertions(+) create mode 100644 addons/logistics_uavbattery/CfgSounds.hpp create mode 100644 addons/logistics_uavbattery/sounds/exchange_battery.ogg diff --git a/addons/logistics_uavbattery/CfgSounds.hpp b/addons/logistics_uavbattery/CfgSounds.hpp new file mode 100644 index 0000000000..530c5b86a9 --- /dev/null +++ b/addons/logistics_uavbattery/CfgSounds.hpp @@ -0,0 +1,7 @@ +class CfgSounds { + class ACE_replaceUAVBattery { + name = "ACE_replaceUAVBattery"; + sound[]={QUOTE(PATHTOF(sounds\exchange_battery.ogg)),1,1}; + titles[]={}; + }; +}; diff --git a/addons/logistics_uavbattery/config.cpp b/addons/logistics_uavbattery/config.cpp index 046a2665d0..32d8c49978 100644 --- a/addons/logistics_uavbattery/config.cpp +++ b/addons/logistics_uavbattery/config.cpp @@ -15,3 +15,4 @@ class CfgPatches { #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" +#include "CfgSounds.hpp" diff --git a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf index 9384044f00..5a248bf812 100644 --- a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf @@ -21,6 +21,7 @@ if (!(_this call FUNC(canRefuelUAV))) exitWith {}; _onFinish = { EXPLODE_2_PVT((_this select 0),_caller,_target); _caller removeItem "ACE_UAVBattery"; + playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10]; ["VehicleSetFuel", [_target], [_target, 1]] call EFUNC(common,targetEvent); //setFuel is local }; diff --git a/addons/logistics_uavbattery/sounds/exchange_battery.ogg b/addons/logistics_uavbattery/sounds/exchange_battery.ogg new file mode 100644 index 0000000000000000000000000000000000000000..5a40ddb47a7aa5db7a2ba779baa37072286fc37c GIT binary patch literal 34349 zcmeFZcT|&2yEl3#BoH8A=%E^_Q~@ah0w(k-MS_4*La!o41VjwgfOMr70jU9`NKph0 z9i{iCfPx*Aq9`JAZq)ZZ&%4)N>)UI6`>(UkFquBr%v{s1`OVyzxVfDLpuk_X^el1q z&?y@K((p?-~d#>7szk>0mS4m=fBlqP6+7h%j?c(#vZ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$y34~1{e5d~D zHt9$t{3gkd##8a(KlshJbcS41LS+AfN&$c$Y;c?`Ej_#E>`WJ0pIHzTV*=B}g7}wf zv38}mSVlqK6Z^++=8yQj4#cKDYzEKkdL})ZxhLh9;W{+Vtc+X<8<>)cL7O5{fE@oE z?*9W8{ox-J`NQo0>~(IZoIZ9K?ISD!3OW5@2nbq(cAk*7o(k{N_hpRuMEJCbKaiU>`@(sSQ0x&D|pJSX<{})~wy6_LYGzA7F{`UluJcgO? z+*E%zCE(-s?4+sn(VI;4ZPw-b-CI?i=~a-9$1Cmk zc}GvvS|84G$_$1EOwZ+Iv!rFX=G>9eqvZO>Tj$yvGMWFF?EI6U%}5TA|Jy9Sg+k8C zzPviqf1BELtF7tQnd0B1w;v`~f68>^=CKgf_uXY{gsNi9i(Nd*D22=E{(txP-#eGI z)8vymB_+|*rCH*yp`7;lyqm867Ui<*+ljBNce2WLfmS=1&#LryQ_`6yxe$?zgGj%j ze-l!l{@*s-b!F93>@KKJ7n5vC(YI8-dgr*Z?yD(ww_{F0&WDx3=al#E>#J)M5Hl3Mcr05Hu>EC2ui literal 0 HcmV?d00001 From baf9396459c38d021801b7e6aa0cf0ad7ea6802e Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 15 Feb 2015 15:31:09 +0100 Subject: [PATCH 100/113] cleanup attach --- addons/attach/CfgEventHandlers.hpp | 5 +- addons/attach/CfgMagazines.hpp | 4 +- addons/attach/CfgVehicles.hpp | 28 +++++----- addons/attach/CfgWeapons.hpp | 9 ++-- addons/attach/config.cpp | 11 ++-- addons/attach/functions/fnc_attach.sqf | 32 ++++++------ addons/attach/functions/fnc_canAttach.sqf | 8 +-- addons/attach/functions/fnc_canDetach.sqf | 13 ++--- addons/attach/functions/fnc_detach.sqf | 54 ++++++++++---------- addons/attach/functions/fnc_openAttachUI.sqf | 18 +++---- addons/attach/functions/fnc_placeApprove.sqf | 8 +-- addons/attach/stringtable.xml | 2 +- 12 files changed, 100 insertions(+), 92 deletions(-) diff --git a/addons/attach/CfgEventHandlers.hpp b/addons/attach/CfgEventHandlers.hpp index 4c2b8b16ca..f0a9f14d91 100644 --- a/addons/attach/CfgEventHandlers.hpp +++ b/addons/attach/CfgEventHandlers.hpp @@ -1,5 +1,6 @@ + class Extended_PreInit_EventHandlers { class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; -}; \ No newline at end of file +}; diff --git a/addons/attach/CfgMagazines.hpp b/addons/attach/CfgMagazines.hpp index 282d36b964..d63b8db36b 100644 --- a/addons/attach/CfgMagazines.hpp +++ b/addons/attach/CfgMagazines.hpp @@ -1,10 +1,12 @@ + class CfgMagazines { class CA_Magazine; class B_IR_Grenade: CA_Magazine { ACE_Attachable = 1; }; + class SmokeShell; class Chemlight_green: SmokeShell { ACE_Attachable = 1; }; -}; \ No newline at end of file +}; diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index bc1f52988a..1b16d59acc 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -1,7 +1,3 @@ -#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; #define MACRO_ATTACHTOVEHICLE \ class ACE_Actions { \ @@ -32,16 +28,20 @@ class CfgVehicles { class Car: LandVehicle { MACRO_ATTACHTOVEHICLE }; + class Tank: LandVehicle { MACRO_ATTACHTOVEHICLE }; + class Air; class Helicopter: Air { MACRO_ATTACHTOVEHICLE }; + class Plane: Air { MACRO_ATTACHTOVEHICLE }; + class Ship; class Ship_F: Ship { MACRO_ATTACHTOVEHICLE @@ -96,6 +96,7 @@ class CfgVehicles { onlyInNvg = 1; useFlare = 0; }; + side = 7;//-1=NO_SIDE yellow box,3=CIV grey box,4=NEUTRAL yellow box,6=FRIENDLY green box,7=LOGIC no radar signature accuracy = 1000; cost = 0; @@ -111,37 +112,36 @@ class CfgVehicles { }; class NATO_Box_Base; - class EAST_Box_Base; - class IND_Box_Base; - class FIA_Box_Base_F; - class Box_NATO_Support_F: NATO_Box_Base { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; + class EAST_Box_Base; class Box_East_Support_F: EAST_Box_Base { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; + class IND_Box_Base; class Box_IND_Support_F: IND_Box_Base { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; + class FIA_Box_Base_F; class Box_FIA_Support_F: FIA_Box_Base_F { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; class ACE_Box_Misc: Box_NATO_Support_F { class TransportItems { - MACRO_ADDITEM(ACE_IR_Strobe_Item,12) + MACRO_ADDITEM(ACE_IR_Strobe_Item,12); }; }; -}; \ No newline at end of file +}; diff --git a/addons/attach/CfgWeapons.hpp b/addons/attach/CfgWeapons.hpp index 8174f67b38..4ad34832c5 100644 --- a/addons/attach/CfgWeapons.hpp +++ b/addons/attach/CfgWeapons.hpp @@ -1,16 +1,19 @@ + class CfgWeapons { class ACE_ItemCore; class InventoryItem_Base_F; class ACE_IR_Strobe_Item: ACE_ItemCore { + ACE_attachable = 1; + author = "$STR_ACE_Common_ACETeam"; + scope = 2; displayName = "$STR_ACE_IrStrobe_Name"; descriptionShort = "$STR_ACE_IrStrobe_Description"; model = "\A3\weapons_F\ammo\mag_univ.p3d"; picture = PATHTOF(UI\irstrobe_item.paa); - scope = 2; - ACE_attachable = 1; + class ItemInfo: InventoryItem_Base_F { mass = 1; }; }; -}; \ No newline at end of file +}; diff --git a/addons/attach/config.cpp b/addons/attach/config.cpp index 9accc9f253..007084d8df 100644 --- a/addons/attach/config.cpp +++ b/addons/attach/config.cpp @@ -5,17 +5,14 @@ class CfgPatches { units[] = {}; weapons[] = {"ACE_IR_Strobe_Item"}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common", "ace_interaction"}; - author[] = {"KoffeinFlummi", "eRazeri", "CAA-Picard"}; + requiredAddons[] = {"ace_common","ace_interaction"}; + author[] = {"KoffeinFlummi","eRazeri","CAA-Picard"}; authorUrl = "https://github.com/KoffeinFlummi/"; VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" - -#include "CfgVehicles.hpp" - -#include "CfgWeapons.hpp" - #include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 9fd0cf7952..3aa06bacc2 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -20,31 +20,33 @@ PARAMS_3(_unit,_attachToVehicle,_itemName); //Sanity Check (_unit has item in inventory, not over attach limit) -if (!([_unit,_attachToVehicle,_itemName] call FUNC(canAttach))) exitWith {ERROR("Tried to attach, but check failed");}; +if !([_unit, _attachToVehicle, _itemName] call FUNC(canAttach)) exitWith {ERROR("Tried to attach, but check failed");}; + +private ["_itemVehClass", "_onAtachText", "_selfAttachPosition"]; -_selfAttachPosition = [_unit, [-0.05,0,0.12], "rightshoulder"]; _itemVehClass = ""; _onAtachText = ""; +_selfAttachPosition = [_unit, [-0.05, 0, 0.12], "rightshoulder"]; -switch true do { -case (_itemName == "ACE_IR_Strobe_Item"): { +switch (true) do { + case (_itemName == "ACE_IR_Strobe_Item"): { _itemVehClass = "ACE_IR_Strobe_Effect"; _onAtachText = localize "STR_ACE_Attach_IrStrobe_Attached"; - _selfAttachPosition = [_unit,[0,-0.11,0.16],"pilot"]; //makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri + //_selfAttachPosition = [_unit, [0, -0.11, 0.16], "pilot"]; //makes it attach to the head a bit better, shoulder is not good for visibility - eRazeri }; -case (_itemName == "B_IR_Grenade"): { + case (_itemName == "B_IR_Grenade"): { _itemVehClass = "B_IRStrobe"; _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; }; -case (_itemName == "O_IR_Grenade"): { + case (_itemName == "O_IR_Grenade"): { _itemVehClass = "O_IRStrobe"; _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; }; -case (_itemName == "I_IR_Grenade"): { + case (_itemName == "I_IR_Grenade"): { _itemVehClass = "I_IRStrobe"; _onAtachText = localize "STR_ACE_Attach_IrGrenade_Attached"; }; -case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}): { + case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]): { _itemVehClass = _itemName; _onAtachText = localize "STR_ACE_Attach_Chemlight_Attached"; }; @@ -57,8 +59,8 @@ if (_unit == _attachToVehicle) then { //Self Attachment _attachedItem = _itemVehClass createVehicle [0,0,0]; _attachedItem attachTo _selfAttachPosition; [_onAtachText] call EFUNC(common,displayTextStructured); - _attachToVehicle setVariable ["ACE_AttachedObjects", [_attachedItem], true]; - _attachToVehicle setVariable ["ACE_AttachedItemNames", [_itemName], true]; + _attachToVehicle setVariable [QGVAR(Objects), [_attachedItem], true]; + _attachToVehicle setVariable [QGVAR(ItemNames), [_itemName], true]; } else { GVAR(setupObject) = _itemVehClass createVehicleLocal [0,0,-10000]; GVAR(setupObject) enableSimulationGlobal false; @@ -72,17 +74,17 @@ if (_unit == _attachToVehicle) then { //Self Attachment private "_player"; _player = ACE_player; //Stop if player switch or player gets to far from vehicle - if ((GVAR(placer) != _player) || {(_player distance GVAR(SetupAttachVehicle)) > 7}) exitWith { + if (GVAR(placer) != _player || {_player distance GVAR(SetupAttachVehicle) > 7}) exitWith { call FUNC(placeCancel); }; GVAR(pfeh_running) = true; _pos = (ASLtoATL eyePos _player) vectorAdd (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); GVAR(setupObject) setPosATL _pos; - }] call BIS_fnc_addStackedEventHandler; + }] call BIS_fnc_addStackedEventHandler; // @todo replace with CBA PFH //had to delay the mouseHint, not sure why [{[localize "STR_ACE_Attach_PlaceAction", localize "STR_ACE_Attach_CancelAction"] call EFUNC(interaction,showMouseHint)}, [], 0, 0] call EFUNC(common,waitAndExecute); - _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; - _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) AND !isNull (GVAR(setupObject))}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; + _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {GVAR(pfeh_running) && {!isNull (GVAR(setupObject))}}, {call FUNC(placeApprove);}] call EFUNC(common,AddActionEventHandler)]; + _unit setVariable [QGVAR(cancelActionEH), [_unit, "MenuBack", {GVAR(pfeh_running) && {!isNull (GVAR(setupObject))}}, {call FUNC(placeCancel);}] call EFUNC(common,AddActionEventHandler)]; }; diff --git a/addons/attach/functions/fnc_canAttach.sqf b/addons/attach/functions/fnc_canAttach.sqf index ac646ef700..1c33f7b112 100644 --- a/addons/attach/functions/fnc_canAttach.sqf +++ b/addons/attach/functions/fnc_canAttach.sqf @@ -19,7 +19,9 @@ PARAMS_3(_unit,_attachToVehicle,_item); -_attachLimit = if (_unit == _attachToVehicle) then {1} else {10}; -_attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; +private ["_attachLimit", "_attachedObjects"]; -canStand _unit && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_item in ((magazines _unit) + (items _unit) + [""])} +_attachLimit = [10, 1] select (_unit == _attachToVehicle); +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; + +canStand _unit && {alive _attachToVehicle} && {count _attachedObjects < _attachLimit} && {_item in (itemsWithMagazines _unit + [""])} diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf index d099d2035e..ad2f68776c 100644 --- a/addons/attach/functions/fnc_canDetach.sqf +++ b/addons/attach/functions/fnc_canDetach.sqf @@ -16,24 +16,25 @@ */ #include "script_component.hpp" -private ["_attachedObjects", "_inRange", "_unitPos", "_objectPos"]; - PARAMS_2(_unit,_attachToVehicle); -_attachedObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; +private ["_attachedObjects", "_inRange"]; + +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _inRange = false; if (_unit == _attachToVehicle) then { - _inRange = (count _attachedObjects) > 0; + _inRange = count _attachedObjects > 0; } else { //Scan if unit is within range (using 2d distance) + private ["_unitPos", "_objectPos"]; _unitPos = getPos _unit; _unitPos set [2,0]; { _objectPos = getPos _x; _objectPos set [2, 0]; - if ((_objectPos distance _unitPos) < 4) exitWith {_inRange = true}; + if (_objectPos distance _unitPos < 4) exitWith {_inRange = true}; } forEach _attachedObjects; }; -(canStand _unit) && _inRange && {alive _attachToVehicle} +canStand _unit && {_inRange} && {alive _attachToVehicle} diff --git a/addons/attach/functions/fnc_detach.sqf b/addons/attach/functions/fnc_detach.sqf index b18cec09bd..8fb9e3cc9c 100644 --- a/addons/attach/functions/fnc_detach.sqf +++ b/addons/attach/functions/fnc_detach.sqf @@ -16,12 +16,14 @@ */ #include "script_component.hpp" -private ["_itemName", "_count", "_attachedItem", "_fnc_detachDelay"]; - PARAMS_2(_unit,_attachToVehicle); -_attachedObjectsArray = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; -_attachedItemsArray = _attachToVehicle getVariable ["ACE_AttachedItemNames", []]; +private ["_attachedObjects", "_attachedItems"]; + +_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; +_attachedItems = _attachToVehicle getVariable [QGVAR(ItemNames), []]; + +private ["_attachedObject", "_attachedIndex", "_itemName", "_minDistance", "_unitPos", "_objectPos"]; _attachedObject = objNull; _attachedIndex = -1; @@ -34,53 +36,51 @@ _unitPos set [2,0]; { _objectPos = getPos _x; _objectPos set [2, 0]; - if ((_objectPos distance _unitPos) < _minDistance) then { - _minDistance = (_objectPos distance _unitPos); + if (_objectPos distance _unitPos < _minDistance) then { + _minDistance = _objectPos distance _unitPos; _attachedObject = _x; - _itemName = _attachedItemsArray select _forEachIndex; + _itemName = _attachedItems select _forEachIndex; _attachedIndex = _forEachIndex; }; -} forEach _attachedObjectsArray; +} forEach _attachedObjects; // Check if unit has an attached item -if ((isNull _attachedObject) || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; +if (isNull _attachedObject || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; -// Add item to inventory -_count = (count items _unit) + (count magazines _unit); -_unit addItem _itemName; -if ((count items _unit) + (count magazines _unit) <= _count) exitWith { +// Exit if can't add the item +if !(_unit canAdd _itemName) exitWith { [localize "STR_ACE_Attach_Inventory_Full"] call EFUNC(common,displayTextStructured); }; -if (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") then { +// Add item to inventory +_unit addItem _itemName; + +if (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) then { // Hack for dealing with X_IR_Grenade effect not dissapearing on deleteVehicle detach _attachedObject; - _attachedObject setPos [getPos _unit select 0, getPos _unit select 1, ((getPos _unit select 2) - 1000)]; + _attachedObject setPos ((getPos _unit) vectorAdd [0, 0, -1000]); // Delete attached item after 0.5 seconds - _fnc_detachDelay = { - deleteVehicle (_this select 0); - }; - [_fnc_detachDelay, [_attachedObject], 0.5, 0] call EFUNC(common,waitAndExecute); + [{deleteVehicle (_this select 0)}, [_attachedObject], 0.5, 0] call EFUNC(common,waitAndExecute); } else { // Delete attached item deleteVehicle _attachedObject; }; // Reset unit variables -_attachedObjectsArray deleteAt _attachedIndex; -_attachedItemsArray deleteAt _attachedIndex; -_attachToVehicle setVariable ["ACE_AttachedObjects", _attachedObjectsArray, true]; -_attachToVehicle setVariable ["ACE_AttachedItemNames", _attachedItemsArray, true]; +_attachedObjects deleteAt _attachedIndex; +_attachedItems deleteAt _attachedIndex; +_attachToVehicle setVariable [QGVAR(Objects), _attachedObjects, true]; +_attachToVehicle setVariable [QGVAR(ItemNames), _attachedItems, true]; // Display message -switch true do { -case (_itemName == "ACE_IR_Strobe_Item") : { +switch (true) do { + case (_itemName == "ACE_IR_Strobe_Item") : { [localize "STR_ACE_Attach_IrStrobe_Detached"] call EFUNC(common,displayTextStructured); }; -case (_itemName == "B_IR_Grenade" or _itemName == "O_IR_Grenade" or _itemName == "I_IR_Grenade") : { + case (toLower _itemName in ["b_ir_grenade", "o_ir_grenade", "i_ir_grenade"]) : { [localize "STR_ACE_Attach_IrGrenade_Detached"] call EFUNC(common,displayTextStructured); }; -case (_itemName == "Chemlight_blue" or {_itemName == "Chemlight_green"} or {_itemName == "Chemlight_red"} or {_itemName == "Chemlight_yellow"}) : { + case (toLower _itemName in ["chemlight_blue", "chemlight_green", "chemlight_red", "chemlight_yellow"]) : { [localize "STR_ACE_Attach_Chemlight_Detached"] call EFUNC(common,displayTextStructured); }; }; diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index 6521e43fbe..5533956bb6 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -55,13 +55,13 @@ _attachables = items _unit; } forEach _attachables; [ -_actions, -{ - [ACE_player, GVAR(attachTarget), _this] call FUNC(attach); - call EFUNC(interaction,hideMenu); -}, -{ - call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; -} + _actions, + { + [ACE_player, GVAR(attachTarget), _this] call FUNC(attach); + call EFUNC(interaction,hideMenu); + }, + { + call EFUNC(interaction,hideMenu); + if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; + } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/attach/functions/fnc_placeApprove.sqf b/addons/attach/functions/fnc_placeApprove.sqf index ceb48de9b5..c6277e2961 100644 --- a/addons/attach/functions/fnc_placeApprove.sqf +++ b/addons/attach/functions/fnc_placeApprove.sqf @@ -100,11 +100,11 @@ _attachedObject attachTo [_attachToVehicle, _endPosTestOffset]; _placer removeItem _itemClassname; //Add Object to ACE_AttachedObjects and ACE_AttachedItemNames -_currentObjects = _attachToVehicle getVariable ["ACE_AttachedObjects", []]; +_currentObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _currentObjects pushBack _attachedObject; -_attachToVehicle setVariable ["ACE_AttachedObjects", _currentObjects, true]; -_currentItemNames = _attachToVehicle getVariable ["ACE_AttachedItemNames", []]; +_attachToVehicle setVariable [QGVAR(Objects), _currentObjects, true]; +_currentItemNames = _attachToVehicle getVariable [QGVAR(ItemNames), []]; _currentItemNames pushBack _itemClassname; -_attachToVehicle setVariable ["ACE_AttachedItemNames", _currentItemNames, true]; +_attachToVehicle setVariable [QGVAR(ItemNames), _currentItemNames, true]; [_placementText] call EFUNC(common,displayTextStructured); diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index 21577c55d3..13c468184b 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -176,4 +176,4 @@ Error en Acoplar - \ No newline at end of file + From 4f5ab1f8e5f67f13b2f8f180734e5b91f5eda1cb Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 15 Feb 2015 15:34:19 +0100 Subject: [PATCH 101/113] removed common as required addon for attach --- addons/attach/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/attach/config.cpp b/addons/attach/config.cpp index 007084d8df..dd7e1add3b 100644 --- a/addons/attach/config.cpp +++ b/addons/attach/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {"ACE_IR_Strobe_Item"}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common","ace_interaction"}; + requiredAddons[] = {"ace_interaction"}; author[] = {"KoffeinFlummi","eRazeri","CAA-Picard"}; authorUrl = "https://github.com/KoffeinFlummi/"; VERSION_CONFIG; From c094c10e467d2d3c132178c612793203bfe828f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 11:42:20 -0300 Subject: [PATCH 102/113] visible ir strobes --- addons/attach/CfgVehicles.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index bc1f52988a..e7b5cb3bb4 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -83,15 +83,17 @@ class CfgVehicles { simulation = "nvmarker"; class NVGMarker { - diffuse[] = {0,0,0}; - ambient[] = {0,0,0}; - brightness = 0.004; + diffuse[] = {0.006, 0.006, 0.006, 1}; + ambient[] = {0.005, 0.005, 0.005, 1}; + brightness = 0.2; name = "pozicni blik"; - drawLight = 1; - drawLightSize = 0.005; + drawLightSize = 0.2; drawLightCenterSize = 0.003; activeLight = 0; blinking=1; + blinkingStartsOn=1; + blinkingPattern[] = {2,2}; + blinkingPatternGuarantee = false; dayLight = 0; onlyInNvg = 1; useFlare = 0; From 44aaf3955b2f59fe18c346f784f4b614552af88b Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 15 Feb 2015 15:48:40 +0100 Subject: [PATCH 103/113] some backblast cleanup --- addons/backblast/CfgEventHandlers.hpp | 8 +++--- addons/backblast/CfgWeapons.hpp | 35 +++++++++++++++------------ addons/backblast/config.cpp | 3 +-- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/addons/backblast/CfgEventHandlers.hpp b/addons/backblast/CfgEventHandlers.hpp index a336a5dd41..aaa0189b6d 100644 --- a/addons/backblast/CfgEventHandlers.hpp +++ b/addons/backblast/CfgEventHandlers.hpp @@ -7,11 +7,11 @@ class Extended_PreInit_EventHandlers { class Extended_FiredNear_EventHandlers { class CAManBase { - class GVAR(LauncherBackblast) { - FiredNear = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_Backblast_Damage') > 0}) then {_this call FUNC(launcherBackblast)} ); + class ADDON { + firedNear = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_Backblast_Damage') > 0}) then {_this call DFUNC(launcherBackblast)}); }; - class GVAR(TankDangerZone) { - FiredNear = QUOTE( if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_DangerZone_Damage') > 0}) then {_this call FUNC(tankDangerZone)} ); + class ADDON { + firedNear = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 3 >> 'ACE_DangerZone_Damage') > 0}) then {_this call DFUNC(tankDangerZone)}); }; }; }; diff --git a/addons/backblast/CfgWeapons.hpp b/addons/backblast/CfgWeapons.hpp index fcb4bde0c5..f4f7c07153 100644 --- a/addons/backblast/CfgWeapons.hpp +++ b/addons/backblast/CfgWeapons.hpp @@ -1,33 +1,37 @@ + class CfgWeapons { class LauncherCore; class Launcher: LauncherCore { - ACE_Backblast_Angle = 60; - ACE_Backblast_Range = 10; - ACE_Backblast_Damage = 0.7; + GVAR(angle) = 60; + GVAR(range) = 10; + GVAR(damage) = 0.7; }; + class Launcher_Base_F: Launcher {}; class launch_Titan_base: Launcher_Base_F { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 8; - ACE_Backblast_Damage = 0.5; + GVAR(angle) = 40; + GVAR(range) = 8; + GVAR(damage) = 0.5; }; + class launch_Titan_short_base: launch_Titan_base { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 8; - ACE_Backblast_Damage = 0.5; + GVAR(angle) = 40; + GVAR(range) = 8; + GVAR(damage) = 0.5; }; class launch_NLAW_F: Launcher_Base_F { - ACE_Backblast_Angle = 40; - ACE_Backblast_Range = 5; - ACE_Backblast_Damage = 0.6; + GVAR(angle) = 40; + GVAR(range) = 5; + GVAR(damage) = 0.6; }; + class launch_RPG32_F: Launcher_Base_F { - ACE_Backblast_Angle = 60; - ACE_Backblast_Range = 15; - ACE_Backblast_Damage = 0.7; + GVAR(angle) = 60; + GVAR(range) = 15; + GVAR(damage) = 0.7; }; class CannonCore; @@ -36,6 +40,7 @@ class CfgWeapons { ACE_DangerZone_Range = 50; ACE_DangerZone_Damage = 0.85; }; + class mortar_155mm_AMOS: CannonCore { ACE_DangerZone_Angle = 90; ACE_DangerZone_Range = 60; diff --git a/addons/backblast/config.cpp b/addons/backblast/config.cpp index 88de936cf9..d4aaf8131b 100644 --- a/addons/backblast/config.cpp +++ b/addons/backblast/config.cpp @@ -6,12 +6,11 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi"}; + author[] = {"commy2","KoffeinFlummi"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" - #include "CfgWeapons.hpp" From f3a94f03ed94059840c8c67287ca2ece5c17d38e Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 15 Feb 2015 17:14:09 +0100 Subject: [PATCH 104/113] clean up backblast --- .../functions/fnc_backblastDamage.sqf | 39 ++++++++++--------- .../functions/fnc_fireLauncherBackblast.sqf | 24 +++++++----- .../functions/fnc_fireOverpressureZone.sqf | 23 ++++++----- .../backblast/functions/fnc_getDistance.sqf | 6 +-- .../functions/fnc_overpressureDamage.sqf | 37 ++++++++++-------- 5 files changed, 74 insertions(+), 55 deletions(-) diff --git a/addons/backblast/functions/fnc_backblastDamage.sqf b/addons/backblast/functions/fnc_backblastDamage.sqf index 21d2e81736..651dc58830 100644 --- a/addons/backblast/functions/fnc_backblastDamage.sqf +++ b/addons/backblast/functions/fnc_backblastDamage.sqf @@ -1,5 +1,5 @@ /* - * Author: Commy2 and CAA-Picard + * Author: commy2 and CAA-Picard * * Calculate and apply backblast damage to potentially affected local units * @@ -16,52 +16,55 @@ EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); -private ["_backblastAngle","_backblastRange","_backblastDamage"]; -_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Angle") / 2; -_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Range"); -_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Damage"); +private ["_backblastAngle", "_backblastRange", "_backblastDamage"]; + +_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); + TRACE_4("Parameters:",_backblastAngle,_backblastRange,_backblastDamage,_weapon); +private "_pos"; _pos = _posASL; if (!surfaceIsWater _pos) then { _pos = ASLtoATL _pos; }; -_affected = _pos nearEntities ["CAManBase", _backblastRange]; { - _unit = _x; - if (local _unit && _unit != _firer && vehicle _unit == _unit) then { + if (local _x && {_x != _firer} && {vehicle _x == _x}) then { + private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; - _targetPositionASL = eyePos _unit; + _targetPositionASL = eyePos _x; _relativePosition = _targetPositionASL vectorDiff _posASL; _axisDistance = _relativePosition vectorDotProduct _direction; _distance = vectorMagnitude _relativePosition; _angle = acos (_axisDistance / _distance); - _line = [_posASL, _targetPositionASL, _firer, _unit]; + _line = [_posASL, _targetPositionASL, _firer, _x]; _line2 = [_posASL, _targetPositionASL]; - TRACE_4("Affected:",_unit,_axisDistance,_distance,_angle); + TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); + if (_angle < _backblastAngle && {_distance < _backblastRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { + private ["_alpha", "_beta", "_damage"]; + _alpha = sqrt (1 - _distance / _backblastRange); _beta = sqrt (1 - _angle / _backblastAngle); _damage = 2 * _alpha * _beta * _backblastDamage; // If the target is the ACE_player - if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; + if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; // TODO: Sort this interaction with medical if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _unit spawn { + [_x, "HitBody", ([_x, "", (_x getHitPointDamage "HitBody") + _damage, objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + _x spawn { sleep 0.5; [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); }; } else { - _unit setDamage (damage _unit + _damage); + _x setDamage (damage _x + _damage); }; }; }; -} forEach _affected; - - +} forEach (_pos nearEntities ["CAManBase", _backblastRange]); diff --git a/addons/backblast/functions/fnc_fireLauncherBackblast.sqf b/addons/backblast/functions/fnc_fireLauncherBackblast.sqf index 5970e7b9c2..a35af9f19d 100644 --- a/addons/backblast/functions/fnc_fireLauncherBackblast.sqf +++ b/addons/backblast/functions/fnc_fireLauncherBackblast.sqf @@ -23,27 +23,32 @@ EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); // Prevent AI from causing backblast damage if !([_firer] call EFUNC(common,isPlayer)) exitWith {}; -private ["_position","_direction","_distance","_alpha","_beta","_damage","_affected"]; +private ["_position", "_direction"]; + _position = getPosASL _projectile; _direction = [0, 0, 0] vectorDiff (vectorDir _projectile); -private ["_backblastAngle","_backblastRange","_backblastDamage"]; -_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Angle") / 2; -_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Range"); -_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_Backblast_Damage"); +private ["_backblastAngle", "_backblastRange", "_backblastDamage"]; +_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); // Damage to others +private "_affected"; _affected = getPos _projectile nearEntities ["CAManBase", _backblastRange]; -// Let each client handle their own affected units -["backblast", _affected, [_firer,_position,_direction,_weapon]] call EFUNC(common,targetEvent); +// Let each client handle their own affected units +["backblast", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); // Damage to the firer +private "_distance"; _distance = [_position, _direction, _backblastRange] call FUNC(getDistance); -TRACE_1("Distance", _distance); + +TRACE_1("Distance",_distance); if (_distance < _backblastRange) then { + private ["_alpha", "_beta", "_damage"]; _alpha = sqrt (1 - _distance / _backblastRange); _beta = sqrt 0.5; @@ -66,6 +71,7 @@ if (_distance < _backblastRange) then { [1,1,0,1] ] call EFUNC(common,addLineToDebugDraw); + private "_ref"; _ref = _direction call EFUNC(common,createOrthonormalReference); [ _position, _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), @@ -88,4 +94,4 @@ if (_distance < _backblastRange) then { _position vectorAdd (_direction vectorMultiply (_distance min _backblastRange)), [1,0,0,1] ] call EFUNC(common,addLineToDebugDraw); -#endif \ No newline at end of file +#endif diff --git a/addons/backblast/functions/fnc_fireOverpressureZone.sqf b/addons/backblast/functions/fnc_fireOverpressureZone.sqf index c638f4ad82..0ded8f974b 100644 --- a/addons/backblast/functions/fnc_fireOverpressureZone.sqf +++ b/addons/backblast/functions/fnc_fireOverpressureZone.sqf @@ -14,28 +14,32 @@ * * Return value: * None - *///#define DEBUG_MODE_FULL + */ +//#define DEBUG_MODE_FULL #include "script_component.hpp" EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); // Prevent AI from causing backblast damage -if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; +if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets? + +private ["_position", "_direction"]; -private ["_position","_direction","_distance","_alpha","_beta","_damage","_affected"]; _position = getPosASL _projectile; _direction = vectorDir _projectile; -private ["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; -_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Angle") / 2; -_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Range"); -_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Damage"); +private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; +_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); // Damage to others +private "_affected"; _affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; + // Let each client handle their own affected units -["overpressure", _affected, [_firer,_position,_direction,_weapon]] call EFUNC(common,targetEvent); +["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); // Draw debug lines #ifdef DEBUG_MODE_FULL @@ -44,6 +48,7 @@ _affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; [1,0,0,1] ] call EFUNC(common,addLineToDebugDraw); + private "_ref"; _ref = _direction call EFUNC(common,createOrthonormalReference); [ _position, _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), @@ -62,4 +67,4 @@ _affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; [1,1,0,1] ] call EFUNC(common,addLineToDebugDraw); -#endif \ No newline at end of file +#endif diff --git a/addons/backblast/functions/fnc_getDistance.sqf b/addons/backblast/functions/fnc_getDistance.sqf index b6f61548c6..6ffa60f7af 100644 --- a/addons/backblast/functions/fnc_getDistance.sqf +++ b/addons/backblast/functions/fnc_getDistance.sqf @@ -1,5 +1,5 @@ /* - * Author: Commy2 and CAA-Picard + * Author: commy2 and CAA-Picard * * Calculate the distance to the first intersection of a line * @@ -13,10 +13,10 @@ */ #include "script_component.hpp" -private ["_distance", "_interval", "_line", "_line"]; - EXPLODE_3_PVT(_this,_posASL,_direction,_maxDistance); +private ["_distance", "_interval", "_line", "_intersections"]; + _distance = _maxDistance; _interval = _distance; _line = [_posASL, []]; diff --git a/addons/backblast/functions/fnc_overpressureDamage.sqf b/addons/backblast/functions/fnc_overpressureDamage.sqf index 5dd7447ce8..995c5db9e4 100644 --- a/addons/backblast/functions/fnc_overpressureDamage.sqf +++ b/addons/backblast/functions/fnc_overpressureDamage.sqf @@ -1,5 +1,5 @@ /* - * Author: Commy2 and CAA-Picard + * Author: commy2 and CAA-Picard * * Calculate and apply overpressure damage to potentially affected local units * @@ -16,50 +16,55 @@ EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); -private ["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; -_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Angle") / 2; -_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Range"); -_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> "ACE_DangerZone_Damage"); +private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; + +_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); + TRACE_4("Parameters:",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage,_weapon); +private "_pos"; _pos = _posASL; if (!surfaceIsWater _pos) then { _pos = ASLtoATL _pos; }; -_affected = _pos nearEntities ["CAManBase", _dangerZoneRange]; { - _unit = _x; - if (local _unit && _unit != _firer && vehicle _unit == _unit) then { + if (local _x && {_x != _firer} && {vehicle _x == _x}) then { + private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; - _targetPositionASL = eyePos _unit; + _targetPositionASL = eyePos _x; _relativePosition = _targetPositionASL vectorDiff _posASL; _axisDistance = _relativePosition vectorDotProduct _direction; _distance = vectorMagnitude _relativePosition; _angle = acos (_axisDistance / _distance); - _line = [_posASL, _targetPositionASL, _firer, _unit]; + _line = [_posASL, _targetPositionASL, _firer, _x]; _line2 = [_posASL, _targetPositionASL]; - TRACE_4("Affected:",_unit,_axisDistance,_distance,_angle); + TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); + if (_angle < _dangerZoneAngle && {_distance < _dangerZoneRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { + private ["_alpha", "_beta", "_damage"]; + _alpha = sqrt (1 - _distance / _dangerZoneRange); _beta = sqrt (1 - _angle / _dangerZoneAngle); _damage = 2 * _alpha * _beta * _dangerZoneDamage; // If the target is the ACE_player - if (_unit == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; + if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; // @todo: Sort this interaction with medical if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_unit, "HitBody", ([_unit, "", ((_unit getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _unit spawn { + [_x, "HitBody", ([_x, "", ((_x getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); + _x spawn { sleep 0.5; [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); }; } else { - _unit setDamage (damage _unit + _damage); + _x setDamage (damage _x + _damage); }; }; }; -} forEach _affected; +} forEach (_pos nearEntities ["CAManBase", _dangerZoneRange]); From 3f98d1485ea0f6545e6a48ce67216b15d64e4fa3 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 15 Feb 2015 17:17:20 +0100 Subject: [PATCH 105/113] author name --- addons/backblast/functions/fnc_fireLauncherBackblast.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/backblast/functions/fnc_fireLauncherBackblast.sqf b/addons/backblast/functions/fnc_fireLauncherBackblast.sqf index a35af9f19d..515135d56f 100644 --- a/addons/backblast/functions/fnc_fireLauncherBackblast.sqf +++ b/addons/backblast/functions/fnc_fireLauncherBackblast.sqf @@ -1,5 +1,5 @@ /* - * Author: Commy2 and CAA-Picard + * Author: commy2 and CAA-Picard * * Handle fire of local launchers * From f3aa0e58aa84eade721047a4fdd24c6defce4be3 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 15 Feb 2015 17:55:20 +0100 Subject: [PATCH 106/113] clean up backblast --- addons/backblast/CfgWeapons.hpp | 12 ++-- addons/backblast/XEH_postInit.sqf | 1 - addons/backblast/XEH_preInit.sqf | 1 - .../functions/fnc_fireOverpressureZone.sqf | 2 +- .../functions/fnc_overpressureDamage.sqf | 70 ------------------- 5 files changed, 7 insertions(+), 79 deletions(-) delete mode 100644 addons/backblast/functions/fnc_overpressureDamage.sqf diff --git a/addons/backblast/CfgWeapons.hpp b/addons/backblast/CfgWeapons.hpp index f4f7c07153..5880795ee2 100644 --- a/addons/backblast/CfgWeapons.hpp +++ b/addons/backblast/CfgWeapons.hpp @@ -36,14 +36,14 @@ class CfgWeapons { class CannonCore; class cannon_120mm: CannonCore { - ACE_DangerZone_Angle = 90; - ACE_DangerZone_Range = 50; - ACE_DangerZone_Damage = 0.85; + GVAR(angle) = 90; + GVAR(range) = 50; + GVAR(damage) = 0.85; }; class mortar_155mm_AMOS: CannonCore { - ACE_DangerZone_Angle = 90; - ACE_DangerZone_Range = 60; - ACE_DangerZone_Damage = 1; + GVAR(angle) = 90; + GVAR(range) = 60; + GVAR(damage) = 1; }; }; diff --git a/addons/backblast/XEH_postInit.sqf b/addons/backblast/XEH_postInit.sqf index 72ca42a012..6f9a6f4cf8 100644 --- a/addons/backblast/XEH_postInit.sqf +++ b/addons/backblast/XEH_postInit.sqf @@ -1,4 +1,3 @@ #include "script_component.hpp" ["backblast", FUNC(backblastDamage)] call EFUNC(common,addEventHandler); -["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler); diff --git a/addons/backblast/XEH_preInit.sqf b/addons/backblast/XEH_preInit.sqf index 11193c3bf4..dde5f3affe 100644 --- a/addons/backblast/XEH_preInit.sqf +++ b/addons/backblast/XEH_preInit.sqf @@ -6,6 +6,5 @@ PREP(backblastDamage); PREP(fireLauncherBackblast); PREP(fireOverpressureZone); PREP(getDistance); -PREP(overpressureDamage); ADDON = true; diff --git a/addons/backblast/functions/fnc_fireOverpressureZone.sqf b/addons/backblast/functions/fnc_fireOverpressureZone.sqf index 0ded8f974b..178b519fc0 100644 --- a/addons/backblast/functions/fnc_fireOverpressureZone.sqf +++ b/addons/backblast/functions/fnc_fireOverpressureZone.sqf @@ -39,7 +39,7 @@ private "_affected"; _affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; // Let each client handle their own affected units -["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); +["backblast", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); // Draw debug lines #ifdef DEBUG_MODE_FULL diff --git a/addons/backblast/functions/fnc_overpressureDamage.sqf b/addons/backblast/functions/fnc_overpressureDamage.sqf deleted file mode 100644 index 995c5db9e4..0000000000 --- a/addons/backblast/functions/fnc_overpressureDamage.sqf +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Author: commy2 and CAA-Picard - * - * Calculate and apply overpressure damage to potentially affected local units - * - * Argument: - * 0: Unit that fired (Object) - * 1: Pos ASL of the projectile (Array) - * 2: Direction of the projectile (Array) - * 3: Weapon fired (String) - * - * Return value: - * None - */ -#include "script_component.hpp" - -EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); - -private ["_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; - -_dangerZoneAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; -_dangerZoneRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); -_dangerZoneDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); - -TRACE_4("Parameters:",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage,_weapon); - -private "_pos"; -_pos = _posASL; -if (!surfaceIsWater _pos) then { - _pos = ASLtoATL _pos; -}; - -{ - if (local _x && {_x != _firer} && {vehicle _x == _x}) then { - private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; - - _targetPositionASL = eyePos _x; - _relativePosition = _targetPositionASL vectorDiff _posASL; - _axisDistance = _relativePosition vectorDotProduct _direction; - _distance = vectorMagnitude _relativePosition; - _angle = acos (_axisDistance / _distance); - - _line = [_posASL, _targetPositionASL, _firer, _x]; - _line2 = [_posASL, _targetPositionASL]; - TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); - - if (_angle < _dangerZoneAngle && {_distance < _dangerZoneRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { - private ["_alpha", "_beta", "_damage"]; - - _alpha = sqrt (1 - _distance / _dangerZoneRange); - _beta = sqrt (1 - _angle / _dangerZoneAngle); - - _damage = 2 * _alpha * _beta * _dangerZoneDamage; - - // If the target is the ACE_player - if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; - - // @todo: Sort this interaction with medical - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical")) then { - [_x, "HitBody", ([_x, "", ((_x getHitPointDamage "HitBody") + _damage), objNull, objNull] call EFUNC(medical,handleDamage))] call EFUNC(medical,setHitPointDamage); - _x spawn { - sleep 0.5; - [_this, "", 0, objNull, objNull] call EFUNC(medical,handleDamage); - }; - } else { - _x setDamage (damage _x + _damage); - }; - }; - }; -} forEach (_pos nearEntities ["CAManBase", _dangerZoneRange]); From 2252f82de7a8279d5dca76f4c871a2ccd0617d8d Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 15 Feb 2015 18:11:50 +0100 Subject: [PATCH 107/113] rename backblast to overpressure --- addons/backblast/$PBOPREFIX$ | 1 - addons/backblast/XEH_postInit.sqf | 3 --- .../backblast/functions/script_component.hpp | 1 - addons/backblast/script_component.hpp | 12 ----------- addons/overpressure/$PBOPREFIX$ | 1 + .../CfgEventHandlers.hpp | 0 .../CfgWeapons.hpp | 0 addons/{backblast => overpressure}/README.md | 0 addons/overpressure/XEH_postInit.sqf | 3 +++ .../XEH_preInit.sqf | 2 +- addons/{backblast => overpressure}/config.cpp | 0 .../functions/fnc_fireLauncherBackblast.sqf | 2 +- .../functions/fnc_fireOverpressureZone.sqf | 6 +++--- .../functions/fnc_getDistance.sqf | 0 .../functions/fnc_overpressureDamage.sqf} | 20 +++++++++---------- .../functions/script_component.hpp | 1 + addons/overpressure/script_component.hpp | 12 +++++++++++ 17 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 addons/backblast/$PBOPREFIX$ delete mode 100644 addons/backblast/XEH_postInit.sqf delete mode 100644 addons/backblast/functions/script_component.hpp delete mode 100644 addons/backblast/script_component.hpp create mode 100644 addons/overpressure/$PBOPREFIX$ rename addons/{backblast => overpressure}/CfgEventHandlers.hpp (100%) rename addons/{backblast => overpressure}/CfgWeapons.hpp (100%) rename addons/{backblast => overpressure}/README.md (100%) create mode 100644 addons/overpressure/XEH_postInit.sqf rename addons/{backblast => overpressure}/XEH_preInit.sqf (84%) rename addons/{backblast => overpressure}/config.cpp (100%) rename addons/{backblast => overpressure}/functions/fnc_fireLauncherBackblast.sqf (97%) rename addons/{backblast => overpressure}/functions/fnc_fireOverpressureZone.sqf (92%) rename addons/{backblast => overpressure}/functions/fnc_getDistance.sqf (100%) rename addons/{backblast/functions/fnc_backblastDamage.sqf => overpressure/functions/fnc_overpressureDamage.sqf} (69%) create mode 100644 addons/overpressure/functions/script_component.hpp create mode 100644 addons/overpressure/script_component.hpp diff --git a/addons/backblast/$PBOPREFIX$ b/addons/backblast/$PBOPREFIX$ deleted file mode 100644 index c5ed230994..0000000000 --- a/addons/backblast/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\backblast \ No newline at end of file diff --git a/addons/backblast/XEH_postInit.sqf b/addons/backblast/XEH_postInit.sqf deleted file mode 100644 index 6f9a6f4cf8..0000000000 --- a/addons/backblast/XEH_postInit.sqf +++ /dev/null @@ -1,3 +0,0 @@ -#include "script_component.hpp" - -["backblast", FUNC(backblastDamage)] call EFUNC(common,addEventHandler); diff --git a/addons/backblast/functions/script_component.hpp b/addons/backblast/functions/script_component.hpp deleted file mode 100644 index 817131570f..0000000000 --- a/addons/backblast/functions/script_component.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\backblast\script_component.hpp" \ No newline at end of file diff --git a/addons/backblast/script_component.hpp b/addons/backblast/script_component.hpp deleted file mode 100644 index 9f2a71f2d5..0000000000 --- a/addons/backblast/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT backblast -#include "\z\ace\Addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_BACKBLAST - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_BACKBLAST - #define DEBUG_SETTINGS DEBUG_SETTINGS_BACKBLAST -#endif - -#include "\z\ace\Addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/overpressure/$PBOPREFIX$ b/addons/overpressure/$PBOPREFIX$ new file mode 100644 index 0000000000..fc5a82e0f7 --- /dev/null +++ b/addons/overpressure/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\overpressure \ No newline at end of file diff --git a/addons/backblast/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp similarity index 100% rename from addons/backblast/CfgEventHandlers.hpp rename to addons/overpressure/CfgEventHandlers.hpp diff --git a/addons/backblast/CfgWeapons.hpp b/addons/overpressure/CfgWeapons.hpp similarity index 100% rename from addons/backblast/CfgWeapons.hpp rename to addons/overpressure/CfgWeapons.hpp diff --git a/addons/backblast/README.md b/addons/overpressure/README.md similarity index 100% rename from addons/backblast/README.md rename to addons/overpressure/README.md diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf new file mode 100644 index 0000000000..33c2e679c9 --- /dev/null +++ b/addons/overpressure/XEH_postInit.sqf @@ -0,0 +1,3 @@ +#include "script_component.hpp" + +["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler); diff --git a/addons/backblast/XEH_preInit.sqf b/addons/overpressure/XEH_preInit.sqf similarity index 84% rename from addons/backblast/XEH_preInit.sqf rename to addons/overpressure/XEH_preInit.sqf index dde5f3affe..5eefc5eae4 100644 --- a/addons/backblast/XEH_preInit.sqf +++ b/addons/overpressure/XEH_preInit.sqf @@ -2,9 +2,9 @@ ADDON = false; -PREP(backblastDamage); PREP(fireLauncherBackblast); PREP(fireOverpressureZone); PREP(getDistance); +PREP(overpressureDamage); ADDON = true; diff --git a/addons/backblast/config.cpp b/addons/overpressure/config.cpp similarity index 100% rename from addons/backblast/config.cpp rename to addons/overpressure/config.cpp diff --git a/addons/backblast/functions/fnc_fireLauncherBackblast.sqf b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf similarity index 97% rename from addons/backblast/functions/fnc_fireLauncherBackblast.sqf rename to addons/overpressure/functions/fnc_fireLauncherBackblast.sqf index 515135d56f..f42ffd23ed 100644 --- a/addons/backblast/functions/fnc_fireLauncherBackblast.sqf +++ b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf @@ -39,7 +39,7 @@ private "_affected"; _affected = getPos _projectile nearEntities ["CAManBase", _backblastRange]; // Let each client handle their own affected units -["backblast", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); +["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); // Damage to the firer private "_distance"; diff --git a/addons/backblast/functions/fnc_fireOverpressureZone.sqf b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf similarity index 92% rename from addons/backblast/functions/fnc_fireOverpressureZone.sqf rename to addons/overpressure/functions/fnc_fireOverpressureZone.sqf index 178b519fc0..cc4918275d 100644 --- a/addons/backblast/functions/fnc_fireOverpressureZone.sqf +++ b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf @@ -1,5 +1,5 @@ /* - * Author: Commy2 and CAA-Picard + * Author: commy2 and CAA-Picard * * Handle fire of local vehicle weapons creating overpressure zones * @@ -20,7 +20,7 @@ EXPLODE_7_PVT(_this,_firer,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); -// Prevent AI from causing backblast damage +// Prevent AI from causing overpressure damage if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets? private ["_position", "_direction"]; @@ -39,7 +39,7 @@ private "_affected"; _affected = getPos _projectile nearEntities ["CAManBase", _dangerZoneRange]; // Let each client handle their own affected units -["backblast", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); +["overpressure", _affected, [_firer, _position, _direction, _weapon]] call EFUNC(common,targetEvent); // Draw debug lines #ifdef DEBUG_MODE_FULL diff --git a/addons/backblast/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf similarity index 100% rename from addons/backblast/functions/fnc_getDistance.sqf rename to addons/overpressure/functions/fnc_getDistance.sqf diff --git a/addons/backblast/functions/fnc_backblastDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf similarity index 69% rename from addons/backblast/functions/fnc_backblastDamage.sqf rename to addons/overpressure/functions/fnc_overpressureDamage.sqf index 651dc58830..c19fed1c04 100644 --- a/addons/backblast/functions/fnc_backblastDamage.sqf +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -16,13 +16,13 @@ EXPLODE_4_PVT(_this,_firer,_posASL,_direction,_weapon); -private ["_backblastAngle", "_backblastRange", "_backblastDamage"]; +private ["_overpressureAngle", "_overpressureRange", "_overpressureDamage"]; -_backblastAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; -_backblastRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); -_backblastDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); +_overpressureAngle = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(angle)) / 2; +_overpressureRange = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(range)); +_overpressureDamage = getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(damage)); -TRACE_4("Parameters:",_backblastAngle,_backblastRange,_backblastDamage,_weapon); +TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon); private "_pos"; _pos = _posASL; @@ -44,13 +44,13 @@ if (!surfaceIsWater _pos) then { _line2 = [_posASL, _targetPositionASL]; TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); - if (_angle < _backblastAngle && {_distance < _backblastRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { + if (_angle < _overpressureAngle && {_distance < _overpressureRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { private ["_alpha", "_beta", "_damage"]; - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt (1 - _angle / _backblastAngle); + _alpha = sqrt (1 - _distance / _overpressureRange); + _beta = sqrt (1 - _angle / _overpressureAngle); - _damage = 2 * _alpha * _beta * _backblastDamage; + _damage = 2 * _alpha * _beta * _overpressureDamage; // If the target is the ACE_player if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; @@ -67,4 +67,4 @@ if (!surfaceIsWater _pos) then { }; }; }; -} forEach (_pos nearEntities ["CAManBase", _backblastRange]); +} forEach (_pos nearEntities ["CAManBase", _overpressureRange]); diff --git a/addons/overpressure/functions/script_component.hpp b/addons/overpressure/functions/script_component.hpp new file mode 100644 index 0000000000..d66ac7aec3 --- /dev/null +++ b/addons/overpressure/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\overpressure\script_component.hpp" \ No newline at end of file diff --git a/addons/overpressure/script_component.hpp b/addons/overpressure/script_component.hpp new file mode 100644 index 0000000000..8dac72cbbf --- /dev/null +++ b/addons/overpressure/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT overpressure +#include "\z\ace\Addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_OVERPRESSURE + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_ENABLED_OVERPRESSURE + #define DEBUG_SETTINGS DEBUG_ENABLED_OVERPRESSURE +#endif + +#include "\z\ace\Addons\main\script_macros.hpp" \ No newline at end of file From 618ac2f8f65279625678ec26e6d625c0202caff2 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 15 Feb 2015 18:44:10 +0100 Subject: [PATCH 108/113] change overpressure readme.md --- addons/overpressure/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/overpressure/README.md b/addons/overpressure/README.md index 857776693a..3d3f242e40 100644 --- a/addons/overpressure/README.md +++ b/addons/overpressure/README.md @@ -1,4 +1,4 @@ -ace_backblast +ace_overpressure ============= Adds backblast to AT launchers and overpressure zones to tank cannons. From e8933d69c8cd582e0628689a5c67f7cc48d98842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 15:42:54 -0300 Subject: [PATCH 109/113] overpressure: renamed more config entries; avoid handheld launchers producing overpressure in addition to backblast. --- addons/overpressure/CfgEventHandlers.hpp | 27 +++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp index 6258484c7c..9494a61149 100644 --- a/addons/overpressure/CfgEventHandlers.hpp +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -14,12 +14,33 @@ class Extended_PostInit_EventHandlers { class Extended_FiredBIS_EventHandlers { class CAManBase { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Backblast_Damage') > 0}) then {_this call DFUNC(fireLauncherBackblast)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireLauncherBackblast)}); }; }; - class AllVehicles { + + class Tank { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_DangerZone_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Car { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Helicopter { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Plane { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + }; + }; + class Ship_F { + class ADDON { + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); }; }; }; From be427388813b6c4d1d1414ff3e40fdf167c46055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 15:56:37 -0300 Subject: [PATCH 110/113] macros --- addons/overpressure/CfgEventHandlers.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp index 9494a61149..3503333139 100644 --- a/addons/overpressure/CfgEventHandlers.hpp +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -14,33 +14,33 @@ class Extended_PostInit_EventHandlers { class Extended_FiredBIS_EventHandlers { class CAManBase { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireLauncherBackblast)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage)) > 0}) then {_this call DFUNC(fireLauncherBackblast)}); }; }; class Tank { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); }; }; class Car { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); }; }; class Helicopter { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); }; }; class Plane { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); }; }; class Ship_F { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> 'ACE_Overpressure_Damage') > 0}) then {_this call DFUNC(fireOverpressureZone)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireOverpressureZone)}); }; }; }; From 25645c2ae994de3f2b8140850f7da7e2f3677a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Sun, 15 Feb 2015 16:25:09 -0300 Subject: [PATCH 111/113] mm --- addons/overpressure/CfgEventHandlers.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp index 3503333139..40c3b32a57 100644 --- a/addons/overpressure/CfgEventHandlers.hpp +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers { class Extended_FiredBIS_EventHandlers { class CAManBase { class ADDON { - firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage)) > 0}) then {_this call DFUNC(fireLauncherBackblast)}); + firedBIS = QUOTE(if (local (_this select 0) && {getNumber (configfile >> 'CfgWeapons' >> _this select 1 >> QUOTE(QGVAR(Damage))) > 0}) then {_this call DFUNC(fireLauncherBackblast)}); }; }; From 1f737dc91495f5ef801e6712a4b83dd202847cec Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Mon, 16 Feb 2015 19:08:27 +0100 Subject: [PATCH 112/113] Add editorconfig --- .editorconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..f6f23b8d1b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + From b86869d7a1c7e90b5b06b55eec50472d130b9657 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 17 Feb 2015 22:37:04 -0600 Subject: [PATCH 113/113] UAV-Recharge Headers --- .../functions/fnc_canRefuelUAV.sqf | 30 ++++++++++--------- .../functions/fnc_refuelUAV.sqf | 30 ++++++++++--------- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf index 4256ddabf9..aaaac3077d 100644 --- a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf @@ -1,17 +1,19 @@ -/* fnc_refuel.sqf -* -* Author: marc_book (modified by PabstMirror) -* -* Tests if unit can refuel the target UAV -* -* Argument: -* 0: OBJECT - Player unit -* 1: OBJECT - UAV to test -* -* Return value: -* BOOL -*/ - +/* + * Author: marc_book + * Tests if unit can refuel the target UAV + * + * Arguments: + * 0: Player + * 1: UAV + * + * Return Value: + * Can the player rechange the UAV + * + * Example: + * [player, theUAV] call ace_logistics_uavbattery_fnc_canRefuelUAV + * + * Public: No + */ #include "script_component.hpp" PARAMS_2(_caller,_target); diff --git a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf index 5a248bf812..a23969aa9f 100644 --- a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf @@ -1,17 +1,19 @@ -/* fnc_refuel.sqf -* -* Author: marc_book (modified by PabstMirror) -* -* Starts refueling/recharging the 'Dartar' UAVs -* -* Argument: -* 0: OBJECT - Player unit -* 1: OBJECT - UAV -* -* Return value: -* NOTHING -*/ - +/* + * Author: marc_book + * Starts refueling/recharging the 'Dartar' UAVs + * + * Arguments: + * 0: Player + * 1: UAV + * + * Return Value: + * Nothing + * + * Example: + * [player, theUAV] call ace_logistics_uavbattery_fnc_refuelUAV + * + * Public: No + */ #include "script_component.hpp" PARAMS_2(_caller,_target);