Merge branch 'master' into microDAGR

This commit is contained in:
PabstMirror 2015-03-12 11:39:12 -05:00
commit 862a758e3b
146 changed files with 34981 additions and 745 deletions

View File

@ -1,21 +1,23 @@
<p align="center">
<img src="https://raw.githubusercontent.com/KoffeinFlummi/ACE3/new-readme/extras/logo.png?token=ACU2mWeJUeshQIVc52XPoNiPpc3PzTauks5Uv24rwA%3D%3D" height="150px" /><br />
<img src="https://github.com/KoffeinFlummi/ACE3/blob/master/extras/assets/logo/black/ACE3-Logo.jpg" height="80" />
</p>
<p align="center">
<a href="https://github.com/KoffeinFlummi/ACE3/releases">
<img src="http://img.shields.io/badge/release-3.0-green.svg?style=flat" alt="ACE version">
</a>
<a href="#">
<a href="#">
<img src="http://img.shields.io/badge/download-22_MB-blue.svg?style=flat" alt="ACE download">
</a>
<a href="https://github.com/KoffeinFlummi/ACE3/issues">
<a href="https://github.com/KoffeinFlummi/ACE3/issues">
<img src="http://img.shields.io/github/issues/KoffeinFlummi/ACE3.svg?style=flat" alt="ACE issues">
</a>
<a href="https://github.com/KoffeinFlummi/ACE3/blob/master/LICENSE">
<a href="https://github.com/KoffeinFlummi/ACE3/blob/master/LICENSE">
<img src="http://img.shields.io/badge/license-GPLv2-red.svg?style=flat" alt="ACE license">
</a>
</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** and **CSE** to improve the realism and authenticity of Arma 3.
**ACE 3** is a joint effort by the teams behind **ACE2**, **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).

View File

@ -0,0 +1 @@
z\ace\addons\backpacks

View File

@ -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) {

View File

@ -0,0 +1,3 @@
#include "script_component.hpp"
["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);

View File

@ -2,6 +2,7 @@
ADDON = false;
PREP(backpackOpened);
PREP(getBackpackAssignedUnit);
PREP(isBackpack);
PREP(onOpenInventory);

View File

@ -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"

View 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
];

View 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

View File

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

View 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"

Binary file not shown.

Binary file not shown.

View File

@ -154,15 +154,10 @@ class CfgVehicles {
MACRO_LOADUNLOADCAPTIVE
};
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class Box_NATO_Support_F;
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_CableTie,12)
MACRO_ADDITEM(ACE_CableTie,12);
};
};

View File

@ -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);
@ -200,6 +203,9 @@ PREP(logDisplays);
PREP(monitor);
PREP(showUser);
PREP(dumpPerformanceCounters);
PREP(dumpArray);
// ACE_CuratorFix
PREP(addCuratorUnloadEventhandler);
PREP(fixCrateContent);
@ -228,6 +234,9 @@ PREP(hashListSelect);
PREP(hashListSet);
PREP(hashListPush);
//Debug
ACE_COUNTERS = [];
// Load settings
if (isServer) then {
call FUNC(loadSettingsOnServer);

View 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

View 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)];
};

View 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;
*/

View 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];

View 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)}

View File

