Implemented Medkit (works like in ACE2)

This commit is contained in:
ulteq 2016-12-08 18:11:24 +01:00
parent a48d271368
commit c486f17539
11 changed files with 209 additions and 103 deletions

View File

@ -121,6 +121,14 @@ class ACE_Settings {
value = 0;
values[] = {"Anyone", "Medics only", "Doctors only"};
};
class GVAR(medicSetting_Medkit) {
category = CSTRING(Category_Medical);
displayName = CSTRING(AdvancedMedicalSettings_medicSetting_Medkit_DisplayName);
description = CSTRING(AdvancedMedicalSettings_medicSetting_Medkit_Description);
typeName = "SCALAR";
value = 0;
values[] = {"Anyone", "Medics only", "Doctors only"};
};
class GVAR(medicSetting_PAK) {
category = CSTRING(Category_Medical);
displayName = CSTRING(AdvancedMedicalSettings_medicSetting_PAK_DisplayName);
@ -137,6 +145,14 @@ class ACE_Settings {
value = 0;
values[] = {"Anyone", "Medics only", "Doctors only"};
};
class GVAR(consumeItem_Medkit) {
category = CSTRING(Category_Medical);
displayName = CSTRING(AdvancedMedicalSettings_consumeItem_Medkit_DisplayName);
description = CSTRING(AdvancedMedicalSettings_consumeItem_Medkit_Description);
typeName = "SCALAR";
value = 1;
values[] = {"No", "Yes"};
};
class GVAR(consumeItem_PAK) {
category = CSTRING(Category_Medical);
displayName = CSTRING(AdvancedMedicalSettings_consumeItem_PAK_DisplayName);
@ -161,6 +177,14 @@ class ACE_Settings {
value = 0;
values[] = {CSTRING(AdvancedMedicalSettings_anywhere), CSTRING(AdvancedMedicalSettings_vehicle), CSTRING(AdvancedMedicalSettings_facility), CSTRING(AdvancedMedicalSettings_vehicleAndFacility), ECSTRING(common,Disabled)};
};
class GVAR(useLocation_Medkit) {
category = CSTRING(Category_Medical);
displayName = CSTRING(AdvancedMedicalSettings_useLocation_Medkit_DisplayName);
description = CSTRING(AdvancedMedicalSettings_useLocation_Medkit_Description);
typeName = "SCALAR";
value = 0;
values[] = {CSTRING(AdvancedMedicalSettings_anywhere), CSTRING(AdvancedMedicalSettings_vehicle), CSTRING(AdvancedMedicalSettings_facility), CSTRING(AdvancedMedicalSettings_vehicleAndFacility), ECSTRING(common,Disabled)};
};
class GVAR(useLocation_PAK) {
category = CSTRING(Category_Medical);
displayName = CSTRING(AdvancedMedicalSettings_useLocation_PAK_DisplayName);
@ -177,20 +201,12 @@ class ACE_Settings {
value = 0;
values[] = {CSTRING(AdvancedMedicalSettings_anywhere), CSTRING(AdvancedMedicalSettings_vehicle), CSTRING(AdvancedMedicalSettings_facility), CSTRING(AdvancedMedicalSettings_vehicleAndFacility), ECSTRING(common,Disabled)};
};
class GVAR(fullHealLocation_PAK) {
class GVAR(remainingDamage_Medkit) {
category = CSTRING(Category_Medical);
displayName = CSTRING(MedicalSettings_fullHealLocation_PAK_DisplayName);
description = CSTRING(MedicalSettings_fullHealLocation_PAK_Description);
displayName = CSTRING(AdvancedMedicalSettings_remainingDamage_Medkit_DisplayName);
description = CSTRING(AdvancedMedicalSettings_remainingDamage_Medkit_Description);
typeName = "SCALAR";
value = 3;
values[] = {CSTRING(AdvancedMedicalSettings_anywhere), CSTRING(AdvancedMedicalSettings_vehicle), CSTRING(AdvancedMedicalSettings_facility), CSTRING(AdvancedMedicalSettings_vehicleAndFacility), ECSTRING(common,Disabled)};
};
class GVAR(fieldEffectiveness_PAK) {
category = CSTRING(Category_Medical);
displayName = CSTRING(MedicalSettings_fieldEffectiveness_PAK_DisplayName);
description = CSTRING(MedicalSettings_fieldEffectiveness_PAK_Description);
typeName = "SCALAR";
value = 0.9;
value = 0.1;
};
class GVAR(painEffectType) {
category = CSTRING(Category_Medical);

View File

@ -207,6 +207,16 @@ class CfgVehicles {
MACRO_ADDITEM(ACE_quikclot,1);
};
};
class ACE_medKitItem: Item_Base_F {
scope = 2;
scopeCurator = 2;
displayName = CSTRING(Med_Kit_Display);
author = ECSTRING(common,ACETeam);
vehicleClass = "Items";
class TransportItems {
MACRO_ADDITEM(ACE_medKit,1);
};
};
class ACE_personalAidKitItem: Item_Base_F {
scope = 2;
scopeCurator = 2;
@ -277,6 +287,7 @@ class CfgVehicles {
MACRO_ADDITEM(ACE_bloodIV_500,7);
MACRO_ADDITEM(ACE_bloodIV_250,7);
MACRO_ADDITEM(ACE_quikClot,20);
MACRO_ADDITEM(ACE_medKit,20);
MACRO_ADDITEM(ACE_personalAidKit,3);
MACRO_ADDITEM(ACE_surgicalKit,2);
MACRO_ADDITEM(ACE_bodyBag,5);

View File

@ -207,6 +207,16 @@ class CfgWeapons {
mass = 2;
};
};
class ACE_medKit: ACE_ItemCore {
scope = 2;
displayName = CSTRING(Med_Kit_Display);
picture = QPATHTOF(ui\items\personal_aid_kit_x_ca.paa); // todo: new picture
descriptionShort = CSTRING(Med_Kit_Desc_Short);
descriptionUse = CSTRING(Med_Kit_Desc_Use);
class ItemInfo: InventoryItem_Base_F {
mass = 10;
};
};
class ACE_personalAidKit: ACE_ItemCore {
scope = 2;
displayName = CSTRING(Aid_Kit_Display);

View File

@ -1374,6 +1374,18 @@
<Czech>Hemostatický obvaz určený k zástavě krvácení</Czech>
<Japanese>血液凝固剤をふくむ包帯により、止血できます。</Japanese>
</Key>
<Key ID="STR_ACE_Medical_Med_Kit_Display">
<English>Medkit</English>
</Key>
<Key ID="STR_ACE_Medical_Med_Kit_Desc_Short">
<English>...</English>
</Key>
<Key ID="STR_ACE_Medical_Med_Kit_Desc_Use">
<English>...</English>
</Key>
<Key ID="STR_ACE_Medical_Use_Med_Kit">
<English>Use Medkit</English>
</Key>
<Key ID="STR_ACE_Medical_Aid_Kit_Display">
<English>Personal Aid Kit</English>
<Russian>Аптечка</Russian>
@ -2322,6 +2334,9 @@
<Czech>%1 použil škrtidlo</Czech>
<Japanese>%1 は止血帯を巻いた</Japanese>
</Key>
<Key ID="STR_ACE_Medical_Activity_partialHeal">
<English>%1 used Medkit</English>
</Key>
<Key ID="STR_ACE_Medical_Activity_fullHeal">
<English>%1 used Personal Aid Kit</English>
<German>%1 hat das eigene Erste-Hilfe-Set verwendet</German>
@ -2903,18 +2918,6 @@
<Italian>Coefficiente che modifica l'intensità del dolore</Italian>
<Japanese>この係数では痛みの強さを変更できます</Japanese>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fullHealLocation_PAK_DisplayName">
<English>Full Heal Locations</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fullHealLocation_PAK_Description">
<English>Where does the PAK perform a full heal?</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fieldEffectiveness_PAK_DisplayName">
<English>PAK effectiveness</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_fieldEffectiveness_PAK_Description">
<English>PAK effectiveness when used outside of medical facilities</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_Module_Description">
<English>Provides a medical system for both players and AI.</English>
<Russian>Включает медицинскую систему как для игроков, так и для ботов.</Russian>
@ -3081,6 +3084,12 @@
<Russian>Кому разрешено использовать адреналин для полного излечения? (Только для базовой медицины)</Russian>
<Japanese>完全に回復できるよう誰しもがアドレナリンを使えるようにしますか?(ベーシック医療のみ)</Japanese>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_medicSetting_Medkit_DisplayName">
<English>Allow Medkit</English>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_medicSetting_Medkit_Description">
<English>Who can use the Medkit for partial heal?</English>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_medicSetting_PAK_DisplayName">
<English>Allow PAK</English>
<Russian>Использование аптечки</Russian>
@ -3146,6 +3155,12 @@
<Italian>Solo dottori</Italian>
<Japanese>医師のみ</Japanese>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_consumeItem_Medkit_DisplayName">
<English>Remove Medkit on use</English>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_consumeItem_Medkit_Description">
<English>Should Medkit be removed on usage?</English>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_consumeItem_PAK_DisplayName">
<English>Remove PAK on use</English>
<Russian>Удалять аптечки после использования</Russian>
@ -3196,6 +3211,9 @@
<Russian>Где может использоваться адреналин? (Базовая медицина)</Russian>
<Japanese>どこでもアドレナリンをつかえるようにしますか?(ベーシック医療のみ)</Japanese>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_useLocation_Medkit_DisplayName">
<English>Locations Medkit</English>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_useLocation_PAK_DisplayName">
<English>Locations PAK</English>
<Russian>Место использования аптечки</Russian>
@ -3378,6 +3396,12 @@
<Italian>Dove può essere usato il Kit Chirurgico?</Italian>
<Japanese>どこでも縫合キットをつかえるようにしますか?</Japanese>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_remainingDamage_Medkit_DisplayName">
<English>Remaining Damage</English>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_remainingDamage_Medkit_Description">
<English>Remaining damage on Medkit usage (increases with every use)?</English>
</Key>
<Key ID="STR_ACE_Medical_AdvancedMedicalSettings_useCondition_SurgicalKit_DisplayName">
<English>Condition Surgical Kit (Adv)</English>
<German>Beding. für d. Operationskasten (erw.)</German>

View File

@ -298,4 +298,12 @@ class GVAR(Actions) {
{"All", "_bloodLossOnBodyPart <= 0", {"ACE_MedicalLitter_clean"}}
};
};
class MedKit: PersonalAidKit {
displayName = ECSTRING(medical,Use_Med_Kit);
items[] = {"ACE_medKit"};
treatmentLocations[] = {QEGVAR(medical,useLocation_MedKit)};
requiredMedic = QEGVAR(medical,medicSetting_MedKit);
callbackSuccess = QFUNC(treatmentPartialHeal);
itemConsumed = QEGVAR(medical,consumeItem_MedKit);
};
};

View File

@ -14,23 +14,25 @@ PREP(actionUnloadUnit);
PREP(canTreat);
PREP(canTreatCached);
PREP(treatment);
PREP(treatment_success);
PREP(treatment_failure);
PREP(treatment_success);
PREP(treatmentBandage);
PREP(treatmentBandageLocal);
PREP(treatmentTourniquet);
PREP(treatmentTourniquetLocal);
PREP(treatmentTourniquetRemove);
PREP(treatmentMedication);
PREP(treatmentMedicationLocal);
PREP(treatmentIV);
PREP(treatmentIVLocal);
PREP(treatmentCPR);
PREP(treatmentCPRLocal);
PREP(treatmentFullHeal);
PREP(treatmentFullHealLocal);
PREP(treatmentIV);
PREP(treatmentIVLocal);
PREP(treatmentMedication);
PREP(treatmentMedicationLocal);
PREP(treatmentPartialHeal);
PREP(treatmentPartialHealLocal);
PREP(treatmentSurgicalKit_onProgress);
PREP(treatmentTourniquet);
PREP(treatmentTourniquetLocal);
PREP(treatmentTourniquetRemove);
// misc
PREP(addToLog);
@ -40,10 +42,10 @@ PREP(canAccessMedicalEquipment);
PREP(dropDownTriageCard);
PREP(getTriageStatus);
PREP(handleBandageOpening);
PREP(healTime);
PREP(isBeingCarried);
PREP(isBeingDragged);
PREP(onMedicationUsage);
PREP(healTime);
// items
PREP(checkItems);
@ -53,6 +55,6 @@ PREP(useItem);
PREP(useItems);
// litter
PREP(litterCleanupLoop);
PREP(litterCreate);
PREP(litterHandleCreate);
PREP(litterCleanupLoop);

View File

@ -13,6 +13,7 @@ if (isServer) then {
[QGVAR(treatmentMedicationLocal), FUNC(treatmentMedicationLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentIVLocal), FUNC(treatmentIVLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentCPRLocal), FUNC(treatmentCPRLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentPartialHealLocal), FUNC(treatmentPartialHealLocal)] call CBA_fnc_addEventHandler;
[QGVAR(treatmentFullHealLocal), FUNC(treatmentFullHealLocal)] call CBA_fnc_addEventHandler;
// action events

View File

@ -23,4 +23,4 @@ private _totalDamage = 0;
_totalDamage = _totalDamage + _x;
} forEach (_unit getVariable [QEGVAR(medical,bodyPartDamage), []]);
10 max (_totalDamage * 10) min 180
10 max (_totalDamage * 5) min 180

View File

@ -17,84 +17,52 @@ params ["_caller", "_target"];
if (!alive _target) exitWith {};
private _fullHealLocation = EGVAR(medical,fullHealLocation_PAK);
private _partialHeal = _fullHealLocation > 0; // Full heal not everywhere
_target setVariable [QEGVAR(medical,pain), 0, true];
_target setVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME, true];
if (_partialHeal) then {
private _medFacility = ([_caller] call EFUNC(medical,isInMedicalFacility)) || {[_target] call EFUNC(medical,isInMedicalFacility)};
private _medVeh = ([_caller] call EFUNC(medical,isInMedicalVehicle)) || {[_target] call EFUNC(medical,isInMedicalVehicle)};
switch (_fullHealLocation) do {
case 1: { _partialHeal = !_medFacility; };
case 2: { _partialHeal = !_medVeh; };
case 3: { _partialHeal = !_medFacility && {!_medVeh}; };
};
};
// tourniquets
_target setVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0], true];
_target setVariable [QGVAR(occludedMedications), nil, true];
if (_partialHeal) then {
private _partialHealCounter = _target getVariable [QGVAR(partialHealCounter), 0];
_partialHealCounter = _partialHealCounter + 1;
_target setVariable [QGVAR(partialHealCounter), _partialHealCounter, true];
// wounds and injuries
_target setVariable [QEGVAR(medical,openWounds), [], true];
_target setVariable [QEGVAR(medical,bandagedWounds), [], true];
_target setVariable [QEGVAR(medical,stitchedWounds), [], true];
private _effectiveness = (0 max EGVAR(medical,fieldEffectiveness_PAK) min 1) ^ _partialHealCounter;
private _persistentDamage = 1 - _effectiveness;
// vitals
_target setVariable [QEGVAR(medical,heartRate), 80, true];
_target setVariable [QEGVAR(medical,heartRateAdjustments), [], true];
_target setVariable [QEGVAR(medical,bloodPressure), [80, 120], true];
_target setVariable [QEGVAR(medical,peripheralResistance), 100, true];
_target setVariable [QGVAR(peripheralResistanceAdjustments), [], true];
private _bodyPartDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
_bodyPartDamage = _bodyPartDamage apply {
(_x min _persistentDamage)
};
_target setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
// IVs
_target setVariable [QEGVAR(medical,ivBags), nil, true];
if ((_bodyPartDamage select 4) < 0.3 && {(_bodyPartDamage select 5) < 0.3}) then {
[_unit, false] call EFUNC(medical_engine,setLimping);
};
} else {
_target setVariable [QEGVAR(medical,pain), 0, true];
_target setVariable [QEGVAR(medical,bloodVolume), DEFAULT_BLOOD_VOLUME, true];
// tourniquets
_target setVariable [QEGVAR(medical,tourniquets), [0,0,0,0,0,0], true];
_target setVariable [QGVAR(occludedMedications), nil, true];
// wounds and injuries
_target setVariable [QEGVAR(medical,openWounds), [], true];
_target setVariable [QEGVAR(medical,bandagedWounds), [], true];
_target setVariable [QEGVAR(medical,stitchedWounds), [], true];
// vitals
_target setVariable [QEGVAR(medical,heartRate), 80, true];
_target setVariable [QEGVAR(medical,heartRateAdjustments), [], true];
_target setVariable [QEGVAR(medical,bloodPressure), [80, 120], true];
_target setVariable [QEGVAR(medical,peripheralResistance), 100, true];
_target setVariable [QGVAR(peripheralResistanceAdjustments), [], true];
// IVs
_target setVariable [QEGVAR(medical,ivBags), nil, true];
// damage storage
_target setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true];
// damage storage
_target setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true];
#ifdef DEBUG_TESTRESULTS
_target setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true];
_target setVariable [QEGVAR(medical,bodyPartStatus), [0,0,0,0,0,0], true];
#endif
// generic medical admin
_target setVariable [QEGVAR(medical,inCardiacArrest), false, true];
_target setVariable [QEGVAR(medical,isUnconscious), false, true];
_target setVariable [QEGVAR(medical,hasLostBlood), 0, true];
_target setVariable [QEGVAR(medical,isBleeding), false, true];
_target setVariable [QEGVAR(medical,hasPain), false, true];
_target setVariable [QEGVAR(medical,painSuppress), 0, true];
_target setVariable [QGVAR(painSuppressAdjustments), [], true];
_target setVariable [QGVAR(partialHealCounter), 0, true];
// medication
private _allUsedMedication = _target getVariable [QEGVAR(medical,allUsedMedication), []];
// generic medical admin
_target setVariable [QEGVAR(medical,inCardiacArrest), false, true];
_target setVariable [QEGVAR(medical,isUnconscious), false, true];
_target setVariable [QEGVAR(medical,hasLostBlood), 0, true];
_target setVariable [QEGVAR(medical,isBleeding), false, true];
_target setVariable [QEGVAR(medical,hasPain), false, true];
_target setVariable [QEGVAR(medical,painSuppress), 0, true];
_target setVariable [QGVAR(painSuppressAdjustments), [], true];
_target setVariable [QGVAR(partialHealCounter), 0, true];
{
_target setVariable [_x select 0, nil];
} forEach _allUsedMedication;
// medication
private _allUsedMedication = _target getVariable [QEGVAR(medical,allUsedMedication), []];
[_unit, false] call EFUNC(medical_engine,setLimping);
};
{
_target setVariable [_x select 0, nil];
} forEach _allUsedMedication;
[_unit, false] call EFUNC(medical_engine,setLimping);
// Resetting damage
_target setDamage 0;

