mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #396 from KoffeinFlummi/medicalCleanup
Medical cleanup
This commit is contained in:
commit
84c8e02328
@ -22,4 +22,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// a static weapon has to be empty for dragging
|
||||
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false])}
|
||||
alive _target && {_target getVariable [QGVAR(canCarry), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLeftLeg") + (_target getHitPointDamage "HitRightLeg") > 0.4})}
|
||||
|
@ -22,4 +22,4 @@ if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// a static weapon has to be empty for dragging
|
||||
if ((typeOf _target) isKindOf "StaticWeapon" && {count crew _target > 0}) exitWith {false};
|
||||
|
||||
alive _target && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false])}
|
||||
alive _target && {_target getVariable [QGVAR(canDrag), false]} && {animationState _target in ["", "unconscious"] || (_target getvariable ["ACE_isUnconscious", false]) || (_target isKindOf "CAManBase" && {(_target getHitPointDamage "HitLeftLeg") + (_target getHitPointDamage "HitRightLeg") > 0.4})};
|
@ -9,6 +9,8 @@ _isUnconscious = _this select 1;
|
||||
private "_player";
|
||||
_player = ACE_player;
|
||||
|
||||
if ((_unit getHitPointDamage "HitLeftLeg") + (_unit getHitPointDamage "HitRightLeg") > 0.4) exitwith {};
|
||||
|
||||
if (_player getVariable [QGVAR(isDragging), false]) then {
|
||||
|
||||
private "_draggedObject";
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -444,6 +444,26 @@ class CfgVehicles {
|
||||
#define EXCEPTIONS exceptions[] = {"isNotInside"};
|
||||
#include "ACE_Medical_Actions.hpp"
|
||||
};
|
||||
class GVAR(loadPatient) {
|
||||
displayName = "$STR_ACE_Medical_LoadPatient";
|
||||
distance = 5;
|
||||
condition = QUOTE(_target getvariable[ARR_2(QUOTE(QUOTE(ACE_isUnconscious)),false)] && vehicle _target == _target);
|
||||
statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionLoadUnit));
|
||||
showDisabled = 0;
|
||||
priority = 2;
|
||||
icon = PATHTOF(UI\icons\medical_cross.paa);
|
||||
exceptions[] = {"isNotDragging", "isNotCarrying"};
|
||||
};
|
||||
class GVAR(UnLoadPatient) {
|
||||
displayName = "$STR_ACE_Medical_UnloadPatient";
|
||||
distance = 5;
|
||||
condition = QUOTE(_target getvariable[ARR_2(QUOTE(QUOTE(ACE_isUnconscious)),false)] && vehicle _target != _target);
|
||||
statement = QUOTE([ARR_2(_player, _target)] call DFUNC(actionUnloadUnit));
|
||||
showDisabled = 0;
|
||||
priority = 2;
|
||||
icon = PATHTOF(UI\icons\medical_cross.paa);
|
||||
exceptions[] = {"isNotDragging", "isNotCarrying"};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -972,84 +992,4 @@ class CfgVehicles {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// Patient unload from vehicle actions
|
||||
class LandVehicle;
|
||||
class Car: LandVehicle {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
class ACE_UnloadPatients {
|
||||
displayName = "$STR_ACE_Medical_UnloadPatient";
|
||||
condition = "true";
|
||||
statement = "";
|
||||
insertChildren = QUOTE(_this call FUNC(addUnloadPatientActions));
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
class Tank: LandVehicle {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
class ACE_UnloadPatients {
|
||||
displayName = "$STR_ACE_Medical_UnloadPatient";
|
||||
condition = "true";
|
||||
statement = "";
|
||||
insertChildren = QUOTE(_this call FUNC(addUnloadPatientActions));
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Air;
|
||||
class Helicopter: Air {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
class ACE_UnloadPatients {
|
||||
displayName = "$STR_ACE_Medical_UnloadPatient";
|
||||
condition = "true";
|
||||
statement = "";
|
||||
insertChildren = QUOTE(_this call FUNC(addUnloadPatientActions));
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
class Plane: Air {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
class ACE_UnloadPatients {
|
||||
displayName = "$STR_ACE_Medical_UnloadPatient";
|
||||
condition = "true";
|
||||
statement = "";
|
||||
insertChildren = QUOTE(_this call FUNC(addUnloadPatientActions));
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Ship;
|
||||
class Ship_F: Ship {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
class ACE_UnloadPatients {
|
||||
displayName = "$STR_ACE_Medical_UnloadPatient";
|
||||
condition = "true";
|
||||
statement = "";
|
||||
insertChildren = QUOTE(_this call FUNC(addUnloadPatientActions));
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class StaticWeapon: LandVehicle {
|
||||
class ACE_Actions {
|
||||
class ACE_MainActions {
|
||||
class ACE_UnloadPatients {
|
||||
displayName = "$STR_ACE_Medical_UnloadPatient";
|
||||
condition = "true";
|
||||
statement = "";
|
||||
insertChildren = QUOTE(_this call FUNC(addUnloadPatientActions));
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -11,8 +11,6 @@ PREP(actionPlaceInBodyBag);
|
||||
PREP(actionRemoveTourniquet);
|
||||
PREP(actionLoadUnit);
|
||||
PREP(actionUnloadUnit);
|
||||
PREP(actionCarryUnit);
|
||||
PREP(actionDropUnit);
|
||||
PREP(addHeartRateAdjustment);
|
||||
PREP(addToInjuredCollection);
|
||||
PREP(addToLog);
|
||||
@ -22,7 +20,6 @@ PREP(addUnloadPatientActions);
|
||||
PREP(canAccessMedicalEquipment);
|
||||
PREP(canTreat);
|
||||
PREP(canTreatCached);
|
||||
PREP(canCarry);
|
||||
PREP(createLitter);
|
||||
PREP(determineIfFatal);
|
||||
PREP(getBloodLoss);
|
||||
@ -61,7 +58,6 @@ PREP(itemCheck);
|
||||
PREP(onMedicationUsage);
|
||||
PREP(onWoundUpdateRequest);
|
||||
PREP(onPropagateWound);
|
||||
PREP(onCarryObjectDropped);
|
||||
PREP(parseConfigForInjuries);
|
||||
PREP(playInjuredSound);
|
||||
PREP(selectionNameToNumber);
|
||||
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
* 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);
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
};
|
@ -22,6 +22,12 @@ if ([_target] call EFUNC(common,isAwake)) exitwith {
|
||||
// TODO localization
|
||||
["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent);
|
||||
};
|
||||
if ([_target] call FUNC(isBeingCarried)) then {
|
||||
[_caller, _target] call FUNC(dropObject_carry);
|
||||
};
|
||||
if ([_target] call FUNC(isBeingDragged)) then {
|
||||
[_caller, _target] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
_vehicle = [_caller, _target] call EFUNC(common,loadPerson);
|
||||
if (!isNull _vehicle) then {
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* 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))})
|
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
};
|
||||
};
|
@ -28,12 +28,10 @@ if !(_set) exitwith {
|
||||
|
||||
if !(!(isNull _unit) && {(_unit isKindOf "CaManBase") && ([_unit] call EFUNC(common,isAwake))}) exitwith{};
|
||||
|
||||
// We only want this function to work on local machines
|
||||
if (!local _unit) exitwith {
|
||||
[[_unit], QUOTE(DFUNC(setUnconscious)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */
|
||||
};
|
||||
|
||||
// Set the unit in the unconscious state.
|
||||
_unit setvariable ["ACE_isUnconscious", true, true];
|
||||
_unit setUnconscious true;
|
||||
|
||||
@ -85,9 +83,8 @@ _startingTime = time;
|
||||
_startingTime = _args select 3;
|
||||
_minWaitingTime = _args select 4;
|
||||
_hasMovedOut = _args select 5;
|
||||
// Since the unit is no longer alive, get rid of this PFH.
|
||||
|
||||
if (!alive _unit) exitwith {
|
||||
// EXIT PFH
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
@ -132,19 +129,10 @@ _startingTime = time;
|
||||
// Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs
|
||||
if ((time - _startingTime) >= _minWaitingTime) exitwith {
|
||||
|
||||
// Wait until the unit is no longer unconscious
|
||||
if (!([_unit] call FUNC(getUnconsciousCondition))) then {
|
||||
// Move unit out of unconscious state
|
||||
_unit setvariable ["ACE_isUnconscious", false, true];
|
||||
};
|
||||
};
|
||||
|
||||
// A check to ensure that the animation is being played properly.
|
||||
// TODO: Might no longer be necessary: Have to test this in MP.
|
||||
// if (vehicle _unit == _unit && {animationState _unit != "deadState" && animationState _unit != "unconscious"} && {(isNull ([_unit] call EFUNC(common,getCarriedBy)))} && (time - _startingTime >= 0.5)) then {
|
||||
//[_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call EFUNC(common,doAnimation); // Reset animations if unit starts doing wierd things.
|
||||
//};
|
||||
|
||||
}, 0.1, [_unit,_animState, _originalPos, _startingTime, _minWaitingTime, false] ] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
["medical_onUnconscious", [_unit, true]] call EFUNC(common,globalEvent);
|
||||
|
@ -876,6 +876,9 @@
|
||||
<Key ID="STR_ACE_Medical_UnloadPatient">
|
||||
<English>Unload patient</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Medical_LoadPatient">
|
||||
<English>Load patient</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_MEDICAL_PlaceInBodyBag">
|
||||
<English>Place body in bodybag</English>
|
||||
</Key>
|
||||
|
Loading…
Reference in New Issue
Block a user