@ -1,8 +1,3 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class CfgVehicles {
class Man;
@ -142,47 +137,47 @@ class CfgVehicles {
class Box_NATO_AmmoOrd_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_Clacker,12)
MACRO_ADDITEM(ACE_M26_Clacker,6)
MACRO_ADDITEM(ACE_DefusalKit,12)
MACRO_ADDITEM(ACE_Clacker,12);
MACRO_ADDITEM(ACE_M26_Clacker,6);
MACRO_ADDITEM(ACE_DefusalKit,12);
};
};
class Box_East_AmmoOrd_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_Clacker,12)
MACRO_ADDITEM(ACE_M26_Clacker,6)
MACRO_ADDITEM(ACE_DefusalKit,12)
MACRO_ADDITEM(ACE_Clacker,12);
MACRO_ADDITEM(ACE_M26_Clacker,6);
MACRO_ADDITEM(ACE_DefusalKit,12);
};
};
class Box_IND_AmmoOrd_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_Clacker,12)
MACRO_ADDITEM(ACE_M26_Clacker,6)
MACRO_ADDITEM(ACE_DefusalKit,12)
MACRO_ADDITEM(ACE_Deadmanswitch,2)
MACRO_ADDITEM(ACE_Cellphone,3)
MACRO_ADDITEM(ACE_Clacker,12);
MACRO_ADDITEM(ACE_M26_Clacker,6);
MACRO_ADDITEM(ACE_DefusalKit,12);
MACRO_ADDITEM(ACE_Deadmanswitch,2);
MACRO_ADDITEM(ACE_Cellphone,3);
};
};
class Box_FIA_Ammo_F: FIA_Box_Base_F {
class TransportItems {
MACRO_ADDITEM(ACE_Clacker,2)
MACRO_ADDITEM(ACE_M26_Clacker,2)
MACRO_ADDITEM(ACE_DefusalKit,2)
MACRO_ADDITEM(ACE_Deadmanswitch,1)
MACRO_ADDITEM(ACE_Cellphone,2)
MACRO_ADDITEM(ACE_Clacker,2);
MACRO_ADDITEM(ACE_M26_Clacker,2);
MACRO_ADDITEM(ACE_DefusalKit,2);
MACRO_ADDITEM(ACE_Deadmanswitch,1);
MACRO_ADDITEM(ACE_Cellphone,2);
};
};
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_Clacker,12)
MACRO_ADDITEM(ACE_M26_Clacker,6)
MACRO_ADDITEM(ACE_DefusalKit,12)
MACRO_ADDITEM(ACE_Deadmanswitch,6)
MACRO_ADDITEM(ACE_Cellphone,10)
MACRO_ADDITEM(ACE_Clacker,12);
MACRO_ADDITEM(ACE_M26_Clacker,6);
MACRO_ADDITEM(ACE_DefusalKit,12);
MACRO_ADDITEM(ACE_Deadmanswitch,6);
MACRO_ADDITEM(ACE_Cellphone,10);
};
};

View File

@ -26,7 +26,7 @@ if (!hasInterface) exitWith {};
false
},
{false},
[20, true, true, false], false] call CALLSTACK(cba_fnc_addKeybind);
[20, [true, true, false]], false] call cba_fnc_addKeybind;
if isNil(QGVAR(UsePP)) then {
GVAR(UsePP) = true;

View File

@ -1,8 +1,3 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class CfgVehicles {
class NATO_Box_Base;
class EAST_Box_Base;
@ -11,35 +6,35 @@ class CfgVehicles {
class Box_NATO_Grenades_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_White,12)
MACRO_ADDITEM(ACE_HandFlare_Green,12)
MACRO_ADDITEM(ACE_M84,12)
MACRO_ADDITEM(ACE_HandFlare_White,12);
MACRO_ADDITEM(ACE_HandFlare_Green,12);
MACRO_ADDITEM(ACE_M84,12);
};
};
class Box_East_Grenades_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_Yellow,12)
MACRO_ADDITEM(ACE_HandFlare_Red,12)
MACRO_ADDITEM(ACE_M84,12)
MACRO_ADDITEM(ACE_HandFlare_Yellow,12);
MACRO_ADDITEM(ACE_HandFlare_Red,12);
MACRO_ADDITEM(ACE_M84,12);
};
};
class Box_IND_Grenades_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_Yellow,12)
MACRO_ADDITEM(ACE_HandFlare_Green,12)
MACRO_ADDITEM(ACE_M84,12)
MACRO_ADDITEM(ACE_HandFlare_Yellow,12);
MACRO_ADDITEM(ACE_HandFlare_Green,12);
MACRO_ADDITEM(ACE_M84,12);
};
};
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_White,12)
MACRO_ADDITEM(ACE_HandFlare_Red,12)
MACRO_ADDITEM(ACE_HandFlare_Green,12)
MACRO_ADDITEM(ACE_HandFlare_Yellow,12)
MACRO_ADDITEM(ACE_M84,12)
MACRO_ADDITEM(ACE_HandFlare_White,12);
MACRO_ADDITEM(ACE_HandFlare_Red,12);
MACRO_ADDITEM(ACE_HandFlare_Green,12);
MACRO_ADDITEM(ACE_HandFlare_Yellow,12);
MACRO_ADDITEM(ACE_M84,12);
};
};
};

