Merge pull request #193 from KoffeinFlummi/Medical_Dragging

Medical: Carry, drag and dropping of a unit
This commit is contained in:
Glowbal 2015-03-22 23:30:32 +01:00
commit cb63302926
20 changed files with 494 additions and 52 deletions

View File

@ -49,6 +49,30 @@ class ACE_Medical_Actions {
callbackSuccess = QUOTE(DFUNC(treatmentBasic_bloodbag));
animationCaller = "AinvPknlMstpSnonWnonDnon_medic1";
};
class Carry: Bandage {
displayName = "";
displayNameProgress = "";
treatmentLocations[] = {"All"};
requiredMedic = 0;
treatmentTime = 0;
items[] = {};
condition = QUOTE(DFUNC(canCarry));
callbackSuccess = QUOTE([ARR_3(_this select 0, _this select 1, true)] call DFUNC(actionCarryUnit));
callbackFailure = "";
callbackProgress = "";
itemConsumed = 0;
animationPatient = "";
animationCaller = "";
animationCallerProne = "";
animationCallerSelf = "";
animationCallerSelfProne = "";
};
class Drag: Carry {
displayName = "";
displayNameProgress = "";
condition = QUOTE(DFUNC(canCarry));
callbackSuccess = QUOTE([ARR_3(_this select 0, _this select 1, false)] call DFUNC(actionCarryUnit));
};
};
class Advanced {
@ -199,6 +223,30 @@ class ACE_Medical_Actions {
animationPatient = "";
itemConsumed = 0;
};
class Carry: fieldDressing {
displayName = "";
displayNameProgress = "";
treatmentLocations[] = {"All"};
requiredMedic = 0;
treatmentTime = 0;
items[] = {};
condition = QUOTE(DFUNC(canCarry));
callbackSuccess = QUOTE([ARR_3(_this select 0, _this select 1, true)] call DFUNC(actionCarryUnit));
callbackFailure = "";
callbackProgress = "";
itemConsumed = 0;
animationPatient = "";
animationCaller = "";
animationCallerProne = "";
animationCallerSelf = "";
animationCallerSelfProne = "";
};
class Drag: Carry {
displayName = "";
displayNameProgress = "";
condition = QUOTE(DFUNC(canCarry));
callbackSuccess = QUOTE([ARR_3(_this select 0, _this select 1, false)] call DFUNC(actionCarryUnit));
};
};
};

View File

@ -68,4 +68,8 @@ class ACE_Settings {
typeName = "NUMBER";
value = 120;
};
class GVAR(allowDeadBodyMovement) {
typeName = "BOOL";
value = false;
};
};

View File

