mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Get treatment callback structure working
This commit is contained in:
parent
d50466ac67
commit
1689829f93
@ -15,7 +15,7 @@ class ACE_Medical_Actions {
|
|||||||
itemConsumed = 1;
|
itemConsumed = 1;
|
||||||
|
|
||||||
callbackSuccess = QUOTE(DFUNC(treatmentBasic_bandage));
|
callbackSuccess = QUOTE(DFUNC(treatmentBasic_bandage));
|
||||||
callbackFailure = QUOTE(DFUNC(treatmentBasic_abort));
|
callbackFailure = "";
|
||||||
callbackProgress = "";
|
callbackProgress = "";
|
||||||
|
|
||||||
animationPatient = "";
|
animationPatient = "";
|
||||||
|
@ -54,23 +54,15 @@ if !(_return) exitwith {false};
|
|||||||
|
|
||||||
// Parse the config for the progress callback
|
// Parse the config for the progress callback
|
||||||
_callbackProgress = getText (_config >> "callbackProgress");
|
_callbackProgress = getText (_config >> "callbackProgress");
|
||||||
|
if (_callbackProgress == "") then {
|
||||||
|
_callbackProgress = "true";
|
||||||
|
};
|
||||||
if (isNil _callbackProgress) then {
|
if (isNil _callbackProgress) then {
|
||||||
_callbackProgress = compile _callbackProgress;
|
_callbackProgress = compile _callbackProgress;
|
||||||
} else {
|
} else {
|
||||||
_callbackProgress = missionNamespace getvariable _callbackProgress;
|
_callbackProgress = missionNamespace getvariable _callbackProgress;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Start treatment
|
|
||||||
_treatmentTime = getNumber (_config >> "treatmentTime");
|
|
||||||
[
|
|
||||||
_treatmentTime,
|
|
||||||
[_caller, _target, _selectionName, _className, _items],
|
|
||||||
DFUNC(treatment_success),
|
|
||||||
DFUNC(treatment_failure),
|
|
||||||
getText (_config >> "displayNameProgress"),
|
|
||||||
_callbackProgress
|
|
||||||
] call EFUNC(common,progressBar);
|
|
||||||
|
|
||||||
// Patient Animation
|
// Patient Animation
|
||||||
_patientAnim = getText (_confg >> "animationPatient");
|
_patientAnim = getText (_confg >> "animationPatient");
|
||||||
if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""}) then {
|
if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""}) then {
|
||||||
@ -89,10 +81,21 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
|
|||||||
_caller addWeapon "ACE_FakePrimaryWeapon";
|
_caller addWeapon "ACE_FakePrimaryWeapon";
|
||||||
};
|
};
|
||||||
_caller selectWeapon (primaryWeapon _caller);
|
_caller selectWeapon (primaryWeapon _caller);
|
||||||
_caller setvariable [QGVAR(treatmentPrevAnimCaller), animationState _target];
|
_caller setvariable [QGVAR(treatmentPrevAnimCaller), animationState _caller];
|
||||||
[_caller, _callerAnim] call EFUNC(common,doAnimation);
|
[_caller, _callerAnim] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Start treatment
|
||||||
|
_treatmentTime = getNumber (_config >> "treatmentTime");
|
||||||
|
[
|
||||||
|
_treatmentTime,
|
||||||
|
[_caller, _target, _selectionName, _className, _items],
|
||||||
|
DFUNC(treatment_success),
|
||||||
|
DFUNC(treatment_failure),
|
||||||
|
getText (_config >> "displayNameProgress"),
|
||||||
|
_callbackProgress
|
||||||
|
] call EFUNC(common,progressBar);
|
||||||
|
|
||||||
// Display Icon
|
// Display Icon
|
||||||
_iconDisplayed = getText (_config >> "actionIconPath");
|
_iconDisplayed = getText (_config >> "actionIconPath");
|
||||||
if (_iconDisplayed != "") then {
|
if (_iconDisplayed != "") then {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
#define BANDAGEHEAL 0.8
|
#define BANDAGEHEAL 0.8
|
||||||
|
|
||||||
private ["_caller", "_target","_selection","_className","_config","_callback"];
|
private ["_caller", "_target","_selection","_className","_target","_hitSelections","_hitPoints","_point"];
|
||||||
_caller = _this select 0;
|
_caller = _this select 0;
|
||||||
_target = _this select 1;
|
_target = _this select 1;
|
||||||
_selection = _this select 2;
|
_selection = _this select 2;
|
||||||
@ -30,8 +30,8 @@ if (_selection == "all") then {
|
|||||||
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
|
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
|
||||||
_point = _hitPoints select (_hitSelections find _selection);
|
_point = _hitPoints select (_hitSelections find _selection);
|
||||||
|
|
||||||
systemChat _point;
|
|
||||||
|
|
||||||
_damage = ((_target getHitPointDamage _point) - BANDAGEHEAL) max 0;
|
_damage = ((_target getHitPointDamage _point) - BANDAGEHEAL) max 0;
|
||||||
[_target, _point, _damage] call FUNC(setHitPointDamage);
|
[_target, _point, _damage] call FUNC(setHitPointDamage);
|
||||||
|
|
||||||
|
// @todo: leg/arm damage - in setHitPointDamage?
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
* Epipen treatment.
|
* Callback when the bloodbag treatment is complete
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Medic <OBJECT>
|
* 0: The medic <OBJECT>
|
||||||
* 1: Patient <OBJECT>
|
* 1: The patient <OBJECT>
|
||||||
* 2: Selection Name <STRING>
|
* 2: Selection Name <STRING>
|
||||||
* 3: Treatment Classname <STRING>
|
* 3: Treatment classname <STRING>
|
||||||
* 4: Items required <ARRAY<STRING>>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* nil
|
* nil
|
||||||
@ -16,9 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
#define BLOODBAGHEAL 70
|
||||||
|
|
||||||
_medic = _this select 0;
|
private ["_caller", "_target","_className","_blood"];
|
||||||
_patient = _this select 1;
|
_caller = _this select 0;
|
||||||
_items = _this select 4;
|
_target = _this select 1;
|
||||||
|
_className = _this select 3;
|
||||||
|
|
||||||
[_patient, false] call FUNC(setUnconscious);
|
_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + BLOODBAGHEAL) min 100;
|
||||||
|
_target setVariable [QGVAR(bloodVolume), _blood, true];
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Author: KoffeinFlummi
|
* Author: KoffeinFlummi
|
||||||
* Epipen treatment.
|
* Callback when the epipen treatment is complete
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Medic <OBJECT>
|
* 0: The medic <OBJECT>
|
||||||
* 1: Patient <OBJECT>
|
* 1: The patient <OBJECT>
|
||||||
* 2: Selection Name <STRING>
|
* 2: Selection Name <STRING>
|
||||||
* 3: Treatment Classname <STRING>
|
* 3: Treatment classname <STRING>
|
||||||
* 4: Items required <ARRAY<STRING>>
|
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* nil
|
* nil
|
||||||
@ -16,9 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
#define BLOODBAGHEAL 70
|
||||||
|
|
||||||
_medic = _this select 0;
|
private ["_caller", "_target","_className"];
|
||||||
_patient = _this select 1;
|
_caller = _this select 0;
|
||||||
_items = _this select 4;
|
_target = _this select 1;
|
||||||
|
_className = _this select 3;
|
||||||
|
|
||||||
[_patient, false] call FUNC(setUnconscious);
|
[_target, false] call FUNC(setUnconscious);
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Author: KoffeinFlummi
|
||||||
|
* Callback when the morphine treatment is complete
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The medic <OBJECT>
|
||||||
|
* 1: The patient <OBJECT>
|
||||||
|
* 2: Selection Name <STRING>
|
||||||
|
* 3: Treatment classname <STRING>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* nil
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
#define MORPHINEHEAL 0.4
|
||||||
|
|
||||||
|
private ["_caller", "_target","_className","_blood","_morphine","_pain"];
|
||||||
|
_caller = _this select 0;
|
||||||
|
_target = _this select 1;
|
||||||
|
_className = _this select 3;
|
||||||
|
|
||||||
|
// reduce pain, pain sensitivity
|
||||||
|
_morphine = (_target getVariable [QGVAR(morphine), 0] + MORPHINEHEAL) min 1;
|
||||||
|
_target setVariable [QGVAR(morphine), _morphine, true];
|
||||||
|
_pain = ((_target getVariable [QGVAR(pain), 0]) - MORPHINEHEAL) max 0;
|
||||||
|
_target setVariable [QGVAR(pain), _pain, true];
|
||||||
|
|
||||||
|
// @todo overdose
|
||||||
|
|
||||||
|
// @todo pain, painkiller reduction
|
@ -7,6 +7,7 @@
|
|||||||
* 1: The patient <OBJECT>
|
* 1: The patient <OBJECT>
|
||||||
* 2: SelectionName <STRING>
|
* 2: SelectionName <STRING>
|
||||||
* 3: Treatment classname <STRING>
|
* 3: Treatment classname <STRING>
|
||||||
|
* 4: Items available <ARRAY<STRING>>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* nil
|
* nil
|
||||||
@ -17,17 +18,20 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_caller", "_target","_selectionName","_className","_config","_callback"];
|
private ["_caller", "_target","_selectionName","_className","_config","_callback"];
|
||||||
_caller = _this select 0;
|
|
||||||
_target = _this select 1;
|
_args = _this select 0;
|
||||||
_selectionName = _this select 2;
|
_caller = _args select 0;
|
||||||
_className = _this select 3;
|
_target = _args select 1;
|
||||||
|
_selectionName = _args select 2;
|
||||||
|
_className = _args select 3;
|
||||||
|
|
||||||
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||||
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
||||||
[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]] call EFUNC(common,doAnimation);
|
|
||||||
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];
|
|
||||||
};
|
};
|
||||||
|
[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""], 1] call EFUNC(common,doAnimation);
|
||||||
|
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];
|
||||||
|
|
||||||
|
// @todo remove item?
|
||||||
|
|
||||||
// Record specific callback
|
// Record specific callback
|
||||||
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
||||||
@ -36,5 +40,10 @@ if (GVAR(level) >= 1) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_callback = getText (_config >> "callbackFailure");
|
_callback = getText (_config >> "callbackFailure");
|
||||||
|
if (isNil _callback) then {
|
||||||
|
_callback = compile _callback;
|
||||||
|
} else {
|
||||||
|
_callback = missionNamespace getvariable _callback;
|
||||||
|
};
|
||||||
|
|
||||||
_this call compile _callback
|
_args call _callback
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
* 1: The patient <OBJECT>
|
* 1: The patient <OBJECT>
|
||||||
* 2: SelectionName <STRING>
|
* 2: SelectionName <STRING>
|
||||||
* 3: Treatment classname <STRING>
|
* 3: Treatment classname <STRING>
|
||||||
|
* 4: Items available <ARRAY<STRING>>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* nil
|
* nil
|
||||||
@ -17,17 +18,20 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_caller", "_target","_selectionName","_className","_config","_callback"];
|
private ["_caller", "_target","_selectionName","_className","_config","_callback"];
|
||||||
_caller = _this select 0;
|
|
||||||
_target = _this select 1;
|
_args = _this select 0;
|
||||||
_selectionName = _this select 2;
|
_caller = _args select 0;
|
||||||
_className = _this select 3;
|
_target = _args select 1;
|
||||||
|
_selectionName = _args select 2;
|
||||||
|
_className = _args select 3;
|
||||||
|
|
||||||
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
|
||||||
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
_caller removeWeapon "ACE_FakePrimaryWeapon";
|
||||||
[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""]] call EFUNC(common,doAnimation);
|
|
||||||
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];
|
|
||||||
};
|
};
|
||||||
|
[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""], 1] call EFUNC(common,doAnimation);
|
||||||
|
_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil];
|
||||||
|
|
||||||
|
// @todo remove item
|
||||||
|
|
||||||
// Record specific callback
|
// Record specific callback
|
||||||
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
|
||||||
@ -36,5 +40,10 @@ if (GVAR(level) >= 1) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_callback = getText (_config >> "callbackSuccess");
|
_callback = getText (_config >> "callbackSuccess");
|
||||||
|
if (isNil _callback) then {
|
||||||
|
_callback = compile _callback;
|
||||||
|
} else {
|
||||||
|
_callback = missionNamespace getvariable _callback;
|
||||||
|
};
|
||||||
|
|
||||||
_this call compile _callback
|
_args call _callback
|
||||||
|
Loading…
Reference in New Issue
Block a user