Added damage threshold module

Removed debug prints
This commit is contained in:
Thomas Kooi 2015-01-22 23:29:18 +01:00
parent dc1098233e
commit dce0b61d57
18 changed files with 72 additions and 44 deletions

View File

@ -181,12 +181,43 @@ class CfgVehicles
sync[] = {};
};
};
class ACE_moduleDamageSettings: Module_F {
scope = 2;
displayName = "Damage Settings [ACE]";
icon = QUOTE(PATHTOF(data\ACE_medical_module.paa));
category = "ACE_medical";
function = QUOTE(FUNC(moduleDamageSettings));
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;
author = "Glowbal";
class Arguments {
class damageThresholdAI {
displayName = "Damage Threshold AI";
description = "How much damage does it take for an AI to be killed?";
typeName = "NUMBER";
defaultValue = 1;
};
class damageThresholdPlayers {
displayName = "Damage Threshold Players";
description = "How much damage does it take for a player to be killed?";
typeName = "NUMBER";
defaultValue = 1;
};
};
class ModuleDescription {
description = "Custom damage threshold module";
sync[] = {};
};
};
class ACE_moduleAssignMedicRoles: Module_F {
scope = 2;
displayName = "Set Medic Class [ACE]";
icon = QUOTE(PATHTOF(data\ACE_medical_module.paa));
category = "ACE_medical";
function = QUOTE(FUNC(assignMedicRoles));
function = QUOTE(FUNC(moduleAssignMedicRoles));
functionPriority = 10;
isGlobal = 2;
isTriggerActivated = 0;
@ -216,7 +247,7 @@ class CfgVehicles
displayName = "set Medical Vehicle [ACE]";
icon = QUOTE(PATHTOF(data\ACE_medical_module.paa));
category = "ACE_medical";
function = QUOTE(FUNC(assignMedicalVehicle));
function = QUOTE(FUNC(moduleAssignMedicalVehicle));
functionPriority = 10;
isGlobal = 2;
isTriggerActivated = 0;
@ -246,7 +277,7 @@ class CfgVehicles
displayName = "Set Medical Facility [ACE]";
icon = QUOTE(PATHTOF(data\ACE_medical_module.paa));
category = "ACE_medical";
function = QUOTE(FUNC(assignMedicalFacility));
function = QUOTE(FUNC(moduleAssignMedicalFacility));
functionPriority = 10;
isGlobal = 2;
isTriggerActivated = 0;
@ -269,7 +300,7 @@ class CfgVehicles
displayName = "Assign Medical Equipment [ACE]";
icon = QUOTE(PATHTOF(data\ACE_medical_module.paa));
category = "ACE_medical";
function = QUOTE(FUNC(assignMedicalEquipment));
function = QUOTE(FUNC(moduleAssignMedicalEquipment));
functionPriority = 1;
isGlobal = 1;
isTriggerActivated = 0;

View File

@ -240,6 +240,3 @@ ADD_TREATMENT_MEDICATION("STR_ACE_ACTION_EPINEPHRINE","STR_ACE_ACTION_EPINEPHRIN
((vehicle _target != _target));
}, {[_this select 0,_this select 1] call FUNC(actionUnloadUnit)},'drag'] call FUNC(addTreatmentOption);
systemchat format["finished postInit"];
diag_log format["finished postInit"];

View File

@ -93,11 +93,11 @@ PREP(isMedicalVehicle);
PREP(isSetTreatmentMutex);
PREP(isMovingUnit);
PREP(moduleAssignMedicalEquipment);
PREP(moduleAssignMedicalFacility);
PREP(moduleAssignMedicalVehicle);
PREP(moduleAssignMedicRoles);
PREP(moduleDamageSettings);
PREP(onInitForUnit);
PREP(onInjury_assignAirwayStatus);

View File

