#1259 - Medical Locations Boost Training

This commit is contained in:
PabstMirror 2016-01-09 23:54:48 -06:00
parent 0397b3f9f4
commit c2f780e95f
7 changed files with 51 additions and 13 deletions

View File

@ -11,6 +11,13 @@ class ACE_Settings {
typeName = "SCALAR";
values[] = {"Disabled", "Normal", "Advanced"};
};
class GVAR(increaseTrainingInLocations) {
category = CSTRING(Category_Medical);
displayName = CSTRING(MedicalSettings_increaseTrainingInLocations_DisplayName);
description = CSTRING(MedicalSettings_increaseTrainingInLocations_Description);
value = 0;
typeName = "BOOL";
};
class GVAR(enableFor) {
category = CSTRING(Category_Medical);
value = 0;

View File

@ -58,6 +58,12 @@ class CfgVehicles {
};
};
};
class increaseTrainingInLocations {
displayName = CSTRING(MedicalSettings_increaseTrainingInLocations_DisplayName);
description = CSTRING(MedicalSettings_increaseTrainingInLocations_Description);
typeName = "BOOL";
defaultValue = 0;
};
class allowLitterCreation {
displayName = CSTRING(MedicalSettings_allowLitterCreation_DisplayName);
description = CSTRING(MedicalSettings_allowLitterCreation_Description);

View File

@ -8,18 +8,23 @@
* ReturnValue:
* Is in medical facility <BOOL>
*
* Example:
* [player] call ace_medical_fnc_isInMedicalFacility
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_eyePos", "_objects", "_isInBuilding", "_medicalFacility"];
params ["_unit"];
_eyePos = eyePos _unit;
_isInBuilding = false;
//Cache the results as this function could be called rapidly
(_unit getVariable [QGVAR(cacheInFacility), [-9, false]]) params ["_expireTime", "_lastResult"];
if (ACE_time < _expireTime) exitWith {_lastResult};
_medicalFacility =
private _eyePos = eyePos _unit;
private _isInBuilding = false;
private _medicalFacility =
[
"TK_GUE_WarfareBFieldhHospital_Base_EP1",
"TK_GUE_WarfareBFieldhHospital_EP1",
@ -37,18 +42,22 @@ _medicalFacility =
"USMC_WarfareBFieldhHospital"
];
_objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]);
private _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]);
{
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitWith {
_isInBuilding = true;
};
} forEach _objects;
if (!_isInBuilding) then {
_objects = position _unit nearObjects 7.5;
_objects = _unit nearObjects 7.5;
{
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitWith {
_isInBuilding = true;
};
} forEach _objects;
};
//Save the results (with a 1 second expiry)
_unit setVariable [QGVAR(cacheInFacility), [ACE_time + 1, _isInBuilding]];
_isInBuilding;

View File

@ -8,14 +8,15 @@
* Return Value:
* Is unit in medical vehicle? <BOOL>
*
* Example:
* [player] call ace_medical_fnc_isInMedicalVehicle
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_vehicle"];
params ["_unit"];
_vehicle = vehicle _unit;
private _vehicle = vehicle _unit;
if (_unit == _vehicle) exitWith {false};
if (_unit in [driver _vehicle, gunner _vehicle, commander _vehicle]) exitWith {false};

View File

@ -9,15 +9,23 @@
* ReturnValue:
* Is in of medic class <BOOL>
*
* Example:
* [player] call ace_medical_fnc_isMedic
*
* Public: Yes
*/
#include "script_component.hpp"
private ["_unit", "_class", "_medicN"];
params ["_unit", ["_medicN", 1]];
_class = _unit getVariable [QGVAR(medicClass),
getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")];
private _class = _unit getVariable [QGVAR(medicClass), getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "attendant")];
if (_class >= _medicN min GVAR(medicSetting)) exitWith {true};
if (!GVAR(increaseTrainingInLocations)) exitWith {false};
if (([_unit] call FUNC(isInMedicalVehicle)) || {[_unit] call FUNC(isInMedicalFacility)}) then {
_class = _class + 1; //boost by one: untrained becomes medic, medic becomes doctor
};
_class >= _medicN min GVAR(medicSetting)

View File

@ -21,6 +21,7 @@ if !(_activated) exitWith {};
[_logic, QGVAR(level), "level"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(medicSetting), "medicSetting"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(increaseTrainingInLocations), "increaseTrainingInLocations"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(allowLitterCreation), "allowLitterCreation"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(litterCleanUpDelay), "litterCleanUpDelay"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(enableScreams), "enableScreams"] call EFUNC(common,readSettingFromModule);

View File

@ -2835,6 +2835,12 @@
<French>Quel niveau de détail voullez vous pour les infirmier?</French>
<Hungarian>Mi a javasolt részletesség orvosok számára?</Hungarian>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_increaseTrainingInLocations_DisplayName">
<English>Locations boost training</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_increaseTrainingInLocations_Description">
<English>Boost medic rating in medical vehicles or near medical facilities [untrained becomes medic, medic becomes doctor]</English>
</Key>
<Key ID="STR_ACE_Medical_MedicalSettings_medicSetting_disable">
<English>Disable medics</English>
<Russian>Отключить медиков</Russian>