@ -894,6 +894,28 @@ class CfgVehicles {
enableInside = 1;
icon = PATHTOF(UI\icons\bandage.paa);
};
class Carry {
displayName = "$STR_ACE_MEDICAL_CARRY";
distance = 2.0;
condition = QUOTE([ARR_4(_player, _target, 'body', 'Carry')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'body', 'Carry')] call DFUNC(treatment));
showDisabled = 1;
priority = 2;
hotkey = "";
enableInside = 1;
//icon = PATHTOF(UI\icons\bandage.paa);
};
class Drag {
displayName = "$STR_ACE_MEDICAL_DRAG";
distance = 2.0;
condition = QUOTE([ARR_4(_player, _target, 'body', 'Drag')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'body', 'Drag')] call DFUNC(treatment));
showDisabled = 1;
priority = 2;
hotkey = "";
enableInside = 1;
//icon = PATHTOF(UI\icons\bandage.paa);
};
class TriageCard {
displayName = "Triage Card";
@ -1050,27 +1072,27 @@ class CfgVehicles {
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'BloodIV')] call DFUNC(treatment));
};
class PlasmaIV_500: PlasmaIV {
displayName = "Give Blood IV (500ml)";
displayName = "Give Plasma IV (500ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'PlasmaIV_500')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'PlasmaIV_500')] call DFUNC(treatment));
};
class PlasmaIV_250: PlasmaIV {
displayName = "Give Blood IV (250ml)";
displayName = "Give Plasma IV (250ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'PlasmaIV_250')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'PlasmaIV_250')] call DFUNC(treatment));
};
class SalineIV: BloodIV {
displayName = "Give Blood IV (1000ml)";
displayName = "Give Saline IV (1000ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'SalineIV')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'SalineIV')] call DFUNC(treatment));
};
class SalineIV_500: SalineIV {
displayName = "Give Blood IV (500ml)";
displayName = "Give Saline IV (500ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'SalineIV_500')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'SalineIV_500')] call DFUNC(treatment));
};
class SalineIV_250: SalineIV {
displayName = "Give Blood IV (250ml)";
displayName = "Give Saline IV (250ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'SalineIV_250')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'SalineIV_250')] call DFUNC(treatment));
};
@ -1175,32 +1197,32 @@ class CfgVehicles {
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'BloodIV_250')] call DFUNC(treatment));
};
class PlasmaIV: BloodIV {
displayName = "Give Blood IV (1000ml)";
displayName = "Give Plasma IV (1000ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'BloodIV')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'BloodIV')] call DFUNC(treatment));
};
class PlasmaIV_500: PlasmaIV {
displayName = "Give Blood IV (500ml)";
displayName = "Give Plasma IV (500ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'PlasmaIV_500')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'PlasmaIV_500')] call DFUNC(treatment));
};
class PlasmaIV_250: PlasmaIV {
displayName = "Give Blood IV (250ml)";
displayName = "Give Plasma IV (250ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'PlasmaIV_250')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'PlasmaIV_250')] call DFUNC(treatment));
};
class SalineIV: BloodIV {
displayName = "Give Blood IV (1000ml)";
displayName = "Give Saline IV (1000ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'SalineIV')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'SalineIV')] call DFUNC(treatment));
};
class SalineIV_500: SalineIV {
displayName = "Give Blood IV (500ml)";
displayName = "Give Saline IV (500ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'SalineIV_500')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'SalineIV_500')] call DFUNC(treatment));
};
class SalineIV_250: SalineIV {
displayName = "Give Blood IV (250ml)";
displayName = "Give Saline IV (250ml)";
condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'SalineIV_250')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'SalineIV_250')] call DFUNC(treatment));
};
@ -1307,32 +1329,32 @@ class CfgVehicles {
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'BloodIV_250')] call DFUNC(treatment));
};
class PlasmaIV: BloodIV {
displayName = "Give Blood IV (1000ml)";
displayName = "Give Plasma IV (1000ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'BloodIV')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'BloodIV')] call DFUNC(treatment));
};
class PlasmaIV_500: PlasmaIV {
displayName = "Give Blood IV (500ml)";
displayName = "Give Plasma IV (500ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'PlasmaIV_500')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'PlasmaIV_500')] call DFUNC(treatment));
};
class PlasmaIV_250: PlasmaIV {
displayName = "Give Blood IV (250ml)";
displayName = "Give Plasma IV (250ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'PlasmaIV_250')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'PlasmaIV_250')] call DFUNC(treatment));
};
class SalineIV: BloodIV {
displayName = "Give Blood IV (1000ml)";
displayName = "Give saline IV (1000ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'SalineIV')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'SalineIV')] call DFUNC(treatment));
};
class SalineIV_500: SalineIV {
displayName = "Give Blood IV (500ml)";
displayName = "Give saline IV (500ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'SalineIV_500')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'SalineIV_500')] call DFUNC(treatment));
};
class SalineIV_250: SalineIV {
displayName = "Give Blood IV (250ml)";
displayName = "Give saline IV (250ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'SalineIV_250')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'SalineIV_250')] call DFUNC(treatment));
};
@ -1427,32 +1449,32 @@ class CfgVehicles {
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'BloodIV_250')] call DFUNC(treatment));
};
class PlasmaIV: BloodIV {
displayName = "Give Blood IV (1000ml)";
displayName = "Give Plasma IV (1000ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'BloodIV')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'BloodIV')] call DFUNC(treatment));
};
class PlasmaIV_500: PlasmaIV {
displayName = "Give Blood IV (500ml)";
displayName = "Give Plasma IV (500ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'PlasmaIV_500')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'PlasmaIV_500')] call DFUNC(treatment));
};
class PlasmaIV_250: PlasmaIV {
displayName = "Give Blood IV (250ml)";
displayName = "Give Plasma IV (250ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'PlasmaIV_250')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'PlasmaIV_250')] call DFUNC(treatment));
};
class SalineIV: BloodIV {
displayName = "Give Blood IV (1000ml)";
displayName = "Give Saline IV (1000ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'SalineIV')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'SalineIV')] call DFUNC(treatment));
};
class SalineIV_500: SalineIV {
displayName = "Give Blood IV (500ml)";
displayName = "Give Saline IV (500ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'SalineIV_500')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'SalineIV_500')] call DFUNC(treatment));
};
class SalineIV_250: SalineIV {
displayName = "Give Blood IV (250ml)";
displayName = "Give Saline IV (250ml)";
condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'SalineIV_250')] call DFUNC(canTreatCached));
statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'SalineIV_250')] call DFUNC(treatment));
};