View File

@ -1,9 +1,3 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class CfgVehicles {
class Man;
class CAManBase: Man {
@ -41,61 +35,61 @@ class CfgVehicles {
class Box_NATO_Support_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class B_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class Box_East_Support_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class O_supplyCrate_F: B_supplyCrate_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class Box_IND_Support_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class Box_FIA_Support_F: FIA_Box_Base_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class I_supplyCrate_F: B_supplyCrate_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class IG_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class C_supplyCrate_F: ReammoBox_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_EarBuds,12)
MACRO_ADDITEM(ACE_EarBuds,12);
};
};
};

View File

@ -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;

View File

@ -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
],
[]

View File

@ -0,0 +1,94 @@
/*
* 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);
// Ensure the config menu was compiled first
if (_typeNum == 0) then {
[_objectType] call FUNC(compileMenu);
} else {
[_objectType] call FUNC(compileMenuSelfAction);
};
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

View File

@ -3,7 +3,7 @@
* Compile the action menu from config for an object's class
*
* Argument:
* 0: Object <OBJECT>
* 0: Object or class name <OBJECT> or <STRING>
*
* Return value:
* None
@ -12,10 +12,13 @@
*/
#include "script_component.hpp";
EXPLODE_1_PVT(_this,_object);
EXPLODE_1_PVT(_this,_target);
private ["_objectType","_actionsVarName"];
_objectType = typeOf _object;
_objectType = _target;
if (typeName _target == "OBJECT") then {
_objectType = typeOf _target;
};
_actionsVarName = format [QGVAR(Act_%1), _objectType];
// Exit if the action menu is already compiled for this class
@ -24,7 +27,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 +51,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 +67,7 @@ _recurseFnc = {
_statement,
_condition,
_distance,
[_showDisabled,_enableInside,_canCollapse],
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
_fullPath
],
_children

View File

@ -3,7 +3,7 @@
* Compile the self action menu from config for an object's class
*
* Argument:
* 0: Object <OBJECT>
* 0: Object or class name <OBJECT> or <STRING>
*
* Return value:
* None
@ -12,10 +12,13 @@
*/
#include "script_component.hpp";
EXPLODE_1_PVT(_this,_object);
EXPLODE_1_PVT(_this,_target);
private ["_objectType","_actionsVarName"];
_objectType = typeOf _object;
_objectType = _target;
if (typeName _target == "OBJECT") then {
_objectType = typeOf _target;
};
_actionsVarName = format [QGVAR(SelfAct_%1), _objectType];
// Exit if the action menu is already compiled for this class
@ -24,7 +27,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 +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);
@ -60,7 +64,7 @@ _recurseFnc = {
_statement,
_condition,
10, //distace
[_showDisabled,_enableInside,_canCollapse],
[_showDisabled,_enableInside,_canCollapse,_runOnHover],
_fullPath
],
_children

View File

@ -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 EFUNC(common,localEvent);
};
GVAR(expanded) = false;
GVAR(lastPath) = [];
GVAR(menuDepthPath) = [];

View File

@ -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 EFUNC(common,localEvent);
};
GVAR(expanded) = false;
GVAR(lastPath) = [];
GVAR(menuDepthPath) = [];

View 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;

View File

@ -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);
};
};
};
};

View File

@ -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};

View File

