Skip to content
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

Conversion - Allows for Conversion of Player Patients to AI Patients #686

Open
wants to merge 30 commits into
base: dev-Tomcat
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b312e6b
Start
mazinskihenry Jan 11, 2025
2360b79
Working?
mazinskihenry Jan 11, 2025
0bf1fef
Pulling hairs
mazinskihenry Jan 11, 2025
aa72614
Ticket/Lib Supply Conversion
mazinskihenry Jan 12, 2025
010fd88
Extension
mazinskihenry Jan 12, 2025
f89b676
Diag_log remove
mazinskihenry Jan 12, 2025
234172d
Mechanics
mazinskihenry Jan 12, 2025
8dd8144
Update stringtable.xml
mazinskihenry Jan 12, 2025
6f2b196
Headers
mazinskihenry Jan 12, 2025
f411965
Update fnc_handleUnitVitals.sqf
mazinskihenry Jan 12, 2025
a0d0d73
Errors
mazinskihenry Jan 12, 2025
218b85e
Merge branch 'Role_Two' of https://github.com/mazinskihenry/KAM into …
mazinskihenry Jan 12, 2025
4fb4d00
Update stringtable.xml
mazinskihenry Jan 12, 2025
c99d9f1
Update fnc_handleUnitVitals.sqf
mazinskihenry Jan 12, 2025
5d8768e
One Life Conversion
mazinskihenry Jan 12, 2025
c2bdda8
Redo Config
mazinskihenry Jan 13, 2025
846f3fc
Its broken again
mazinskihenry Jan 13, 2025
ce56b12
Update fnc_KATConditionExecutionDeath.sqf
mazinskihenry Jan 13, 2025
eeccf2e
Working again
mazinskihenry Jan 13, 2025
4375982
Add option to disable text
mazinskihenry Jan 13, 2025
5f143f8
Add distance for libConversion and one life options
mazinskihenry Jan 13, 2025
e59b2d2
Delete fnc_spectatorRespawn.sqf
mazinskihenry Jan 13, 2025
7c7ed1d
Update XEH_PREP.hpp
mazinskihenry Jan 13, 2025
30950d3
Update fnc_manualConversionCondition.sqf
mazinskihenry Jan 15, 2025
5ff9f09
Update addons/conversion/ACE_Medical_Treatment_Actions.hpp
mazinskihenry Jan 17, 2025
e0f2a16
Update addons/conversion/ACE_Medical_Treatment_Actions.hpp
mazinskihenry Jan 17, 2025
3fa54b9
Review
mazinskihenry Jan 17, 2025
6c70041
Merge branch 'Role_Two' of https://github.com/mazinskihenry/KAM into …
mazinskihenry Jan 17, 2025
3493372
Shift statemachine to seperate addon
mazinskihenry Jan 17, 2025
bd83366
Update fnc_handleUnitVitals.sqf
mazinskihenry Jan 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/conversion/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x\kat\addons\conversion
15 changes: 15 additions & 0 deletions addons/conversion/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class ACE_Medical_Treatment_Actions {
class CheckPulse;
class BasicBandage;
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);
};
};
20 changes: 20 additions & 0 deletions addons/conversion/CfgEventHandlers.hpp
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));
};
};
10 changes: 10 additions & 0 deletions addons/conversion/CfgFunctions.hpp
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);
};
};
};
};
21 changes: 21 additions & 0 deletions addons/conversion/CfgVehicles.hpp
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);
};
};
};
};
};
15 changes: 15 additions & 0 deletions addons/conversion/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PREP(conversionCheck);
PREP(conversionCondition);
PREP(fullHealLocal);
PREP(handleRespawn);
PREP(init);
PREP(KATConditionExecutionDeath);
PREP(KATConditionSecondChance);
PREP(libConversion);
PREP(libConversionCondition);
PREP(libConversionDistance);
PREP(manualConversion);
PREP(manualConversionCondition);
PREP(setDead);
PREP(ticketConversion);
PREP(ticketConversionCondition);
50 changes: 50 additions & 0 deletions addons/conversion/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#include "script_component.hpp"