View File

@ -0,0 +1,23 @@
/*
* Author: Glowbal
* Partial heal treatment
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
* 2: Body part <STRING>
* 3: Treatment class name <STRING>
* 4: Item <STRING>
*
* Return Value:
* Succesful treatment started <BOOL>
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_caller", "_target"];
[QGVAR(treatmentPartialHealLocal), [_caller, _target], _target] call CBA_fnc_targetEvent;
true

View File

@ -0,0 +1,43 @@
/*
* Author: Glowbal
* Handles partial heal of a patient.
*
* Arguments:
* 0: The medic <OBJECT>
* 1: The patient <OBJECT>
*
* Return Value:
* Succesful treatment started <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_caller", "_target"];
if (!alive _target) exitWith {};
private _partialHealCounter = _target getVariable [QGVAR(partialHealCounter), 0];
_partialHealCounter = _partialHealCounter + 1;
_target setVariable [QGVAR(partialHealCounter), _partialHealCounter, true];
private _healingPower = (0 max (1 - EGVAR(medical,remainingDamage_Medkit)) min 1) ^ _partialHealCounter;
private _damageRemainder = 1 - _healingPower;
private _bodyPartDamage = _target getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
_bodyPartDamage = _bodyPartDamage apply {
(_x min _damageRemainder)
};
_target setVariable [QEGVAR(medical,bodyPartDamage), _bodyPartDamage, true];
if ((_bodyPartDamage select 4) < 0.3 && {(_bodyPartDamage select 5) < 0.3}) then {
[_unit, false] call EFUNC(medical_engine,setLimping);
};
// Resetting damage
_target setDamage 0;
//[QEGVAR(medical,FullHeal), _target] call CBA_fnc_localEvent;
[_target, "activity", ELSTRING(medical,Activity_partialHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog);
[_target, "activity_view", ELSTRING(medical,Activity_partialHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message