Merge branch 'medical-impr' into merge-basic-and-advanced

This commit is contained in:
Glowbal 2016-06-13 14:32:15 +02:00
commit 295ad3b037
17 changed files with 91 additions and 134 deletions

View File

@ -14,7 +14,6 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_amount", "_item", "_log", "_message", "_triageCardTexts", "_triageStatus"];
params ["_target", ["_show", true]]; params ["_target", ["_show", true]];
GVAR(TriageCardTarget) = if (_show) then {_target} else {ObjNull}; GVAR(TriageCardTarget) = if (_show) then {_target} else {ObjNull};
@ -24,7 +23,6 @@ if (_show) then {
createDialog QGVAR(triageCard); createDialog QGVAR(triageCard);
[{ [{
private ["_target", "_display", "_alphaLevel", "_alphaLevel", "_lbCtrl"];
params ["_args", "_idPFH"]; params ["_args", "_idPFH"];
_args params ["_target"]; _args params ["_target"];
if (GVAR(TriageCardTarget) != _target) exitWith { if (GVAR(TriageCardTarget) != _target) exitWith {
@ -32,21 +30,21 @@ if (_show) then {
}; };
disableSerialization; disableSerialization;
_display = uiNamespace getVariable QGVAR(triageCard); private _display = uiNamespace getVariable QGVAR(triageCard);
if (isNil "_display") exitWith { if (isNil "_display") exitWith {
[_idPFH] call CBA_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };
_triageCardTexts = []; private _triageCardTexts = [];
// TODO fill the lb with the appropiate information for the patient // TODO fill the lb with the appropiate information for the patient
_lbCtrl = (_display displayCtrl 200); private _lbCtrl = (_display displayCtrl 200);
lbClear _lbCtrl; lbClear _lbCtrl;
_log = _target getVariable [QGVAR(triageCard), []]; private _log = _target getVariable [QGVAR(triageCard), []];
{ {
_x params ["_item", "_amount"]; _x params ["_item", "_amount"];
_message = _item; private _message = _item;
if (isClass(configFile >> "CfgWeapons" >> _item)) then { if (isClass(configFile >> "CfgWeapons" >> _item)) then {
_message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName"); _message = getText(configFile >> "CfgWeapons" >> _item >> "DisplayName");
} else { } else {
@ -64,8 +62,7 @@ if (_show) then {
_lbCtrl lbAdd _x; _lbCtrl lbAdd _x;
} forEach _triageCardTexts; } forEach _triageCardTexts;
_triageStatus = [_target] call FUNC(getTriageStatus); private _triageStatus = [_target] call FUNC(getTriageStatus);
_triageStatus params ["_text", "", "_color"]; _triageStatus params ["_text", "", "_color"];
(_display displayCtrl 2000) ctrlSetText _text; (_display displayCtrl 2000) ctrlSetText _text;

View File

@ -13,20 +13,19 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_ctrl", "_display", "_idc", "_pos"];
params ["_show"]; params ["_show"];
disableSerialization;
_display = uiNamespace getVariable QGVAR(triageCard); disableSerialization;
private _display = uiNamespace getVariable QGVAR(triageCard);
if (isNil "_display") exitWith {}; if (isNil "_display") exitWith {};
_pos = [0,0,0,0]; private _pos = [0,0,0,0];
if (_show) then { if (_show) then {
_pos = ctrlPosition (_display displayCtrl 2001); _pos = ctrlPosition (_display displayCtrl 2001);
}; };
for "_idc" from 2002 to 2006 step 1 do { for "_idc" from 2002 to 2006 step 1 do {
_pos set [1, (_pos select 1) + (_pos select 3)]; _pos set [1, (_pos select 1) + (_pos select 3)];
_ctrl = (_display displayCtrl _idc); private _ctrl = (_display displayCtrl _idc);
_ctrl ctrlSetPosition _pos; _ctrl ctrlSetPosition _pos;
_ctrl ctrlCommit 0; _ctrl ctrlCommit 0;
}; };

View File

@ -18,12 +18,11 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_decreaseAmount", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"];
params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"]; params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"];
TRACE_8("params",_target,_className,_variable,_maxDosage,_timeInSystem,_incompatabileMeds,_viscosityChange,_painReduce); TRACE_8("params",_target,_className,_variable,_maxDosage,_timeInSystem,_incompatabileMeds,_viscosityChange,_painReduce);
_foundEntry = false; private _foundEntry = false;
_allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; private _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []];
{ {
_x params ["_variableX", "_allMedsFromClassname"]; _x params ["_variableX", "_allMedsFromClassname"];
if (_variableX== _variable) exitWith { if (_variableX== _variable) exitWith {
@ -43,12 +42,12 @@ if (!_foundEntry) then {
}; };
_usedMeds = _target getVariable [_variable, 0]; private _usedMeds = _target getVariable [_variable, 0];
if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1 && GVAR(enableOverdosing)) then { if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1 && GVAR(enableOverdosing)) then {
[_target] call FUNC(setDead); [_target] call FUNC(setDead);
}; };
_hasOverDosed = 0; private _hasOverDosed = 0;
{ {
_x params ["_med", "_limit"]; _x params ["_med", "_limit"];
{ {
@ -60,8 +59,8 @@ _hasOverDosed = 0;
} forEach _incompatabileMeds; } forEach _incompatabileMeds;
if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then { if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then {
_medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); private _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication");
_onOverDose = getText (_medicationConfig >> "onOverDose"); private _onOverDose = getText (_medicationConfig >> "onOverDose");
if (isClass (_medicationConfig >> _className)) then { if (isClass (_medicationConfig >> _className)) then {
_medicationConfig = (_medicationConfig >> _className); _medicationConfig = (_medicationConfig >> _className);
if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); }; if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); };
@ -74,8 +73,8 @@ if (_hasOverDosed > 0 && GVAR(enableOverdosing)) then {
[_target, _className] call _onOverDose; [_target, _className] call _onOverDose;
}; };
_decreaseAmount = 1 / _timeInSystem; private _decreaseAmount = 1 / _timeInSystem;
_viscosityAdjustment = _viscosityChange / _timeInSystem; private _viscosityAdjustment = _viscosityChange / _timeInSystem;
// Run the loop that computes the effect of the medication over time // Run the loop that computes the effect of the medication over time
[_target, _variable, 0, _decreaseAmount, _viscosityAdjustment, _painReduce / _timeInSystem] call FUNC(medicationEffectLoop); [_target, _variable, 0, _decreaseAmount, _viscosityAdjustment, _painReduce / _timeInSystem] call FUNC(medicationEffectLoop);

View File

@ -16,7 +16,6 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit","_availableSounds_A","_availableSounds_B","_availableSounds_C","_sound", "_pain"];
params ["_unit", "_pain"]; params ["_unit", "_pain"];
if (!local _unit || !GVAR(enableScreams)) exitWith{}; if (!local _unit || !GVAR(enableScreams)) exitWith{};
@ -27,7 +26,7 @@ _unit setVariable [QGVAR(playingInjuredSound),true];
// Play the sound if there is any damage present. // Play the sound if there is any damage present.
if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith { if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith {
// Classnames of the available sounds. // Classnames of the available sounds.
_availableSounds_A = [ private _availableSounds_A = [
"WoundedGuyA_01", "WoundedGuyA_01",
"WoundedGuyA_02", "WoundedGuyA_02",
"WoundedGuyA_03", "WoundedGuyA_03",
@ -37,7 +36,7 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith {
"WoundedGuyA_07", "WoundedGuyA_07",
"WoundedGuyA_08" "WoundedGuyA_08"
]; ];
_availableSounds_B = [ private _availableSounds_B = [
"WoundedGuyB_01", "WoundedGuyB_01",
"WoundedGuyB_02", "WoundedGuyB_02",
"WoundedGuyB_03", "WoundedGuyB_03",
@ -47,14 +46,14 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith {
"WoundedGuyB_07", "WoundedGuyB_07",
"WoundedGuyB_08" "WoundedGuyB_08"
]; ];
_availableSounds_C = [ private _availableSounds_C = [
"WoundedGuyC_01", "WoundedGuyC_01",
"WoundedGuyC_02", "WoundedGuyC_02",
"WoundedGuyC_03", "WoundedGuyC_03",
"WoundedGuyC_04", "WoundedGuyC_04",
"WoundedGuyC_05" "WoundedGuyC_05"
]; ];
_sound = ""; private _sound = "";
// Select the to be played sound based upon damage amount. // Select the to be played sound based upon damage amount.
if (_pain > 0.5) then { if (_pain > 0.5) then {
@ -70,14 +69,13 @@ if (_pain > 0 && {[_unit] call EFUNC(common,isAwake)}) exitWith {
playSound3D [(getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0) + ".wss", objNull, false, getPos _unit, 15, 1, 25]; // +2db, 15 meters. playSound3D [(getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0) + ".wss", objNull, false, getPos _unit, 15, 1, 25]; // +2db, 15 meters.
// Figure out what the delay will be before it is possible to play a sound again. // Figure out what the delay will be before it is possible to play a sound again.
private "_delay"; private _delay = (30 - (random(25) * _pain)) max (3.5 + random(2));
_delay = (30 - (random(25) * _pain)) max (3.5 + random(2));
// Clean up the lock // Clean up the lock
[{ [{
(_this select 0) setVariable [QGVAR(playingInjuredSound),nil]; (_this select 0) setVariable [QGVAR(playingInjuredSound), nil];
}, [_unit], _delay, _delay] call CBA_fnc_waitAndExecute; }, [_unit], _delay, _delay] call CBA_fnc_waitAndExecute;
}; };
// Clean up in case there has not been played any sounds. // Clean up in case there has not been played any sounds.
_unit setVariable [QGVAR(playingInjuredSound),nil]; _unit setVariable [QGVAR(playingInjuredSound), nil];

View File

@ -16,28 +16,26 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_config", "_medicRequired", "_items", "_locations", "_return", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed", "_return", "_usersOfItems", "_consumeItems", "_condition", "_displayText", "_wpn", "_treatmentTimeConfig", "_patientStateCondition", "_allowedSelections"];
params ["_caller", "_target", "_selectionName", "_className"]; params ["_caller", "_target", "_selectionName", "_className"];
// If the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine // If the cursorMenu is open, the loading bar will fail. If we execute the function one frame later, it will work fine
if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitwith { if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exitwith {
[{ [DFUNC(treatment), _this] call CBA_fnc_execNextFrame;
_this call FUNC(treatment);
}, _this] call CBA_fnc_execNextFrame;
}; };
if !(_target isKindOf "CAManBase") exitWith {false}; if !(_target isKindOf "CAManBase") exitWith {false};
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); private _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
if (GVAR(level) >= 2) then { if (GVAR(level) >= 2) then {
_config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className);
}; };
if !(isClass _config) exitwith {false}; if !(isClass _config) exitwith {false};
// Allow self treatment check // Allow self treatment check
if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false}; if (_caller == _target && {getNumber (_config >> "allowSelfTreatment") == 0}) exitwith {false};
_medicRequired = if (isNumber (_config >> "requiredMedic")) then { private _medicRequired = if (isNumber (_config >> "requiredMedic")) then {
getNumber (_config >> "requiredMedic"); getNumber (_config >> "requiredMedic");
} else { } else {
// Check for required class // Check for required class
@ -49,16 +47,16 @@ _medicRequired = if (isNumber (_config >> "requiredMedic")) then {
if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false}; if !([_caller, _medicRequired] call FUNC(isMedic)) exitwith {false};
_allowedSelections = getArray (_config >> "allowedSelections"); private _allowedSelections = getArray (_config >> "allowedSelections");
if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false}; if !("All" in _allowedSelections || {(_selectionName in _allowedSelections)}) exitwith {false};
// Check item // Check item
_items = getArray (_config >> "items"); private _items = getArray (_config >> "items");
if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false};
_return = true; private _return = true;
if (isText (_config >> "Condition")) then { if (isText (_config >> "Condition")) then {
_condition = getText(_config >> "condition"); private _condition = getText(_config >> "condition");
if (_condition != "") then { if (_condition != "") then {
if (isnil _condition) then { if (isnil _condition) then {
_condition = compile _condition; _condition = compile _condition;
@ -74,7 +72,7 @@ if (isText (_config >> "Condition")) then {
}; };
if (!_return) exitwith {false}; if (!_return) exitwith {false};
_patientStateCondition = if (isText(_config >> "patientStateCondition")) then { private _patientStateCondition = if (isText(_config >> "patientStateCondition")) then {
missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0] missionNamespace getVariable [getText(_config >> "patientStateCondition"), 0]
} else { } else {
getNumber(_config >> "patientStateCondition") getNumber(_config >> "patientStateCondition")
@ -82,22 +80,20 @@ _patientStateCondition = if (isText(_config >> "patientStateCondition")) then {
if (_patientStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false}; if (_patientStateCondition == 1 && {!([_target] call FUNC(isInStableCondition))}) exitwith {false};
// Check allowed locations // Check allowed locations
_locations = getArray (_config >> "treatmentLocations"); private _locations = getArray (_config >> "treatmentLocations");
if ("All" in _locations) then { if ("All" in _locations) then {
_return = true; _return = true;
} else { } else {
private [ "_medFacility", "_medVeh"]; private _medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))};
_medFacility = {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}; private _medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))};
_medVeh = {([_caller] call FUNC(isInMedicalVehicle)) || ([_target] call FUNC(isInMedicalVehicle))};
{ {
if (_x == "field") exitwith {_return = true;}; if (_x == "field") exitwith {_return = true;};
if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;}; if (_x == "MedicalFacility" && _medFacility) exitwith {_return = true;};
if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;}; if (_x == "MedicalVehicle" && _medVeh) exitwith {_return = true;};
if !(isnil _x) exitwith { if !(isnil _x) exitwith {
private "_val"; private _val = missionNamespace getVariable _x;
_val = missionNamespace getVariable _x;
if (_val isEqualType 0) then { if (_val isEqualType 0) then {
_return = switch (_val) do { _return = switch (_val) do {
case 0: {true}; //AdvancedMedicalSettings_anywhere case 0: {true}; //AdvancedMedicalSettings_anywhere
@ -113,8 +109,8 @@ if ("All" in _locations) then {
if !(_return) exitwith {false}; if !(_return) exitwith {false};
_usersOfItems = []; private _usersOfItems = [];
_consumeItems = if (isNumber (_config >> "itemConsumed")) then { private _consumeItems = if (isNumber (_config >> "itemConsumed")) then {
getNumber (_config >> "itemConsumed"); getNumber (_config >> "itemConsumed");
} else { } else {
// Check for required class // Check for required class
@ -128,7 +124,7 @@ if (_consumeItems > 0) then {
}; };
// Parse the config for the progress callback // Parse the config for the progress callback
_callbackProgress = getText (_config >> "callbackProgress"); private _callbackProgress = getText (_config >> "callbackProgress");
if (_callbackProgress == "") then { if (_callbackProgress == "") then {
_callbackProgress = "true"; _callbackProgress = "true";
}; };
@ -139,7 +135,7 @@ if (isNil _callbackProgress) then {
}; };
// Patient Animation // Patient Animation
_patientAnim = getText (_config >> "animationPatient"); private _patientAnim = getText (_config >> "animationPatient");
if (_target getVariable ["ACE_isUnconscious", false] && GVAR(allowUnconsciousAnimationOnTreatment)) then { if (_target getVariable ["ACE_isUnconscious", false] && GVAR(allowUnconsciousAnimationOnTreatment)) then {
if !(animationState _target in (getArray (_config >> "animationPatientUnconsciousExcludeOn"))) then { if !(animationState _target in (getArray (_config >> "animationPatientUnconsciousExcludeOn"))) then {
_patientAnim = getText (_config >> "animationPatientUnconscious"); _patientAnim = getText (_config >> "animationPatientUnconscious");
@ -155,7 +151,7 @@ if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""})
}; };
// Player Animation // Player Animation
_callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); private _callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE");
if (_caller == _target) then { if (_caller == _target) then {
_callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE"); _callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE");
}; };
@ -167,8 +163,8 @@ if (currentWeapon _caller == secondaryWeapon _caller) then {
_caller selectWeapon (primaryWeapon _caller); _caller selectWeapon (primaryWeapon _caller);
}; };
_wpn = ["non", "rfl", "pst"] select (1 + ([primaryWeapon _caller, handgunWeapon _caller] find (currentWeapon _caller))); private _wpn = ["non", "rfl", "pst"] select (1 + ([primaryWeapon _caller, handgunWeapon _caller] find (currentWeapon _caller)));
_callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; private _callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace;
if (vehicle _caller == _caller && {_callerAnim != ""}) then { if (vehicle _caller == _caller && {_callerAnim != ""}) then {
if (primaryWeapon _caller == "") then { if (primaryWeapon _caller == "") then {
_caller addWeapon "ACE_FakePrimaryWeapon"; _caller addWeapon "ACE_FakePrimaryWeapon";
@ -195,11 +191,11 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
}; };
//Get treatment time //Get treatment time
_treatmentTime = if (isNumber (_config >> "treatmentTime")) then { private _treatmentTime = if (isNumber (_config >> "treatmentTime")) then {
getNumber (_config >> "treatmentTime"); getNumber (_config >> "treatmentTime");
} else { } else {
if (isText (_config >> "treatmentTime")) exitwith { if (isText (_config >> "treatmentTime")) exitwith {
_treatmentTimeConfig = getText(_config >> "treatmentTime"); private _treatmentTimeConfig = getText(_config >> "treatmentTime");
if (isnil _treatmentTimeConfig) then { if (isnil _treatmentTimeConfig) then {
_treatmentTimeConfig = compile _treatmentTimeConfig; _treatmentTimeConfig = compile _treatmentTimeConfig;
} else { } else {
@ -225,13 +221,13 @@ _treatmentTime = if (isNumber (_config >> "treatmentTime")) then {
] call EFUNC(common,progressBar); ] call EFUNC(common,progressBar);
// Display Icon // Display Icon
_iconDisplayed = getText (_config >> "actionIconPath"); private _iconDisplayed = getText (_config >> "actionIconPath");
if (_iconDisplayed != "") then { if (_iconDisplayed != "") then {
[QGVAR(treatmentActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber(_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon); [QGVAR(treatmentActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber(_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon);
}; };
// handle display of text/hints // handle display of text/hints
_displayText = ""; private _displayText = "";
if (_target != _caller) then { if (_target != _caller) then {
_displayText = getText(_config >> "displayTextOther"); _displayText = getText(_config >> "displayTextOther");
} else { } else {

View File

@ -17,7 +17,6 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_config", "_callback", "_weaponSelect", "_lastAnim"];
params ["_args"]; params ["_args"];
_args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; _args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"];
@ -25,7 +24,7 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon"; _caller removeWeapon "ACE_FakePrimaryWeapon";
}; };
if (vehicle _caller == _caller) then { if (vehicle _caller == _caller) then {
_lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; private _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""];
//Don't play another medic animation (when player is rapidily treating) //Don't play another medic animation (when player is rapidily treating)
TRACE_2("Reseting to old animation", animationState player, _lastAnim); TRACE_2("Reseting to old animation", animationState player, _lastAnim);
switch (toLower _lastAnim) do { switch (toLower _lastAnim) do {
@ -40,7 +39,7 @@ if (vehicle _caller == _caller) then {
}; };
_caller setVariable [QGVAR(treatmentPrevAnimCaller), nil]; _caller setVariable [QGVAR(treatmentPrevAnimCaller), nil];
_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]);
if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then {
for "_index" from 0 to 99 do { for "_index" from 0 to 99 do {
_caller action ["SwitchWeapon", _caller, _caller, _index]; _caller action ["SwitchWeapon", _caller, _caller, _index];
@ -58,12 +57,12 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "")
} forEach _usersOfItems; } forEach _usersOfItems;
// Record specific callback // Record specific callback
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); private _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
if (GVAR(level) >= 2) then { if (GVAR(level) >= 2) then {
_config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className);
}; };
_callback = getText (_config >> "callbackFailure"); private _callback = getText (_config >> "callbackFailure");
_callback = if (isNil _callback) then { _callback = if (isNil _callback) then {
compile _callback compile _callback
} else { } else {
@ -72,5 +71,3 @@ _callback = if (isNil _callback) then {
if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};}; if (!(_callback isEqualType {})) then {_callback = {TRACE_1("callback was NOT code",_callback)};};
_args call _callback; _args call _callback;
// _args call FUNC(createLitter);

View File

@ -17,7 +17,6 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_config", "_callback", "_weaponSelect", "_lastAnim"];
params ["_args"]; params ["_args"];
_args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"]; _args params ["_caller", "_target", "_selectionName", "_className", "_items", "_usersOfItems"];
@ -25,7 +24,7 @@ if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon"; _caller removeWeapon "ACE_FakePrimaryWeapon";
}; };
if (vehicle _caller == _caller) then { if (vehicle _caller == _caller) then {
_lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""]; private _lastAnim = _caller getVariable [QGVAR(treatmentPrevAnimCaller), ""];
//Don't play another medic animation (when player is rapidily treating) //Don't play another medic animation (when player is rapidily treating)
TRACE_2("Reseting to old animation", animationState player, _lastAnim); TRACE_2("Reseting to old animation", animationState player, _lastAnim);
switch (toLower _lastAnim) do { switch (toLower _lastAnim) do {
@ -40,7 +39,7 @@ if (vehicle _caller == _caller) then {
}; };
_caller setVariable [QGVAR(treatmentPrevAnimCaller), nil]; _caller setVariable [QGVAR(treatmentPrevAnimCaller), nil];
_weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]); private _weaponSelect = (_caller getVariable [QGVAR(selectedWeaponOnTreatment), []]);
if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then { if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "") && {_previousWeapon in (weapons _caller)}}) then {
for "_index" from 0 to 99 do { for "_index" from 0 to 99 do {
_caller action ["SwitchWeapon", _caller, _caller, _index]; _caller action ["SwitchWeapon", _caller, _caller, _index];
@ -53,12 +52,12 @@ if ((_weaponSelect params [["_previousWeapon", ""]]) && {(_previousWeapon != "")
}; };
// Record specific callback // Record specific callback
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); private _config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
if (GVAR(level) >= 2) then { if (GVAR(level) >= 2) then {
_config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className);
}; };
_callback = getText (_config >> "callbackSuccess"); private _callback = getText (_config >> "callbackSuccess");
if (isNil _callback) then { if (isNil _callback) then {
_callback = compile _callback; _callback = compile _callback;
} else { } else {

View File

@ -15,27 +15,25 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_configBasic", "_configAdvanced", "_fnc_compileActionsLevel"]; private _configBasic = (configFile >> "ACE_Medical_Actions" >> "Basic");
_configBasic = (configFile >> "ACE_Medical_Actions" >> "Basic"); private _configAdvanced = (configFile >> "ACE_Medical_Actions" >> "Advanced");
_configAdvanced = (configFile >> "ACE_Medical_Actions" >> "Advanced");
_fnc_compileActionsLevel = { private _fnc_compileActionsLevel = {
private ["_actions", "_displayName", "_condition", "_category", "_statement"];
params ["_config"]; params ["_config"];
_actions = []; private _actions = [];
{ {
if (isClass _x) then { if (isClass _x) then {
_displayName = getText (_x >> "displayName"); private _displayName = getText (_x >> "displayName");
_category = getText (_x >> "category"); private _category = getText (_x >> "category");
_condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,canTreatCached)), configName _x]; private _condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,canTreatCached)), configName _x];
_statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,treatment)), configName _x]; private _statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,treatment)), configName _x];
_actions pushBack [_displayName, _category, compile _condition, compile _statement]; _actions pushBack [_displayName, _category, compile _condition, compile _statement];
}; };
nil nil
} count ("true" configClasses _config); } count ("true" configClasses _config);
_actions // return _actions;
}; };
GVAR(actionsBasic) = [_configBasic] call _fnc_compileActionsLevel; GVAR(actionsBasic) = [_configBasic] call _fnc_compileActionsLevel;
@ -43,20 +41,20 @@ GVAR(actionsAdvanced) = [_configAdvanced] call _fnc_compileActionsLevel;
//Manually add the drag actions, if dragging exists. //Manually add the drag actions, if dragging exists.
if (["ace_dragging"] call EFUNC(common,isModLoaded)) then { if (["ace_dragging"] call EFUNC(common,isModLoaded)) then {
_condition = { private _condition = {
(ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canDrag)} (ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canDrag)}
}; };
_statement = { private _statement = {
GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true
[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startDrag); [ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startDrag);
}; };
GVAR(actionsBasic) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement]; GVAR(actionsBasic) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement];
GVAR(actionsAdvanced) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement]; GVAR(actionsAdvanced) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement];
_condition = { private _condition = {
(ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canCarry)} (ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canCarry)}
}; };
_statement = { private _statement = {
GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true
[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startCarry); [ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startCarry);
}; };

View File

@ -19,19 +19,16 @@
params ["_player", "_target", "_name"]; params ["_player", "_target", "_name"];
private ["_actions", "_collectedActions", "_bodyPart"];
if (!([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith))) exitWith {[]}; if (!([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith))) exitWith {[]};
_actions = if (EGVAR(medical,level) == 2) then { private _actions = if (EGVAR(medical,level) == 2) then {
GVAR(actionsAdvanced); GVAR(actionsAdvanced);
} else { } else {
GVAR(actionsBasic); GVAR(actionsBasic);
}; };
_collectedActions = []; private _collectedActions = [];
private _bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart);
_bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart);
{ {
_x params ["", "_currentCategory", "_currentCondition"]; _x params ["", "_currentCategory", "_currentCondition"];
if (_name == _currentCategory && {call _currentCondition}) then { if (_name == _currentCategory && {call _currentCondition}) then {
@ -40,4 +37,4 @@ _bodyPart = EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart);
nil nil
} count _actions; } count _actions;
_collectedActions // return _collectedActions;

View File

@ -15,13 +15,11 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_display", "_pos", "_ctrl", "_currentPos", "_idc"];
disableSerialization; disableSerialization;
_display = uiNamespace getVariable QGVAR(medicalMenu); private _display = uiNamespace getVariable QGVAR(medicalMenu);
_pos = [0, 0, 0, 0]; private _pos = [0, 0, 0, 0];
_currentPos = ctrlPosition (_display displayCtrl 2002); private _currentPos = ctrlPosition (_display displayCtrl 2002);
_currentPos params ["_currentPosX", "_currentPosY"]; _currentPos params ["_currentPosX", "_currentPosY"];
if (_currentPosX == 0 && _currentPosY == 0) then { if (_currentPosX == 0 && _currentPosY == 0) then {
_pos = ctrlPosition (_display displayCtrl 2001); _pos = ctrlPosition (_display displayCtrl 2001);
@ -29,7 +27,7 @@ if (_currentPosX == 0 && _currentPosY == 0) then {
for "_idc" from 2002 to 2006 step 1 do { for "_idc" from 2002 to 2006 step 1 do {
_pos set [1, (_pos select 1) + (_pos select 3)]; _pos set [1, (_pos select 1) + (_pos select 3)];
_ctrl = _display displayCtrl _idc; private _ctrl = _display displayCtrl _idc;
_ctrl ctrlSetPosition _pos; _ctrl ctrlSetPosition _pos;
_ctrl ctrlCommit 0; _ctrl ctrlCommit 0;
}; };

View File

@ -16,8 +16,6 @@
#include "script_component.hpp" #include "script_component.hpp"
#define MAX_DISTANCE 10 #define MAX_DISTANCE 10
private "_target";
params ["_display"]; params ["_display"];
if (isNil "_display") exitWith {}; if (isNil "_display") exitWith {};
@ -34,7 +32,7 @@ if (isNil QGVAR(LatestDisplayOptionMenu)) then {
}; };
}; };
_target = GVAR(INTERACTION_TARGET); private _target = GVAR(INTERACTION_TARGET);
if (isNil QGVAR(INTERACTION_TARGET_PREVIOUS)) then { if (isNil QGVAR(INTERACTION_TARGET_PREVIOUS)) then {
GVAR(INTERACTION_TARGET_PREVIOUS) = _target; GVAR(INTERACTION_TARGET_PREVIOUS) = _target;
}; };

View File

@ -20,15 +20,10 @@ params ["_interactionTarget"];
if (dialog || {isNull _interactionTarget}) exitWith { if (dialog || {isNull _interactionTarget}) exitWith {
disableSerialization; disableSerialization;
private ["_display", "_handled"]; private _display = uiNamespace getVariable QGVAR(medicalMenu);
_handled = false;
_display = uiNamespace getVariable QGVAR(medicalMenu);
if (!isNil "_display") then { if (!isNil "_display") then {
closeDialog 314412; closeDialog 314412;
_handled = true;
}; };
_handled
}; };
GVAR(INTERACTION_TARGET) = _interactionTarget; GVAR(INTERACTION_TARGET) = _interactionTarget;

View File

@ -16,11 +16,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private "_logCtrl";
params ["_display", "_logs"]; params ["_display", "_logs"];
_logCtrl = _display displayCtrl 214; private _logCtrl = _display displayCtrl 214;
lbClear _logCtrl; lbClear _logCtrl;
{ {

View File

@ -22,11 +22,9 @@ params ["_selectionBloodLoss", "_damaged", "_display"];
// Handle the body image coloring // Handle the body image coloring
private _availableSelections = [50, 51, 52, 53, 54, 55]; private _availableSelections = [50, 51, 52, 53, 54, 55];
{ {
private ["_red", "_green", "_blue"]; private _red = 1;
private _green = 1;
_red = 1; private _blue = 1;
_green = 1;
_blue = 1;
if (_x > 0) then { if (_x > 0) then {
if (_damaged select _forEachIndex) then { if (_damaged select _forEachIndex) then {

View File

@ -18,15 +18,13 @@
#define START_IDC 111 #define START_IDC 111
#define END_IDC 118 #define END_IDC 118
private ["_display", "_idc", "_options", "_amount"];
disableSerialization; disableSerialization;
_display = uiNamespace getVariable QGVAR(medicalMenu); private _display = uiNamespace getVariable QGVAR(medicalMenu);
private _options = ["triage" , "examine", "bandage", "medication", "airway", "advanced", "drag", "toggle"];
_options = ["triage" , "examine", "bandage", "medication", "airway", "advanced", "drag", "toggle"];
for "_idc" from START_IDC to END_IDC step 1 do { for "_idc" from START_IDC to END_IDC step 1 do {
_amount = [ACE_player, GVAR(INTERACTION_TARGET), _options select (_idc - START_IDC)] call FUNC(getTreatmentOptions); private _amount = [ACE_player, GVAR(INTERACTION_TARGET), _options select (_idc - START_IDC)] call FUNC(getTreatmentOptions);
if ((count _amount) > 0 || _idc == START_IDC || _idc == END_IDC) then { if ((count _amount) > 0 || _idc == START_IDC || _idc == END_IDC) then {
(_display displayCtrl _idc) ctrlSettextColor [1, 1, 1, 1]; (_display displayCtrl _idc) ctrlSettextColor [1, 1, 1, 1];
} else { } else {

View File

@ -14,11 +14,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_lbCtrl", "_amountOfGeneric"];
params ["_display", "_genericMessages", "_allInjuryTexts"]; params ["_display", "_genericMessages", "_allInjuryTexts"];
_lbCtrl = _display displayCtrl 213; private _lbCtrl = _display displayCtrl 213;
lbClear _lbCtrl; lbClear _lbCtrl;
{ {
_x params ["_add", "_color"]; _x params ["_add", "_color"];
@ -26,7 +24,7 @@ lbClear _lbCtrl;
_lbCtrl lbSetColor [_forEachIndex, _color]; _lbCtrl lbSetColor [_forEachIndex, _color];
} forEach _genericMessages; } forEach _genericMessages;
_amountOfGeneric = count _genericMessages; private _amountOfGeneric = count _genericMessages;
{ {
_x params ["_add", "_color"]; _x params ["_add", "_color"];
_lbCtrl lbAdd _add; _lbCtrl lbAdd _add;

View File

@ -16,27 +16,21 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private "_logCtrl";
params ["_display", "_logs"]; params ["_display", "_logs"];
_logCtrl = _display displayCtrl 215; private _logCtrl = _display displayCtrl 215;
lbClear _logCtrl; lbClear _logCtrl;
{ {
_x params ["_message", "_moment", "", "_arguments"]; _x params ["_message", "_moment", "", "_arguments"];
if (isLocalized _message) then {
_message = localize _message;
};
{ {
if (_x isEqualType "" && {isLocalized _x}) then { if (_x isEqualType "" && {isLocalized _x}) then {
_arguments set [_foreachIndex, localize _x]; _arguments set [_foreachIndex, localize _x];
}; };
} forEach _arguments; } forEach _arguments;
_message = format ([_message] + _arguments); _message = format ([([_message, localize _message] select (isLocalized _message))] + _arguments);
_logCtrl lbAdd format ["%1 %2", _moment, _message]; _logCtrl lbAdd format ["%1 %2", _moment, _message];
nil nil
} count _logs; } count _logs;