mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
General - Events for Mods (#9813)
* full heal local * update body image * log list * better _enable in categories * update injury list * cardiac output internal variable * typo * remove duplicate event * rename event * add docs * Update docs/wiki/framework/events-framework.md Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
parent
b1520a9aaf
commit
67fa53fd2c
@ -19,6 +19,7 @@ if (isNil QUOTE(BLOOD_LOSS_KNOCK_OUT_THRESHOLD)) then {BLOOD_LOSS_KNOCK_OUT_THRE
|
|||||||
if (isNil QUOTE(PAIN_FADE_TIME)) then {PAIN_FADE_TIME = PAIN_FADE_TIME_DEFAULT};
|
if (isNil QUOTE(PAIN_FADE_TIME)) then {PAIN_FADE_TIME = PAIN_FADE_TIME_DEFAULT};
|
||||||
if (isNil QUOTE(LIMPING_DAMAGE_THRESHOLD)) then {LIMPING_DAMAGE_THRESHOLD = LIMPING_DAMAGE_THRESHOLD_DEFAULT};
|
if (isNil QUOTE(LIMPING_DAMAGE_THRESHOLD)) then {LIMPING_DAMAGE_THRESHOLD = LIMPING_DAMAGE_THRESHOLD_DEFAULT};
|
||||||
if (isNil QUOTE(FRACTURE_DAMAGE_THRESHOLD)) then {FRACTURE_DAMAGE_THRESHOLD = FRACTURE_DAMAGE_THRESHOLD_DEFAULT};
|
if (isNil QUOTE(FRACTURE_DAMAGE_THRESHOLD)) then {FRACTURE_DAMAGE_THRESHOLD = FRACTURE_DAMAGE_THRESHOLD_DEFAULT};
|
||||||
|
if (isNil QUOTE(CARIDAC_OUTPUT_MIN)) then {CARIDAC_OUTPUT_MIN = CARIDAC_OUTPUT_MIN_DEFAULT};
|
||||||
// Derive the alternate fatal damage coefficents
|
// Derive the alternate fatal damage coefficents
|
||||||
if (isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_K) || isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_L)) then {
|
if (isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_K) || isNil QUOTE(FATAL_SUM_DAMAGE_WEIBULL_L)) then {
|
||||||
private _x1 = 0.5;
|
private _x1 = 0.5;
|
||||||
|
@ -108,6 +108,10 @@
|
|||||||
#define FRACTURE_DAMAGE_THRESHOLD EGVAR(medical,const_fractureDamageThreshold)
|
#define FRACTURE_DAMAGE_THRESHOLD EGVAR(medical,const_fractureDamageThreshold)
|
||||||
#define FRACTURE_DAMAGE_THRESHOLD_DEFAULT 0.50
|
#define FRACTURE_DAMAGE_THRESHOLD_DEFAULT 0.50
|
||||||
|
|
||||||
|
// Minimum cardiac output
|
||||||
|
#define CARIDAC_OUTPUT_MIN EGVAR(medical,const_minCardiacOutput)
|
||||||
|
#define CARIDAC_OUTPUT_MIN_DEFAULT 0.05
|
||||||
|
|
||||||
// Minimum body part damage required for blood effect on uniform
|
// Minimum body part damage required for blood effect on uniform
|
||||||
#define VISUAL_BODY_DAMAGE_THRESHOLD 0.35
|
#define VISUAL_BODY_DAMAGE_THRESHOLD 0.35
|
||||||
|
|
||||||
|
@ -105,3 +105,5 @@ private _bodyPartBloodLoss = [0, 0, 0, 0, 0, 0];
|
|||||||
[IDC_BODY_LEGLEFT, IDC_BODY_LEGLEFT_S, IDC_BODY_LEGLEFT_T, IDC_BODY_LEGLEFT_B],
|
[IDC_BODY_LEGLEFT, IDC_BODY_LEGLEFT_S, IDC_BODY_LEGLEFT_T, IDC_BODY_LEGLEFT_B],
|
||||||
[IDC_BODY_LEGRIGHT, IDC_BODY_LEGRIGHT_S, IDC_BODY_LEGRIGHT_T, IDC_BODY_LEGRIGHT_B]
|
[IDC_BODY_LEGRIGHT, IDC_BODY_LEGRIGHT_S, IDC_BODY_LEGRIGHT_T, IDC_BODY_LEGRIGHT_B]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
[QGVAR(updateBodyImage), [_ctrlGroup, _target, _selectionN]] call CBA_fnc_localEvent;
|
||||||
|
@ -21,8 +21,9 @@ params ["_display"];
|
|||||||
_x params ["_idc", "_category"];
|
_x params ["_idc", "_category"];
|
||||||
|
|
||||||
private _ctrl = _display displayCtrl _idc;
|
private _ctrl = _display displayCtrl _idc;
|
||||||
private _enable = GVAR(actions) findIf {_category == _x select 1 && {call (_x select 2)}} > -1;
|
private _enable = if (_category == "triage") then { true } else {
|
||||||
if (_category isEqualTo "triage") then {_enable = true};
|
GVAR(actions) findIf {_category == _x select 1 && {call (_x select 2)}} > -1
|
||||||
|
};
|
||||||
_ctrl ctrlEnable _enable;
|
_ctrl ctrlEnable _enable;
|
||||||
|
|
||||||
private _selectedColor = [
|
private _selectedColor = [
|
||||||
|
@ -145,6 +145,8 @@ if (_selectionN == -1) exitWith {
|
|||||||
_ctrl lbSetCurSel -1;
|
_ctrl lbSetCurSel -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[QGVAR(updateInjuryListGeneral), [_ctrl, _target, _selectionN, _entries]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
_entries pushBack ["", [1, 1, 1, 1]];
|
_entries pushBack ["", [1, 1, 1, 1]];
|
||||||
|
|
||||||
// Add selected body part name
|
// Add selected body part name
|
||||||
@ -213,6 +215,8 @@ switch (GET_FRACTURES(_target) select _selectionN) do {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[QGVAR(updateInjuryListPart), [_ctrl, _target, _selectionN, _entries, _bodyPartName]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
// Add entries for open, bandaged, and stitched wounds
|
// Add entries for open, bandaged, and stitched wounds
|
||||||
private _woundEntries = [];
|
private _woundEntries = [];
|
||||||
|
|
||||||
@ -245,6 +249,8 @@ private _fnc_processWounds = {
|
|||||||
[GET_BANDAGED_WOUNDS(_target), "[B] %1", [0.88, 0.7, 0.65, 1]] call _fnc_processWounds;
|
[GET_BANDAGED_WOUNDS(_target), "[B] %1", [0.88, 0.7, 0.65, 1]] call _fnc_processWounds;
|
||||||
[GET_STITCHED_WOUNDS(_target), "[S] %1", [0.7, 0.7, 0.7, 1]] call _fnc_processWounds;
|
[GET_STITCHED_WOUNDS(_target), "[S] %1", [0.7, 0.7, 0.7, 1]] call _fnc_processWounds;
|
||||||
|
|
||||||
|
[QGVAR(updateInjuryListWounds), [_ctrl, _target, _selectionN, _woundEntries, _bodyPartName]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
// Handle no wound entries
|
// Handle no wound entries
|
||||||
if (_woundEntries isEqualTo []) then {
|
if (_woundEntries isEqualTo []) then {
|
||||||
_entries pushBack [localize ELSTRING(medical_treatment,NoInjuriesBodypart), _nonissueColor];
|
_entries pushBack [localize ELSTRING(medical_treatment,NoInjuriesBodypart), _nonissueColor];
|
||||||
|
@ -23,6 +23,8 @@ lbClear _ctrl;
|
|||||||
{
|
{
|
||||||
_x params ["_message", "_timeStamp", "_arguments"];
|
_x params ["_message", "_timeStamp", "_arguments"];
|
||||||
|
|
||||||
|
private _unlocalizedMessage = _message;
|
||||||
|
|
||||||
// Localize message and arguments
|
// Localize message and arguments
|
||||||
if (isLocalized _message) then {
|
if (isLocalized _message) then {
|
||||||
_message = localize _message;
|
_message = localize _message;
|
||||||
@ -33,5 +35,7 @@ lbClear _ctrl;
|
|||||||
// Format message with arguments
|
// Format message with arguments
|
||||||
_message = format ([_message] + _arguments);
|
_message = format ([_message] + _arguments);
|
||||||
|
|
||||||
_ctrl lbAdd format ["%1 %2", _timeStamp, _message];
|
private _row = _ctrl lbAdd format ["%1 %2", _timeStamp, _message];
|
||||||
|
|
||||||
|
[QGVAR(logListAppended), [_ctrl, _row, _message, _unlocalizedMessage, _timeStamp, _arguments]] call CBA_fnc_localEvent;
|
||||||
} forEach _logs;
|
} forEach _logs;
|
||||||
|
@ -23,4 +23,4 @@ if (_woundBleeding == 0) exitWith {0};
|
|||||||
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);
|
private _cardiacOutput = [_unit] call FUNC(getCardiacOutput);
|
||||||
|
|
||||||
// even if heart stops blood will still flow slowly (gravity)
|
// even if heart stops blood will still flow slowly (gravity)
|
||||||
(_woundBleeding * (_cardiacOutput max 0.05) * EGVAR(medical,bleedingCoefficient))
|
(_woundBleeding * (_cardiacOutput max CARIDAC_OUTPUT_MIN) * EGVAR(medical,bleedingCoefficient))
|
||||||
|
@ -25,6 +25,9 @@ if ((["ace_fire"] call EFUNC(common,isModLoaded)) && {[_patient] call EFUNC(fire
|
|||||||
_patient setVariable [QEGVAR(fire,intensity), 0, true];
|
_patient setVariable [QEGVAR(fire,intensity), 0, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Allow mods to heal
|
||||||
|
[QGVAR(fullHealLocalMod), [_patient]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
private _state = GET_SM_STATE(_patient);
|
private _state = GET_SM_STATE(_patient);
|
||||||
TRACE_1("start",_state);
|
TRACE_1("start",_state);
|
||||||
|
|
||||||
|
@ -129,6 +129,22 @@ MenuType: 0 = Interaction, 1 = Self Interaction
|
|||||||
| `ace_trenches_placed` | [_unit, _trench] | Global | Listen | After trench object is placed by unit.
|
| `ace_trenches_placed` | [_unit, _trench] | Global | Listen | After trench object is placed by unit.
|
||||||
| `ace_trenches_finished` | [_unit, _trench] | Global | Listen | After trench object is fully dug up by unit (100% progress).
|
| `ace_trenches_finished` | [_unit, _trench] | Global | Listen | After trench object is fully dug up by unit (100% progress).
|
||||||
|
|
||||||
|
### 2.13 Medical GUI (`ace_medical_gui`)
|
||||||
|
|
||||||
|
| Event Key | Parameters | Locality | Type | Description |
|
||||||
|
|---------- |------------|----------|------|-------------|
|
||||||
|
| `ace_medical_gui_updateBodyImage` | [_ctrlGroup, _target, _selectionN] | Local | Listen | Allows mods to update any modifications they have made to the body image
|
||||||
|
| `ace_medical_gui_updateInjuryListGeneral` | [_ctrl, _target, _selectionN, _entries] | Local | Listen | Allows mods to update the general injury list by pushing to the _entries array
|
||||||
|
| `ace_medical_gui_updateInjuryListPart` | [_ctrl, _target, _selectionN, _entries, _bodyPartName] | Local | Listen | Allows mods to update the part injury list by pushing to the _entries array
|
||||||
|
| `ace_medical_gui_updateInjuryListWounds` | [_ctrl, _target, _selectionN, _woundEntries, _bodyPartName] | Local | Listen | Allows mods to update the wounds injury list by pushing to the _woundEntries array
|
||||||
|
| `ace_medical_gui_logListAppended` | [_ctrl, _row, _message, _unlocalizedMessage, _timeStamp, _arguments] | Local | Listen | After an entry is appended to the log list
|
||||||
|
|
||||||
|
### 2.14 Medical Treatment (`ace_medical_treatment`)
|
||||||
|
|
||||||
|
| Event Key | Parameters | Locality | Type | Description |
|
||||||
|
|---------- |------------|----------|------|-------------|
|
||||||
|
| `ace_medical_treatment_fullHealLocalMod` | [_patient] | Local | Listen | Called before a local unit is fully healed, mods can listen and apply their own healing logic
|
||||||
|
|
||||||
## 3. Usage
|
## 3. Usage
|
||||||
Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.
|
Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user