View File

@ -11,6 +11,8 @@ PREP(actionPlaceInBodyBag);
PREP(actionRemoveTourniquet);
PREP(actionLoadUnit);
PREP(actionUnloadUnit);
PREP(actionCarryUnit);
PREP(actionDropUnit);
PREP(addHeartRateAdjustment);
PREP(addToInjuredCollection);
PREP(addToLog);
@ -20,12 +22,14 @@ PREP(addUnloadPatientActions);
PREP(canAccessMedicalEquipment);
PREP(canTreat);
PREP(canTreatCached);
PREP(canCarry);
PREP(determineIfFatal);
PREP(getBloodLoss);
PREP(getBloodPressure);
PREP(getBloodVolumeChange);
PREP(getCardiacOutput);
PREP(getTypeOfDamage);
PREP(getHeartRateChange);
PREP(getTriageStatus);
PREP(getUnconsciousCondition);
PREP(handleDamage);
@ -52,6 +56,7 @@ PREP(itemCheck);
PREP(onMedicationUsage);
PREP(onWoundUpdateRequest);
PREP(onPropagateWound);
PREP(onCarryObjectDropped);
PREP(parseConfigForInjuries);
PREP(playInjuredSound);
PREP(reactionToDamage);
@ -89,9 +94,12 @@ PREP(moduleAssignMedicRoles);
PREP(moduleAssignMedicalVehicle);
PREP(moduleAssignMedicalFacility);
PREP(moduleTreatmentConfiguration);
PREP(copyDeadBody);
PREP(requestWoundSync);
GVAR(injuredUnitCollection) = [];
GVAR(IVBags) = [];
call FUNC(parseConfigForInjuries);
ADDON = true;

View File