@ -1,8 +1,3 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class CfgVehicles {
class Module_F;

View File

@ -22,37 +22,22 @@ GVAR(isOpeningDoor) = false;
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(!GVAR(isOpeningDoor) &&
{[2] call FUNC(getDoor) select 1 != ''}
) exitWith {false};
if (GVAR(isOpeningDoor) || {[2] call FUNC(getDoor) select 1 == ''}) exitWith {false};
// Statement
call EFUNC(interaction,openDoor);
true
},
{},
[57, [false, true, false]], false] call cba_fnc_addKeybind;
["ACE3",
localize "STR_ACE_Interaction_OpenDoor",
{
// Conditions: canInteract
_exceptions = [];
if !(_exceptions call EGVAR(common,canInteract)) exitWith {false};
// Conditions: specific
if !(GVAR(isOpeningDoor)) exitWith {false};
//Probably don't want any condidtions here, so variable never gets locked down
// Statement
GVAR(isOpeningDoor) = false;
true
},
[57, [false, true, false]],
false,
"keyup"
] call cba_fnc_registerKeybind;
[57, [false, true, false]], false] call cba_fnc_addKeybind; //Key CTRL+Space
["ACE3",
localize "STR_ACE_Interaction_TapShoulder",
["ACE3", QGVAR(tapShoulder), localize "STR_ACE_Interaction_TapShoulder",
{
// Conditions: canInteract
_exceptions = [];
@ -64,13 +49,10 @@ localize "STR_ACE_Interaction_TapShoulder",
[ACE_player, cursorTarget] call FUNC(tapShoulder);
true
},
[20, [true, false, false]],
false,
"keydown"
] call cba_fnc_registerKeybind;
{false},
[20, [true, false, false]], false] call cba_fnc_addKeybind;
["ACE3",
localize "STR_ACE_Interaction_ModifierKey",
["ACE3", QGVAR(modifierKey), localize "STR_ACE_Interaction_ModifierKey",
{
// Conditions: canInteract
_exceptions = ["ACE_Drag_isNotDragging"];
@ -81,24 +63,9 @@ localize "STR_ACE_Interaction_ModifierKey",
// 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
//Probably don't want any condidtions here, so variable never gets locked down
ACE_Modifier = 0;
// Return false so it doesn't block other actions
false
false;
},
[29, [false, false, false]],
false,
"keyup"
] call cba_fnc_registerKeybind;
[29, [false, false, false]], false] call cba_fnc_addKeybind;

View File

@ -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;

View File

@ -1,9 +1,3 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
}
class CfgVehicles {
class Man;
class CAManBase: Man {

View File

@ -1,9 +1,3 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
}
class CfgVehicles {
class NATO_Box_Base;
class Box_NATO_Support_F: NATO_Box_Base {

View File

@ -1 +0,0 @@
z\ace\addons\lockbackpacks

View File

@ -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;
};
};
};
};
};

View File

@ -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

View File

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

View File

@ -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"

View File

@ -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>

View 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

View File

@ -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"

View File

@ -1,8 +1,3 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class CfgVehicles {
class Man;
class CAManBase: Man {
@ -103,31 +98,31 @@ class CfgVehicles {
class Box_NATO_Support_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_MapTools,12)
MACRO_ADDITEM(ACE_MapTools,12);
};
};
class Box_East_Support_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_MapTools,12)
MACRO_ADDITEM(ACE_MapTools,12);
};
};
class Box_IND_Support_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_MapTools,12)
MACRO_ADDITEM(ACE_MapTools,12);
};
};
class Box_FIA_Support_F: FIA_Box_Base_F {
class TransportItems {
MACRO_ADDITEM(ACE_MapTools,12)
MACRO_ADDITEM(ACE_MapTools,12);
};
};
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_MapTools,12)
MACRO_ADDITEM(ACE_MapTools,12);
};
};

View File

@ -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[] = {QGVAR(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;
};

View 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;
};
};

View File

@ -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));
};
};
};

View 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

View File

