-
Notifications
You must be signed in to change notification settings - Fork 108
Conversion - Allows for Conversion of Player Patients to AI Patients #686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev-Tomcat
Are you sure you want to change the base?
Changes from all commits
b312e6b
2360b79
0bf1fef
aa72614
010fd88
f89b676
234172d
8dd8144
6f2b196
f411965
a0d0d73
218b85e
4fb4d00
c99d9f1
5d8768e
c2bdda8
846f3fc
ce56b12
eeccf2e
4375982
5f143f8
e59b2d2
7c7ed1d
30950d3
5ff9f09
e0f2a16
3fa54b9
6c70041
3493372
bd83366
2688fee
ee826bd
7c48285
a018e1e
85f588e
7486c92
cb18c68
2fd12c6
c02ce5a
84144b7
16f0b80
be8e2ab
a7cb839
826a60c
07369ed
030b2ed
2aa8d70
ee3cb70
406273c
4b55167
981e940
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| x\kat\addons\conversion |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| class ACE_Medical_Treatment_Actions { | ||
| class CheckPulse; | ||
| class ConvertPatient: CheckPulse { | ||
| displayName = CSTRING(convertPatient); | ||
| displayNameProgress = CSTRING(converting); | ||
| condition = QFUNC(manualConversionCondition); | ||
| medicRequired = QGVAR(manualConversionLevel); | ||
| treatmentLocations = QGVAR(manualConversionLocation); | ||
| treatmentTime = QGVAR(manualConversionTime); | ||
| allowedSelections[] = {"All"}; | ||
| items[] = {""}; | ||
| callbackSuccess = QFUNC(manualConversion); | ||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| class Extended_PreInit_EventHandlers { | ||
| class ADDON { | ||
| init = QUOTE(call COMPILE_FILE(XEH_preInit)); | ||
| disableModuload = "true"; | ||
| }; | ||
| }; | ||
|
|
||
| class Extended_Init_EventHandlers { | ||
| class CAManBase { | ||
| class ADDON { | ||
| init = QUOTE([ARR_2((_this select 0),false)] call FUNC(init)); | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| class Extended_PostInit_EventHandlers { | ||
| class ADDON { | ||
| init = QUOTE(call COMPILE_FILE(XEH_postInit)); | ||
| }; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| class CfgFunctions { | ||
| class overwrite_ace_medical_status { | ||
| tag = "ace_medical_status"; | ||
| class ace_medical_status { | ||
| class setDead { | ||
| file = QPATHTOF(functions\fnc_setDead.sqf); | ||
| }; | ||
| }; | ||
| }; | ||
| }; |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't get why these are ace actions, just make them medical menu actions like manual conversion. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| class CfgVehicles { | ||
| class Man; | ||
| class CAManBase: Man { | ||
| class ACE_Actions { | ||
| class ACE_MainActions { | ||
| class KAT_TicketConversion { | ||
| displayName = CSTRING(TicketConversion); | ||
| condition = QUOTE(_target call FUNC(ticketConversionCondition)); | ||
| statement = QUOTE(_target call FUNC(ticketConversion)); | ||
| icon = QACEPATHTOF(medical_gui,ui\cross.paa); | ||
| }; | ||
| class KAT_LibConversion { | ||
| displayName = CSTRING(LibConversion); | ||
| condition = QUOTE(_target call FUNC(libConversionCondition)); | ||
| statement = QUOTE(_target call FUNC(libConversion)); | ||
| icon = QACEPATHTOF(medical_gui,ui\cross.paa); | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| PREP(conversionCheck); | ||
| PREP(conversionCondition); | ||
| PREP(fullHealLocal); | ||
| PREP(gui_updateInjuryListPart); | ||
| PREP(handleRespawn); | ||
| PREP(init); | ||
| PREP(KATConditionExecutionDeath); | ||
| PREP(KATConditionSecondChance); | ||
| PREP(libConversion); | ||
| PREP(libConversionCondition); | ||
| PREP(libConversionDistance); | ||
| PREP(manualConversion); | ||
| PREP(manualConversionCondition); | ||
| PREP(setDead); | ||
| PREP(ticketConversion); | ||
| PREP(ticketConversionCondition); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||
| #include "script_component.hpp" | ||||||
|
|
||||||
| [QEGVAR(misc,handleRespawn), LINKFUNC(handleRespawn)] call CBA_fnc_addEventHandler; | ||||||
| [QACEGVAR(medical_treatment,fullHealLocalMod), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler; | ||||||
| [QACEGVAR(medical_gui,updateInjuryListPart), LINKFUNC(gui_updateInjuryListPart)] call CBA_fnc_addEventHandler; | ||||||
|
|
||||||
| [QGVAR(convertCasualty), { | ||||||
| private _type = typeOf player; | ||||||
| private _group = createGroup [(side player), true]; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
side player on an uncon player returns CIV, not the original side |
||||||
| private _previousUnit = player; | ||||||
| private _setName = name _previousUnit; | ||||||
| private _loadout = [player] call CBA_fnc_getLoadout; | ||||||
| private _unit = _group createUnit [_type, [0,0,0], [], 0, "NONE"]; | ||||||
| [player, _loadout] call CBA_fnc_setLoadout; | ||||||
|
|
||||||
| _previousUnit setVariable [QEGVAR(vitals,simpleMedical), false, true]; | ||||||
| _previousUnit setVariable [QGVAR(currentConverted), true, true]; | ||||||
|
|
||||||
| selectPlayer _unit; | ||||||
|
|
||||||
| [QGVAR(unitTransfer), [_previousUnit]] call CBA_fnc_serverEvent; | ||||||
|
|
||||||
| _previousUnit setName _setName; | ||||||
|
|
||||||
| forceRespawn player; | ||||||
| deleteVehicle _unit; | ||||||
| }] call CBA_fnc_addEventHandler; | ||||||
|
|
||||||
| [QGVAR(unitTransfer), { | ||||||
| params ["_previousUnit"]; | ||||||
| private _group2 = createGroup [(side _previousUnit), true]; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Same as above |
||||||
| [_previousUnit] join _group2; | ||||||
| _group2 setGroupOwner 2; | ||||||
| [_previousUnit, true] call ACEFUNC(medical,setUnconscious); | ||||||
| }] call CBA_fnc_addEventHandler; | ||||||
|
|
||||||
| [QGVAR(respawnTimer), { | ||||||
| params ["_time"]; | ||||||
| private _currentRespawnTime = playerRespawnTime; | ||||||
| setPlayerRespawnTime _time; | ||||||
| _currentUnit = player; | ||||||
|
|
||||||
| [{ | ||||||
| params ["_currentUnit"]; | ||||||
|
|
||||||
| (lifeState _currentUnit isEqualTo "HEALTHY") | ||||||
| }, { | ||||||
| params [_currentRespawnTime]; | ||||||
| setPlayerRespawnTime _currentRespawnTime; | ||||||
| }, [_currentUnit, _currentRespawnTime], 360, {}] call CBA_fnc_waitUntilAndExecute; | ||||||
| }] call CBA_fnc_addEventHandler; | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #include "script_component.hpp" | ||
|
|
||
| ADDON = false; | ||
|
|
||
| PREP_RECOMPILE_START; | ||
| #include "XEH_PREP.hpp" | ||
| PREP_RECOMPILE_END; | ||
|
|
||
| #define CBA_SETTINGS_CAT LSTRING(cba_name) | ||
| #include "initSettings.inc.sqf" | ||
|
|
||
| ADDON = true; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #include "script_component.hpp" | ||
|
|
||
| class CfgPatches { | ||
| class ADDON { | ||
| name = COMPONENT_NAME; | ||
| requiredVersion = REQUIRED_VERSION; | ||
| units[] = {}; | ||
| weapons[] = {}; | ||
| magazines[] = {}; | ||
| requiredAddons[] = { | ||
| "ace_medical", | ||
| "ace_medical_ai", | ||
| "ace_medical_blood", | ||
| "ace_medical_damage", | ||
| "ace_medical_engine", | ||
| "ace_medical_feedback", | ||
| "ace_medical_gui", | ||
| "ace_medical_statemachine", | ||
| "ace_medical_status", | ||
| "ace_medical_treatment", | ||
| "ace_medical_vitals", | ||
| "ace_dogtags", | ||
| "cba_settings" | ||
| }; | ||
| author = "Mazinski"; | ||
| authors[] = {"Mazinski"}; | ||
| url = ECSTRING(main,URL); | ||
| VERSION_CONFIG; | ||
| }; | ||
| }; | ||
|
|
||
| #include "CfgEventHandlers.hpp" | ||
| #include "CfgFunctions.hpp" | ||
| #include "CfgVehicles.hpp" | ||
| #include "ACE_Medical_Treatment_Actions.hpp" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Author: Mazinski | ||
| * Condition for automatic conversion | ||
| * | ||
| * Arguments: | ||
| * 0: Unit <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * None | ||
| * | ||
| * Example: | ||
| * [player] call kat_conversion_conversionCheck | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_unit"]; | ||
|
|
||
| if ((!(ACEGVAR(medical_statemachine,AIUnconsciousness))) && (!isPlayer _unit) && LIB_CONVERSION_DISTANCE(_unit)) then { | ||
| GET_CONVERT_STATUS(_unit) != true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Author: Mazinski | ||
| * Check if a unit is in a stable state for resource conversion | ||
| * | ||
| * Arguments: | ||
| * 0: The patient <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * Has no critical health conditions <BOOL> | ||
| * | ||
| * Example: | ||
| * [player] call kat_conversion_conversionCondition | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_unit"]; | ||
|
|
||
| private _bloodVolume = GET_BLOOD_VOLUME_LITERS(_unit); | ||
| if (_bloodVolume < ACEGVAR(medical,const_stableVitalsBloodThreshold)) exitWith { false }; | ||
|
|
||
| if IN_CRDC_ARRST(_unit) exitWith { false }; | ||
|
|
||
| private _bloodPressure = GET_BLOOD_PRESSURE(_unit); | ||
| _bloodPressure params ["_bloodPressureL", "_bloodPressureH"]; | ||
| if (_bloodPressureL < 50 || {_bloodPressureH < 60}) exitWith { false }; | ||
|
|
||
| private _heartRate = GET_HEART_RATE(_unit); | ||
| if (_heartRate < 70 || _heartRate > 100) exitWith { false }; | ||
|
|
||
| private _o2 = GET_KAT_SPO2(_unit); | ||
| if (_o2 < EGVAR(breathing,Stable_spo2)) exitWith { false }; | ||
|
|
||
| private _fractures = _unit getVariable [QEGVAR(surgery,fractures), [0,0,0,0,0,0]]; | ||
| if (({_x == 0} count _fracture) != 6) exitWith { false }; | ||
|
|
||
| true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Author: MiszczuZPolski | ||
| * Local callback for fully healing a patient. | ||
| * | ||
| * Arguments: | ||
| * 0: Patient <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * None | ||
| * | ||
| * Example: | ||
| * [player] call kat_conversion_fnc_fullHealLocal | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_patient"]; | ||
|
|
||
| if (hasInterface && GVAR(enable)) then { | ||
| _patient setVariable [QGVAR(convert), true, true]; | ||
| }; | ||
|
|
||
| _patient setVariable [QGVAR(currentConverted), false, true]; | ||
| _patient setVariable [QGVAR(associatedPlayer), player, true]; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Author: MiszczuZPolski | ||
| * Updates injury list for given body part for the target. | ||
| * | ||
| * Arguments: | ||
| * 0: Injury list <CONTROL> | ||
| * 1: Target <OBJECT> | ||
| * 2: Body part, -1 to only show overall health info <NUMBER> | ||
| * 3: Entries <ARRAY> | ||
| * | ||
| * Return Value: | ||
| * None | ||
| * | ||
| * Example: | ||
| * [_ctrlInjuries, _target, 0] call kat_conversion_fnc_gui_updateInjuryListPart | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_ctrl", "_target", "_selectionN", "_entries"]; | ||
|
|
||
| if (_target getVariable [QGVAR(currentConverted), false] && GVAR(enableConversionMessage)) then { | ||
| _entries pushBack [LLSTRING(ConversionText), [0.35, 0.72, 0.82, 1]]; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include "..\script_component.hpp" | ||
| /* | ||
| * Author: MiszczuZPolski | ||
| * Local callback for fully healing a patient. | ||
| * | ||
| * Arguments: | ||
| * 0: Patient <OBJECT> | ||
| * | ||
| * Return Value: | ||
| * None | ||
| * | ||
| * Example: | ||
| * [player] call kat_conversion_fnc_handleRespawn | ||
| * | ||
| * Public: No | ||
| */ | ||
|
|
||
| params ["_patient"]; | ||
|
|
||
| [_patient] call FUNC(fullHealLocal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.