@ -0,0 +1,87 @@
/*
* Author: Glowbal
* makes the calling unit start carrying the specified unit
*
* Arguments:
* 0: The caller <OBJECT>
* 1: The target <OBJECT>
* 2: Carry object. True is carry, false is dragging <BOOL>
*
* Return Value:
* NONE
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target", "_positionUnit", "_carry"];
_caller = _this select 0;
_target = _this select 1;
_carry = _this select 2;
if (!(_target isKindOf "CaManBase") || !(_caller isKindOf "CaManBase")) exitwith{ };
if (vehicle _caller != _caller || vehicle _target != _target) exitwith {};
if (!([_caller] call EFUNC(common,canInteract)) || {_caller == _target} || {(([_target] call EFUNC(common,isAwake)))}) exitwith {};
if (!alive _target) exitwith {
if (GVAR(allowDeadBodyMovement)) then {
[{
_this call FUNC(actionCarryUnit);
}, [_caller, ([_target,_caller] call FUNC(copyDeadBody)), _carry], 0.25, 0.25] call EFUNC(common,waitAndExecute);
};
};
if !([_caller,_target] call EFUNC(common,carryObj)) exitwith {};
if (primaryWeapon _caller == "") then {
_caller addWeapon "ACE_FakePrimaryWeapon";
};
if (currentWeapon _caller != (primaryWeapon _caller)) then {
_caller selectWeapon (primaryWeapon _caller);
};
if (_carry) then {
_target attachTo [_caller, [0.1, -0.1, -1.25], "LeftShoulder"];
[_target, "AinjPfalMstpSnonWnonDf_carried_dead", 2, true] call EFUNC(common,doAnimation);
[_caller, "acinpercmstpsraswrfldnon", 1] call EFUNC(common,doAnimation);
} else {
_target attachTo [_caller, [0.125, 1.007, 0]];
_target setDir (getDir _target + 180) % 360;
_target setPos ((getPos _target) vectorAdd ((vectorDir _caller) vectorMultiply 1.5));
[_caller, "AcinPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
[_target, "AinjPpneMstpSnonWrflDb", 2, true] call EFUNC(common,doAnimation);
};
[
2,
[_caller, _target, _carry],
{
private ["_caller","_target", "_carry", "_args"];
_args = _this select 0;
_caller = _args select 0;
_target = _args select 1;
_carry = _args select 2;
_target setvariable [QGVAR(beingCarried), _caller, true];
_caller setvariable [QGVAR(carrying), _target, true];
_caller setvariable [QGVAR(isCarrying), if (_carry) then {1} else {0}, true];
// Removing any old drop scroll wheel actions
// TODO Do we still want scroll wheel actions?
if (!isnil QGVAR(DROP_ADDACTION)) then {
_caller removeAction GVAR(DROP_ADDACTION);
GVAR(DROP_ADDACTION) = nil;
};
// Adding the drop scroll wheel action.
GVAR(DROP_ADDACTION) = _caller addAction [format["Drop %1",[_target] call EFUNC(common,getName)], {[_this select 1, _this select 2] call FUNC(actionDropUnit);}];
[_target, true] call EFUNC(common,disableAI);
},
{
[(_this select 0), objNull,[0, 0, 0]] call EFUNC(common,carryObj);
// TODO reset animations..
},
if (_carry) then {localize "STR_ACE_MEDICAL_ACTION_CARRY"} else {localize "STR_ACE_MEDICAL_ACTION_DRAG"},
{true}
] call EFUNC(common,progressBar);

View File

@ -11,7 +11,9 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller","_target"];
_caller = _this select 0;
_target = _this select 1;

View File

@ -11,7 +11,9 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller","_target","_title","_content"];
_caller = _this select 0;
_target = _this select 1;

View File

@ -0,0 +1,23 @@
/*
* Author: Glowbal
* Drop a unit if the caller nit is currently dragging or carrying a unit
*
* Arguments:
* 0: The caller <OBJECT>
*
* Return Value:
* NONE
*
* Public: No
*/
#include "script_component.hpp"
private "_caller";
_caller = _this select 0;
if (!isnil QGVAR(DROP_ADDACTION)) then {
[_caller,objNull] call EFUNC(common,carryObj);
_caller removeAction GVAR(DROP_ADDACTION);
GVAR(DROP_ADDACTION) = nil;
};

View File

@ -12,10 +12,8 @@
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target","_vehicle", "_loaded"];
_caller = _this select 0;
_target = _this select 1;

View File

@ -27,7 +27,7 @@ if (([_target] call cse_fnc_isAwake)) exitwith {};
if ([_caller, _target] call EFUNC(common,unloadPerson)) then {
if (_drag) then {
if ((vehicle _caller) == _caller) then {
[[_caller, _target], QUOTE(DFUNC(actionDragUnit)), _caller, false] call BIS_fnc_MP;
[[_caller, _target, true], QUOTE(DFUNC(actionDragUnit)), _caller, false] call EFUNC(common,execRemoteFnc); // TODO replace by event
};
};
};

View File

@ -39,6 +39,4 @@ _actions = [];
};
} forEach crew _vehicle;
systemChat str(count _actions);
_actions

View File

@ -0,0 +1,29 @@
/*
* Author: Glowbal
* Check if caller can carry or drag the target
*
* Arguments:
* 0: The caller <OBJECT>
* 1: The target <OBJECT>
*
* Return Value:
* NONE
*
* Public: No
*/
#include "script_component.hpp"
private ["_caller", "_target", "_positionUnit", "_carry"];
_caller = _this select 0;
_target = _this select 1;
if (!(_target isKindOf "CaManBase") || !(_caller isKindOf "CaManBase")) exitwith{false};
if (vehicle _caller != _caller || vehicle _target != _target) exitwith {false};
if (!([_caller] call EFUNC(common,canInteract)) || {_caller == _target} || {(([_target] call EFUNC(common,isAwake)))}) exitwith {false};
if (!alive _target) exitwith {GVAR(allowDeadBodyMovement)};
((isNull ([_caller] call FUNC(getCarriedObj))) && {isNull ([_target] call FUNC(getCarriedObj))} && {isNull ([_caller] call FUNC(getCarriedBy))} && {isNull ([_target] call FUNC(getCarriedBy))})