@ -227,7 +227,7 @@ class CfgWeapons {
count = 1;
type = 16;
displayName = $STR_ACE_MEDICAL_AID_KIT_DISPLAY;
//picture = QUOTE(PATHTOF(ui\items\personal_aid_kit.paa));
picture = QUOTE(PATHTOF(ui\items\personal_aid_kit.paa));
//model = QUOTE(PATHTOF(equipment\Personal-aidkits\MTP.p3d));
descriptionShort = $STR_ACE_MEDICAL_AID_KIT_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_AID_KIT_DESC_USE;
@ -240,7 +240,7 @@ class CfgWeapons {
scope=2;
displayName= $STR_ACE_MEDICAL_SURGICALKIT_DISPLAY;
model = QUOTE(PATHTOF(data\surgical_kit.p3d));
//picture = QUOTE(PATHTOF(data\surgical_kit.paa));
picture = QUOTE(PATHTOF(ui\items\surgicalKit.paa));
descriptionShort = $STR_ACE_MEDICAL_SURGICALKIT_DESC_SHORT;
descriptionUse = $STR_ACE_MEDICAL_SURGICALKIT_DESC_USE;
class ItemInfo: InventoryItem_Base_F {

View File

@ -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);

View File

@ -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);

View File

@ -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"

Binary file not shown.

View File

@ -8,7 +8,7 @@ PixelShaderID="Super";
VertexShaderID="Super";
class Stage1
{
texture="z\ace\addons\medical\equipment\data\bodybag_nohq.paa";
texture="z\ace\addons\medical\data\bodybag_nohq.paa";
uvSource="tex";
class uvTransform
{
@ -80,7 +80,7 @@ class Stage6
};
class Stage7
{
texture="z\ace\addons\medical\equipment\data\env_co.paa";
texture="z\ace\addons\medical\data\env_co.paa";
uvSource="tex";
class uvTransform
{

View File

@ -8,7 +8,7 @@ PixelShaderID="NormalMapSpecularDIMap";
VertexShaderID="NormalMap";
class Stage1
{
texture="z\ace\addons\medical\equipment\data\bodybagItem_nohq.paa";
texture="z\ace\addons\medical\data\bodybagItem_nohq.paa";
uvSource="tex";
class uvTransform
{
@ -20,7 +20,7 @@ class Stage1
};
class Stage2
{
texture="z\ace\addons\medical\equipment\data\bodybagItem_smdi.paa";
texture="z\ace\addons\medical\data\bodybagItem_smdi.paa";
uvSource="tex";
class uvTransform
{

Binary file not shown.

View File

@ -8,7 +8,7 @@ PixelShaderID="NormalMapSpecularDIMap";
VertexShaderID="NormalMap";
class Stage1
{
texture="z\ace\addons\medical\equipment\bandages\packingbandage_nohq.paa";
texture="z\ace\addons\medical\data\packingbandage_nohq.paa";
uvSource="tex";
class uvTransform
{
@ -20,7 +20,7 @@ class Stage1
};
class Stage2
{
texture="z\ace\addons\medical\equipment\bandages\packingbandage_smdi.paa";
texture="z\ace\addons\medical\data\packingbandage_smdi.paa";
uvSource="tex";
class uvTransform
{

Binary file not shown.

Binary file not shown.

View File

@ -8,7 +8,7 @@ PixelShaderID="Super";
VertexShaderID="Super";
class Stage1
{
texture="z\ace\addons\medical\equipment\data\surgical_kit_nohq.paa";
texture="z\ace\addons\medical\data\surgical_kit_nohq.paa";
uvSource="tex";
class uvTransform
{
@ -80,7 +80,7 @@ class Stage6
};
class Stage7
{
texture="z\ace\addons\medical\equipment\data\env_co.tga";
texture="z\ace\addons\medical\data\env_co.tga";
uvSource="tex";
class uvTransform
{

Binary file not shown.

Binary file not shown.

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
};

View File

@ -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

View File

@ -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;
};

View File

@ -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;};

View File

@ -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(hasPain), 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"];
};

View File

@ -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);

View 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;

View File

@ -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) = [];
};

View File

@ -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 {

View File

@ -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;

View File

@ -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];

View File

@ -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 {

View File

@ -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);

View 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];
};

View 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);
};
};

View File

@ -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

View File

@ -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;

View File

@ -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];

View File

@ -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;

View 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

View 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;

View 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;

View 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);

View File

@ -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);

View File

@ -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];
};

View File

@ -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;
};

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