mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into medical-basic
This commit is contained in:
commit
fabecdd0d3
@ -15,7 +15,7 @@
|
||||
</p>
|
||||
<p align="center"><sup><strong>Requires the latest version of <a href="http://www.armaholic.com/page.php?id=18767">CBA A3</a> | <a href="#">BIF thread</a></strong></sup></p>
|
||||
|
||||
**ACE 3** is a join effort by the teams behind **ACE 2**, **AGM**, **CSE** and **RHS** to improve the realism and authenticity of Arma 3.
|
||||
**ACE 3** is a joint effort by the teams behind **ACE 2**, **AGM** and **CSE** to improve the realism and authenticity of Arma 3.
|
||||
|
||||
This mod is entirely **open-source**, and everyone is free to propose changes or maintain their own, customized version as long as they make their changes open to the public in accordance with the GNU General Public License (for more information check the license file attached to this project).
|
||||
|
||||
@ -32,7 +32,7 @@ More information on the purpose of the different components of ACE and which one
|
||||
* Realistic ballistics including wind and humidity
|
||||
* Backblast simulation
|
||||
* Weapon resting and bipod deployment
|
||||
* A fire control system for armored vehicles and helicopters
|
||||
* A fire control system for armored vehicles and helicopters
|
||||
***and more...***
|
||||
|
||||
For a full list of current features, check [the official wiki](https://github.com/KoffeinFlummi/ACE3/wiki).
|
||||
|
BIN
ace_fcs.dll
BIN
ace_fcs.dll
Binary file not shown.
1
addons/backpacks/$PBOPREFIX$
Normal file
1
addons/backpacks/$PBOPREFIX$
Normal file
@ -0,0 +1 @@
|
||||
z\ace\addons\backpacks
|
@ -5,6 +5,12 @@ class Extended_PreInit_EventHandlers {
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_InventoryOpened_EventHandlers {
|
||||
class CAManBase {
|
||||
class GVAR(onOpenInventory) {
|
3
addons/backpacks/XEH_postInit.sqf
Normal file
3
addons/backpacks/XEH_postInit.sqf
Normal file
@ -0,0 +1,3 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);
|
@ -2,6 +2,7 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(backpackOpened);
|
||||
PREP(getBackpackAssignedUnit);
|
||||
PREP(isBackpack);
|
||||
PREP(onOpenInventory);
|
@ -5,7 +5,7 @@ class CfgPatches {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common","ace_interaction"};
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author[] = {"bux","commy2"};
|
||||
authorUrl = "https://github.com/commy2/";
|
||||
VERSION_CONFIG;
|
||||
@ -13,4 +13,3 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
51
addons/backpacks/functions/fnc_backpackOpened.sqf
Normal file
51
addons/backpacks/functions/fnc_backpackOpened.sqf
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Someone opened your backpack. Execute locally.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Who accessed your inventory? (Object)
|
||||
* 1: Unit that wields the backpack (Object)
|
||||
* 2: The backpack object (Object)
|
||||
*
|
||||
* Return value:
|
||||
* None.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
_backpack = _this select 2;
|
||||
|
||||
// do cam shake if the target is the player
|
||||
if ([_target] call EFUNC(common,isPlayer)) then {
|
||||
addCamShake [4, 0.5, 5];
|
||||
};
|
||||
|
||||
// play a rustling sound
|
||||
private ["_sounds", "_position"];
|
||||
|
||||
_sounds = [
|
||||
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
|
||||
"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWrflDnon_medic.wss",
|
||||
"a3\sounds_f\characters\ingame\AinvPpneMstpSlayWpstDnon_medic.wss",
|
||||
"a3\sounds_f\characters\ingame\AinvPpneMstpSlayWrflDnon_medic.wss"*/
|
||||
|
||||
QUOTE(PATHTO_R(sounds\zip_in.wav)),
|
||||
QUOTE(PATHTO_R(sounds\zip_out.wav))
|
||||
];
|
||||
|
||||
_position = _target modelToWorld (_target selectionPosition "Spine3");
|
||||
_position = _position call EFUNC(common,positionToASL);
|
||||
|
||||
playSound3D [
|
||||
_sounds select floor random count _sounds,
|
||||
objNull,
|
||||
false,
|
||||
_position,
|
||||
1,
|
||||
1,
|
||||
50
|
||||
];
|
30
addons/backpacks/functions/fnc_onOpenInventory.sqf
Normal file
30
addons/backpacks/functions/fnc_onOpenInventory.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Handle the open inventory event. Display message on traget client.
|
||||
*
|
||||
* Argument:
|
||||
* Input from "InventoryOpened" eventhandler
|
||||
*
|
||||
* Return value:
|
||||
* false. Always open the inventory dialog. (Bool)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_backpack"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_backpack = _this select 1;
|
||||
|
||||
// exit if the target is not a backpack
|
||||
if !([_backpack] call FUNC(isBackpack)) exitWith {};
|
||||
|
||||
// get the unit that wears the backpack object
|
||||
private "_target";
|
||||
_target = [_backpack] call FUNC(getBackpackAssignedUnit);
|
||||
|
||||
// raise event on target unit
|
||||
["backpackOpened", _target, [_unit, _target, _backpack]] call EFUNC(common,targetEvent);
|
||||
|
||||
// return false to open inventory as usual
|
||||
false
|
1
addons/backpacks/functions/script_component.hpp
Normal file
1
addons/backpacks/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\backpacks\script_component.hpp"
|
12
addons/backpacks/script_component.hpp
Normal file
12
addons/backpacks/script_component.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#define COMPONENT backpacks
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_BACKPACKS
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ENABLED_BACKPACKS
|
||||
#define DEBUG_SETTINGS DEBUG_ENABLED_BACKPACKS
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
BIN
addons/backpacks/sounds/zip_in.wav
Normal file
BIN
addons/backpacks/sounds/zip_in.wav
Normal file
Binary file not shown.
BIN
addons/backpacks/sounds/zip_out.wav
Normal file
BIN
addons/backpacks/sounds/zip_out.wav
Normal file
Binary file not shown.
@ -19,6 +19,7 @@ PREP(ASLToPosition);
|
||||
PREP(beingCarried);
|
||||
PREP(binarizeNumber);
|
||||
PREP(blurScreen);
|
||||
PREP(cachedCall);
|
||||
PREP(callCustomEventHandlers);
|
||||
PREP(callCustomEventHandlersGlobal);
|
||||
PREP(canGetInPosition);
|
||||
@ -47,6 +48,7 @@ PREP(displayTextPicture);
|
||||
PREP(displayTextStructured);
|
||||
PREP(doAnimation);
|
||||
PREP(endRadioTransmission);
|
||||
PREP(eraseCache);
|
||||
PREP(execNextFrame);
|
||||
PREP(execPersistentFnc);
|
||||
PREP(execRemoteFnc);
|
||||
@ -109,6 +111,7 @@ PREP(insertionSort);
|
||||
PREP(interpolateFromArray);
|
||||
PREP(inTransitionAnim);
|
||||
PREP(inWater);
|
||||
PREP(isAlive);
|
||||
PREP(isArrested);
|
||||
PREP(isAutoWind);
|
||||
PREP(isAwake);
|
||||
@ -147,6 +150,7 @@ PREP(removeCameraEventHandler);
|
||||
PREP(removeCustomEventHandler);
|
||||
PREP(removeMapMarkerCreatedEventHandler);
|
||||
PREP(removeScrollWheelEventHandler);
|
||||
PREP(removeSpecificMagazine);
|
||||
PREP(requestCallback);
|
||||
PREP(resetAllDefaults);
|
||||
PREP(restoreVariablesJIP);
|
||||
@ -199,6 +203,9 @@ PREP(logDisplays);
|
||||
PREP(monitor);
|
||||
PREP(showUser);
|
||||
|
||||
PREP(dumpPerformanceCounters);
|
||||
PREP(dumpArray);
|
||||
|
||||
// ACE_CuratorFix
|
||||
PREP(addCuratorUnloadEventhandler);
|
||||
PREP(fixCrateContent);
|
||||
@ -227,6 +234,9 @@ PREP(hashListSelect);
|
||||
PREP(hashListSet);
|
||||
PREP(hashListPush);
|
||||
|
||||
//Debug
|
||||
ACE_COUNTERS = [];
|
||||
|
||||
// Load settings
|
||||
if (isServer) then {
|
||||
call FUNC(loadSettingsOnServer);
|
||||
|
30
addons/common/functions/fnc_cachedCall.sqf
Normal file
30
addons/common/functions/fnc_cachedCall.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: CAA-Picard and Jaynus
|
||||
* Returns the result of the function and caches it up to a given time
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Parameters <ARRAY>
|
||||
* 1: Function <CODE>
|
||||
* 2: Namespace to store the cache on <NAMESPACE>
|
||||
* 3: Cache uid <STRING>
|
||||
* 4: Max duration of the cache <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* Result of the function <ANY>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_5_PVT(_this,_params,_function,_namespace,_uid,_duration);
|
||||
|
||||
if (((_namespace getVariable [_uid, [-99999]]) select 0) < diag_tickTime) then {
|
||||
_namespace setVariable [_uid, [diag_tickTime + _duration, _params call _function]];
|
||||
#ifdef DEBUG_MODE_FULL
|
||||
diag_log format ["Calculated result: %1 %2", _namespace, _uid];
|
||||
} else {
|
||||
diag_log format ["Cached result : %1 %2", _namespace, _uid];
|
||||
#endif
|
||||
};
|
||||
|
||||
(_namespace getVariable _uid) select 1
|
25
addons/common/functions/fnc_dumpArray.sqf
Normal file
25
addons/common/functions/fnc_dumpArray.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
//fnc_dumpArray.sqf
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_var", "_depth", "_pad", "_i", "_x"];
|
||||
|
||||
_var = _this select 0;
|
||||
_depth = _this select 1;
|
||||
_pad = "";
|
||||
for "_i" from 0 to _depth do {
|
||||
_pad = _pad + toString [9];
|
||||
};
|
||||
_depth = _depth + 1;
|
||||
if(IS_ARRAY(_var)) then {
|
||||
if((count _var) > 0) then {
|
||||
diag_log text format["%1[", _pad];
|
||||
{
|
||||
[_x, _depth] call FUNC(dumpArray);
|
||||
} forEach _var;
|
||||
diag_log text format["%1],", _pad];
|
||||
} else {
|
||||
diag_log text format["%1[],", _pad];
|
||||
};
|
||||
} else {
|
||||
diag_log text format["%1%2", _pad, [_var] call FUNC(formatVar)];
|
||||
};
|
73
addons/common/functions/fnc_dumpPerformanceCounters.sqf
Normal file
73
addons/common/functions/fnc_dumpPerformanceCounters.sqf
Normal file
@ -0,0 +1,73 @@
|
||||
//fnc_dumpPerformanceCounters.sqf
|
||||
#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
|
||||
/*
|
||||
diag_log text format["REGISTERED ACE PFH HANDLERS"];
|
||||
diag_log text format["-------------------------------------------"];
|
||||
if(!isNil "ACE_PFH") then {
|
||||
{
|
||||
private["_pfh"];
|
||||
_pfh = _x select 0;
|
||||
diag_log text format["Registered PFH: id=%1, %1:%2", (_pfh select 0), (_pfh select 1), (_pfh select 2) ];
|
||||
} forEach ACE_PFH;
|
||||
};*/
|
||||
|
||||
diag_log text format["ACE COUNTER RESULTS"];
|
||||
diag_log text format["-------------------------------------------"];
|
||||
{
|
||||
private["_counterEntry", "_iter", "_total", "_count", "_delta", "_averageResult"];
|
||||
_counterEntry = _x;
|
||||
_iter = 0;
|
||||
_total = 0;
|
||||
_count = 0;
|
||||
_averageResult = 0;
|
||||
if( (count _counterEntry) > 3) then {
|
||||
// calc
|
||||
{
|
||||
if(_iter > 2) then {
|
||||
_count = _count + 1;
|
||||
_delta = (_x select 1) - (_x select 0);
|
||||
|
||||
_total = _total + _delta;
|
||||
};
|
||||
_iter = _iter + 1;
|
||||
} forEach _counterEntry;
|
||||
|
||||
// results
|
||||
_averageResult = (_total / _count) * 1000;
|
||||
|
||||
// dump results
|
||||
diag_log text format["%1: Average: %2s / %3 = %4ms", (_counterEntry select 0), _total, _count, _averageResult];
|
||||
} else {
|
||||
diag_log text format["%1: No results", (_counterEntry select 0) ];
|
||||
};
|
||||
} forEach ACE_COUNTERS;
|
||||
|
||||
/*
|
||||
// Dump PFH Trackers
|
||||
diag_log text format["ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER"];
|
||||
diag_log text format["-------------------------------------------"];
|
||||
{
|
||||
private["_delay"];
|
||||
_delay = _x select 2;
|
||||
//if(_delay > 0) then { _delay = _delay / 1000; };
|
||||
|
||||
diag_log text format["%1: %2s, delay=%3, handle=%4",(_x select 0), _delay, (_x select 3), (_x select 4)];
|
||||
} forEach ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER;
|
||||
|
||||
// Dump PFH Trackers
|
||||
diag_log text format["ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER"];
|
||||
diag_log text format["-------------------------------------------"];
|
||||
{
|
||||
private["_delta"];
|
||||
_delta = _x select 1;
|
||||
//if(_delta > 0) then { _delta = _delta / 1000; };
|
||||
diag_log text format[" DELTA: %1s", _delta];
|
||||
} forEach ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER;
|
||||
|
||||
//{
|
||||
//
|
||||
//} forEach ACRE_EXCESSIVE_FRAME_TRACKER;
|
||||
|
||||
*/
|
18
addons/common/functions/fnc_eraseCache.sqf
Normal file
18
addons/common/functions/fnc_eraseCache.sqf
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Author: CAA-Picard
|
||||
* Deletes a cached result
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Namespace to store the cache on <NAMESPACE>
|
||||
* 1: Cache uid <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_2_PVT(_this,_namespace,_uid);
|
||||
|
||||
_namespace setVariable [_uid, nil];
|
14
addons/common/functions/fnc_isAlive.sqf
Normal file
14
addons/common/functions/fnc_isAlive.sqf
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Check if the object still exists and is alive. This function exists because 'alive objNull' actually returns true.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Any object (Object)
|
||||
*
|
||||
* Return value:
|
||||
* The object exists and is alive (Bool).
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
!isNull (_this select 0) && {alive (_this select 0)}
|
69
addons/common/functions/fnc_removeSpecificMagazine.sqf
Normal file
69
addons/common/functions/fnc_removeSpecificMagazine.sqf
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Author: CAA-Picard
|
||||
* Removes a magazine from the unit that has an specific ammo count
|
||||
*
|
||||
* Argument:
|
||||
* 0: Player <OBJECT>
|
||||
* 1: Magazine <STRING>
|
||||
* 2: Ammo count <NUMBER>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_3_PVT(_this,_player,_magazineType,_ammoCount);
|
||||
|
||||
private ["_magazines","_index","_isRemoved"];
|
||||
_isRemoved = false;
|
||||
|
||||
// Check uniform
|
||||
_magazines = [magazinesAmmoCargo uniformContainer _player, {_this select 0 == _magazineType}] call FUNC(filter);
|
||||
_index = _magazines find [_magazineType,_ammoCount];
|
||||
if (_index > -1) exitWith {
|
||||
{
|
||||
_player removeItemFromUniform (_x select 0);
|
||||
} forEach _magazines;
|
||||
|
||||
{
|
||||
if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then {
|
||||
_isRemoved = true;
|
||||
} else {
|
||||
(uniformContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
|
||||
};
|
||||
} forEach _magazines;
|
||||
};
|
||||
|
||||
// Check vest
|
||||
_magazines = [magazinesAmmoCargo vestContainer _player, {_this select 0 == _magazineType}] call FUNC(filter);
|
||||
_index = _magazines find [_magazineType,_ammoCount];
|
||||
if (_index > -1) exitWith {
|
||||
{
|
||||
_player removeItemFromVest (_x select 0);
|
||||
} forEach _magazines;
|
||||
|
||||
{
|
||||
if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then {
|
||||
_isRemoved = true;
|
||||
} else {
|
||||
(vestContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
|
||||
};
|
||||
} forEach _magazines;
|
||||
};
|
||||
|
||||
// Check backpack
|
||||
_magazines = [magazinesAmmoCargo backpackContainer _player, {_this select 0 == _magazineType}] call FUNC(filter);
|
||||
_index = _magazines find [_magazineType,_ammoCount];
|
||||
if (_index > -1) exitWith {
|
||||
{
|
||||
_player removeItemFromBackpack (_x select 0);
|
||||
} forEach _magazines;
|
||||
|
||||
{
|
||||
if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then {
|
||||
_isRemoved = true;
|
||||
} else {
|
||||
(backpackContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1];
|
||||
};
|
||||
} forEach _magazines;
|
||||
};
|
@ -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 DFUNC(reset););
|
||||
statement = QUOTE([ARR_2(vehicle _player,[_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 DFUNC(reset););
|
||||
statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset););
|
||||
showDisabled = 0;
|
||||
priority = 1;
|
||||
icon = "";
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_vehicle", "_weapon", "_ammo", "_magazine", "_projectile"];
|
||||
private ["_vehicle", "_weapon", "_ammo", "_magazine", "_projectile","_velocityCorrection"];
|
||||
|
||||
_vehicle = _this select 0;
|
||||
_weapon = _this select 1;
|
||||
@ -43,8 +43,12 @@ _offset = 0;
|
||||
};
|
||||
} forEach _FCSMagazines;
|
||||
|
||||
[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection);
|
||||
// Correct velocity for weapons that have initVelocity
|
||||
// @todo: Take into account negative initVelocities
|
||||
_velocityCorrection = (vectorMagnitude velocity _projectile) -
|
||||
getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
||||
|
||||
[_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, _velocityCorrection] call EFUNC(common,changeProjectileDirection);
|
||||
// Air burst missile
|
||||
|
||||
// handle locally only
|
||||
|
@ -1,81 +1,63 @@
|
||||
// by commy2
|
||||
|
||||
["ACE3",
|
||||
localize "STR_ACE_FCS_LaseTarget",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
|
||||
["ACE3", QGVAR(lazeTarget), localize "STR_ACE_FCS_LaseTarget",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false};
|
||||
|
||||
// prevent holding down
|
||||
if (GETGVAR(isDownStateKey1,false)) exitWith {false};
|
||||
GVAR(isDownStateKey1) = true;
|
||||
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
|
||||
false
|
||||
},
|
||||
[15, [false, false, false]],
|
||||
false,
|
||||
"keydown"
|
||||
] call cba_fnc_registerKeybind;
|
||||
// Statement
|
||||
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyDown);
|
||||
// Return false so it doesn't block the rest weapon action
|
||||
false
|
||||
},
|
||||
{
|
||||
// prevent holding down
|
||||
GVAR(isDownStateKey1) = false;
|
||||
|
||||
["ACE3",
|
||||
localize "STR_ACE_FCS_LaseTarget",
|
||||
{
|
||||
// prevent holding down
|
||||
GVAR(isDownStateKey1) = false;
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false};
|
||||
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(GVAR(enabled) && FUNC(canUseFCS)) exitWith {false};
|
||||
// Statement
|
||||
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyUp);
|
||||
false
|
||||
},
|
||||
[15, [false, false, false]], false] call cba_fnc_addKeybind; //Tab Key
|
||||
|
||||
// Statement
|
||||
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call FUNC(keyUp);
|
||||
false
|
||||
},
|
||||
[15, [false, false, false]],
|
||||
false,
|
||||
"keyup"
|
||||
] call cba_fnc_registerKeybind;
|
||||
["ACE3", QGVAR(adjustRangeUp), 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};
|
||||
|
||||
["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, [ACE_player] call EFUNC(common,getTurretIndex), 50] call FUNC(adjustRange);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[201, [false, false, false]], false] call cba_fnc_addKeybind; //PageUp Key
|
||||
|
||||
// Statement
|
||||
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), 50] call FUNC(adjustRange);
|
||||
true
|
||||
},
|
||||
[201, [false, false, false]],
|
||||
false,
|
||||
"keydown"
|
||||
] call cba_fnc_registerKeybind;
|
||||
["ACE3", QGVAR(adjustRangDown), 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};
|
||||
|
||||
["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, [ACE_player] call EFUNC(common,getTurretIndex), -50] call FUNC(adjustRange);
|
||||
true
|
||||
},
|
||||
[209, [false, false, false]],
|
||||
false,
|
||||
"keydown"
|
||||
] call cba_fnc_registerKeybind;
|
||||
// Statement
|
||||
[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -50] call FUNC(adjustRange);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[209, [false, false, false]], false] call cba_fnc_addKeybind; //PageDown Key
|
||||
|
@ -17,17 +17,19 @@
|
||||
#include "script_component.hpp"
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
["ACE3", localize "STR_ACE_Goggles_WipeGlasses",
|
||||
["ACE3", QGVAR(wipeGlasses), localize "STR_ACE_Goggles_WipeGlasses",
|
||||
{
|
||||
if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith {
|
||||
call FUNC(clearGlasses);
|
||||
true
|
||||
};
|
||||
false
|
||||
}, [20, true, true, false], false, "keydown"] call CALLSTACK(cba_fnc_registerKeybind);
|
||||
if (!(GETVAR(ace_player,ACE_isUnconscious,false))) exitWith {
|
||||
call FUNC(clearGlasses);
|
||||
true
|
||||
};
|
||||
false
|
||||
},
|
||||
{false},
|
||||
[20, [true, true, false]], false] call cba_fnc_addKeybind;
|
||||
|
||||
if isNil(QGVAR(UsePP)) then {
|
||||
GVAR(UsePP) = true;
|
||||
GVAR(UsePP) = true;
|
||||
};
|
||||
|
||||
GVAR(PostProcess) = ppEffectCreate ["ColorCorrections", 1995];
|
||||
@ -47,78 +49,78 @@ GVAR(RainActive) = false;
|
||||
GVAR(RainLastLevel) = 0;
|
||||
|
||||
FUNC(CheckGlasses) = {
|
||||
if (GVAR(Current) != (goggles ace_player)) then {
|
||||
GVAR(Current) = (goggles ace_player);
|
||||
["GlassesChanged",[GVAR(Current)]] call EFUNC(common,localEvent);
|
||||
};
|
||||
if (GVAR(Current) != (goggles ace_player)) then {
|
||||
GVAR(Current) = (goggles ace_player);
|
||||
["GlassesChanged",[GVAR(Current)]] call EFUNC(common,localEvent);
|
||||
};
|
||||
};
|
||||
|
||||
player addEventHandler ["Explosion", {
|
||||
if (alive ace_player) then {
|
||||
call FUNC(ApplyDirtEffect);
|
||||
if (GETBROKEN) exitWith {};
|
||||
if (((_this select 1) call FUNC(GetExplosionIndex)) < getNumber(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Resistance")) exitWith {};
|
||||
if !([ace_player] call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);};
|
||||
_effects = GETGLASSES(ace_player);
|
||||
_effects set [BROKEN, true];
|
||||
SETGLASSES(ace_player,_effects);
|
||||
if (getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked") != "" && {cameraOn == ace_player}) then {
|
||||
if (call FUNC(ExternalCamera)) exitWith {};
|
||||
if (isNull(GLASSDISPLAY)) then {
|
||||
150 cutRsc["RscACE_Goggles", "PLAIN",1, false];
|
||||
};
|
||||
(GLASSDISPLAY displayCtrl 10650) ctrlSetText getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked");
|
||||
if (alive ace_player) then {
|
||||
call FUNC(ApplyDirtEffect);
|
||||
if (GETBROKEN) exitWith {};
|
||||
if (((_this select 1) call FUNC(GetExplosionIndex)) < getNumber(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_Resistance")) exitWith {};
|
||||
if !([ace_player] call FUNC(isGogglesVisible)) exitWith {["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);};
|
||||
_effects = GETGLASSES(ace_player);
|
||||
_effects set [BROKEN, true];
|
||||
SETGLASSES(ace_player,_effects);
|
||||
if (getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked") != "" && {cameraOn == ace_player}) then {
|
||||
if (call FUNC(ExternalCamera)) exitWith {};
|
||||
if (isNull(GLASSDISPLAY)) then {
|
||||
150 cutRsc["RscACE_Goggles", "PLAIN",1, false];
|
||||
};
|
||||
(GLASSDISPLAY displayCtrl 10650) ctrlSetText getText(ConfigFile >> "CfgGlasses" >> GVAR(Current) >> "ACE_OverlayCracked");
|
||||
};
|
||||
["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);
|
||||
};
|
||||
["GlassesCracked",[ace_player]] call EFUNC(common,localEvent);
|
||||
};
|
||||
}];
|
||||
player addEventHandler ["Killed",{
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
SETGLASSES(ace_player,GLASSESDEFAULT);
|
||||
call FUNC(removeGlassesEffect);
|
||||
GVAR(EffectsActive)=false;
|
||||
ace_player setVariable ["ACE_EyesDamaged", false];
|
||||
if (GVAR(EyesDamageScript) != -1) then {
|
||||
[GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler);
|
||||
};
|
||||
if (GVAR(DustHandler) != -1) then {
|
||||
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
||||
GVAR(DustHandler) = -1;
|
||||
};
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
SETGLASSES(ace_player,GLASSESDEFAULT);
|
||||
call FUNC(removeGlassesEffect);
|
||||
GVAR(EffectsActive)=false;
|
||||
ace_player setVariable ["ACE_EyesDamaged", false];
|
||||
if (GVAR(EyesDamageScript) != -1) then {
|
||||
[GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler);
|
||||
};
|
||||
if (GVAR(DustHandler) != -1) then {
|
||||
[GVAR(DustHandler)] call CALLSTACK(cba_fnc_removePerFrameHandler);
|
||||
GVAR(DustHandler) = -1;
|
||||
};
|
||||
}];
|
||||
player addEventHandler ["Fired",{[_this select 0, _this select 1] call FUNC(dustHandler);}];
|
||||
player AddEventHandler ["Take",{call FUNC(checkGlasses);}];
|
||||
player AddEventHandler ["Put", {call FUNC(checkGlasses);}];
|
||||
|
||||
["GlassesChanged",{
|
||||
SETGLASSES(ace_player,GLASSESDEFAULT);
|
||||
SETGLASSES(ace_player,GLASSESDEFAULT);
|
||||
|
||||
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
|
||||
if (call FUNC(ExternalCamera)) exitWith {call FUNC(RemoveGlassesEffect)};
|
||||
|
||||
if ([ace_player] call FUNC(isGogglesVisible)) then {
|
||||
[_this select 0] call FUNC(applyGlassesEffect);
|
||||
} else {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
if ([ace_player] call FUNC(isGogglesVisible)) then {
|
||||
[_this select 0] call FUNC(applyGlassesEffect);
|
||||
} else {
|
||||
call FUNC(removeGlassesEffect);
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
["GlassesCracked",{
|
||||
if (_this select 0 != ace_player) exitWith {};
|
||||
ace_player setVariable ["ACE_EyesDamaged", true];
|
||||
if (GVAR(EyesDamageScript) != -1) then {
|
||||
[GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler);
|
||||
};
|
||||
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0.5,0.5,0.5,0.5],[1,1,1,0]];
|
||||
GVAR(PostProcessEyes) ppEffectCommit 0;
|
||||
GVAR(PostProcessEyes) ppEffectEnable true;
|
||||
GVAR(EyesDamageScript) = [{
|
||||
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
|
||||
GVAR(PostProcessEyes) ppEffectCommit 5;
|
||||
if (_this select 0 != ace_player) exitWith {};
|
||||
ace_player setVariable ["ACE_EyesDamaged", true];
|
||||
if (GVAR(EyesDamageScript) != -1) then {
|
||||
[GVAR(EyesDamageScript)] call CALLSTACK(cba_fnc_removePreFrameHandler);
|
||||
};
|
||||
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [0.5,0.5,0.5,0.5],[1,1,1,0]];
|
||||
GVAR(PostProcessEyes) ppEffectCommit 0;
|
||||
GVAR(PostProcessEyes) ppEffectEnable true;
|
||||
GVAR(EyesDamageScript) = [{
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
ace_player setVariable ["ACE_EyesDamaged", false];
|
||||
GVAR(EyesDamageScript) = -1;
|
||||
}, [], 5, 1] call EFUNC(common,waitAndExecute);
|
||||
}, [], 25, 5] call EFUNC(common,waitAndExecute);
|
||||
GVAR(PostProcessEyes) ppEffectAdjust[1, 1, 0, [0,0,0,0], [1,1,1,1],[1,1,1,0]];
|
||||
GVAR(PostProcessEyes) ppEffectCommit 5;
|
||||
GVAR(EyesDamageScript) = [{
|
||||
GVAR(PostProcessEyes) ppEffectEnable false;
|
||||
ace_player setVariable ["ACE_EyesDamaged", false];
|
||||
GVAR(EyesDamageScript) = -1;
|
||||
}, [], 5, 1] call EFUNC(common,waitAndExecute);
|
||||
}, [], 25, 5] call EFUNC(common,waitAndExecute);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
call FUNC(checkGlasses);
|
||||
[FUNC(CheckGoggles), 1, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
@ -10,19 +10,16 @@ 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};
|
||||
["ACE3", QGVAR(switchGrenadeMode), 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;
|
||||
// Statement
|
||||
[] call FUNC(nextMode);
|
||||
},
|
||||
{false},
|
||||
[9, [false, false, false]], false] call cba_fnc_addKeybind; //8 Key
|
||||
|
@ -6,30 +6,12 @@ _fnc = {
|
||||
};
|
||||
addMissionEventHandler ["Draw3D", _fnc];
|
||||
|
||||
["ACE3",
|
||||
"Interact Key",
|
||||
["ACE3", QGVAR(InteractKey), "Interact Key",
|
||||
{_this call FUNC(keyDown)},
|
||||
[219, [false, false, false]],
|
||||
false,
|
||||
"keydown"] call cba_fnc_registerKeybind;
|
||||
|
||||
["ACE3",
|
||||
"Interact Key",
|
||||
{_this call FUNC(keyUp)},
|
||||
[219, [false, false, false]],
|
||||
false,
|
||||
"keyUp"] call cba_fnc_registerKeybind;
|
||||
[219, [false, false, false]], false] call cba_fnc_addKeybind; //Left Windows Key
|
||||
|
||||
["ACE3",
|
||||
"Self Actions Key",
|
||||
["ACE3", QGVAR(SelfInteractKey), "Self Actions Key",
|
||||
{_this call FUNC(keyDownSelfAction)},
|
||||
[219, [false, true, false]],
|
||||
false,
|
||||
"keydown"] call cba_fnc_registerKeybind;
|
||||
|
||||
["ACE3",
|
||||
"Self Actions Key",
|
||||
{_this call FUNC(keyUpSelfAction)},
|
||||
[219, [false, true, false]],
|
||||
false,
|
||||
"keyUp"] call cba_fnc_registerKeybind;
|
||||
[219, [false, true, false]], false] call cba_fnc_addKeybind; //Left Windows Key + Ctrl/Strg
|
||||
|
@ -3,6 +3,7 @@
|
||||
ADDON = false;
|
||||
|
||||
PREP(addAction);
|
||||
PREP(addClassAction);
|
||||
PREP(compileMenu);
|
||||
PREP(compileMenuSelfAction);
|
||||
PREP(collectActiveActionTree);
|
||||
@ -11,6 +12,7 @@ PREP(keyDownSelfAction);
|
||||
PREP(keyUp);
|
||||
PREP(keyUpSelfAction);
|
||||
PREP(removeAction);
|
||||
PREP(removeClassAction);
|
||||
PREP(render);
|
||||
PREP(renderIcon);
|
||||
PREP(renderBaseMenu);
|
||||
@ -23,7 +25,8 @@ GVAR(keyDownTime) = 0;
|
||||
GVAR(lastTime) = diag_tickTime;
|
||||
GVAR(rotationAngle) = 0;
|
||||
|
||||
GVAR(selectedAction) = {};
|
||||
GVAR(selectedAction) = [[],[]];
|
||||
GVAR(selectedStatement) = {};
|
||||
GVAR(actionSelected) = false;
|
||||
GVAR(selectedTarget) = objNull;
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
* 6: Statement <CODE>
|
||||
* 7: Condition <CODE>
|
||||
* 8: Distance <NUMBER>
|
||||
* 9: Other parameters <ARRAY> (Optional)
|
||||
*
|
||||
* Return value:
|
||||
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
|
||||
@ -26,7 +27,7 @@
|
||||
|
||||
EXPLODE_9_PVT(_this,_object,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance);
|
||||
|
||||
private ["_varName","_actions"];
|
||||
private ["_varName","_actions","_params","_entry"];
|
||||
|
||||
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
|
||||
_actions = _object getVariable [_varName, []];
|
||||
@ -34,7 +35,11 @@ if((count _actions) == 0) then {
|
||||
_object setVariable [_varName, _actions];
|
||||
};
|
||||
|
||||
private "_entry";
|
||||
_params = [false,false,false,false];
|
||||
if (count _this > 9) then {
|
||||
_params = _this select 9;
|
||||
};
|
||||
|
||||
_entry = [
|
||||
[
|
||||
_displayName,
|
||||
@ -43,7 +48,7 @@ _entry = [
|
||||
_statement,
|
||||
_condition,
|
||||
_distance,
|
||||
[false,false,false],
|
||||
_params,
|
||||
+ _fullPath
|
||||
],
|
||||
[]
|
||||
|
87
addons/interact_menu/functions/fnc_addClassAction.sqf
Normal file
87
addons/interact_menu/functions/fnc_addClassAction.sqf
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Author: CAA-Picard
|
||||
* Add an ACE action to a class, under a certain path
|
||||
* Note: This function is NOT global.
|
||||
*
|
||||
* Argument:
|
||||
* 0: TypeOf of the class <STRING>
|
||||
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
|
||||
* 2: Full path of the new action <ARRAY>
|
||||
* 3: Name of the action shown in the menu <STRING>
|
||||
* 4: Icon <STRING>
|
||||
* 5: Position (Position or Selection Name) <POSITION> or <STRING>
|
||||
* 6: Statement <CODE>
|
||||
* 7: Condition <CODE>
|
||||
* 8: Distance <NUMBER>
|
||||
* 9: Other parameters <ARRAY> (Optional)
|
||||
*
|
||||
* Return value:
|
||||
* The entry full path, which can be used to remove the entry, or add children entries <ARRAY>.
|
||||
*
|
||||
* Example:
|
||||
* [typeOf cursorTarget, 0,["ACE_TapShoulderRight","VulcanPinch"],"Vulcan Pinch","",[0,0,0],{_target setDamage 1;},{true},100] call ace_interact_menu_fnc_addClassAction;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_9_PVT(_this,_objectType,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance);
|
||||
|
||||
private ["_varName","_actions","_params","_entry", "_parentLevel", "_foundParentLevel", "_fnc_findFolder"];
|
||||
|
||||
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
|
||||
_actions = missionNamespace getVariable [_varName, []];
|
||||
if((count _actions) == 0) then {
|
||||
missionNamespace setVariable [_varName, _actions];
|
||||
};
|
||||
|
||||
_params = [false,false,false,false];
|
||||
if (count _this > 9) then {
|
||||
_params = _this select 9;
|
||||
};
|
||||
|
||||
// Search the class action trees and find where to insert the entry
|
||||
_parentLevel = _actions;
|
||||
_foundParentLevel = false;
|
||||
|
||||
_fnc_findFolder = {
|
||||
EXPLODE_3_PVT(_this,_fullPath,_level,_classActions);
|
||||
|
||||
if (count _fullPath == _level + 1) then {
|
||||
_parentLevel = _classActions;
|
||||
_foundParentLevel = true;
|
||||
};
|
||||
|
||||
if (_foundParentLevel) exitWith {};
|
||||
|
||||
{
|
||||
EXPLODE_2_PVT(_x,_actionData,_actionChildren);
|
||||
if (((_actionData select 7) select _level) isEqualTo (_fullPath select _level)) exitWith {
|
||||
// The action should go somewhere in here
|
||||
[_fullPath, _level + 1, _actionChildren] call _fnc_findFolder;
|
||||
};
|
||||
} forEach _classActions;
|
||||
};
|
||||
|
||||
[_fullPath, 0, _actions] call _fnc_findFolder;
|
||||
|
||||
// Exit if there's no entry point to insert this action
|
||||
if (!_foundParentLevel) exitWith {};
|
||||
|
||||
_entry = [
|
||||
[
|
||||
_displayName,
|
||||
_icon,
|
||||
_position,
|
||||
_statement,
|
||||
_condition,
|
||||
_distance,
|
||||
_params,
|
||||
+ _fullPath
|
||||
],
|
||||
[]
|
||||
];
|
||||
|
||||
_parentLevel pushBack _entry;
|
||||
|
||||
_fullPath
|
@ -24,7 +24,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
|
||||
private "_recurseFnc";
|
||||
_recurseFnc = {
|
||||
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
|
||||
"_enableInside", "_children", "_entry", "_entryCfg", "_fullPath"];
|
||||
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_fullPath"];
|
||||
EXPLODE_2_PVT(_this,_actionsCfg,_parentPath);
|
||||
_actions = [];
|
||||
|
||||
@ -48,6 +48,7 @@ _recurseFnc = {
|
||||
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
|
||||
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
||||
_canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
|
||||
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
|
||||
|
||||
_fullPath = (+ _parentPath);
|
||||
_fullPath pushBack (configName _entryCfg);
|
||||
@ -63,7 +64,7 @@ _recurseFnc = {
|
||||
_statement,
|
||||
_condition,
|
||||
_distance,
|
||||
[_showDisabled,_enableInside,_canCollapse],
|
||||
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
|
||||
_fullPath
|
||||
],
|
||||
_children
|
||||
|
@ -24,7 +24,7 @@ if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {};
|
||||
private "_recurseFnc";
|
||||
_recurseFnc = {
|
||||
private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled",
|
||||
"_enableInside", "_children", "_entry", "_entryCfg", "_fullPath"];
|
||||
"_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_fullPath"];
|
||||
EXPLODE_2_PVT(_this,_actionsCfg,_parentPath);
|
||||
_actions = [];
|
||||
|
||||
@ -45,6 +45,7 @@ _recurseFnc = {
|
||||
_showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0;
|
||||
_enableInside = (getNumber (_entryCfg >> "enableInside")) > 0;
|
||||
_canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0;
|
||||
_runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0;
|
||||
|
||||
_fullPath = (+ _parentPath);
|
||||
_fullPath pushBack (configName _entryCfg);
|
||||
@ -60,7 +61,7 @@ _recurseFnc = {
|
||||
_statement,
|
||||
_condition,
|
||||
10, //distace
|
||||
[_showDisabled,_enableInside,_canCollapse],
|
||||
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
|
||||
_fullPath
|
||||
],
|
||||
_children
|
||||
|
@ -12,13 +12,18 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(keyDown) = false;
|
||||
if(GVAR(actionSelected)) then {
|
||||
this = GVAR(selectedTarget);
|
||||
_player = ACE_Player;
|
||||
_target = GVAR(selectedTarget);
|
||||
[GVAR(selectedTarget), ACE_player] call GVAR(selectedAction);
|
||||
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
|
||||
};
|
||||
|
||||
if (GVAR(keyDown)) then {
|
||||
GVAR(keyDown) = false;
|
||||
["interactMenuClosed", [0]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
GVAR(expanded) = false;
|
||||
GVAR(lastPath) = [];
|
||||
GVAR(menuDepthPath) = [];
|
||||
|
@ -16,13 +16,18 @@ if (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then {
|
||||
closeDialog 0;
|
||||
};
|
||||
|
||||
GVAR(keyDownSelfAction) = false;
|
||||
if(GVAR(actionSelected)) then {
|
||||
this = GVAR(selectedTarget);
|
||||
_player = ACE_Player;
|
||||
_target = GVAR(selectedTarget);
|
||||
[GVAR(selectedTarget), ACE_player] call GVAR(selectedAction);
|
||||
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
|
||||
};
|
||||
|
||||
if (GVAR(keyDownSelfAction)) then {
|
||||
GVAR(keyDownSelfAction) = false;
|
||||
["interactMenuClosed", [1]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
GVAR(expanded) = false;
|
||||
GVAR(lastPath) = [];
|
||||
GVAR(menuDepthPath) = [];
|
||||
|
72
addons/interact_menu/functions/fnc_removeClassAction.sqf
Normal file
72
addons/interact_menu/functions/fnc_removeClassAction.sqf
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Author: CAA-Picard
|
||||
* Removes a class action from a class
|
||||
* Note: This function is NOT global.
|
||||
*
|
||||
* Argument:
|
||||
* 0: TypeOf of the class <STRING>
|
||||
* 1: Type of action, 0 for actions, 1 for self-actions <NUMBER>
|
||||
* 2: Full path of the new action <ARRAY>
|
||||
*
|
||||
* Return value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [typeOf cursorTarget, 0,["ACE_TapShoulderRight","VulcanPinch"]] call ace_interact_menu_fnc_removeClassAction;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
EXPLODE_3_PVT(_this,_objectType,_typeNum,_fullPath);
|
||||
|
||||
private ["_varName","_actions","_parentLevel", "_actionIndex", "_foundAction", "_fnc_findFolder"];
|
||||
|
||||
_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType];
|
||||
_actions = missionNamespace getVariable [_varName, []];
|
||||
|
||||
// Search the class action trees and find where to insert the entry
|
||||
_parentLevel = _actions;
|
||||
_actionIndex = -1;
|
||||
_foundAction = false;
|
||||
|
||||
_fnc_findFolder = {
|
||||
EXPLODE_3_PVT(_this,_fullPath,_level,_classActions);
|
||||
|
||||
if (count _fullPath == _level + 1) then {
|
||||
_parentLevel = _classActions;
|
||||
};
|
||||
|
||||
{
|
||||
EXPLODE_2_PVT(_x,_actionData,_actionChildren);
|
||||
if (((_actionData select 7) select _level) isEqualTo (_fullPath select _level)) exitWith {
|
||||
if (_level + 1 == count _fullPath) exitWith {
|
||||
_actionIndex = _forEachIndex;
|
||||
_foundAction = true;
|
||||
};
|
||||
[_fullPath, _level + 1, _actionChildren] call _fnc_findFolder;
|
||||
};
|
||||
if (_foundAction) exitWith {};
|
||||
} forEach _classActions;
|
||||
};
|
||||
|
||||
[_fullPath, 0, _actions] call _fnc_findFolder;
|
||||
|
||||
// Exit if the action was not found
|
||||
if (!_foundAction) exitWith {};
|
||||
|
||||
_entry = [
|
||||
[
|
||||
_displayName,
|
||||
_icon,
|
||||
_position,
|
||||
_statement,
|
||||
_condition,
|
||||
_distance,
|
||||
_params,
|
||||
+ _fullPath
|
||||
],
|
||||
[]
|
||||
];
|
||||
|
||||
_parentLevel deleteAt _actionIndex;
|
@ -143,7 +143,9 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
||||
_foundTarget = true;
|
||||
GVAR(actionSelected) = true;
|
||||
GVAR(selectedTarget) = (_closest select 0) select 0;
|
||||
GVAR(selectedAction) = (((_closest select 0) select 1) select 0) select 3;
|
||||
GVAR(selectedAction) = (_closest select 0) select 1;
|
||||
GVAR(selectedStatement) = ((GVAR(selectedAction)) select 0) select 3;
|
||||
|
||||
_misMatch = false;
|
||||
_hoverPath = (_closest select 2);
|
||||
|
||||
@ -165,6 +167,16 @@ if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then {
|
||||
if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then {
|
||||
GVAR(expanded) = true;
|
||||
GVAR(menuDepthPath) = +GVAR(lastPath);
|
||||
|
||||
// Execute the current action if it's run on hover
|
||||
private "_runOnHover";
|
||||
_runOnHover = ((GVAR(selectedAction) select 0) select 6) select 3;
|
||||
if (_runOnHover) then {
|
||||
this = GVAR(selectedTarget);
|
||||
_player = ACE_Player;
|
||||
_target = GVAR(selectedTarget);
|
||||
[GVAR(selectedTarget), ACE_player] call GVAR(selectedStatement);
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -58,8 +58,14 @@ if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZon
|
||||
|
||||
|
||||
// Collect active tree
|
||||
// @todo: cache activeActionTree?
|
||||
_activeActionTree = ([_object, _baseAction] call FUNC(collectActiveActionTree));
|
||||
private "_uid";
|
||||
_uid = format [QGVAR(ATCache_%1), (_actionData select 7) select 0];
|
||||
_activeActionTree = [
|
||||
[_object, _baseAction],
|
||||
DFUNC(collectActiveActionTree),
|
||||
_object, _uid, 0.2
|
||||
] call EFUNC(common,cachedCall);
|
||||
|
||||
|
||||
// Check if there's something left for rendering
|
||||
if (count _activeActionTree == 0) exitWith {false};
|
||||
|
@ -481,8 +481,8 @@ class CfgVehicles {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
displayName = "$STR_ACE_Interaction_MainAction";
|
||||
selection = "";
|
||||
distance = 10;
|
||||
selection = "gunnerview";
|
||||
distance = 2;
|
||||
condition = "true";
|
||||
};
|
||||
};
|
||||
@ -494,8 +494,8 @@ class CfgVehicles {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
displayName = "$STR_ACE_Interaction_MainAction";
|
||||
selection = "";
|
||||
distance = 10;
|
||||
selection = "gunnerview";
|
||||
distance = 2;
|
||||
condition = "true";
|
||||
};
|
||||
};
|
||||
|
@ -16,92 +16,56 @@ GVAR(isOpeningDoor) = false;
|
||||
|
||||
|
||||
// Add keybinds
|
||||
["ACE3",
|
||||
localize "STR_ACE_Interaction_OpenDoor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(!GVAR(isOpeningDoor) &&
|
||||
{[2] call FUNC(getDoor) select 1 != ''}
|
||||
) exitWith {false};
|
||||
["ACE3", QGVAR(openDoor), localize "STR_ACE_Interaction_OpenDoor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false};
|
||||
|
||||
// Statement
|
||||
call EFUNC(interaction,openDoor);
|
||||
true
|
||||
},
|
||||
[57, [false, true, false]],
|
||||
false,
|
||||
"keydown"
|
||||
] call cba_fnc_registerKeybind;
|
||||
// Statement
|
||||
call EFUNC(interaction,openDoor);
|
||||
true
|
||||
},
|
||||
{
|
||||
//Probably don't want any condidtions here, so variable never gets locked down
|
||||
// Statement
|
||||
GVAR(isOpeningDoor) = false;
|
||||
true
|
||||
},
|
||||
[57, [false, true, false]], false] call cba_fnc_addKeybind; //Key CTRL+Space
|
||||
|
||||
["ACE3",
|
||||
localize "STR_ACE_Interaction_OpenDoor",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !(GVAR(isOpeningDoor)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
GVAR(isOpeningDoor) = false;
|
||||
true
|
||||
},
|
||||
[57, [false, true, false]],
|
||||
false,
|
||||
"keyup"
|
||||
] call cba_fnc_registerKeybind;
|
||||
["ACE3", QGVAR(tapShoulder), localize "STR_ACE_Interaction_TapShoulder",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false};
|
||||
|
||||
["ACE3",
|
||||
localize "STR_ACE_Interaction_TapShoulder",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = [];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false};
|
||||
// Statement
|
||||
[ACE_player, cursorTarget] call FUNC(tapShoulder);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[20, [true, false, false]], false] call cba_fnc_addKeybind;
|
||||
|
||||
// Statement
|
||||
[ACE_player, cursorTarget] call FUNC(tapShoulder);
|
||||
true
|
||||
},
|
||||
[20, [true, false, false]],
|
||||
false,
|
||||
"keydown"
|
||||
] call cba_fnc_registerKeybind;
|
||||
["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = ["ACE_Drag_isNotDragging"];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
|
||||
["ACE3",
|
||||
localize "STR_ACE_Interaction_ModifierKey",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = ["ACE_Drag_isNotDragging"];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
ACE_Modifier = 1;
|
||||
// Return false so it doesn't block other actions
|
||||
false
|
||||
},
|
||||
[29, [false, false, false]],
|
||||
false,
|
||||
"keydown"
|
||||
] call cba_fnc_registerKeybind;
|
||||
|
||||
["ACE3",
|
||||
localize "STR_ACE_Interaction_ModifierKey",
|
||||
{
|
||||
// Conditions: canInteract
|
||||
_exceptions = ["ACE_Drag_isNotDragging"];
|
||||
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
ACE_Modifier = 0;
|
||||
// Return false so it doesn't block other actions
|
||||
false
|
||||
},
|
||||
[29, [false, false, false]],
|
||||
false,
|
||||
"keyup"
|
||||
] call cba_fnc_registerKeybind;
|
||||
// Statement
|
||||
ACE_Modifier = 1;
|
||||
// Return false so it doesn't block other actions
|
||||
false
|
||||
},
|
||||
{
|
||||
//Probably don't want any condidtions here, so variable never gets locked down
|
||||
ACE_Modifier = 0;
|
||||
false;
|
||||
},
|
||||
[29, [false, false, false]], false] call cba_fnc_addKeybind;
|
||||
|
@ -47,7 +47,7 @@ playSound "ACE_Sound_Click";
|
||||
!GVAR(isOpeningDoor) || {getPosASL ACE_player distance _position > 1}
|
||||
};
|
||||
|
||||
if (!_usedMouseWheel && {time < _time}) then {
|
||||
if (!_usedMouseWheel && {time < _time} && {[] call EGVAR(common,canInteract)}) then {
|
||||
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
|
||||
|
||||
{_house animate [_x, _phase]} forEach _animations;
|
||||
|
@ -1 +0,0 @@
|
||||
z\ace\addons\lockbackpacks
|
@ -1,31 +0,0 @@
|
||||
|
||||
class CfgVehicles {
|
||||
class Man;
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class ACE_LockBackpack {
|
||||
displayName = "$STR_ACE_LockBackpacks_LockBackpack";
|
||||
condition = QUOTE([backpackContainer _player] call FUNC(isBackpack) && {!((backpackContainer _player) getVariable [ARR_2('ACE_LockedInventory', false)])});
|
||||
statement = QUOTE((backpackContainer _player) setVariable [ARR_3('ACE_LockedInventory', true, true)];);
|
||||
showDisabled = 0;
|
||||
priority = 2.5;
|
||||
icon = ""; // @todo
|
||||
hotkey = "L";
|
||||
enableInside = 1;
|
||||
};
|
||||
|
||||
class ACE_UnlockBackpack {
|
||||
displayName = "$STR_ACE_LockBackpacks_UnlockBackpack";
|
||||
condition = QUOTE([backpackContainer _player] call FUNC(isBackpack) && {(backpackContainer _player) getVariable [ARR_2('ACE_LockedInventory', false)]});
|
||||
statement = QUOTE((backpackContainer _player) setVariable [ARR_3('ACE_LockedInventory', false, true)];);
|
||||
showDisabled = 0;
|
||||
priority = 2.5;
|
||||
icon = ""; // @todo
|
||||
hotkey = "L";
|
||||
enableInside = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Author: bux, commy2
|
||||
*
|
||||
* Handle the open inventory event. Don't open the inventory if it's locked and display message.
|
||||
*
|
||||
* Argument:
|
||||
* Input from "InventoryOpened" eventhandler
|
||||
*
|
||||
* Return value:
|
||||
* Don't open the inventory dialog? (Bool)
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_target", "_isBackpack", "_isLocked", "_return"];
|
||||
|
||||
_target = _this select 1;
|
||||
|
||||
_isBackpack = [_target] call FUNC(isBackpack);
|
||||
_isLocked = _target getVariable ["ACE_LockedInventory", false];
|
||||
|
||||
_return = false;
|
||||
if (_isBackpack) then {
|
||||
// target is a backpack
|
||||
private "_unit";
|
||||
_unit = [_target] call FUNC(getBackpackAssignedUnit);
|
||||
|
||||
if (!alive _unit || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith {};
|
||||
|
||||
if (_isLocked) then {
|
||||
// target is a locked backpack
|
||||
[format [localize "STR_ACE_LockBackpacks_BackpackLocked", [_unit] call EFUNC(common,getName)]] call EFUNC(common,displayTextStructured);
|
||||
_return = true;
|
||||
} else {
|
||||
// target is a not-locked backpack
|
||||
if (_unit getVariable ["ACE_LockedInventory", false]) then {
|
||||
[localize "STR_ACE_LockBackpacks_InventoryLocked"] call EFUNC(common,displayTextStructured);
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// target is not a backpack
|
||||
if (_isLocked) then {
|
||||
[localize "STR_ACE_LockBackpacks_InventoryLocked"] call EFUNC(common,displayTextStructured);
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
_return
|
@ -1 +0,0 @@
|
||||
#include "\z\ace\addons\lockbackpacks\script_component.hpp"
|
@ -1,12 +0,0 @@
|
||||
#define COMPONENT lockbackpacks
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
#ifdef DEBUG_ENABLED_LOCKBACKPACKS
|
||||
#define DEBUG_MODE_FULL
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ENABLED_LOCKBACKPACKS
|
||||
#define DEBUG_SETTINGS DEBUG_ENABLED_LOCKBACKPACKS
|
||||
#endif
|
||||
|
||||
#include "\z\ace\addons\main\script_macros.hpp"
|
@ -1,70 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Edited with tabler - 2014-12-21 -->
|
||||
<Project name="ACE">
|
||||
<Package name="LockBackpacks">
|
||||
<Key ID="STR_ACE_LockBackpacks_BackpackVentralTake">
|
||||
<English>Take (Ventral)</English>
|
||||
<German>Aufnehmen (Am Bauch)</German>
|
||||
<Spanish>Coger (Mochila delantera)</Spanish>
|
||||
<Polish>Załóż (brzuch)</Polish>
|
||||
<Czech>Vzít (ventrální)</Czech>
|
||||
<French>Prendre (Ventral)</French>
|
||||
<Russian>Взять рюкзак (передний)</Russian>
|
||||
<Hungarian>Felvétel (előre)</Hungarian>
|
||||
<Portuguese>Pegar (Mochila Ventral)</Portuguese>
|
||||
<Italian>Prendi</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_LockBackpacks_BackpackVentralPut">
|
||||
<English>Take Off Backpack</English>
|
||||
<German>Rucksack ablegen</German>
|
||||
<Spanish>Dejar mochila</Spanish>
|
||||
<Polish>Zdejmij (brzuch)</Polish>
|
||||
<Czech>Odložit batoh</Czech>
|
||||
<French>Enlever (Ventral)</French>
|
||||
<Russian>Снять рюкзак (передний)</Russian>
|
||||
<Hungarian>Táska levétele</Hungarian>
|
||||
<Portuguese>Retirar Mochila</Portuguese>
|
||||
<Italian>Togliere zaino</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_LockBackpacks_LockBackpack">
|
||||
<English>Lock Backpack</English>
|
||||
<German>Rucksack verschließen</German>
|
||||
<French>Verrouiller le sac à dos</French>
|
||||
<Spanish>Bloquear mochila</Spanish>
|
||||
<Czech>Zamknout batoh</Czech>
|
||||
<Polish>Zablokuj plecak</Polish>
|
||||
<Hungarian>Táska zárolása</Hungarian>
|
||||
<Russian>Запереть рюкзак</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_LockBackpacks_UnlockBackpack">
|
||||
<English>Unlock Backpack</English>
|
||||
<German>Rucksack aufschließen</German>
|
||||
<French>Déverouiller le sac à dos</French>
|
||||
<Spanish>Desbloquear mochila</Spanish>
|
||||
<Czech>Odemknout batoh</Czech>
|
||||
<Polish>Odblokuj plecak</Polish>
|
||||
<Hungarian>Táska nyitása</Hungarian>
|
||||
<Russian>Отпереть рюкзак</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_LockBackpacks_BackpackLocked">
|
||||
<English>Backpack of %1 is locked</English>
|
||||
<German>Der Rucksack von %1 ist verschlossen</German>
|
||||
<French>Le sac à dos de %1 est verroullé</French>
|
||||
<Spanish>La mochila de %1 está bloqueada</Spanish>
|
||||
<Czech>%1 má zamčený batoh</Czech>
|
||||
<Polish>Plecak %1 jest zablokowany</Polish>
|
||||
<Hungarian>%1 táskája zárolva</Hungarian>
|
||||
<Russian>Рюкзак %1 заперт</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_LockBackpacks_InventoryLocked">
|
||||
<English>Inventory is locked</English>
|
||||
<German>Das Inventar ist verschlossen</German>
|
||||
<French>L'inventaire est verrouillé</French>
|
||||
<Spanish>Inventario bloqueado</Spanish>
|
||||
<Czech>Inventář je zamčený</Czech>
|
||||
<Polish>Ekwipunek jest zablokowany</Polish>
|
||||
<Hungarian>Felszerelés zárolt</Hungarian>
|
||||
<Russian>Инвентарь заперт</Russian>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
13
addons/magazines/CfgEventHandlers.hpp
Normal file
13
addons/magazines/CfgEventHandlers.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_FILE(XEH_preInit));
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class AllVehicles {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE(_this call FUNC(forceMagazineMuzzleVelocity));
|
||||
};
|
||||
};
|
||||
};
|
@ -22,6 +22,7 @@ class CfgMagazines {
|
||||
descriptionShort = "$STR_ACE_30Rnd_65x39_caseless_mag_SDDescription";
|
||||
picture = "\A3\weapons_f\data\ui\m_30stanag_caseless_green_CA.paa";
|
||||
initSpeed = 320;
|
||||
GVAR(forceMagazineMuzzleVelocity) = 1;
|
||||
};
|
||||
|
||||
class ACE_30Rnd_65x39_caseless_mag_AP: 30Rnd_65x39_caseless_mag {
|
||||
@ -57,6 +58,7 @@ class CfgMagazines {
|
||||
displayNameShort = "$STR_ACE_30Rnd_65x39_caseless_green_mag_SDNameShort";
|
||||
descriptionShort = "$STR_ACE_30Rnd_65x39_caseless_green_mag_SDDescription";
|
||||
initSpeed = 320;
|
||||
GVAR(forceMagazineMuzzleVelocity) = 1;
|
||||
};
|
||||
|
||||
class ACE_30Rnd_65x39_caseless_green_mag_AP: 30Rnd_65x39_caseless_green {
|
||||
@ -88,6 +90,7 @@ class CfgMagazines {
|
||||
displayNameShort = "$STR_ACE_30Rnd_556x45_mag_SDNameShort";
|
||||
descriptionShort = "$STR_ACE_30Rnd_556x45_mag_SDDescription";
|
||||
initSpeed = 320;
|
||||
GVAR(forceMagazineMuzzleVelocity) = 1;
|
||||
picture = "\A3\weapons_f\data\ui\m_30stanag_green_ca.paa";
|
||||
};
|
||||
|
||||
@ -127,6 +130,7 @@ class CfgMagazines {
|
||||
displayNameShort = "$STR_ACE_20Rnd_762x51_mag_SDNameShort";
|
||||
descriptionShort = "$STR_ACE_20Rnd_762x51_mag_SDDescription";
|
||||
initSpeed = 320;
|
||||
GVAR(forceMagazineMuzzleVelocity) = 1;
|
||||
};
|
||||
|
||||
class ACE_20Rnd_762x51_Mag_AP: 20Rnd_762x51_Mag {
|
||||
|
7
addons/magazines/XEH_preInit.sqf
Normal file
7
addons/magazines/XEH_preInit.sqf
Normal file
@ -0,0 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(forceMagazineMuzzleVelocity);
|
||||
|
||||
ADDON = true;
|
@ -12,6 +12,8 @@ class CfgPatches {
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
|
||||
#include "CfgAmmo.hpp"
|
||||
#include "CfgMagazines.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* DESCRIPTION.
|
||||
*
|
||||
* Arguments:
|
||||
* firedBIS
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_weapon", "_magazine", "_projectile"];
|
||||
|
||||
_weapon = _this select 1;
|
||||
_magazine = _this select 5;
|
||||
_projectile = _this select 6;
|
||||
|
||||
if (getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(forceMagazineMuzzleVelocity)) != 1) exitWith {
|
||||
//hint str (speed _projectile / 3.6);
|
||||
};
|
||||
|
||||
private ["_initSpeedWeapon", "_initSpeedMagazine"];
|
||||
|
||||
_initSpeedWeapon = getNumber (configFile >> "CfgWeapons" >> _weapon >> "initSpeed");
|
||||
_initSpeedMagazine = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
||||
|
||||
//systemChat format ["W: %1m/s, M: %2m/s", _initSpeedWeapon, _initSpeedMagazine];
|
||||
|
||||
// force magazine initSpeed
|
||||
|
||||
private ["_credit", "_debit"];
|
||||
|
||||
_credit = vectorMagnitude velocity _projectile;
|
||||
_debit = _credit + (_initSpeedMagazine - _initSpeedWeapon);
|
||||
|
||||
_projectile setVelocity ((velocity _projectile) vectorMultiply (_debit / _credit));
|
||||
|
||||
//hint str (speed _projectile / 3.6);
|
1
addons/magazines/functions/script_component.hpp
Normal file
1
addons/magazines/functions/script_component.hpp
Normal file
@ -0,0 +1 @@
|
||||
#include "\z\ace\addons\magazines\script_component.hpp"
|
46
addons/main/script_debug.hpp
Normal file
46
addons/main/script_debug.hpp
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
STACK TRACING
|
||||
**/
|
||||
//#define ENABLE_CALLSTACK
|
||||
|
||||
#ifdef ENABLE_CALLSTACK
|
||||
|
||||
#define CALLSTACK(function) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
|
||||
#define CALLSTACK_NAMED(function, functionName) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
|
||||
#define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC)
|
||||
|
||||
#define FUNC(var1) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
|
||||
#define EFUNC(var1,var2) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
|
||||
|
||||
#else
|
||||
#define CALLSTACK(function) function
|
||||
#define CALLSTACK_NAMED(function, functionName) function
|
||||
#define DUMPSTACK
|
||||
|
||||
#define FUNC(var1) TRIPLES(ADDON,fnc,var1)
|
||||
#define EFUNC(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
PERFORMANCE COUNTERS SECTION
|
||||
**/
|
||||
//#define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
#ifdef ENABLE_PERFORMANCE_COUNTERS
|
||||
#define ADDPFH(function, timing, args) call { _ret = [function, timing, args, #function] call EFUNC(sys_sync,perFrame_add); if(isNil "ACE_PFH" ) then { ACE_PFH=[]; }; ACE_PFH pushBack [[_ret, __FILE__, __LINE__], [function, timing, args]]; _ret }
|
||||
|
||||
#define CREATE_COUNTER(x) if(isNil "ACE_COUNTERS" ) then { ACE_COUNTERS=[]; }; GVAR(DOUBLES(x,counter))=[]; GVAR(DOUBLES(x,counter)) set[0, QUOTE(GVAR(DOUBLES(x,counter)))]; GVAR(DOUBLES(x,counter)) set[1, diag_tickTime]; ACE_COUNTERS pushBack GVAR(DOUBLES(x,counter));
|
||||
#define BEGIN_COUNTER(x) if(isNil QUOTE(GVAR(DOUBLES(x,counter)))) then { CREATE_COUNTER(x) }; GVAR(DOUBLES(x,counter)) set[2, diag_tickTime];
|
||||
#define END_COUNTER(x) GVAR(DOUBLES(x,counter)) pushBack [(GVAR(DOUBLES(x,counter)) select 2), diag_tickTime];
|
||||
|
||||
#define DUMP_COUNTERS ([__FILE__, __LINE__] call ACE_DUMPCOUNTERS_FNC)
|
||||
#else
|
||||
#define ADDPFH(function, timing, args) [function, timing, args, #function] call EFUNC(sys_sync,perFrame_add)
|
||||
|
||||
#define CREATE_COUNTER(x) /* disabled */
|
||||
#define BEGIN_COUNTER(x) /* disabled */
|
||||
#define END_COUNTER(x) /* disabled */
|
||||
#define DUMP_COUNTERS /* disabled */
|
||||
#endif
|
@ -223,26 +223,6 @@
|
||||
|
||||
#define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QUOTE(PATHTOF(folder\__PREP__.sqf))
|
||||
|
||||
|
||||
#ifdef ENABLE_CALLSTACK
|
||||
#define CALLSTACK(function) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
|
||||
#define CALLSTACK_NAMED(function, functionName) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
|
||||
#define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC)
|
||||
|
||||
#define FUNC(var1) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
|
||||
#define EFUNC(var1,var2) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
|
||||
|
||||
#else
|
||||
#define CALLSTACK(function) function
|
||||
#define CALLSTACK_NAMED(function, functionName) function
|
||||
#define DUMPSTACK
|
||||
|
||||
#define FUNC(var1) TRIPLES(ADDON,fnc,var1)
|
||||
#define EFUNC(var1,var2) TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define HASH_CREATE ([] call EFUNC(common,hashCreate))
|
||||
#define HASH_SET(hash, key, val) ([hash, key, val, __FILE__, __LINE__] call EFUNC(common,hashSet))
|
||||
#define HASH_GET(hash, key) ([hash, key, __FILE__, __LINE__] call EFUNC(common,hashGet))
|
||||
@ -254,3 +234,5 @@
|
||||
#define HASHLIST_SELECT(hashList, index) ([hashList, index, __FILE__, __LINE__] call EFUNC(common,hashListSelect))
|
||||
#define HASHLIST_SET(hashList, index, value) ([hashList, index, value, __FILE__, __LINE__] call EFUNC(common,hashListSet))
|
||||
#define HASHLIST_PUSH(hashList, value) ([hashList, value, __FILE__, __LINE__] call EFUNC(common,hashListPush))
|
||||
|
||||
#include "script_debug.hpp"
|
@ -11,7 +11,7 @@ class ACE_Medical_Actions {
|
||||
treatmentTime = 5;
|
||||
treatmentTimeSelfCoef = 1;
|
||||
items[] = {{QGVAR(fieldDressing), QGVAR(packingBandage), QGVAR(elasticBandage), QGVAR(quikClot)}};
|
||||
|
||||
condition = "";
|
||||
itemConsumed = 1;
|
||||
|
||||
callbackSuccess = QUOTE(DFUNC(treatmentBasic_bandage));
|
||||
@ -53,8 +53,6 @@ class ACE_Medical_Actions {
|
||||
};
|
||||
|
||||
class Advanced {
|
||||
// cse_surgical_kit cse_bandage_basic cse_packing_bandage cse_bandageElastic cse_tourniquet cse_splint cse_morphine cse_atropine cse_epinephrine cse_plasma_iv cse_plasma_iv_500 cse_plasma_iv250 cse_blood_iv cse_blood_iv_500 cse_blood_iv_250 cse_saline_iv cse_saline_iv_500 cse_saline_iv_250 cse_quikclot cse_nasopharyngeal_tube cse_opa cse_liquidSkin cse_chestseal cse_personal_aid_kit
|
||||
|
||||
class FieldDressing {
|
||||
// Which locations can this treatment action be used? Available: Field, MedicalFacility, MedicalVehicle, All.
|
||||
treatmentLocations[] = {"All"};
|
||||
@ -64,13 +62,17 @@ class ACE_Medical_Actions {
|
||||
treatmentTime = 5;
|
||||
// Item required for the action. Leave empty for no item required.
|
||||
items[] = {QGVAR(fieldDressing)};
|
||||
condition = "";
|
||||
// Callbacks
|
||||
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_bandage));
|
||||
callbackFailure = "";
|
||||
callbackProgress = "";
|
||||
animationPatient = "";
|
||||
animationCaller = ""; // TODO
|
||||
itemConsumed = 1;
|
||||
animationPatient = "";
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic4";
|
||||
animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
|
||||
animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic";
|
||||
animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic";
|
||||
};
|
||||
class PackingBandage: fieldDressing {
|
||||
items[] = {QGVAR(packingBandage)};
|
||||
@ -85,16 +87,18 @@ class ACE_Medical_Actions {
|
||||
items[] = {QGVAR(tourniquet)};
|
||||
treatmentTime = 6;
|
||||
callbackSuccess = QUOTE(DFUNC(treatmentTourniquet));
|
||||
condition = QUOTE(!([ARR_2(_this select 1, _this select 2)] call FUNC(hasTourniquetAppliedTo)));
|
||||
};
|
||||
class Morphine: fieldDressing {
|
||||
items[] = {QGVAR(morphine)};
|
||||
treatmentTime = 3;
|
||||
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_medication));
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
};
|
||||
class Atropine: fieldDressing {
|
||||
class Atropine: Morphine {
|
||||
items[] = {QGVAR(atropine)};
|
||||
};
|
||||
class Epinephrine: fieldDressing {
|
||||
class Epinephrine: Morphine {
|
||||
items[] = {QGVAR(epinephrine)};
|
||||
};
|
||||
class BloodIV: fieldDressing {
|
||||
@ -102,6 +106,7 @@ class ACE_Medical_Actions {
|
||||
requiredMedic = 1;
|
||||
treatmentTime = 7;
|
||||
callbackSuccess = QUOTE(DFUNC(treatmentIV));
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
};
|
||||
class BloodIV_500: BloodIV {
|
||||
items[] = {QGVAR(bloodIV_500)};
|
||||
@ -111,6 +116,7 @@ class ACE_Medical_Actions {
|
||||
};
|
||||
class PlasmaIV: BloodIV {
|
||||
items[] = {QGVAR(plasmaIV)};
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
};
|
||||
class PlasmaIV_500: PlasmaIV {
|
||||
items[] = {QGVAR(plasmaIV_500)};
|
||||
@ -120,6 +126,7 @@ class ACE_Medical_Actions {
|
||||
};
|
||||
class SalineIV: BloodIV {
|
||||
items[] = {QGVAR(salineIV)};
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
};
|
||||
class SalineIV_500: SalineIV {
|
||||
items[] = {QGVAR(salineIV_500)};
|
||||
@ -134,6 +141,7 @@ class ACE_Medical_Actions {
|
||||
treatmentTime = 15;
|
||||
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit));
|
||||
itemConsumed = 0;
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
};
|
||||
class PersonalAidKit: fieldDressing {
|
||||
items[] = {QGVAR(personalAidKit)};
|
||||
@ -142,6 +150,7 @@ class ACE_Medical_Actions {
|
||||
treatmentTime = 15;
|
||||
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal));
|
||||
itemConsumed = 0;
|
||||
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
|
||||
};
|
||||
class CheckPulse: fieldDressing {
|
||||
treatmentLocations[] = {"All"};
|
||||
@ -164,12 +173,14 @@ class ACE_Medical_Actions {
|
||||
class RemoveTourniquet: CheckPulse {
|
||||
treatmentTime = 2.5;
|
||||
callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet));
|
||||
condition = QUOTE([ARR_2(_this select 1, _this select 2)] call FUNC(hasTourniquetAppliedTo));
|
||||
};
|
||||
class CPR: fieldDressing {
|
||||
treatmentLocations[] = {"All"};
|
||||
requiredMedic = 0;
|
||||
treatmentTime = 25;
|
||||
items[] = {};
|
||||
condition = ""; // unconscious?
|
||||
callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR));
|
||||
callbackFailure = "";
|
||||
callbackProgress = "";
|
||||
@ -177,6 +188,18 @@ class ACE_Medical_Actions {
|
||||
animationCaller = ""; // TODO
|
||||
itemConsumed = 0;
|
||||
};
|
||||
class BodyBag: fieldDressing {
|
||||
treatmentLocations[] = {"All"};
|
||||
requiredMedic = 0;
|
||||
treatmentTime = 7.5;
|
||||
items[] = {QVAR(bodyBag)};
|
||||
condition = "!alive (_this select 1);";
|
||||
callbackSuccess = QUOTE(DFUNC(actionPlaceInBodyBag));
|
||||
callbackFailure = "";
|
||||
callbackProgress = "";
|
||||
animationPatient = "";
|
||||
itemConsumed = 0;
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
@ -193,7 +216,7 @@ class ACE_Medical_Advanced {
|
||||
name = "Scrape";
|
||||
selections[] = {"All"};
|
||||
bleedingRate = 0.0001;
|
||||
pain = 0.1;
|
||||
pain = 0.01;
|
||||
causes[] = {"falling", "ropeburn", "vehiclecrash"};
|
||||
minDamage = 0.01;
|
||||
class Minor {
|
||||
@ -215,7 +238,7 @@ class ACE_Medical_Advanced {
|
||||
name = "Avulsion";
|
||||
selections[] = {"All"};
|
||||
bleedingRate = 0.01;
|
||||
pain = 1;
|
||||
pain = 0.3;
|
||||
causes[] = {"explosive", "vehiclecrash", "grenade", "shell", "bullet", "backblast", "bite"};
|
||||
minDamage = 0.2;
|
||||
class Minor {
|
||||
@ -237,7 +260,7 @@ class ACE_Medical_Advanced {
|
||||
name = "Bruise";
|
||||
selections[] = {"All"};
|
||||
bleedingRate = 0.0;
|
||||
pain = 1;
|
||||
pain = 0.05;
|
||||
causes[] = {"bullet", "backblast", "punch","vehiclecrash","falling"};
|
||||
minDamage = 0.01;
|
||||
class Minor {
|
||||
@ -256,7 +279,7 @@ class ACE_Medical_Advanced {
|
||||
name = "Crushed tissue";
|
||||
selections[] = {"All"};
|
||||
bleedingRate = 0.01;
|
||||
pain = 1;
|
||||
pain = 0.1;
|
||||
causes[] = {"falling", "vehiclecrash", "punch"};
|
||||
minDamage = 0.1;
|
||||
class Minor {
|
||||
@ -278,7 +301,7 @@ class ACE_Medical_Advanced {
|
||||
name = "Cut";
|
||||
selections[] = {"All"};
|
||||
bleedingRate = 0.01;
|
||||
pain = 1;
|
||||
pain = 0.075;
|
||||
causes[] = {"vehiclecrash", "grenade", "explosive", "shell", "backblast", "stab"};
|
||||
minDamage = 0.1;
|
||||
class Minor {
|
||||
@ -300,7 +323,7 @@ class ACE_Medical_Advanced {
|
||||
name = "Tear";
|
||||
selections[] = {"All"};
|
||||
bleedingRate = 0.01;
|
||||
pain = 1;
|
||||
pain = 0.075;
|
||||
causes[] = {"vehiclecrash", "punch"};
|
||||
minDamage = 0.01;
|
||||
class Minor {
|
||||
@ -322,7 +345,7 @@ class ACE_Medical_Advanced {
|
||||
name = "Velocity Wound";
|
||||
selections[] = {"All"};
|
||||
bleedingRate = 0.01;
|
||||
pain = 1;
|
||||
pain = 0.2;
|
||||
causes[] = {"bullet", "grenade","explosive", "shell"};
|
||||
minDamage = 0.15;
|
||||
class Minor {
|
||||
@ -344,7 +367,7 @@ class ACE_Medical_Advanced {
|
||||
name = "Puncture Wound";
|
||||
selections[] = {"All"};
|
||||
bleedingRate = 0.01;
|
||||
pain = 1;
|
||||
pain = 0.075;
|
||||
causes[] = {"stab", "grenade"};
|
||||
minDamage = 0.01;
|
||||
class Minor {
|
||||
@ -365,7 +388,7 @@ class ACE_Medical_Advanced {
|
||||
class Femur {
|
||||
name = "Broken Femur";
|
||||
selections[] = {"Head", "Torso"};
|
||||
pain = 20;
|
||||
pain = 0.2;
|
||||
causes[] = {"Bullet", "VehicleCrash", "Backblast", "Explosive", "Shell", "Grenade"};
|
||||
minDamage = 0.5;
|
||||
};
|
||||
|
71
addons/medical/ACE_Settings.hpp
Normal file
71
addons/medical/ACE_Settings.hpp
Normal file
@ -0,0 +1,71 @@
|
||||
class ACE_Settings {
|
||||
class GVAR(level) {
|
||||
value = 1;
|
||||
typeName = "SCALAR";
|
||||
values[] = {"Disabled", "Basic", "Advanced"};
|
||||
};
|
||||
class GVAR(medicSetting) {
|
||||
value = 1;
|
||||
typeName = "SCALAR";
|
||||
values[] = {"Disabled", "Normal", "Advanced"};
|
||||
};
|
||||
class GVAR(enableFor) {
|
||||
value = 0;
|
||||
typeName = "SCALAR";
|
||||
values[] = {"Players only", "Players and AI"};
|
||||
};
|
||||
class GVAR(maxRevives) {
|
||||
typeName = "NUMBER";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(enableOverdosing) {
|
||||
typeName = "BOOL";
|
||||
value = true;
|
||||
};
|
||||
class GVAR(bleedingCoefficient) {
|
||||
typeName = "NUMBER";
|
||||
value = 1;
|
||||
};
|
||||
|
||||
class GVAR(enableAirway) {
|
||||
typeName = "BOOL";
|
||||
value = false;
|
||||
};
|
||||
class GVAR(enableFractures) {
|
||||
typeName = "BOOL";
|
||||
value = false;
|
||||
};
|
||||
class GVAR(enableAdvancedWounds) {
|
||||
typeName = "BOOL";
|
||||
value = false;
|
||||
};
|
||||
class GVAR(enableVehicleCrashes) {
|
||||
typeName = "BOOL";
|
||||
value = true;
|
||||
};
|
||||
class GVAR(enableScreams) {
|
||||
typeName = "BOOL";
|
||||
value = true;
|
||||
};
|
||||
class GVAR(playerDamageThreshold) {
|
||||
typeName = "NUMBER";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(AIDamageThreshold) {
|
||||
typeName = "NUMBER";
|
||||
value = 1;
|
||||
};
|
||||
class GVAR(enableUnsconsiousnessAI) {
|
||||
value = 1;
|
||||
typeName = "NUMBER";
|
||||
values[] = {"Disabled", "Enabled", "50/50"};
|
||||
};
|
||||
class GVAR(preventInstaDeath) {
|
||||
typeName = "BOOL";
|
||||
value = false;
|
||||
};
|
||||
class GVAR(maxReviveTime) {
|
||||
typeName = "NUMBER";
|
||||
value = 120;
|
||||
};
|
||||
};
|
@ -26,3 +26,19 @@ class Extended_Respawn_EventHandlers {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Killed_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
killed = QUOTE(call FUNC(handleKilled));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Local_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
local = QUOTE(call FUNC(handleLocal));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
6
addons/medical/CfgFactionClasses.hpp
Normal file
6
addons/medical/CfgFactionClasses.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
class CfgFactionClasses {
|
||||
class NO_CATEGORY;
|
||||
class ADDON: NO_CATEGORY {
|
||||
displayName = "ACE Medical";
|
||||
};
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (!hasInterface) exitwith{};
|
||||
GVAR(enabledFor) = 1; // TODO remove this once we implement settings. Just here to get the vitals working.
|
||||
|
||||
GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3"];
|
||||
GVAR(heartBeatSounds_Normal) = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"];
|
||||
@ -138,7 +139,7 @@ if (isNil QGVAR(level)) then {
|
||||
// HEARTRATE BASED EFFECTS
|
||||
[{
|
||||
_heartRate = ACE_player getVariable [QGVAR(heartRate), 70];
|
||||
if (GVAR(level) == 0) then {
|
||||
if (GVAR(level) == 1) then {
|
||||
_heartRate = 60 + 40 * (ACE_player getVariable [QGVAR(pain), 0]);
|
||||
};
|
||||
if (_heartRate <= 0) exitwith {};
|
||||
@ -197,7 +198,7 @@ if (isNil QGVAR(level)) then {
|
||||
};
|
||||
};
|
||||
|
||||
if (GVAR(level) > 0 && {_heartRate > 0}) then {
|
||||
if (GVAR(level) >= 2 && {_heartRate > 0}) then {
|
||||
_minTime = 60 / _heartRate;
|
||||
if (time - GVAR(lastHeartBeatSound) > _minTime) then {
|
||||
GVAR(lastHeartBeatSound) = time;
|
||||
@ -216,7 +217,7 @@ if (isNil QGVAR(level)) then {
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
// broadcast injuries to JIP clients in a MP session
|
||||
if (isMultiplayer && !isDedicated) then {
|
||||
if (isMultiplayer) then {
|
||||
[QGVAR(onPlayerConnected), "onPlayerConnected", {
|
||||
if (isNil QGVAR(InjuredCollection)) then {
|
||||
GVAR(InjuredCollection) = [];
|
||||
@ -231,3 +232,13 @@ if (isMultiplayer && !isDedicated) then {
|
||||
}foreach GVAR(InjuredCollection);
|
||||
}, []] call BIS_fnc_addStackedEventHandler;
|
||||
};
|
||||
|
||||
|
||||
[
|
||||
{(((_this select 0) getvariable [QGVAR(bloodVolume), 0]) < 65)},
|
||||
{(((_this select 0) getvariable [QGVAR(pain), 0]) > 0.9)},
|
||||
{(((_this select 0) call FUNC(getBloodLoss)) > 0.25)},
|
||||
{((_this select 0) getvariable [QGVAR(inReviveState), false])},
|
||||
{((_this select 0) getvariable ["ACE_isDead", false])},
|
||||
{(((_this select 0) getvariable [QGVAR(airwayStatus), 100]) < 80)}
|
||||
] call FUNC(addUnconsciousCondition);
|
||||
|
@ -24,6 +24,7 @@ PREP(getBloodPressure);
|
||||
PREP(getBloodVolumeChange);
|
||||
PREP(getCardiacOutput);
|
||||
PREP(getTypeOfDamage);
|
||||
PREP(getTriageStatus);
|
||||
PREP(getUnconsciousCondition);
|
||||
PREP(handleDamage);
|
||||
PREP(handleDamage_advanced);
|
||||
@ -35,6 +36,8 @@ PREP(handleDamage_fractures);
|
||||
PREP(handleDamage_internalInjuries);
|
||||
PREP(handleDamage_wounds);
|
||||
PREP(handleUnitVitals);
|
||||
PREP(handleKilled);
|
||||
PREP(handleLocal);
|
||||
PREP(hasItem);
|
||||
PREP(hasItems);
|
||||
PREP(hasMedicalEnabled);
|
||||
@ -76,6 +79,11 @@ PREP(treatmentTourniquetLocal);
|
||||
PREP(useItem);
|
||||
PREP(useItems);
|
||||
PREP(displayPatientInformation);
|
||||
PREP(moduleMedicalSettings);
|
||||
PREP(moduleAssignMedicRoles);
|
||||
PREP(moduleAssignMedicalVehicle);
|
||||
PREP(moduleAssignMedicalFacility);
|
||||
PREP(moduleTreatmentConfiguration);
|
||||
|
||||
GVAR(injuredUnitCollection) = [];
|
||||
call FUNC(parseConfigForInjuries);
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
units[] = {QGVAR(fieldDressingItem), QGVAR(packingBandageItem), QGVAR(elasticBandageItem), QGVAR(tourniquetItem), QGVAR(morphineItem), QGVAR(atropineItem), QGVAR(epinephrineItem), QGVAR(plasmaIVItem), QGVAR(bloodIVItem), QGVAR(salineIVItem), QGVAR(quikclotItem), QGVAR(personalAidKitItem), QGVAR(surgicalKitItem), QGVAR(bodyBagItem)};
|
||||
weapons[] = {QGVAR(fieldDressing), QGVAR(packingBandage), QGVAR(elasticBandage), QGVAR(tourniquet), QGVAR(morphine), QGVAR(atropine), QGVAR(epinephrine), QGVAR(plasmaIV), QGVAR(plasmaIV_500), QGVAR(plasmaIV_250), QGVAR(bloodIV), QGVAR(bloodIV_500), QGVAR(bloodIV_250), QGVAR(salineIV), QGVAR(salineIV_500), QGVAR(salineIV_250), QGVAR(quikclot), QGVAR(personalAidKit), QGVAR(surgicalKit), QGVAR(bodyBag)};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {ace_common, ace_interaction};
|
||||
author[] = {"Glowbal", "KoffienFlummi"};
|
||||
@ -13,8 +13,10 @@ class CfgPatches {
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgFactionClasses.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CFgSounds.hpp"
|
||||
#include "ACE_Medical_Treatments.hpp"
|
||||
#include "ACE_Settings.hpp"
|
||||
#include "UI\RscTitles.hpp"
|
||||
|
@ -1,21 +1,18 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Action for checking the blood pressure of the patient
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* NONE
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
* Author: Glowbal
|
||||
* Action for checking the blood pressure of the patient
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* NONE
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller","_target"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
[[_caller, _target], QUOTE(DFUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
@ -28,32 +28,32 @@ _bloodPressureLow = _bloodPressure select 0;
|
||||
_output = "";
|
||||
_logOutPut = "";
|
||||
if ([_caller] call FUNC(isMedic)) then {
|
||||
_output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_1";
|
||||
_output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_1";
|
||||
_logOutPut = format["%1/%2",round(_bloodPressureHigh),round(_bloodPressureLow)];
|
||||
} else {
|
||||
if (_bloodPressureHigh > 20) then {
|
||||
_output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_2";
|
||||
_output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_2";
|
||||
_logOutPut = "Low";
|
||||
if (_bloodPressureHigh > 100) then {
|
||||
_output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_3";
|
||||
_output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_3";
|
||||
_logOutPut = "Normal";
|
||||
if (_bloodPressureHigh > 160) then {
|
||||
_output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_4";
|
||||
_output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_4";
|
||||
_logOutPut = "High";
|
||||
};
|
||||
|
||||
};
|
||||
} else {
|
||||
if (random(10) > 3) then {
|
||||
_output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_5";
|
||||
_output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_5";
|
||||
_logOutPut = "No Blood Pressure";
|
||||
} else {
|
||||
_output = "STR_ACE_CHECK_BLOODPRESSURE_OUTPUT_6";
|
||||
_output = "STR_ACE_MEDICAL_CHECK_BLOODPRESSURE_OUTPUT_6";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.5, _caller]] call EFUNC(common,targetEvent);
|
||||
["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent);
|
||||
|
||||
if (_logOutPut != "") then {
|
||||
[_target,"examine", format["%1 checked Blood Pressure: %2", [_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog);
|
||||
|
@ -1,21 +1,18 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Action for checking the pulse or heart rate of the patient
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* NONE
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
* Author: Glowbal
|
||||
* Action for checking the pulse or heart rate of the patient
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The medic <OBJECT>
|
||||
* 1: The patient <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* NONE
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
private ["_caller","_target","_title","_content"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
[[_caller, _target], QUOTE(DFUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
|
@ -23,31 +23,30 @@ _heartRate = _unit getvariable [QGVAR(heartRate), 80];
|
||||
if (!alive _unit) then {
|
||||
_heartRate = 0;
|
||||
};
|
||||
_heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_5";
|
||||
_heartRateOutput = "STR_ACE_MEDICAL_CHECK_PULSE_OUTPUT_5";
|
||||
_logOutPut = "No heart rate";
|
||||
|
||||
if (_heartRate > 1.0) then {
|
||||
if ([_caller] call FUNC(isMedic)) then {
|
||||
_heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_1";
|
||||
_heartRateOutput = "STR_ACE_MEDICAL_CHECK_PULSE_OUTPUT_1";
|
||||
_logOutPut = format["%1",round(_heartRate)];
|
||||
} else {
|
||||
// non medical personel will only find a pulse/HR
|
||||
_heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_2";
|
||||
_heartRateOutput = "STR_ACE_MEDICAL_CHECK_PULSE_OUTPUT_2";
|
||||
_logOutPut = "Weak";
|
||||
if (_heartRate > 60) then {
|
||||
if (_heartRate > 100) then {
|
||||
_heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_3";
|
||||
_heartRateOutput = "STR_ACE_MEDICAL_CHECK_PULSE_OUTPUT_3";
|
||||
_logOutPut = "Strong";
|
||||
} else {
|
||||
_heartRateOutput = "STR_ACE_CHECK_PULSE_OUTPUT_4";
|
||||
_heartRateOutput = "STR_ACE_MEDICAL_CHECK_PULSE_OUTPUT_4";
|
||||
_logOutPut = "Normal";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
_content = ["STR_ACE_CHECK_PULSE_CHECKED_MEDIC",_heartRateOutput];
|
||||
["displayTextStructured", [_caller], [[_content, [_unit] call EFUNC(common,getName), round(_heartRate)], 1.5, _caller]] call EFUNC(common,targetEvent);
|
||||
["displayTextStructured", [_caller], [[_heartRateOutput, [_unit] call EFUNC(common,getName), round(_heartRate)], 1.5, _caller]] call EFUNC(common,targetEvent);
|
||||
|
||||
if (_logOutPut != "") then {
|
||||
[_unit,"examine",format["%1 checked Heart Rate: %2",[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToLog);
|
||||
|
@ -20,11 +20,11 @@ _target = _this select 1;
|
||||
|
||||
_output = "";
|
||||
if ([_target] call EFUNC(common,isAwake)) then {
|
||||
_output = ["STR_ACE_CHECK_REPONSE_RESPONSIVE",[_target] call EFUNC(common,getName)];
|
||||
_output = ["STR_ACE_MEDICAL_CHECK_REPONSE_RESPONSIVE",[_target] call EFUNC(common,getName)];
|
||||
} else {
|
||||
_output = ["STR_ACE_CHECK_REPONSE_UNRESPONSIVE",[_target] call EFUNC(common,getName)];
|
||||
_output = ["STR_ACE_MEDICAL_CHECK_REPONSE_UNRESPONSIVE",[_target] call EFUNC(common,getName)];
|
||||
};
|
||||
|
||||
["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent);
|
||||
["displayTextStructured", [_caller], [_output, 2, _caller]] call EFUNC(common,targetEvent);
|
||||
|
||||
[_target,"examine",_output] call FUNC(addToLog);
|
||||
|
@ -21,7 +21,7 @@ _caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
if ([_target] call EFUNC(common,isAwake)) exitwith {
|
||||
// TODO localization
|
||||
// TODO localization
|
||||
["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
|
||||
|
@ -36,6 +36,6 @@ _tourniquets set[_part, 0];
|
||||
_target setvariable [QGVAR(tourniquets), _tourniquets, true];
|
||||
|
||||
// Adding the tourniquet item to the caller
|
||||
_caller addItem "ACE_tourniquet";
|
||||
_caller addItem QGVAR(tourniquet);
|
||||
|
||||
// "AinvPknlMstpSlayWrflDnon_medic
|
||||
|
@ -15,36 +15,45 @@
|
||||
|
||||
private "_unit";
|
||||
_unit = _this select 0;
|
||||
if !(local _unit) exitwith{
|
||||
[[_unit], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
};
|
||||
_force = if (count _this > 1) then {_this select 1} else {false};
|
||||
|
||||
if !(_unit getvariable[QGVAR(addedToUnitLoop),false]) then{
|
||||
_unit setvariable [QGVAR(addedToUnitLoop),true, true];
|
||||
};
|
||||
|
||||
if ([_unit] call FUNC(hasMedicalEnabled)) then {
|
||||
[{
|
||||
private "_unit";
|
||||
_unit = (_this select 0) select 0;
|
||||
if (!alive _unit || !local _unit) then {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
} else {
|
||||
[_unit] call FUNC(handleUnitVitals);
|
||||
|
||||
private "_pain";
|
||||
_pain = _unit getvariable [QGVAR(pain), 0];
|
||||
if (_pain > 45) then {
|
||||
if (random(1) > 0.6) then {
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
};
|
||||
[_unit] call FUNC(playInjuredSound);
|
||||
};
|
||||
};
|
||||
}, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
|
||||
if ([_unit] call FUNC(hasMedicalEnabled) || _force) then {
|
||||
if ((_unit getvariable[QGVAR(addedToUnitLoop),false] || !alive _unit) && !_force) exitwith{};
|
||||
if !(local _unit) exitwith {
|
||||
[[_unit, _force], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
};
|
||||
_unit setvariable [QGVAR(addedToUnitLoop), true, true];
|
||||
|
||||
if (isNil QGVAR(InjuredCollection)) then {
|
||||
GVAR(InjuredCollection) = [];
|
||||
};
|
||||
GVAR(InjuredCollection) pushback _unit;
|
||||
|
||||
[{
|
||||
private "_unit";
|
||||
_unit = (_this select 0) select 0;
|
||||
if (!alive _unit || !local _unit) then {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
if (!local _unit) then {
|
||||
if (GVAR(level) >= 2) then {
|
||||
_unit setvariable [QGVAR(heartRate), _unit getvariable [QGVAR(heartRate), 0], true];
|
||||
_unit setvariable [QGVAR(bloodPressure), _unit getvariable [QGVAR(bloodPressure), [0, 0]], true];
|
||||
};
|
||||
_unit setvariable [QGVAR(bloodVolume), _unit getvariable [QGVAR(bloodVolume), 0], true];
|
||||
};
|
||||
GVAR(InjuredCollection) = GVAR(InjuredCollection) - [_unit];
|
||||
} else {
|
||||
[_unit] call FUNC(handleUnitVitals);
|
||||
|
||||
private "_pain";
|
||||
_pain = _unit getvariable [QGVAR(pain), 0];
|
||||
if (_pain > 0) then {
|
||||
if (_pain > 0.7 && {random(1) > 0.6}) then {
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
};
|
||||
|
||||
[_unit, _pain] call FUNC(playInjuredSound);
|
||||
};
|
||||
};
|
||||
}, 1, [_unit]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
@ -16,29 +16,48 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return"];
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_condition"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
_className = _this select 3;
|
||||
|
||||
_config = (ConfigFile >> "ACE_Medical_Treatments" >> "Basic" >> _className);
|
||||
if (GVAR(level)>=1) then {
|
||||
_config = (ConfigFile >> "ACE_Medical_Treatments" >> "Advanced" >> _className);
|
||||
if !(_target isKindOf "CAManBase") exitWith {false};
|
||||
|
||||
_config = (ConfigFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
||||
if (GVAR(level)>=2) then {
|
||||
_config = (ConfigFile >> "ACE_Medical_Actions" >> "Advanced" >> _className);
|
||||
};
|
||||
if !(isClass _config) exitwith {false};
|
||||
|
||||
_medicRequired = getNumber (_config >> "requiredMedic");
|
||||
if !([_caller, _medicRequired] call FUNC(isMedic) || [_target, _medicRequired] call FUNC(isMedic)) exitwith {false};
|
||||
if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false};
|
||||
|
||||
_items = getArray (_config >> "items");
|
||||
if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false};
|
||||
|
||||
_locations = getArray (_config >> "treatmentLocations");
|
||||
|
||||
_return = true;
|
||||
if (isText (_config >> "Condition")) then {
|
||||
_condition = getText(_config >> "condition");
|
||||
if (_condition != "") then {
|
||||
if (isnil _condition) then {
|
||||
_condition = compile _condition;
|
||||
} else {
|
||||
_condition = missionNamespace getvariable _condition;
|
||||
};
|
||||
if (typeName _condition == "BOOL") then {
|
||||
_return = _condition;
|
||||
} else {
|
||||
_return = [_caller, _target, _selectionName, _className] call _condition;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (!_return) exitwith {false};
|
||||
|
||||
if ("All" in _locations) exitwith {true};
|
||||
|
||||
_return = false;
|
||||
{
|
||||
if (_x == "field") exitwith {_return = true;};
|
||||
if (_x == "MedicalFacility" && {[_caller, _target] call FUNC(inMedicalFacility)}) exitwith {_return = true;};
|
||||
|
@ -17,58 +17,136 @@
|
||||
private ["_target", "_show"];
|
||||
_target = _this select 0;
|
||||
_show = if (count _this > 1) then {_this select 1} else {true};
|
||||
GVAR(currentSelectedSelectionN) = if (count _this > 2) then {_this select 2} else {0};
|
||||
|
||||
GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull};
|
||||
|
||||
if (_show) then {
|
||||
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"];
|
||||
|
||||
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"];
|
||||
[{
|
||||
private ["_target", "_display", "_alphaLevel", "_damaged", "_availableSelections", "_openWounds", "_selectionBloodLoss", "_red", "_green", "_blue", "_alphaLevel", "_allInjuryTexts", "_lbCtrl", "_genericMessages"];
|
||||
_target = (_this select 0) select 0;
|
||||
if (GVAR(displayPatientInformationTarget) != _target) exitwith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
[{
|
||||
private ["_target", "_display", "_alphaLevel", "_damaged", "_availableSelections", "_openWounds", "_selectionBloodLoss", "_red", "_green", "_blue", "_alphaLevel"];
|
||||
_target = (_this select 0) select 0;
|
||||
if (GVAR(displayPatientInformationTarget) != _target) exitwith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
disableSerialization;
|
||||
_display = uiNamespace getvariable QGVAR(DisplayInformation);
|
||||
if (isnil "_display") exitwith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
disableSerialization;
|
||||
_display = uiNamespace getvariable QGVAR(DisplayInformation);
|
||||
if (isnil "_display") exitwith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
_allInjuryTexts = [];
|
||||
_genericMessages = [];
|
||||
if (_target getvariable[QGVAR(isBleeding), false]) then {
|
||||
_genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_BLEEDING", [1, 0.1, 0.1, 1]];
|
||||
};
|
||||
if (_target getvariable[QGVAR(hasLostBlood), false]) then {
|
||||
_genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_LOST_BLOOD", [1, 0.1, 0.1, 1]];
|
||||
};
|
||||
|
||||
_alphaLevel = 1.0;
|
||||
_damaged = [false, false, false, false, false, false];
|
||||
_availableSelections = [50,51,52,53,54,55];
|
||||
_openWounds = _target getvariable [QGVAR(openWounds), []];
|
||||
if (((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select GVAR(currentSelectedSelectionN)) > 0) then {
|
||||
_genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_TOURNIQUET_APPLIED", [0.5, 0.5, 0, 1]];
|
||||
};
|
||||
if (_target getvariable[QGVAR(inPain), false]) then {
|
||||
_genericMessages pushback [localize "STR_ACE_MEDICAL_STATUS_PAIN", [1, 1, 1, 1]];
|
||||
};
|
||||
|
||||
_selectionBloodLoss = [0,0,0,0,0,0];
|
||||
{
|
||||
_selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + ((_x select 4) * (_x select 3))];
|
||||
}foreach _openWounds;
|
||||
_selectionBloodLoss = [0,0,0,0,0,0];
|
||||
if (GVAR(level) >= 2) then {
|
||||
_openWounds = _target getvariable [QGVAR(openWounds), []];
|
||||
private "_amountOf";
|
||||
{
|
||||
_amountOf = _x select 3;
|
||||
// Find how much this bodypart is bleeding
|
||||
_selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + (15 * ((_x select 4) * _amountOf))];
|
||||
if (GVAR(currentSelectedSelectionN) == (_x select 2)) then {
|
||||
// Collect the text to be displayed for this injury [ Select injury class type definition - select the classname DisplayName (6th), amount of injuries for this]
|
||||
if (_amountOf > 0) then {
|
||||
if (_amountOf >= 1) then {
|
||||
// TODO localization
|
||||
_allInjuryTexts pushback format["%2x %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6, _amountOf];
|
||||
} else {
|
||||
// TODO localization
|
||||
_allInjuryTexts pushback format["Partial %1", (GVAR(AllWoundInjuryTypes) select (_x select 1)) select 6];
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach _openWounds;
|
||||
} else {
|
||||
// TODO handle basic medical colors for body part selections here
|
||||
|
||||
{
|
||||
private ["_red", "_green", "_blue"];
|
||||
_total = _x;
|
||||
|
||||
_red = 1;
|
||||
_green = 1;
|
||||
_blue = 1;
|
||||
if (_total >0) then {
|
||||
_green = 0.9 - (15*(_total));
|
||||
if (_green < 0.0) then {
|
||||
_green = 0.0;
|
||||
};
|
||||
_blue = _green;
|
||||
_damaged set[_foreachIndex, true];
|
||||
};
|
||||
(_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, _alphaLevel];
|
||||
}foreach _selectionBloodLoss;
|
||||
};
|
||||
|
||||
// TODO fill the lb with the appropiate information for the patient
|
||||
// Handle the body image coloring
|
||||
_damaged = [false, false, false, false, false, false];
|
||||
_availableSelections = [50,51,52,53,54,55];
|
||||
{
|
||||
private ["_red", "_green", "_blue"];
|
||||
_total = _x;
|
||||
|
||||
}, 0, [_target]] call CBA_fnc_addPerFrameHandler;
|
||||
_red = 1;
|
||||
_green = 1;
|
||||
_blue = 1;
|
||||
if (_total >0) then {
|
||||
_green = 0.9 - _total;
|
||||
if (_green < 0.0) then {
|
||||
_green = 0.0;
|
||||
};
|
||||
_blue = _green;
|
||||
_damaged set[_foreachIndex, true];
|
||||
};
|
||||
(_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, 1.0];
|
||||
}foreach _selectionBloodLoss;
|
||||
|
||||
// TODO fill the lb with the appropiate information for the patient
|
||||
_lbCtrl = (_display displayCtrl 200);
|
||||
lbClear _lbCtrl;
|
||||
{
|
||||
_lbCtrl lbAdd (_x select 0);
|
||||
_lbCtrl lbSetColor [_foreachIndex, _x select 1];
|
||||
}foreach _genericMessages;
|
||||
{
|
||||
_lbCtrl lbAdd _x;
|
||||
}foreach _allInjuryTexts;
|
||||
if (count _genericMessages == 0 && {count _allInjuryTexts == 0}) then {
|
||||
_lbCtrl lbAdd "No injuries on this bodypart..";
|
||||
};
|
||||
|
||||
_logCtrl = (_display displayCtrl 302);
|
||||
lbClear _logCtrl;
|
||||
|
||||
private ["_logs", "_log", "_message", "_moment", "_arguments", "_lbCtrl"];
|
||||
_logs = _target getvariable [QGVAR(allLogs), []];
|
||||
{
|
||||
_log = _target getvariable [_x, []];
|
||||
{
|
||||
// [_message,_moment,_type, _arguments]
|
||||
_message = _x select 0;
|
||||
_moment = _x select 1;
|
||||
_arguments = _x select 3;
|
||||
if (isLocalized _message) then {
|
||||
_message = localize _message;
|
||||
};
|
||||
|
||||
{
|
||||
if (typeName _x == "STRING" && {isLocalized _x}) then {
|
||||
_arguments set [_foreachIndex, localize _x];
|
||||
};
|
||||
}foreach _arguments;
|
||||
_message = format([_message] + _arguments);
|
||||
_logCtrl lbAdd format["%1 %2", _moment, _message];
|
||||
}foreach _log;
|
||||
}foreach _logs;
|
||||
|
||||
_triageStatus = [_target] call FUNC(getTriageStatus);
|
||||
(_display displayCtrl 303) ctrlSetText (_triageStatus select 0);
|
||||
(_display displayCtrl 303) ctrlSetBackgroundColor (_triageStatus select 2);
|
||||
|
||||
}, 0, [_target]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
} else {
|
||||
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc ["","PLAIN"];
|
||||
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
|
||||
};
|
@ -18,13 +18,13 @@ private ["_totalBloodLoss","_tourniquets","_openWounds", "_value", "_cardiacOutp
|
||||
_totalBloodLoss = 0;
|
||||
|
||||
// Advanced medical bloodloss handling
|
||||
if (GVAR(level) >= 1) then {
|
||||
if (GVAR(level) >= 2) then {
|
||||
_tourniquets = _this getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]];
|
||||
_openWounds = _this getvariable [QGVAR(openWounds), []];
|
||||
//_cardiacOutput = [_this] call FUNC(getCardiacOutput);
|
||||
|
||||
{
|
||||
if ((_tourniquets select (_x select 2)) < 1) then {
|
||||
if ((_tourniquets select (_x select 2)) == 0) then {
|
||||
// total bleeding ratio * percentage of injury left
|
||||
_totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3));
|
||||
|
||||
@ -42,4 +42,4 @@ if (GVAR(level) >= 1) then {
|
||||
} else {
|
||||
// TODO basic medical
|
||||
};
|
||||
_totalBloodLoss;
|
||||
_totalBloodLoss * GVAR(bleedingCoefficient);
|
||||
|
26
addons/medical/functions/fnc_getTriageStatus.sqf
Normal file
26
addons/medical/functions/fnc_getTriageStatus.sqf
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Get the triage status and information from a unit
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The unit <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Triage status from the unit. Name, statusID, color <ARRAY <STRING><NUMBER><ARRAY>>
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit","_return","_status"];
|
||||
_unit = _this select 0;
|
||||
_status = _unit getvariable [QGVAR(triageLevel), -1];
|
||||
_return = switch (_status) do {
|
||||
case 1: {[localize "STR_ACE_MEDICAL_TRIAGE_STATUS_MINOR", 1, [0, 0.5, 0, 0.9]]};
|
||||
case 2: {[localize "STR_ACE_MEDICAL_TRIAGE_STATUS_DELAYED", 2, [0.7, 0.5, 0, 0.9]]};
|
||||
case 3: {[localize "STR_ACE_MEDICAL_TRIAGE_STATUS_IMMEDIATE", 3, [0.4, 0.07, 0.07, 0.9]]};
|
||||
case 4: {[localize "STR_ACE_MEDICAL_TRIAGE_STATUS_DECEASED", 4, [0, 0, 0, 0.9]]};
|
||||
default {[localize "STR_ACE_MEDICAL_TRIAGE_STATUS_NONE", 0, [0, 0, 0, 0.9]]};
|
||||
};
|
||||
_return;
|
@ -16,7 +16,7 @@
|
||||
private ["_unit","_return"];
|
||||
_unit = _this select 0;
|
||||
|
||||
if (GVAR(level) == 0) exitwith {true};
|
||||
if (GVAR(level) == 1) exitwith {true};
|
||||
if (isnil QGVAR(unconsciousConditions)) then {
|
||||
GVAR(unconsciousConditions) = [];
|
||||
};
|
||||
|
@ -38,11 +38,11 @@ _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
|
||||
if !(_selection in (_hitSelections + [""])) exitWith {0};
|
||||
|
||||
_damageReturn = _damage;
|
||||
if (GVAR(level) == 0) then {
|
||||
if (GVAR(level) == 1) then {
|
||||
_damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_basic);
|
||||
};
|
||||
|
||||
if (GVAR(level) >= 1) then {
|
||||
if (GVAR(level) >= 2) then {
|
||||
[_unit, _selection, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching);
|
||||
|
||||
if (_damageReturn > 0.9) then {
|
||||
@ -60,6 +60,7 @@ if (GVAR(level) >= 1) then {
|
||||
};
|
||||
};
|
||||
};
|
||||
[_unit] call FUNC(addToInjuredCollection);
|
||||
|
||||
if (_unit getVariable [QGVAR(preventDeath), false] && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith {
|
||||
if (vehicle _unit != _unit and {damage _vehicle >= 1}) then {
|
||||
|
@ -27,6 +27,11 @@ _sourceOfDamage = _this select 3;
|
||||
_typeOfProjectile = _this select 4;
|
||||
_returnDamage = _this select 5;
|
||||
|
||||
// Most likely taking exessive fire damage. Lets exit.
|
||||
if (isNull _sourceOfDamage && (_selectionName == "head" || isBurning _unit) && _typeOfProjectile == "" && vehicle _unit == _unit) exitwith {
|
||||
0
|
||||
};
|
||||
|
||||
_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage);
|
||||
_part = [_selectionName] call FUNC(selectionNameToNumber);
|
||||
|
||||
@ -52,6 +57,11 @@ if (GVAR(enableInternalBleeding)) then {
|
||||
|
||||
if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then {
|
||||
[_unit, _newDamage] call FUNC(reactionToDamage);
|
||||
|
||||
// If it reaches this, we can assume that the hit did not kill this unit, as this function is called 3 frames after the damage has been passed.
|
||||
if ([_unit, _part, if (_part > 1) then {_newDamage * 1.3} else {_newDamage * 2}] call FUNC(determineIfFatal)) then {
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
};
|
||||
};
|
||||
|
||||
_returnDamage;
|
||||
|
@ -25,10 +25,9 @@ _sourceOfDamage = _this select 3;
|
||||
_typeOfDamage = _this select 4;
|
||||
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
|
||||
|
||||
// We process only the head for airway.
|
||||
if (_bodyPartn != 0) exitwith {};
|
||||
if (_bodyPartn > 1) exitwith {};
|
||||
|
||||
if (_amountOfDamage > 0.4) then {
|
||||
if (_amountOfDamage > 0.5) then {
|
||||
if (random(1) >= 0.8) then {
|
||||
if !(_unit getvariable[QGVAR(airwayCollapsed), false]) then {
|
||||
_unit setvariable [QGVAR(airwayCollapsed), true, true];
|
||||
|
@ -35,14 +35,24 @@ if (_selectionName in _hitSelections) then {
|
||||
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName)));
|
||||
};
|
||||
|
||||
|
||||
// we want to move damage to another selection; have to do it ourselves.
|
||||
// this is only the case for limbs, so this will not impact the killed EH.
|
||||
if (_selectionName != (_this select 1)) then {
|
||||
_unit setHitPointDamage [_hitPoints select (_hitSelections find _selectionName), _damage + _newDamage];
|
||||
_newDamage = 0;
|
||||
};
|
||||
// ??????
|
||||
_damage = _damage + _newDamage;
|
||||
|
||||
// Check for vehicle crash
|
||||
if (vehicle _unit != _unit && !(vehicle _unit isKindOf "StaticWeapon") && {isNull _source} && {_projectile == ""} && {_selectionName == ""}) then {
|
||||
if (missionNamespace getvariable [QGVAR(allowVehicleCrashDamage), true]) then {
|
||||
_selectionName = _hitSelections select (floor(random(count _hitSelections)));
|
||||
_projectile = "vehiclecrash";
|
||||
};
|
||||
};
|
||||
|
||||
// From AGM medical:
|
||||
// Exclude falling damage to everything other than legs; reduce structural damage.
|
||||
if (((velocity _unit) select 2 < -5) && (vehicle _unit == _unit)) then {
|
||||
|
@ -36,13 +36,15 @@ _allInjuriesForDamageType = _injuryTypeInfo select 2;
|
||||
|
||||
// find the available injuries for this damage type and damage amount
|
||||
_highestPossibleSpot = -1;
|
||||
_highestPossibleDamage = 0;
|
||||
_highestPossibleDamage = -1;
|
||||
_allPossibleInjuries = [];
|
||||
{
|
||||
_minDamage = _x select 4;
|
||||
_damageLevels = _x select 4;
|
||||
_minDamage = _damageLevels select 0;
|
||||
_maxDamage = _damageLevels select 1;
|
||||
|
||||
// Check if the damage is higher as the min damage for the specific injury
|
||||
if (_damage >= _minDamage) then {
|
||||
if (_damage >= _minDamage && {_damage <= _maxDamage || _maxDamage < 0}) then {
|
||||
_classType = _x select 0;
|
||||
_selections = _x select 1;
|
||||
_bloodLoss = _x select 2;
|
||||
@ -71,7 +73,7 @@ if (_highestPossibleSpot < 0) exitwith {
|
||||
};
|
||||
};
|
||||
|
||||
// admin for open wounds and ids
|
||||
// Administration for open wounds and ids
|
||||
_openWounds = _unit getvariable[QGVAR(openWounds), []];
|
||||
_woundID = _unit getvariable[QGVAR(lastUniqueWoundID), 1];
|
||||
|
||||
@ -81,16 +83,39 @@ _woundsCreated = [];
|
||||
if (_x select 0 <= _damage) exitwith {
|
||||
for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do {
|
||||
|
||||
// Find the injury we are going to add. Format [ classType, allowdSelections, bloodloss, painOfInjury, minimalDamage]
|
||||
_toAddInjury = _allPossibleInjuries select (floor(random (count _allPossibleInjuries)));
|
||||
// Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage]
|
||||
_toAddInjury = if (random(1) >= 0.5) then {_allInjuriesForDamageType select _highestPossibleSpot} else {_allPossibleInjuries select (floor(random (count _allPossibleInjuries)));};
|
||||
_toAddClassID = _toAddInjury select 0;
|
||||
_foundIndex = -1;
|
||||
|
||||
// Create a new injury. Format [ID, classname, bodypart, percentage treated, bloodloss rate]
|
||||
_injury = [_woundID, _toAddInjury select 0, if (_injuryTypeInfo select 1) then {_bodyPartn} else {floor(random(6))}, 1, _toAddInjury select 2];
|
||||
_bodyPartNToAdd = if (_injuryTypeInfo select 1) then {_bodyPartn} else {floor(random(6))};
|
||||
// If the injury type is selection part specific, we will check if one of those injury types already exists and find the spot for it..
|
||||
if ((_injuryTypeInfo select 1)) then {
|
||||
{
|
||||
// Check if we have an id of the given class on the given bodypart already
|
||||
if (_x select 1 == _toAddClassID && {_x select 2 == _bodyPartNToAdd}) exitwith {
|
||||
_foundIndex = _foreachIndex;
|
||||
};
|
||||
}foreach _openWounds;
|
||||
};
|
||||
|
||||
_injury = [];
|
||||
if (_foundIndex < 0) then {
|
||||
// Create a new injury. Format [ID, classID, bodypart, percentage treated, bloodloss rate]
|
||||
_injury = [_woundID, _toAddInjury select 0, _bodyPartNToAdd, 1, _toAddInjury select 2];
|
||||
|
||||
// Since it is a new injury, we will have to add it to the open wounds array to store it
|
||||
_openWounds pushback _injury;
|
||||
|
||||
// New injuries will also increase the wound ID
|
||||
_woundID = _woundID + 1;
|
||||
} else {
|
||||
// We already have one of these, so we are just going to increase the number that we have of it with a new one.
|
||||
_injury = _openWounds select _foundIndex;
|
||||
_injury set [3, (_injury select 3) + 1];
|
||||
};
|
||||
// Store the injury so we can process it later correctly.
|
||||
_openWounds pushback _injury;
|
||||
_woundsCreated pushback _injury;
|
||||
_woundID = _woundID + 1;
|
||||
|
||||
// Collect the pain that is caused by this injury
|
||||
_painToAdd = _painToAdd + (_toAddInjury select 3);
|
||||
@ -99,8 +124,13 @@ _woundsCreated = [];
|
||||
}foreach (_injuryTypeInfo select 0);
|
||||
|
||||
_unit setvariable [QGVAR(openWounds), _openWounds];
|
||||
_unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true];
|
||||
|
||||
// Only update if new wounds have been created
|
||||
if (count _woundsCreated > 0) then {
|
||||
_unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true];
|
||||
};
|
||||
|
||||
// TODO Should this be done in a single broadcast?
|
||||
// Broadcast the new injuries across the net in parts. One broadcast per injury. Prevents having to broadcast one massive array of injuries.
|
||||
{
|
||||
["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent);
|
||||
|
25
addons/medical/functions/fnc_handleKilled.sqf
Normal file
25
addons/medical/functions/fnc_handleKilled.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Called when a unit is killed
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
*
|
||||
* ReturnValue:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private["_unit"];
|
||||
_unit = _this select 0;
|
||||
if (!local _unit) exitwith {};
|
||||
|
||||
_unit setvariable [QGVAR(pain), 0];
|
||||
if (GVAR(level) >= 2) then {
|
||||
_unit setvariable [QGVAR(heartRate), 0];
|
||||
_unit setvariable [QGVAR(bloodPressure), [0, 0]];
|
||||
_unit setvariable [QGVAR(airwayStatus), 0];
|
||||
};
|
25
addons/medical/functions/fnc_handleLocal.sqf
Normal file
25
addons/medical/functions/fnc_handleLocal.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Called when a unit switched locality
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The Unit <OBJECT>
|
||||
* 1: Is local <BOOL>
|
||||
*
|
||||
* ReturnValue:
|
||||
* None
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private["_unit", "_local"];
|
||||
_unit = _this select 0;
|
||||
_local = _this select 1;
|
||||
if (_local) then {
|
||||
if (_unit getvariable[QGVAR(addedToUnitLoop),false]) then {
|
||||
[_unit, true] call FUNC(addToInjuredCollection);
|
||||
};
|
||||
};
|
@ -13,14 +13,20 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus"];
|
||||
private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus", "_lastTimeValuesSynced", "_syncValues"];
|
||||
_unit = _this select 0;
|
||||
|
||||
_lastTimeValuesSynced = _unit getvariable [QGVAR(lastMomentValuesSynced), 0];
|
||||
_syncValues = time - _lastTimeValuesSynced >= (10 + floor(random(10)));
|
||||
if (_syncValues) then {
|
||||
_unit setvariable [QGVAR(lastMomentValuesSynced), time];
|
||||
};
|
||||
|
||||
_bloodVolume = (_unit getvariable [QGVAR(bloodVolume), 0]) + ([_unit] call FUNC(getBloodVolumeChange));
|
||||
if (_bloodVolume <= 0) then {
|
||||
_bloodVolume = 0;
|
||||
};
|
||||
_unit setvariable [QGVAR(bloodVolume), _bloodVolume];
|
||||
_unit setvariable [QGVAR(bloodVolume), _bloodVolume, _syncValues];
|
||||
|
||||
// Set variables for synchronizing information across the net
|
||||
if (_bloodVolume < 90) then {
|
||||
@ -68,29 +74,35 @@ if ([_unit] call EFUNC(common,isAwake)) then {
|
||||
};
|
||||
|
||||
// handle advanced medical, with vitals
|
||||
if ((missionNamespace getvariable[QGVAR(level), 0]) > 0) exitwith {
|
||||
if (GVAR(level) >= 2) then {
|
||||
|
||||
// Set the vitals
|
||||
_heartRate = (_unit getvariable [QGVAR(heartRate), 0]) + ([_unit] call FUNC(getHeartRateChange));
|
||||
_unit setvariable [QGVAR(heartRate), _heartRate];
|
||||
_unit setvariable [QGVAR(heartRate), _heartRate, _syncValues];
|
||||
|
||||
_bloodPressure = [_unit] call FUNC(getBloodPressure);
|
||||
_unit setvariable [QGVAR(bloodPressure), _bloodPressure];
|
||||
_unit setvariable [QGVAR(bloodPressure), _bloodPressure, _syncValues];
|
||||
|
||||
// Handle airway
|
||||
if (GVAR(setting_allowAirwayInjuries)) then {
|
||||
_airwayStatus = _unit getvariable [QGVAR(airwayStatus), 100];
|
||||
if (((_unit getvariable [QGVAR(airwayOccluded), false]) || (_unit getvariable [QGVAR(airwayCollapsed), false])) && !((_unit getvariable [QGVAR(airwaySecured), false]))) then {
|
||||
if (_airwayStatus >= 0.5) then {
|
||||
_unit setvariable [QGVAR(airwayStatus), _airwayStatus - 0.5];
|
||||
_unit setvariable [QGVAR(airwayStatus), _airwayStatus - 0.5, _syncValues];
|
||||
};
|
||||
} else {
|
||||
if !((_unit getvariable [QGVAR(airwayOccluded), false]) || (_unit getvariable [QGVAR(airwayCollapsed), false])) then {
|
||||
if (_airwayStatus <= 98.5) then {
|
||||
_unit setvariable [QGVAR(airwayStatus), _airwayStatus + 1.5];
|
||||
if (_airwayStatus < 100) then {
|
||||
_unit setvariable [QGVAR(airwayStatus), (_airwayStatus + 1.5) min 100, _syncValues];
|
||||
};
|
||||
};
|
||||
};
|
||||
if (_airwayStatus < 80) then {
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
if (_airwayStatus <= 0) then {
|
||||
[_unit, true] call FUNC(setDead);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Check vitals for medical status
|
||||
|
@ -15,7 +15,7 @@ _unit = _this select 0;
|
||||
|
||||
_medicalEnabled = _unit getvariable QGVAR(enableMedical);
|
||||
if (isnil "_medicalEnabled") exitwith {
|
||||
(((GVAR(setting_enableForUnits) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(setting_enableForUnits) == 1));
|
||||
(((GVAR(enabledFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enabledFor) == 1));
|
||||
};
|
||||
|
||||
_medicalEnabled;
|
||||
|
@ -52,13 +52,13 @@ _unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true];
|
||||
// airway
|
||||
_unit setvariable [QGVAR(airwayStatus), 0, true];
|
||||
_unit setVariable [QGVAR(airwayOccluded), false, true];
|
||||
_unit setvariable [QGVAR(airwayCollapsed), true, true];
|
||||
_unit setvariable [QGVAR(airwayCollapsed), false, true];
|
||||
|
||||
// generic medical admin
|
||||
_unit setvariable [QGVAR(addedToUnitLoop), false, true];
|
||||
_unit setvariable [QGVAR(inCardiacArrest), true, true];
|
||||
_unit setvariable [QGVAR(inCardiacArrest), false, true];
|
||||
_unit setVariable [QGVAR(isUnconscious), false, true];
|
||||
_unit setvariable [QGVAR(hasLostBlood), true, true];
|
||||
_unit setvariable [QGVAR(hasLostBlood), false, true];
|
||||
_unit setvariable [QGVAR(isBleeding), false, true];
|
||||
_unit setvariable [QGVAR(hasPain), false, true];
|
||||
|
||||
|
@ -18,14 +18,15 @@ private ["_unit","_class","_return"];
|
||||
_unit = _this select 0;
|
||||
_medicN = if (count _this > 1) then {_this select 1} else {1};
|
||||
|
||||
if (isnil QGVAR(setting_advancedMedicRoles)) exitwith {
|
||||
true;
|
||||
};
|
||||
|
||||
if (GVAR(setting_advancedMedicRoles)) then {
|
||||
_return = false;
|
||||
if (GVAR(medicSetting) >= 1) then {
|
||||
_class = _unit getvariable [QGVAR(medicClass), 0];
|
||||
if (_class >= _medicN) then {
|
||||
_return = true;
|
||||
if (GVAR(medicSetting) == 1) then {
|
||||
_return = _class > 0;
|
||||
} else {
|
||||
if (_class >= _medicN) then {
|
||||
_return = true;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
_return = true;
|
||||
|
63
addons/medical/functions/fnc_moduleAssignMedicRoles.sqf
Normal file
63
addons/medical/functions/fnc_moduleAssignMedicRoles.sqf
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Assign a medical role to a unit
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"];
|
||||
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
|
||||
|
||||
if (!isNull _logic) then {
|
||||
_list = _logic getvariable ["EnableList",""];
|
||||
|
||||
_splittedList = [_list, ","] call BIS_fnc_splitString;
|
||||
_nilCheckPassedList = "";
|
||||
{
|
||||
_x = [_x] call EFUNC(common,stringRemoveWhiteSpace);
|
||||
if !(isnil _x) then {
|
||||
if (_nilCheckPassedList == "") then {
|
||||
_nilCheckPassedList = _x;
|
||||
} else {
|
||||
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
|
||||
};
|
||||
};
|
||||
}foreach _splittedList;
|
||||
|
||||
_list = "[" + _nilCheckPassedList + "]";
|
||||
_parsedList = [] call compile _list;
|
||||
_setting = _logic getvariable ["role",0];
|
||||
_objects = synchronizedObjects _logic;
|
||||
if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then {
|
||||
{
|
||||
if (!isnil "_x") then {
|
||||
if (typeName _x == typeName objNull) then {
|
||||
if (local _x) then {
|
||||
_x setvariable [QGVAR(medicClass), _setting, true];
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach _objects;
|
||||
};
|
||||
{
|
||||
if (!isnil "_x") then {
|
||||
if (typeName _x == typeName objNull) then {
|
||||
if (local _x) then {
|
||||
_x setvariable [QGVAR(medicClass), _setting, true];
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach _parsedList;
|
||||
};
|
||||
|
||||
true
|
30
addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf
Normal file
30
addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Register synchronized objects from passed object as a medical facility
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic","_setting","_objects"];
|
||||
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
|
||||
if (!isNull _logic) then {
|
||||
_setting = _logic getvariable ["class",0];
|
||||
_objects = synchronizedObjects _logic;
|
||||
{
|
||||
if (local _x) then {
|
||||
_x setvariable[QGVAR(isMedicalFacility), true, true];
|
||||
};
|
||||
}foreach _objects;
|
||||
};
|
||||
|
||||
true;
|
64
addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf
Normal file
64
addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Assign vehicle as a medical vehicle
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic","_setting","_objects", "_list", "_splittedList", "_nilCheckPassedList", "_parsedList"];
|
||||
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
|
||||
|
||||
if (!isNull _logic) then {
|
||||
_list = _logic getvariable ["EnableList",""];
|
||||
|
||||
_splittedList = [_list, ","] call BIS_fnc_splitString;
|
||||
_nilCheckPassedList = "";
|
||||
{
|
||||
_x = [_x] call EFUNC(common,stringRemoveWhiteSpace);
|
||||
if !(isnil _x) then {
|
||||
if (_nilCheckPassedList == "") then {
|
||||
_nilCheckPassedList = _x;
|
||||
} else {
|
||||
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
|
||||
};
|
||||
};
|
||||
}foreach _splittedList;
|
||||
|
||||
_list = "[" + _nilCheckPassedList + "]";
|
||||
_parsedList = [] call compile _list;
|
||||
_setting = _logic getvariable ["enabled", false];
|
||||
_objects = synchronizedObjects _logic;
|
||||
if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then {
|
||||
{
|
||||
if (!isnil "_x") then {
|
||||
if (typeName _x == typeName objNull) then {
|
||||
if (local _x) then {
|
||||
_x setvariable [QGVAR(isMedicalVehicle), _setting, true];
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach _objects;
|
||||
};
|
||||
{
|
||||
if (!isnil "_x") then {
|
||||
if (typeName _x == typeName objNull) then {
|
||||
if (local _x) then {
|
||||
_x setvariable [QGVAR(isMedicalVehicle), _setting, true];
|
||||
};
|
||||
};
|
||||
};
|
||||
}foreach _parsedList;
|
||||
};
|
||||
|
||||
true;
|
34
addons/medical/functions/fnc_moduleMedicalSettings.sqf
Normal file
34
addons/medical/functions/fnc_moduleMedicalSettings.sqf
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Module for adjusting the medical damage settings
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic", "_units", "_activated"];
|
||||
_logic = _this select 0;
|
||||
_units = _this select 1;
|
||||
_activated = _this select 2;
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(level), "level"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(enableFor), "enableFor"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(enableAirway), "enableAirway"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(enableFractures), "enableFractures"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(enableAdvancedWounds), "enableAdvancedWounds"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(enableScreams), "enableScreams"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(playerDamageThreshold), "playerDamageThreshold"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(AIDamageThreshold), "AIDamageThreshold"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(enableUnsconsiousnessAI), "enableUnsconsiousnessAI"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(preventInstaDeath), "preventInstaDeath"] call EFUNC(common,readSettingFromModule);
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Module for adjusting the medical treatment settings
|
||||
*
|
||||
* Arguments:
|
||||
* 0: The module logic <LOGIC>
|
||||
* 1: units <ARRAY>
|
||||
* 2: activated <BOOL>
|
||||
*
|
||||
* Return Value:
|
||||
* None <NIL>
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_logic", "_units", "_activated"];
|
||||
_logic = _this select 0;
|
||||
_units = _this select 1;
|
||||
_activated = _this select 2;
|
||||
|
||||
if !(_activated) exitWith {};
|
||||
|
||||
[_logic, QGVAR(medicSetting), "medicSetting"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(maxRevives), "maxRevives"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(enableOverdosing), "enableOverdosing"] call EFUNC(common,readSettingFromModule);
|
||||
[_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule);
|
||||
|
||||
|
@ -19,19 +19,19 @@ _unit = _this select 0;
|
||||
_injury = _this select 1;
|
||||
|
||||
if (!local _unit) then {
|
||||
_openWounds = _unit getvariable[QGVAR(openWounds), []];
|
||||
_injuryID = _injury select 0;
|
||||
_openWounds = _unit getvariable[QGVAR(openWounds), []];
|
||||
_injuryID = _injury select 0;
|
||||
|
||||
_exists = false;
|
||||
{
|
||||
if (_x select 0 == _injuryID) exitwith {
|
||||
_exists = true;
|
||||
_openWounds set [_foreachIndex, _injury];
|
||||
};
|
||||
}foreach _openWounds;
|
||||
_exists = false;
|
||||
{
|
||||
if (_x select 0 == _injuryID) exitwith {
|
||||
_exists = true;
|
||||
_openWounds set [_foreachIndex, _injury];
|
||||
};
|
||||
}foreach _openWounds;
|
||||
|
||||
if (!_exists) then {
|
||||
_openWounds pushback _injury;
|
||||
};
|
||||
_unit setvariable [GVAR(openWounds), _openWounds];
|
||||
if (!_exists) then {
|
||||
_openWounds pushback _injury;
|
||||
};
|
||||
_unit setvariable [GVAR(openWounds), _openWounds];
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ _originOfrequest = _this select 2;
|
||||
|
||||
_openWounds = _unit getvariable [QGVAR(openWounds), []];
|
||||
if (count _openWounds > _lastId) then {
|
||||
{
|
||||
["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent);
|
||||
}foreach _openWounds;
|
||||
{
|
||||
["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent);
|
||||
}foreach _openWounds;
|
||||
};
|
||||
|
@ -12,20 +12,27 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_allTypes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName"];
|
||||
private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_allTypes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName", "_maxDamage", "_subClassmaxDamage"];
|
||||
|
||||
_injuriesRootConfig = (configFile >> "ACE_Medical_Advanced" >> "Injuries");
|
||||
_allTypes = ["stab", "grenade", "bullet", "explosive", "shell", "punch", "vehiclecrash", "backblast", "falling", "bite", "ropeburn"];
|
||||
|
||||
// Collect all available damage types from the config
|
||||
_allFoundDamageTypes = [];
|
||||
_configDamageTypes = (_injuriesRootConfig >> "damageTypes");
|
||||
for "_i" from 0 to (count _configDamageTypes -1) /* step +1 */ do {
|
||||
// Only get the subclasses in damageType class
|
||||
if (isClass(_configDamageTypes select _i)) then {
|
||||
_allFoundDamageTypes pushback (configName (_configDamageTypes select _i));
|
||||
};
|
||||
};
|
||||
GVAR(allAvailableDamageTypes) = _allFoundDamageTypes;
|
||||
GVAR(woundClassNames) = [];
|
||||
GVAR(fractureClassNames) = [];
|
||||
|
||||
|
||||
// Parsing the wounds
|
||||
// function for parsing a sublcass of an injury
|
||||
_parseForSubClassWounds = {
|
||||
_subClass = _this select 0;
|
||||
if (isClass (_entry >> _subClass)) exitwith {
|
||||
@ -35,10 +42,13 @@ _parseForSubClassWounds = {
|
||||
_subClassbloodLoss = if (isNumber(_subClassConfig >> "bleedingRate")) then { getNumber(_subClassConfig >> "bleedingRate");} else { _bloodLoss };
|
||||
_subClasspain = if (isNumber(_subClassConfig >> "pain")) then { getNumber(_subClassConfig >> "pain");} else { _pain };
|
||||
_subClassminDamage = if (isNumber(_subClassConfig >> "minDamage")) then { getNumber(_subClassConfig >> "minDamage");} else { _minDamage };
|
||||
_subClassmaxDamage = if (isNumber(_subClassConfig >> "maxDamage")) then { getNumber(_subClassConfig >> "maxDamage");} else { _maxDamage };
|
||||
_subClasscauses = if (isArray(_subClassConfig >> "causes")) then { getArray(_subClassConfig >> "causes");} else { _causes };
|
||||
_subClassDisplayName = if (isText(_entry >> "name")) then { getText(_entry >> "name");} else {_classDisplayName + " " + _subClass};
|
||||
if (count _selections > 0 && count _causes > 0) then {
|
||||
_allWoundClasses pushback [_subClasstype, _subClassselections, _subClassbloodLoss, _subClasspain, _subClassminDamage, _subClasscauses, _subClassDisplayName];
|
||||
_subClassDisplayName = if (isText(_subClassConfig >> "name")) then { getText(_subClassConfig >> "name");} else {_classDisplayName + " " + _subClass};
|
||||
if (count _selections > 0 && {count _causes > 0}) then {
|
||||
GVAR(woundClassNames) pushback _subClasstype;
|
||||
_allWoundClasses pushback [_classID, _subClassselections, _subClassbloodLoss, _subClasspain, [_subClassminDamage, _subClassmaxDamage], _subClasscauses, _subClassDisplayName];
|
||||
_classID = _classID + 1;
|
||||
};
|
||||
true;
|
||||
};
|
||||
@ -48,6 +58,7 @@ _parseForSubClassWounds = {
|
||||
// TODO classTypes are strings currently. Convert them to unqiue IDs instead.
|
||||
_woundsConfig = (_injuriesRootConfig >> "wounds");
|
||||
_allWoundClasses = [];
|
||||
_classID = 0;
|
||||
if (isClass _woundsConfig) then {
|
||||
_amountOf = count _woundsConfig;
|
||||
for "_i" from 0 to (_amountOf -1) /* step +1 */ do {
|
||||
@ -58,13 +69,18 @@ if (isClass _woundsConfig) then {
|
||||
_bloodLoss = if (isNumber(_entry >> "bleedingRate")) then { getNumber(_entry >> "bleedingRate");} else {0};
|
||||
_pain = if (isNumber(_entry >> "pain")) then { getNumber(_entry >> "pain");} else {0};
|
||||
_minDamage = if (isNumber(_entry >> "minDamage")) then { getNumber(_entry >> "minDamage");} else {0};
|
||||
_maxDamage = if (isNumber(_entry >> "maxDamage")) then { getNumber(_entry >> "maxDamage");} else {-1};
|
||||
_causes = if (isArray(_entry >> "causes")) then { getArray(_entry >> "causes");} else {[]};
|
||||
_classDisplayName = if (isText(_entry >> "name")) then { getText(_entry >> "name");} else {_classType};
|
||||
|
||||
// TODO instead of hardcoding minor, medium and large just go through all sub classes recursively until none are found
|
||||
if (["Minor"] call _parseForSubClassWounds || ["Medium"] call _parseForSubClassWounds || ["Large"] call _parseForSubClassWounds) exitwith {}; // continue to the next one
|
||||
|
||||
// There were no subclasses, so we will add this one instead.
|
||||
if (count _selections > 0 && count _causes > 0) then {
|
||||
_allWoundClasses pushback [_classType, _selections, _bloodLoss, _pain, _minDamage, _causes, _classDisplayName];
|
||||
GVAR(woundClassNames) pushback _classType;
|
||||
_allWoundClasses pushback [_classID, _selections, _bloodLoss, _pain, [_minDamage, _maxDamage], _causes, _classDisplayName];
|
||||
_classID = _classID + 1;
|
||||
};
|
||||
true;
|
||||
};
|
||||
@ -72,10 +88,10 @@ if (isClass _woundsConfig) then {
|
||||
};
|
||||
GVAR(AllWoundInjuryTypes) = _allWoundClasses;
|
||||
|
||||
// Linking injuries to the woundInjuryType variables.
|
||||
_damageTypesConfig = (configFile >> "ACE_Medical_Advanced" >> "Injuries" >> "damageTypes");
|
||||
_thresholds = getArray(_damageTypesConfig >> "thresholds");
|
||||
_selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific");
|
||||
|
||||
{
|
||||
_varName = format[QGVAR(woundInjuryType_%1),_x];
|
||||
_woundTypes = [];
|
||||
@ -93,4 +109,4 @@ _selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific");
|
||||
if (isNumber(_damageTypesConfig >> _x >> "selectionSpecific")) then { _selectionSpecificType = getNumber(_damageTypesConfig >> _x >> "selectionSpecific");};
|
||||
};
|
||||
missionNamespace setvariable [_varName, [_typeThresholds, _selectionSpecificType > 0, _woundTypes]];
|
||||
}foreach _allTypes;
|
||||
}foreach _allFoundDamageTypes;
|
||||
|
@ -17,55 +17,47 @@
|
||||
|
||||
private ["_unit","_amountOfDamage","_bodyPartStatus","_availableSounds_A","_availableSounds_B","_availableSounds_C","_sound"];
|
||||
_unit = _this select 0;
|
||||
if (!local _unit) exitwith{};
|
||||
_pain = _this select 1;
|
||||
if (!local _unit || !GVAR(enableScreams)) exitwith{};
|
||||
|
||||
// Lock if the unit is already playing a sound.
|
||||
if ((_unit getvariable [QGVAR(playingInjuredSound),false])) exitwith {};
|
||||
_unit setvariable [QGVAR(playingInjuredSound),true];
|
||||
|
||||
// Classnames of the available sounds.
|
||||
_availableSounds_A = [
|
||||
"WoundedGuyA_01",
|
||||
"WoundedGuyA_02",
|
||||
"WoundedGuyA_03",
|
||||
"WoundedGuyA_04",
|
||||
"WoundedGuyA_05",
|
||||
"WoundedGuyA_06",
|
||||
"WoundedGuyA_07",
|
||||
"WoundedGuyA_08"
|
||||
];
|
||||
_availableSounds_B = [
|
||||
"WoundedGuyB_01",
|
||||
"WoundedGuyB_02",
|
||||
"WoundedGuyB_03",
|
||||
"WoundedGuyB_04",
|
||||
"WoundedGuyB_05",
|
||||
"WoundedGuyB_06",
|
||||
"WoundedGuyB_07",
|
||||
"WoundedGuyB_08"
|
||||
];
|
||||
_availableSounds_C = [
|
||||
"WoundedGuyC_01",
|
||||
"WoundedGuyC_02",
|
||||
"WoundedGuyC_03",
|
||||
"WoundedGuyC_04",
|
||||
"WoundedGuyC_05"
|
||||
];
|
||||
|
||||
// TODO Base this off hitpoint damage
|
||||
// Find the amount of damage for this unit, based upon body part status.
|
||||
//_bodyPartStatus = [_unit,QGVAR(bodyPartStatus)] call EFUNC(common,getDefinedVariable);
|
||||
_amountOfDamage = 0;
|
||||
/*{
|
||||
_amountOfDamage = _amountOfDamage + _x;
|
||||
}foreach _bodyPartStatus;*/
|
||||
|
||||
// Play the sound if there is any damage present.
|
||||
if (_amountOfDamage > 0) exitwith {
|
||||
if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitwith {
|
||||
// Classnames of the available sounds.
|
||||
_availableSounds_A = [
|
||||
"WoundedGuyA_01",
|
||||
"WoundedGuyA_02",
|
||||
"WoundedGuyA_03",
|
||||
"WoundedGuyA_04",
|
||||
"WoundedGuyA_05",
|
||||
"WoundedGuyA_06",
|
||||
"WoundedGuyA_07",
|
||||
"WoundedGuyA_08"
|
||||
];
|
||||
_availableSounds_B = [
|
||||
"WoundedGuyB_01",
|
||||
"WoundedGuyB_02",
|
||||
"WoundedGuyB_03",
|
||||
"WoundedGuyB_04",
|
||||
"WoundedGuyB_05",
|
||||
"WoundedGuyB_06",
|
||||
"WoundedGuyB_07",
|
||||
"WoundedGuyB_08"
|
||||
];
|
||||
_availableSounds_C = [
|
||||
"WoundedGuyC_01",
|
||||
"WoundedGuyC_02",
|
||||
"WoundedGuyC_03",
|
||||
"WoundedGuyC_04",
|
||||
"WoundedGuyC_05"
|
||||
];
|
||||
_sound = "";
|
||||
|
||||
// Select the to be played sound based upon damage amount.
|
||||
if (_amountOfDamage > 1) then {
|
||||
if (_pain > 0.5) then {
|
||||
if (random(1) > 0.5) then {
|
||||
_sound = _availableSounds_A select (round(random((count _availableSounds_A) - 1)));
|
||||
} else {
|
||||
@ -74,18 +66,12 @@ if (_amountOfDamage > 0) exitwith {
|
||||
} else {
|
||||
_sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1)));
|
||||
};
|
||||
|
||||
// Play the sound
|
||||
playSound3D [((getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0)), _unit, false, getPos _unit, 2, 1, 15]; // +2db, 15 meters.
|
||||
playSound3D [(getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0) + ".wss", objNull, false, getPos _unit, 15, 1, 25]; // +2db, 15 meters.
|
||||
|
||||
// Figure out what the delay will be before it is possible to play a sound again.
|
||||
private "_delay";
|
||||
_delay = 1;
|
||||
if (_amountOfDamage < 1) then {
|
||||
_delay = 10 + random(50);
|
||||
} else {
|
||||
_delay = (60 / _amountOfDamage);
|
||||
};
|
||||
_delay = (30 - (random(25) * _pain)) max (3.5 + random(2));
|
||||
|
||||
// Clean up the lock
|
||||
[{
|
||||
|
@ -25,8 +25,27 @@ if (!local _unit) exitwith {
|
||||
[[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
};
|
||||
|
||||
if (missionNamespace getVariable [QGVAR(enableRevive), false]) exitwith {
|
||||
// TODO Implement the revive state
|
||||
if (GVAR(preventInstaDeath) && !_force) exitwith {
|
||||
if (_unit getvariable [QGVAR(inReviveState), false]) exitwith {}; // already in revive state
|
||||
_unit setvariable [QGVAR(inReviveState), true, true];
|
||||
[_unit] call FUNC(setUnconscious);
|
||||
|
||||
[{
|
||||
private ["_args","_unit","_startTime"];
|
||||
_args = _this select 0;
|
||||
_unit = _args select 0;
|
||||
_startTime = _args select 1;
|
||||
|
||||
if (time - _startTime > GVAR(maxReviveTime)) exitwith {
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
[_unit, true] call FUNC(setDead);
|
||||
_unit setvariable [QGVAR(inReviveState), nil, true];
|
||||
};
|
||||
|
||||
if !(_unit getvariable [QGVAR(inReviveState), false]) exitwith {
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 1, [_unit, time] ] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
_unit setvariable ["ACE_isDead", true, true];
|
||||
|
@ -115,7 +115,7 @@ _minWaitingTime = (round(random(10)+5));
|
||||
_unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP)
|
||||
|
||||
_unit setUnconscious false;
|
||||
|
||||
["medical_onUnconscious", [_unit], [_unit, false]] call EFUNC(common,targetEvent);
|
||||
// ensure this statement runs only once
|
||||
_args set [6, true];
|
||||
};
|
||||
@ -139,3 +139,4 @@ _minWaitingTime = (round(random(10)+5));
|
||||
|
||||
}, 0.1, [_unit,_animState, _captiveSwitch, _originalPos, _startingTime, _minWaitingTime, false] ] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
["medical_onUnconscious", [_unit], [_unit, true]] call EFUNC(common,targetEvent);
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed"];
|
||||
private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
_selectionName = _this select 2;
|
||||
@ -25,14 +25,14 @@ _className = _this select 3;
|
||||
if !(_target isKindOf "CAManBase") exitWith {false};
|
||||
|
||||
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
||||
if (GVAR(level) >= 1) then {
|
||||
if (GVAR(level) >= 2) then {
|
||||
_config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className);
|
||||
};
|
||||
if !(isClass _config) exitwith {false};
|
||||
|
||||
// Check for required class
|
||||
_medicRequired = getNumber (_config >> "requiredMedic");
|
||||
if !([_caller, _medicRequired] call FUNC(isMedic) || [_target, _medicRequired] call FUNC(isMedic)) exitwith {false};
|
||||
if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false};
|
||||
|
||||
// Check item
|
||||
_items = getArray (_config >> "items");
|
||||
@ -40,7 +40,25 @@ if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exi
|
||||
|
||||
// Check allowed locations
|
||||
_locations = getArray (_config >> "treatmentLocations");
|
||||
_return = false;
|
||||
|
||||
_return = true;
|
||||
if (isText (_config >> "Condition")) then {
|
||||
_condition = getText(_config >> "condition");
|
||||
if (_condition != "") then {
|
||||
if (isnil _condition) then {
|
||||
_condition = compile _condition;
|
||||
} else {
|
||||
_condition = missionNamespace getvariable _condition;
|
||||
};
|
||||
if (typeName _condition == "BOOL") then {
|
||||
_return = _condition;
|
||||
} else {
|
||||
_return = [_caller, _target, _selectionName, _className] call _condition;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (!_return) exitwith {false};
|
||||
|
||||
if ("All" in _locations) then {
|
||||
_return = true;
|
||||
} else {
|
||||
@ -50,8 +68,10 @@ if ("All" in _locations) then {
|
||||
if (_x == "MedicalVehicle" && {([vehicle _caller] call FUNC(isMedicalVehicle)) || ([vehicle _target] call FUNC(isMedicalVehicle))}) exitwith {_return = true;};
|
||||
}foreach _locations;
|
||||
};
|
||||
|
||||
if !(_return) exitwith {false};
|
||||
|
||||
|
||||
// Parse the config for the progress callback
|
||||
_callbackProgress = getText (_config >> "callbackProgress");
|
||||
if (_callbackProgress == "") then {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user