View File

@ -40,6 +40,7 @@ _locations = getArray (_config >> "treatmentLocations");
_return = true;
if (getText (_config >> "condition") != "") then {
_condition = getText (_config >> "condition");
if (isnil _condition) then {
_condition = compile _condition;
} else {

View File

@ -0,0 +1,83 @@
/*
* Author: Glowbal
* Makes a copy of a dead body. For handling dead bodies for actions such as load and carry.
*
* Arguments:
* 0: The oldbody <OBJECT>
* 1: The caller <OBJECT>
*
* Return Value:
* OBJECT Returns the copy of the unit. If no copy could be made, returns the oldBody
*
* Public: No
*/
#include "script_component.hpp"
private ["_oldBody","_newUnit","_class","_group","_position","_side","_allVariables"];
_oldBody = _this select 0;
_caller = _this select 1;
if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies
_name = _oldBody getvariable ["ACE_name", "unknown"];
_class = typeof _oldBody;
_side = side _caller;
_group = createGroup _side;
_position = getPos _oldBody;
_newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"];
_newUnit setVariable ["ACE_name", _name, true];
_newUnit disableAI "TARGET";
_newUnit disableAI "AUTOTARGET";
_newUnit disableAI "MOVE";
_newUnit disableAI "ANIM";
_newUnit disableAI "FSM";
removeallweapons _newUnit;
removeallassigneditems _newUnit;
removeUniform _newUnit;
removeHeadgear _newUnit;
removeBackpack _newUnit;
removeVest _newUnit;
_newUnit addHeadgear (headgear _oldBody);
_newUnit addBackpack (backpack _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit);
_newUnit addVest (vest _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit);
_newUnit addUniform (uniform _oldBody);
clearItemCargoGlobal (backpackContainer _newUnit);
clearMagazineCargoGlobal (backpackContainer _newUnit);
clearWeaponCargoGlobal (backpackContainer _newUnit);
{_newUnit addMagazine _x} count (magazines _oldBody);
{_newUnit addWeapon _x} count (weapons _oldBody);
{_newUnit addItem _x} count (items _oldBody);
_newUnit selectWeapon (primaryWeapon _newUnit);
// We are attaching the old unit and hiding it, so we can keep the original unit until later.
_oldBody attachTo [_newUnit, [0,0,0]];
if (isMultiplayer) then {
hideObjectGlobal _oldBody;
} else {
hideObject _oldBody;
};
_newUnit setvariable [QGVAR(copyOfUnit), _oldBody, true];
_oldBody setvariable [QGVAR(hasCopy), _newUnit, true];
_newUnit setvariable ["ACE_isDead", true, true];
_newUnit setvariable ["ACE_isUnconscious", true, true];
_newUnit setvariable [QGVAR(disableInteraction), true, true];
_oldBody setvariable [QGVAR(disableInteraction), true, true];
_newUnit setDamage 0.89;
_newUnit;

View File

@ -37,21 +37,13 @@ _bloodVolume = _unit getvariable [QGVAR(bloodVolume), 100];
_bloodVolumeChange = -(_unit call FUNC(getBloodLoss));
if (_bloodVolume < 100.0) then {
if ((_unit getvariable [QGVAR(salineIVVolume), 0]) > 0) then {
{
if ((_unit getvariable [_x, 0]) > 0) then {
_bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND;
_ivVolume = (_unit getvariable [QGVAR(salineIVVolume), 0]) + IV_CHANGE_PER_SECOND;
_unit setvariable [QGVAR(salineIVVolume),_ivVolume];
};
if ((_unit getvariable [QGVAR(plasmaIVVolume), 0]) > 0) then {
_bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND;
_ivVolume = (_unit getvariable [QGVAR(plasmaIVVolume), 0]) + IV_CHANGE_PER_SECOND;
_unit setvariable [QGVAR(plasmaIVVolume),_ivVolume];
};
if ((_unit getvariable [QGVAR(bloodIVVolume), 0]) > 0) then {
_bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND;
_ivVolume = (_unit getvariable [QGVAR(bloodIVVolume), 0]) + IV_CHANGE_PER_SECOND;
_unit setvariable [QGVAR(bloodIVVolume),_ivVolume];
_ivVolume = (_unit getvariable [_x, 0]) + IV_CHANGE_PER_SECOND;
_unit setvariable [_x,_ivVolume];
};
}foreach GVAR(IVBags);
};
_bloodVolumeChange;

View File

@ -105,7 +105,7 @@ if (GVAR(level) >= 2) then {
};
// Set the vitals
_heartRate = (_unit getvariable [QGVAR(heartRate), 0]) + ([_unit] call FUNC(getHeartRateChange)) * _interval;
_heartRate = (_unit getvariable [QGVAR(heartRate), 0]) + (([_unit] call FUNC(getHeartRateChange)) * _interval);
_unit setvariable [QGVAR(heartRate), _heartRate, _syncValues];
_bloodPressure = [_unit] call FUNC(getBloodPressure);

View File

@ -0,0 +1,85 @@
/*
* Author: Glowbal
* Called on event CarryObjectDropped
*
* Arguments:
* 0: The caller <OBJECT>
*
* Return Value:
* NONE
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit","_params"];
_caller = _this select 0;
_target = _caller getvariable [QGVAR(carrying), objNull];
_carrying = _caller getvariable [QGVAR(isCarrying), -1];
if (_carrying >= 0) then {
if !(isNull (_target getvariable [QGVAR(copyOfUnit), objNull])) then {
_copy = _target;
_target = _copy getvariable [QGVAR(copyOfUnit), objNull];
if (isMultiplayer) then {
_target hideObjectGlobal false;
} else {
_target hideObject false;
};
detach _copy;
deleteVehicle _copy;
_target setvariable [QGVAR(disableInteraction), nil, true];
_target setvariable [QGVAR(hasCopy), nil, true];
};
_caller setvariable [QGVAR(isCarrying), -1, true];
if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then {
_caller removeWeapon "ACE_FakePrimaryWeapon";
};
[_target, false] call EFUNC(common,disableAI);
_caller setvariable[QGVAR(onStartMovingUnitParams), nil];
// handle the drag & carry administration
if (_carrying == 0) then {
_target setvariable [QGVAR(beingDragged), nil, true];
_caller setvariable [QGVAR(dragging), nil, true];
} else {
_target setvariable [QGVAR(beingCarried), nil, true];
_caller setvariable [QGVAR(carrying), nil, true];
};
// handle the drag & carry animiations
if ([_caller] call EFUNC(common,isAwake) && (vehicle _caller == _caller)) then {
[_caller,"amovpercmstpsraswrfldnon_amovpknlmstpslowwrfldnon", 1] call EFUNC(common,doAnimation);
};
if (vehicle _target == _target) then {
if (_carrying == 0) then {
[_target,"AinjPpneMstpSnonWrflDb_release", 2, true] call EFUNC(common,doAnimation);
} else {
[_target,"AinjPfalMstpSnonWrflDnon_carried_Down", 2, true] call EFUNC(common,doAnimation);
};
} else {
if ([_target] call EFUNC(common,isAwake)) then {
[_target,"", 2] call EFUNC(common,doAnimation); // TODO play animation for the current seat instead
} else {
// this might not work properly
[_target,([_target] call EFUNC(common,getDeathAnim)), 1] call EFUNC(common,doAnimation);
};
};
// Ensure that the unit does not get dropped through the floor of a building
if (!surfaceIsWater getPos _caller) then {
[{
EXPLODE_3_PVT(_this,_caller,_target,_killOnDrop);
if (vehicle _target == _target && (vehicle _caller == _caller)) then {
// This will set the target body/unit on the correct position, so it doesn't fall through floors.
_positionUnit = getPosATL _target;
_positionUnit set [2, (getPosATL _caller) select 2];
_target setPosATL _positionUnit;
};
}, [_caller,_target], 0.5, 0.5] call EFUNC(common,waitAndExecute);
};
};

View File

@ -73,11 +73,7 @@ if (alive _target) then {
// Reduce the pain level
_pain = _target getvariable [QGVAR(pain), 0];
_pain = _pain * _painReduce;
if (_pain <= 0) then {
_pain = 0;
};
_target setvariable [QGVAR(pain), _pain];
_target setvariable [QGVAR(pain), (_pain - _painReduce) max 0];
_resistance = _unit getvariable [QGVAR(peripheralResistance), 100];
_resistance = _resistance + _viscosityChange;

View File

@ -21,8 +21,8 @@ _ivItem = _this select 1;
// Find the proper attributes for the used IV
_config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV");
_volumeAdded = getNumber (_medicationConfig >> "volume");
_typeOf = getText (_medicationConfig >> "type");
_volumeAdded = getNumber (_config >> "volume");
_typeOf = getText (_config >> "type");
if (isClass (_config >> _className)) then {
_config = (_config >> _className);
@ -33,6 +33,11 @@ if (isClass (_config >> _className)) then {
_varName = format["ACE_Medical_IVVolume_%1",_typeOf];
_target setvariable [_varName, (_target getvariable [_varName, 0]) + _volumeAdded];
if !(_varName in GVAR(IVBags)) then {
GVAR(IVBags) pushback _varName;
publicVariable GVAR(IVBags);
};
// TODO localization
//[_target,"treatment",format["%1 has given %4 a %2(%3ml)",[_caller] call EFUNC(common,getName),_attributes select 2,_attributes select 1,_target]] call FUNC(addActivityToLog);
//[_target,_removeItem] call FUNC(addToTriageList);

View File

@ -720,10 +720,69 @@
<Russian>%1 проводит вам интубацию</Russian>
<Spanish>%1 te está intubando</Spanish>
</Key>
<Key ID="STR_ACE_MEDICAL_DRAG">
<English>Drag</English>
<German>Ziehen</German>
<Spanish>Arrastrar</Spanish>
<Polish>Ciągnij</Polish>
<Czech>Táhnout</Czech>
<Russian>Тащить</Russian>
<French>Tracter</French>
<Hungarian>Húzás</Hungarian>
<Portuguese>Arrastar</Portuguese>
<Italian>Trascina</Italian>
</Key>
<Key ID="STR_ACE_MEDICAL_CARRY">
<English>Carry</English>
<German>Tragen</German>
<Spanish>Cargar</Spanish>
<Polish>Nieś</Polish>
<Czech>Nést</Czech>
<Russian>Нести</Russian>
<French>Porter</French>
<Hungarian>Cipelés</Hungarian>
<Portuguese>Carregar</Portuguese>
<Italian>Trasporta</Italian>
</Key>
<Key ID="STR_ACE_MEDICAL_RELEASE">
<English>Release</English>
<German>Loslassen</German>
<Spanish>Soltar</Spanish>
<Polish>Połóż</Polish>
<Czech>Položit</Czech>
<Russian>Отпустить</Russian>
<French>Déposer</French>
<Hungarian>Elenged</Hungarian>
<Portuguese>Largar</Portuguese>
<Italian>Lascia</Italian>
</Key>
<Key ID="STR_ACE_MEDICAL_LOAD">
<English>Load Patient Into</English>
<German>Patient Einladen</German>
<Spanish>Cargar el paciente en</Spanish>
<Polish>Załaduj pacjenta</Polish>
<Czech>Naložit pacianta do</Czech>
<Russian>Погрузить пациента в</Russian>
<French>Embarquer le Patient</French>
<Hungarian>Sebesült berakása</Hungarian>
<Portuguese>Carregar Paciente Em</Portuguese>
<Italian>Carica paziente nel</Italian>
</Key>
<Key ID="STR_ACE_MEDICAL_UNLOAD">
<English>Unload Patient</English>
<German>Patient Ausladen</German>
<Spanish>Descargar el paciente</Spanish>
<Polish>Wyładuj pacjenta</Polish>
<Czech>Vyložit pacienta</Czech>
<Russian>Выгрузить пациента</Russian>
<French>Débarquer le Patient</French>
<Hungarian>Sebesült kihúzása</Hungarian>
<Portuguese>Descarregar Paciente</Portuguese>
<Italian>Scarica il paziente</Italian>
</Key>
<Key ID="STR_ACE_Medical_UnloadPatient">
<English>Unload patient &gt;&gt;</English>
</Key>
</Container>
</Package>
</Project>