@ -22,7 +22,7 @@ _content = ["STR_ACE_CHECK_PULSE_CONTENT"];
[_caller, _title, _content] call EFUNC(gui,sendDisplayInformationTo);
_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller];
[2 + round(random(6)),
[2 + round(random(1)),
{((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition
{
private ["_caller","_target"];
@ -37,5 +37,3 @@ _caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller];
}, // on failure
[_caller, _target] // arguments
] call EFUNC(gui,loadingBar);
systemChat format["actionCheckPulse: %1", _this];

View File

@ -22,7 +22,7 @@ _content = ["STR_ACE_CHECK_BLOODPRESSURE_CONTENT"];
[_caller, _title, _content] call EFUNC(gui,sendDisplayInformationTo);
_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller];
[2 + round(random(4)),
[2 + round(random(1)),
{((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition
{
private ["_caller","_target"];

View File

@ -14,7 +14,6 @@ private ["_caller","_unit", "_heartRateOutput", "_heartRate","_logOutPut", "_tit
_caller = _this select 0;
_unit = _this select 1;
systemChat format["called check pulse: %1", _this];
_heartRate = [_unit,QGVAR(heartRate)] call EFUNC(common,getDefinedVariable);
if (!alive _unit) then {
@ -50,6 +49,3 @@ _content = ["STR_ACE_CHECK_PULSE_CHECKED_MEDIC",_heartRateOutput];
if (_logOutPut != "") then {
[_unit,"examine",format["%1 checked Heart Rate: %2",[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToQuickViewLog);
};
systemChat format["completed check pulse: %1 %2 %3 %4", _this, _logOutPut, _title, _content];
diag_log format["completed check pulse: %1 %2 %3 %4", _this, _logOutPut, _title, _content];

View File

@ -22,7 +22,7 @@ _content = ["STR_ACE_CHECK_RESPONSE_CONTENT"];
[_caller, _title, _content] call EFUNC(gui,sendDisplayInformationTo);
_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller];
[2 + round(random(2)),
[2 + round(random(1)),
{((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition
{
private ["_caller","_target", "_output", "_title", "_content"];

View File

@ -26,6 +26,4 @@ if ([_unit] call FUNC(hasMedicalEnabled)) then {
};
if (_unit in GVAR(injuredUnitCollection)) exitwith {};
GVAR(injuredUnitCollection) pushback _unit;
} else {
systemChat format["has no medical system enabled: %1",_unit];
};

View File

@ -16,8 +16,6 @@ _unit = _this select 0;
_type = _this select 1;
_message = _this select 2;
systemChat format["Added event to quick view: %1", _this];
if (!local _unit) exitwith {
[_this, QUOTE(FUNC(addToQuickViewLog)), _unit] call EFUNC(common,execRemoteFnc);
};

View File

@ -10,8 +10,6 @@
#include "script_component.hpp"
#define DEFAULT_DAMAGE_THRESHOLD 1
private ["_unit","_part","_damageThreshold"];
_unit = _this select 0;
_part = _this select 1;

View File

@ -10,8 +10,6 @@
#include "script_component.hpp"
#define ARMOURCOEF 2
private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage", "_typeOfProjectile","_bodyPartn","_newDamage","_typeOfDamage","_caliber", "_hitPointName", "_returnDamage", "_varCheck"];
_unit = _this select 0;
_selectionName = _this select 1;
@ -43,23 +41,22 @@ if (isNull _sourceOfDamage && (_selectionName == "head" || isBurning _unit) && _
0
}; // Prefent excessive fire damage
// Ensure damage is being handled correctly.
_newDamage = [_unit, _amountOfDamage, _bodyPartn] call FUNC(getNewDamageBodyPart);
[_unit] call FUNC(setDamageBodyPart);
if ([_unit] call FUNC(hasMedicalEnabled)) then {
_returnDamage = 0;
if (_amountOfDamage < 0) then {
_amountOfDamage = 0;
};
// Ensure damage is being handled correctly.
_newDamage = [_unit, _amountOfDamage, _bodyPartn] call FUNC(getNewDamageBodyPart);
[_unit] call FUNC(setDamageBodyPart);
// figure out the type of damage so we can use that to determine what injures should be given.
_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage);
[_unit, _newDamage, _typeOfDamage, _bodyPartn] call FUNC(onInjury_assignOpenWounds);
if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) > 0) then {
//[_unit,_newDamage,_typeOfDamage,_bodyPartn] call FUNC(onInjury_assignFractures);
if (GVAR(setting_allowAirwayInjuries)) then {
[_unit, _amountOfDamage, _typeOfDamage, _bodyPartn] call FUNC(onInjury_assignAirwayStatus);
};
@ -84,7 +81,13 @@ if ([_unit] call FUNC(hasMedicalEnabled)) then {
};
["Medical_onHandleDamage", _this] call ace_common_fnc_localEvent;
} else {
// handle damage thresholds
if (_returnDamage > 0.957) then {
_returnDamage = 0.957;
};
if (([_unit, _bodyPartn] call FUNC(determineIfFatal)) || !(alive (vehicle _unit))) then {
[_unit] call FUNC(setDead);
_returnDamage = 1;
};
};
_returnDamage
_returnDamage;

View File

@ -11,9 +11,6 @@
#include "script_component.hpp"
diag_log format["handleTreatment has been called - args: %1 ",_this];
systemChat format["handleTreatment has been called - args: %1 ",_this];
private ["_treatingPerson","_injuredPerson","_selectionName","_removeItem","_attributes","_patient", "_continue", "_prevAnim"];
_caller = _this select 0;
_target = _this select 1;

View File

@ -16,8 +16,6 @@ _target = _this select 1;
_selectionName = _this select 2;
_removeItem = _this select 3;
systemChat format ["Local bandage: %1",_this];
// TODO figure this out later on
//_selectedData = [_this, 4, "", [""]] call BIS_fnc_Param;

View File

@ -16,8 +16,6 @@ _target = _this select 1;
_selectionName = _this select 2;
_removeItem = _this select 3;
systemChat format["fnc_handleTreatment_Action_tourniquet %1", _this];
_part = [_selectionName] call FUNC(getBodyPartNumber);
if (_part == 0 || _part == 1) exitwith {
[_caller,"You cannot apply a CAT on this body part!"] call EFUNC(common,sendHintTo);

View File

@ -11,7 +11,7 @@
#include "script_component.hpp"
private ["_unit","_eyePos","_objects","_isInBuilding","_medicalFacility"];
_unit = [_this, 0, ObjNull, [ObjNull]] call BIS_fnc_Param;
_unit = _this select 0;
_eyePos = eyePos _unit;
_isInBuilding = false;

View File

@ -0,0 +1,20 @@
/**
* fnc_moduleDamageSettings.sqf
* @Descr: N/A
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: false
*/
#include "script_component.hpp"
private ["_logic","_setting","_objects"];
_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (!isNull _logic) then {
GVAR(damageThreshold_AI) = _logic getvariable ["damageThresholdAI", 1];
GVAR(damageThreshold_Players) = _logic getvariable ["damageThresholdPlayers", 1];
};
true

View File

@ -13,9 +13,6 @@
private ["_unit","_handler"];
_unit = _this select 0;
systemChat format["Initalizing CMS for %1", _this];
diag_log format["Initalizing CMS for %1", _this];
if (!local _unit) exitwith {};
if !(_unit isKindOf "CAManBase") exitwith{};

View File

@ -35,7 +35,6 @@ _display = _this select 0; //uiNamespace getVariable QGVAR(medicalMenu);
if (isnil "_display") exitwith {
};
systemChat format["onMenuOpen: %1", _this];
(_display displayCtrl 11) ctrlSetTooltip localize "STR_ACE_UI_VIEW_TRIAGE_CARD";
(_display displayCtrl 12) ctrlSetTooltip localize "STR_ACE_UI_EXAMINE_PATIENT";