Merge branch 'medical-rewrite' of github.com:KoffeinFlummi/ACE3 into medical-rewrite

This commit is contained in:
Glowbal 2015-02-28 22:38:54 +01:00
commit 6310d7b582
8 changed files with 105 additions and 48 deletions

View File

@ -15,7 +15,7 @@ class ACE_Medical_Actions {
itemConsumed = 1;
callbackSuccess = QUOTE(DFUNC(treatmentBasic_bandage));
callbackFailure = QUOTE(DFUNC(treatmentBasic_abort));
callbackFailure = "";
callbackProgress = "";
animationPatient = "";

View File

@ -54,23 +54,15 @@ if !(_return) exitwith {false};
// Parse the config for the progress callback
_callbackProgress = getText (_config >> "callbackProgress");
if (_callbackProgress == "") then {
_callbackProgress = "true";
};
if (isNil _callbackProgress) then {
_callbackProgress = compile _callbackProgress;
} else {
_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
_patientAnim = getText (_confg >> "animationPatient");
if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""}) then {
@ -89,10 +81,21 @@ if (vehicle _caller == _caller && {_callerAnim != ""}) then {
_caller addWeapon "ACE_FakePrimaryWeapon";
};
_caller selectWeapon (primaryWeapon _caller);
_caller setvariable [QGVAR(treatmentPrevAnimCaller), animationState _target];
_caller setvariable [QGVAR(treatmentPrevAnimCaller), animationState _caller];
[_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
_iconDisplayed = getText (_config >> "actionIconPath");
if (_iconDisplayed != "") then {

View File

@ -17,7 +17,7 @@
#include "script_component.hpp"
#define BANDAGEHEAL 0.8
private ["_caller", "_target","_selection","_className","_config","_callback"];
private ["_caller", "_target","_selection","_className","_target","_hitSelections","_hitPoints","_point"];
_caller = _this select 0;
_target = _this select 1;
_selection = _this select 2;
@ -30,8 +30,8 @@ if (_selection == "all") then {
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
_point = _hitPoints select (_hitSelections find _selection);
systemChat _point;
_damage = ((_target getHitPointDamage _point) - BANDAGEHEAL) max 0;
[_target, _point, _damage] call FUNC(setHitPointDamage);
// @todo: leg/arm damage - in setHitPointDamage?
};

View File

@ -1,13 +1,12 @@
/*
* Author: KoffeinFlummi
* Epipen treatment.
* Callback when the bloodbag treatment is complete
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Selection Name <STRING>
* 3: Treatment Classname <STRING>
* 4: Items required <ARRAY<STRING>>
* 3: Treatment classname <STRING>
*
* Return Value:
* nil
@ -16,9 +15,12 @@
*/
#include "script_component.hpp"
#define BLOODBAGHEAL 70
_medic = _this select 0;
_patient = _this select 1;
_items = _this select 4;
private ["_caller", "_target","_className","_blood"];
_caller = _this select 0;
_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];

View File

@ -1,13 +1,12 @@
/*
* Author: KoffeinFlummi
* Epipen treatment.
* Callback when the epipen treatment is complete
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Selection Name <STRING>
* 3: Treatment Classname <STRING>
* 4: Items required <ARRAY<STRING>>
* 3: Treatment classname <STRING>
*
* Return Value:
* nil
@ -16,9 +15,11 @@
*/
#include "script_component.hpp"
#define BLOODBAGHEAL 70
_medic = _this select 0;
_patient = _this select 1;
_items = _this select 4;
private ["_caller", "_target","_className"];
_caller = _this select 0;
_target = _this select 1;
_className = _this select 3;
[_patient, false] call FUNC(setUnconscious);
[_target, false] call FUNC(setUnconscious);

View File

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

View File

@ -7,6 +7,7 @@
* 1: The patient <OBJECT>
* 2: SelectionName <STRING>
* 3: Treatment classname <STRING>
* 4: Items available <ARRAY<STRING>>
*
* Return Value:
* nil
@ -17,17 +18,20 @@
#include "script_component.hpp"
private ["_caller", "_target","_selectionName","_className","_config","_callback"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
_className = _this select 3;
_args = _this select 0;
_caller = _args select 0;
_target = _args select 1;
_selectionName = _args select 2;
_className = _args select 3;
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_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
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
@ -36,5 +40,10 @@ if (GVAR(level) >= 1) then {
};
_callback = getText (_config >> "callbackFailure");
if (isNil _callback) then {
_callback = compile _callback;
} else {
_callback = missionNamespace getvariable _callback;
};
_this call compile _callback
_args call _callback

View File

@ -7,6 +7,7 @@
* 1: The patient <OBJECT>
* 2: SelectionName <STRING>
* 3: Treatment classname <STRING>
* 4: Items available <ARRAY<STRING>>
*
* Return Value:
* nil
@ -17,17 +18,20 @@
#include "script_component.hpp"
private ["_caller", "_target","_selectionName","_className","_config","_callback"];
_caller = _this select 0;
_target = _this select 1;
_selectionName = _this select 2;
_className = _this select 3;
_args = _this select 0;
_caller = _args select 0;
_target = _args select 1;
_selectionName = _args select 2;
_className = _args select 3;
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_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
_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className);
@ -36,5 +40,10 @@ if (GVAR(level) >= 1) then {
};
_callback = getText (_config >> "callbackSuccess");
if (isNil _callback) then {
_callback = compile _callback;
} else {
_callback = missionNamespace getvariable _callback;
};
_this call compile _callback
_args call _callback