[QEGVAR(misc,handleRespawn), LINKFUNC(handleRespawn)] call CBA_fnc_addEventHandler;
[QACEGVAR(medical_treatment,fullHealLocalMod), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler;

["kat_conversion_convertCasualty", {
private _type = typeOf player;
private _group = createGroup [(side player), true];
private _previousUnit = player;
private _setName = name _previousUnit;
private _loadout = getUnitLoadout player;
private _unit = _group createUnit [_type, [0,0,0], [], 0, "NONE"];
_unit setUnitLoadout _loadout;

_previousUnit setVariable [QEGVAR(vitals,simpleMedical), false, true];
_previousUnit setVariable [QGVAR(currentConverted), true, true];

selectPlayer _unit;

["kat_conversion_unitTransfer", [_previousUnit]] call CBA_fnc_serverEvent;

_previousUnit setName _setName;

forceRespawn player;
deleteVehicle _unit;
}] call CBA_fnc_addEventHandler;

["kat_conversion_unitTransfer", {
params ["_previousUnit"];
private _group2 = createGroup [(side _previousUnit), true];
[_previousUnit] join _group2;
_group2 setGroupOwner 2;
[_previousUnit, true] call ACEFUNC(medical,setUnconscious);
}] call CBA_fnc_addEventHandler;

["kat_conversion_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;
142 changes: 142 additions & 0 deletions addons/conversion/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#include "script_component.hpp"

ADDON = false;

PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#define CBA_SETTINGS_CAT "KAT - ADV Medical: Conversion"

[
QGVAR(enable),
"CHECKBOX",
[LLSTRING(CONVERSION_ENABLE), LLSTRING(CONVERSION_ENABLE_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;

[
QGVAR(enableConversionMessage),
"CHECKBOX",
[LLSTRING(CONVERSION_MESSAGE), LLSTRING(CONVERSION_MESSAGE_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;

[
QGVAR(enableTicketConversion),
"CHECKBOX",
[LLSTRING(CONVERSION_TICKET_CONVERSION), LLSTRING(CONVERSION_TICKET_CONVERSION_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;

[
QGVAR(ticketConversionGain),
"SLIDER",
[LLSTRING(CONVERSION_TICKET_CONVERSION_GAIN), LLSTRING(CONVERSION_TICKET_CONVERSION_GAIN_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[0, 10, 3, 0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(enableLiberationConversion),
"CHECKBOX",
[LLSTRING(CONVERSION_LIBERATION_CONVERSION), LLSTRING(CONVERSION_LIBERATION_CONVERSION_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;

[
QGVAR(enableLiberationConversionGain),
"SLIDER",
[LLSTRING(CONVERSION_LIBERATION_CONVERSION_GAIN), LLSTRING(CONVERSION_LIBERATION_CONVERSION_GAIN_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[0, 100, 50, 0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(enableLiberationConversionDistance),
"SLIDER",
[LLSTRING(CONVERSION_LIBERATION_CONVERSION_DISTANCE), LLSTRING(CONVERSION_LIBERATION_CONVERSION_DISTANCE_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[0, 5000, 1000, 0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(enableSpectatorRespawn),
"CHECKBOX",
[LLSTRING(CONVERSION_SPECTATOR_RESPAWN), LLSTRING(CONVERSION_SPECTATOR_RESPAWN_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;

[
QGVAR(forceVehicleConversion),
"CHECKBOX",
[LLSTRING(CONVERSION_FORCE_VEHICLE), LLSTRING(CONVERSION_FORCE_VEHICLE_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;

[
QGVAR(convertVehicles),
"EDITBOX",
[LLSTRING(CONVERSION_FORCE_VEHICLE_LIST), LLSTRING(CONVERSION_FORCE_VEHICLE_LIST_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
"'kat_stretcher'",
1,
{
private _array = [_this, "CfgVehicles"] call EFUNC(chemical,getList);
missionNamespace setVariable [QGVAR(convertVehicles), _array, true];
},
true
] call CBA_Settings_fnc_init;

[
QGVAR(allowManualConversion),
"CHECKBOX",
[LLSTRING(CONVERSION_MANUAL_CONVERSION), LLSTRING(CONVERSION_MANUAL_CONVERSION_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[false],
true
] call CBA_Settings_fnc_init;

[
QGVAR(manualConversionLevel),
"LIST",
[LLSTRING(CONVERSION_MANUAL_CONVERSION_LEVEL), LLSTRING(CONVERSION_MANUAL_CONVERSION_LEVEL_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[[0, 1, 2], ["STR_ACE_Medical_Treatment_Anyone", "STR_ACE_Medical_Treatment_Medics", "STR_ACE_Medical_Treatment_Doctors"], 0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(manualConversionLocation),
"LIST",
[LLSTRING(CONVERSION_MANUAL_CONVERSION_LOCATION), LLSTRING(CONVERSION_MANUAL_CONVERSION_LOCATION_DESC)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[[0,1,2,3],["STR_ACE_Common_Anywhere", "STR_ACE_Common_Vehicle", "STR_ACE_Medical_Treatment_MedicalFacilities", "STR_ACE_Medical_Treatment_VehiclesAndFacilities"],0],
true
] call CBA_Settings_fnc_init;

[
QGVAR(manualConversionTime),
"SLIDER",
[LLSTRING(CONVERSION_LIBERATION_CONVERSION_TIME)],
[CBA_SETTINGS_CAT, ELSTRING(GUI,SubCategory_Basic)],
[0, 60, 15, 0],
true
] call CBA_Settings_fnc_init;

ADDON = true;
35 changes: 35 additions & 0 deletions addons/conversion/config.cpp
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
@@ -1,8 +1,8 @@
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut
* Modified: Blue
* Condition for an execution caused death (fatal injury received in cardiac arrest).
* Author: mharis001
* Edited: Blue, Mazinski.H
* Condition for going into cardiac arrest upon receiving a fatal injury.
*
* Arguments:
* 0: Unit <OBJECT>
Expand All @@ -11,16 +11,16 @@
* None
*
* Example:
* [player] call ace_medical_statemachine_fnc_conditionExecutionDeath
* [player] call kat_conversion_fnc_conditionSecondChance
*
* Public: No
*/

params ["_unit"];

(if (isPlayer _unit) then {
(if (isPlayer _unit || (GET_CONVERT_STATUS(_unit) && LIB_CONVERSION_DISTANCE(_unit))) then {
ACEGVAR(medical_statemachine,fatalInjuriesPlayer) != FATAL_INJURIES_NEVER
} else {
(ACEGVAR(medical_statemachine,fatalInjuriesAI) != FATAL_INJURIES_NEVER) && {!(_unit getVariable [QGVAR(PreventInstantAIDeath), false])}
(ACEGVAR(medical_statemachine,fatalInjuriesAI) != FATAL_INJURIES_NEVER) && {!(_unit getVariable [QEGVAR(misc,PreventInstantAIDeath), false])}
})
&& {!(_unit getVariable [QACEGVAR(medical,deathBlocked), false])}
&& {!(_unit getVariable [QACEGVAR(medical,deathBlocked), false])}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: mharis001
* Modified: Blue
* Edited: Blue, Mazinski.H
* Condition for going into cardiac arrest upon receiving a fatal injury.
*
* Arguments:
Expand All @@ -11,15 +11,15 @@
* None
*
* Example:
* [player] call ace_medical_statemachine_fnc_conditionSecondChance
* [player] call kat_conversion_fnc_conditionSecondChance
*
* Public: No
*/

params ["_unit"];

if (isPlayer _unit) then {
if (isPlayer _unit || (GET_CONVERT_STATUS(_unit) && LIB_CONVERSION_DISTANCE(_unit))) then {
ACEGVAR(medical_statemachine,fatalInjuriesPlayer) != FATAL_INJURIES_ALWAYS
} else {
ACEGVAR(medical_statemachine,fatalInjuriesAI) != FATAL_INJURIES_ALWAYS || {_unit getVariable [QGVAR(PreventInstantAIDeath), false]}
};
ACEGVAR(medical_statemachine,fatalInjuriesAI) != FATAL_INJURIES_ALWAYS || {_unit getVariable [QEGVAR(misc,PreventInstantAIDeath), false]}
}
Loading
Loading