Merge branch 'Event-hanlder-replacement' of https://github.com/lambdatiger/ace_frag-overhaul into Event-hanlder-replacement

This commit is contained in:
lambdatiger 2024-07-29 21:33:37 -05:00
commit 4d79e93b4c
128 changed files with 1727 additions and 1318 deletions

View File

@ -85,10 +85,10 @@ private _insigniaCondition = toString {
// Ref fnc_addListBoxItem, 0/nil = configFile, 1 = campaignConfigFile, 2 = missionConfigFile
{
GVAR(insigniaCache) set [_x, 1];
GVAR(insigniaCache) set [configName _x, 1];
} forEach (_insigniaCondition configClasses (campaignConfigFile >> "CfgUnitInsignia"));
{
GVAR(insigniaCache) set [_x, 2];
GVAR(insigniaCache) set [configName _x, 2];
} forEach (_insigniaCondition configClasses (missionConfigFile >> "CfgUnitInsignia"));
ADDON = true;

View File

@ -62,6 +62,17 @@ if (_item isEqualType objNull) then {
// Some objects below water will take damage over time, eventually becoming "water logged" and unfixable (because of negative z attach)
[_item, "blockDamage", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
// Prevent UAVs from firing
private _UAVCrew = _item call EFUNC(common,getVehicleUAVCrew);
if (_UAVCrew isNotEqualTo []) then {
{
[_x, true] call EFUNC(common,disableAiUAV);
} forEach _UAVCrew;
_item setVariable [QGVAR(isUAV), _UAVCrew, true];
};
};
// Invoke listenable event

View File

@ -100,14 +100,26 @@ if (_item isEqualType objNull) then {
// Create smoke effect when crate landed
[{
(_this select 0) params ["_object"];
params ["_object", "_pfhID"];
if (isNull _object) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
_pfhID call CBA_fnc_removePerFrameHandler;
};
if (getPos _object select 2 < 1) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
_pfhID call CBA_fnc_removePerFrameHandler;
// Reenable UAV crew
private _UAVCrew = _object getVariable [QGVAR(isUAV), []];
if (_UAVCrew isNotEqualTo []) then {
// Reenable AI
{
[_x, false] call EFUNC(common,disableAiUAV);
} forEach _UAVCrew;
_object setVariable [QGVAR(isUAV), nil, true];
};
if ((GVAR(disableParadropEffectsClasstypes) findIf {_object isKindOf _x}) == -1) then {
private _smoke = "SmokeshellYellow" createVehicle [0, 0, 0];

View File

@ -96,6 +96,18 @@ if (_object isEqualType objNull) then {
[QEGVAR(zeus,addObjects), [[_object], _objectCurators]] call CBA_fnc_serverEvent;
};
// Reenable UAV crew
private _UAVCrew = _object getVariable [QGVAR(isUAV), []];
if (_UAVCrew isNotEqualTo []) then {
// Reenable AI
{
[_x, false] call EFUNC(common,disableAiUAV);
} forEach _UAVCrew;
_object setVariable [QGVAR(isUAV), nil, true];
};
} else {
_object = createVehicle [_item, _emptyPosAGL, [], 0, "NONE"];

View File

@ -43,6 +43,7 @@ PREP(deviceKeyFindValidIndex);
PREP(deviceKeyRegisterNew);
PREP(deprecateComponent);
PREP(disableAI);
PREP(disableAiUAV);
PREP(disableUserInput);
PREP(displayIcon);
PREP(displayText);
@ -189,6 +190,7 @@ PREP(stopGesture);
PREP(stringCompare);
PREP(stringToColoredText);
PREP(swayLoop);
PREP(switchAttachmentMode);
PREP(switchPersistentLaser);
PREP(switchToGroupSide);
PREP(throttledPublicVariable);

View File

@ -133,6 +133,30 @@
_object lockInventory (_set > 0);
}] call CBA_fnc_addEventHandler;
[QGVAR(disableAiUAV), {
params ["_unit", "_disable"];
if (_disable) then {
private _features = ["AUTOTARGET", "TARGET", "WEAPONAIM"/*, "FIREWEAPON"*/, "RADIOPROTOCOL"]; // TODO: Uncomment in 2.18
// Save current status
_unit setVariable [QGVAR(featuresAiUAV), _features apply {[_x, _unit checkAIFeature _x]}];
{
_unit enableAIFeature [_x, false];
} forEach _features;
} else {
// Restore previous status
private _features = _unit getVariable [QGVAR(featuresAiUAV), []];
{
_unit enableAIFeature [_x select 0, _x select 1];
} forEach _features;
_unit setVariable [QGVAR(featuresAiUAV), nil];
};
}] call CBA_fnc_addEventHandler;
//Add a fix for BIS's zeus remoteControl module not reseting variables on DC when RC a unit
//This variable is used for isPlayer checks
if (isServer) then {

View File

@ -0,0 +1,45 @@
#include "..\script_component.hpp"
/*
* Author: johnb43
* Disables/Enables UAV AI crew members, can be run on any machine and is applied globally.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Disable AI <BOOL>
*
* Return Value:
* None
*
* Example:
* [cursorObject, true] call ace_common_fnc_disableAiUAV
*
* Public: No
*/
params [["_unit", objNull, [objNull]], ["_disable", true, [false]]];
// Allow disabling of Zeus remote controlled units
if (!alive _unit || {isPlayer _unit} || {!unitIsUAV _unit}) exitWith {};
if (_disable) then {
// Ignore if already disabled
if (!isNil "_jipID") exitWith {};
// Disable shooting and targeting on every machine
// Give predefined JIP ID, in case of simultaneous executions on different machines
private _jipID = [QGVAR(disableAiUAV), [_unit, _disable], QGVAR(disableAiUAV_) + hashValue _unit] call CBA_fnc_globalEventJIP;
[_jipID, _unit] call CBA_fnc_removeGlobalEventJIP;
_unit setVariable [QGVAR(disableAiUavJipID), _jipID, true];
} else {
// Restore shooting and targeting to each client's individual state prior to disabling
private _jipID = _unit getVariable QGVAR(disableAiUavJipID);
if (isNil "_jipID") exitWith {};
_jipID call CBA_fnc_removeGlobalEventJIP;
_unit setVariable [QGVAR(disableAiUavJipID), nil, true];
[QGVAR(disableAiUAV), [_unit, _disable]] call CBA_fnc_globalEvent;
};

View File

@ -1,34 +1,45 @@
#include "..\script_component.hpp"
/*
* Author: commy2
* Author: commy2, johnb43
* Get the available firing modes of a weapon. Will ignore the AI helper modes.
*
* Arguments:
* 0: Weapon <STRING>
* 1: Muzzle <STRING> (default: weapon)
*
* Return Value:
* Firing Modes <ARRAY>
*
* Example:
* ["gun"] call ace_common_fnc_getWeaponModes
* "arifle_AK12_F" call ace_common_fnc_getWeaponModes
*
* Public: Yes
*/
params [["_weapon", "", [""]]];
params [["_weapon", "", [""]], ["_muzzle", nil, [""]]];
private _config = configFile >> "CfgWeapons" >> _weapon;
if (!isNil "_muzzle") then {
_config = _config >> _muzzle
};
if (!isClass _config) exitWith {
[] // return
};
private _modes = [];
{
if (getNumber (_config >> _x >> "showToPlayer") == 1) then {
_modes pushBack _x;
};
if (_x == "this") then {
_modes pushBack _weapon;
if (_x == "this") then {
_modes pushBack (configName _config);
} else {
if (isClass (_config >> _x)) then {
_modes pushBack (configName (_config >> _x));
};
};
};
} forEach getArray (_config >> "modes");
_modes
_modes // return

View File

@ -0,0 +1,61 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Switch attachment from one mode to another - based on CBA_accessory_fnc_switchAttachment
*
* Arguments:
* 0: Unit <OBJECT>
* 1: From <STRING>
* 2: To <STRING>
*
* Return Value:
* None
*
* Example:
* [player, "ACE_DBAL_A3_Green_VP", "ACE_DBAL_A3_Green"] call ace_common_fnc_switchAttachmentMode
*
* Public: No
*/
params ["_unit", "_currItem", "_switchItem"];
TRACE_3("switchAttachmentMode",_unit,_currItem,_switchItem);
switch (currentWeapon _unit) do {
case (""): {};
case (primaryWeapon _unit): {
private _currWeaponType = 0;
_unit removePrimaryWeaponItem _currItem;
[{
params ["_unit", "", "_switchItem"];
_unit addPrimaryWeaponItem _switchItem;
["CBA_attachmentSwitched", _this] call CBA_fnc_localEvent;
}, [_unit, _currItem, _switchItem, _currWeaponType]] call CBA_fnc_execNextFrame;
};
case (handgunWeapon _unit): {
private _currWeaponType = 1;
_unit removeHandgunItem _currItem;
[{
params ["_unit", "", "_switchItem"];
_unit addHandgunItem _switchItem;
["CBA_attachmentSwitched", _this] call CBA_fnc_localEvent;
}, [_unit, _currItem, _switchItem, _currWeaponType]] call CBA_fnc_execNextFrame;
};
case (secondaryWeapon _unit): {
private _currWeaponType = 2;
_unit removeSecondaryWeaponItem _currItem;
[{
params ["_unit", "", "_switchItem"];
_unit addSecondaryWeaponItem _switchItem;
["CBA_attachmentSwitched", _this] call CBA_fnc_localEvent;
}, [_unit, _currItem, _switchItem, _currWeaponType]] call CBA_fnc_execNextFrame;
};
};
private _configSwitchItem = configfile >> "CfgWeapons" >> _switchItem;
private _switchItemHintText = getText (_configSwitchItem >> "MRT_SwitchItemHintText");
private _switchItemHintImage = getText (_configSwitchItem >> "picture");
if (_switchItemHintText isNotEqualTo "") then {
[[_switchItemHintImage, 2.0], [_switchItemHintText], true] call CBA_fnc_notify;
};
if (_unit == ACE_player) then {
playSound "click";
};

View File

@ -108,19 +108,7 @@ class CfgWeapons {
EGVAR(overpressure,offset) = 1.65;
};
class H_HelmetB;
class rhs_tsh4: H_HelmetB {
HEARING_PROTECTION_VICCREW;
};
class rhs_6b47_bare;
class rhs_6b48: rhs_6b47_bare {
HEARING_PROTECTION_VICCREW;
};
class rhs_zsh7a: H_HelmetB {
HEARING_PROTECTION_VICCREW;
};
class rhs_zsh7a;
class rhs_zsh7a_alt: rhs_zsh7a {
ACE_Protection = 1;
};
@ -133,22 +121,6 @@ class CfgWeapons {
ACE_Protection = 1;
};
class rhs_gssh18: H_HelmetB {
HEARING_PROTECTION_EARMUFF;
};
class rhs_6b47;
class rhs_6b47_6m2: rhs_6b47 {
HEARING_PROTECTION_PELTOR;
};
class rhs_6b47_6m2_1: rhs_6b47 {
HEARING_PROTECTION_PELTOR;
};
class rhs_6m2: H_HelmetB {
HEARING_PROTECTION_PELTOR;
};
class rhs_weap_d81;
class rhs_weap_2a70: rhs_weap_d81 { // "Low pressure" 100mm cannon
EGVAR(overpressure,range) = 15;

View File

@ -0,0 +1,28 @@
class CfgWeapons {
class H_HelmetB;
class rhs_tsh4: H_HelmetB {
HEARING_PROTECTION_VICCREW;
};
class rhs_zsh7a: H_HelmetB {
HEARING_PROTECTION_VICCREW;
};
class rhs_gssh18: H_HelmetB {
HEARING_PROTECTION_EARMUFF;
};
class rhs_6m2: H_HelmetB {
HEARING_PROTECTION_PELTOR;
};
class rhs_6b47;
class rhs_6b47_6m2: rhs_6b47 {
HEARING_PROTECTION_PELTOR;
};
class rhs_6b47_6m2_1: rhs_6b47 {
HEARING_PROTECTION_PELTOR;
};
class rhs_6b47_bare;
class rhs_6b48: rhs_6b47_bare {
HEARING_PROTECTION_VICCREW;
};
};

View File

@ -0,0 +1,19 @@
#include "script_component.hpp"
#include "\z\ace\addons\hearing\script_macros_hearingProtection.hpp"
class CfgPatches {
class SUBADDON {
addonRootClass = QUOTE(COMPONENT);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {
"rhs_main_loadorder",
"ace_hearing"
};
skipWhenMissingDependencies = 1;
VERSION_CONFIG;
};
};
#include "CfgWeapons.hpp"

View File

@ -0,0 +1,3 @@
#define SUBCOMPONENT hearing
#define SUBCOMPONENT_BEAUTIFIED Hearing
#include "..\script_component.hpp"

View File

@ -1,5 +1,4 @@
#include "script_component.hpp"
#include "\z\ace\addons\hearing\script_macros_hearingProtection.hpp"
class CfgPatches {
class ADDON {
@ -7,7 +6,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"rhs_main_loadorder"};
requiredAddons[] = {"ace_common", "rhs_main_loadorder"};
author = ECSTRING(common,ACETeam);
authors[] = {"Ruthberg", "GitHawk", "BaerMitUmlaut", "commy2", "Skengman2"};
url = ECSTRING(main,URL);

View File

@ -6,7 +6,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"rhsgref_main_loadorder"};
requiredAddons[] = {"ace_common", "rhsgref_main_loadorder"};
skipWhenMissingDependencies = 1;
author = ECSTRING(common,ACETeam);
authors[] = {"PabstMirror", "Ruthberg", "Anton"};

View File

@ -6,7 +6,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"rhssaf_main_loadorder"};
requiredAddons[] = {"ace_common", "rhssaf_main_loadorder"};
skipWhenMissingDependencies = 1;
author = ECSTRING(common,ACETeam);
authors[] = {};

View File

@ -206,170 +206,7 @@ class CfgWeapons {
EGVAR(overpressure,offset) = 0.9;
};
// Fast Helmets
class rhsusf_opscore_01;
class rhsusf_opscore_ut_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_aor1_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_aor1_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_bk_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_fg_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_fg_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_fg_pelt_cam: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_paint_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_paint_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_paint_pelt_nsw_cam: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_aor2_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_aor2_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_ut_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_ut_pelt_cam: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_ut_pelt_nsw_cam: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mc_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mc_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_cover;
class rhsusf_opscore_mc_cover_pelt_nsw: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mc_cover_pelt: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mc_cover_pelt_cam: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_rg_cover_pelt: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_coy_cover_pelt: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mar_01;
class rhsusf_opscore_mar_ut_pelt: rhsusf_opscore_mar_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mar_fg_pelt: rhsusf_opscore_mar_01 {
HEARING_PROTECTION_PELTOR;
};
// ACH Helmets
class rhsusf_ach_helmet_ocp;
class rhsusf_ach_bare_des_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_des_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_semi_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_semi_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_tan_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_tan_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_wood_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_wood_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_helmet_headset_ocp: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_helmet_headset_ess_ocp: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
// ACVC Helmets
class rhsusf_cvc_helmet: rhsusf_opscore_01 {
HEARING_PROTECTION_VICCREW;
};
// MICH Helmets
class rhsusf_mich_bare;
class rhsusf_mich_bare_alt: rhsusf_mich_bare {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos;
class rhsusf_mich_bare_norotos_alt: rhsusf_mich_bare_norotos {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_arc;
class rhsusf_mich_bare_norotos_arc_alt: rhsusf_mich_bare_norotos_arc {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_semi;
class rhsusf_mich_bare_alt_semi: rhsusf_mich_bare_semi {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_semi;
class rhsusf_mich_bare_norotos_alt_semi: rhsusf_mich_bare_norotos_semi {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_arc_semi: rhsusf_mich_bare_norotos_alt_semi {
HEARING_PROTECTION_OPEN;
};
class rhsusf_mich_bare_norotos_arc_alt_semi: rhsusf_mich_bare_norotos_arc_semi {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_tan;
class rhsusf_mich_bare_alt_tan: rhsusf_mich_bare_tan {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_tan;
class rhsusf_mich_bare_norotos_alt_tan: rhsusf_mich_bare_norotos_tan {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_arc_tan;
class rhsusf_mich_bare_norotos_arc_alt_tan: rhsusf_mich_bare_norotos_arc_tan {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_hgu56p: rhsusf_opscore_01 {
HEARING_PROTECTION_VICCREW;
};
class rhsusf_hgu56p;
class rhsusf_hgu56p_visor: rhsusf_hgu56p {
ACE_Protection = 1;
};
@ -420,13 +257,9 @@ class CfgWeapons {
class rhsusf_hgu56p_mask_black_skull: rhsusf_hgu56p_visor_mask_black_skull {
ACE_Protection = 0;
};
class rhsusf_ihadss: rhsusf_opscore_01 {
HEARING_PROTECTION_VICCREW;
};
class H_HelmetB;
class RHS_jetpilot_usaf: H_HelmetB {
ACE_Protection = 1;
HEARING_PROTECTION_VICCREW;
};
};

View File

@ -0,0 +1,174 @@
class CfgWeapons {
// Fast Helmets
class rhsusf_opscore_01;
class rhsusf_opscore_ut_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_aor1_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_aor1_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_bk_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_fg_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_fg_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_fg_pelt_cam: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_paint_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_paint_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_paint_pelt_nsw_cam: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_aor2_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_aor2_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_ut_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_ut_pelt_cam: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_ut_pelt_nsw_cam: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mc_pelt: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mc_pelt_nsw: rhsusf_opscore_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_cover;
class rhsusf_opscore_mc_cover_pelt_nsw: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mc_cover_pelt: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mc_cover_pelt_cam: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_rg_cover_pelt: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_coy_cover_pelt: rhsusf_opscore_cover {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mar_01;
class rhsusf_opscore_mar_ut_pelt: rhsusf_opscore_mar_01 {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_opscore_mar_fg_pelt: rhsusf_opscore_mar_01 {
HEARING_PROTECTION_PELTOR;
};
// ACH Helmets
class rhsusf_ach_helmet_ocp;
class rhsusf_ach_bare_des_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_des_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_semi_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_semi_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_tan_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_tan_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_wood_headset: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_bare_wood_headset_ess: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_helmet_headset_ocp: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_ach_helmet_headset_ess_ocp: rhsusf_ach_helmet_ocp {
HEARING_PROTECTION_PELTOR;
};
// ACVC Helmets
class rhsusf_cvc_helmet: rhsusf_opscore_01 {
HEARING_PROTECTION_VICCREW;
};
// MICH Helmets
class rhsusf_mich_bare;
class rhsusf_mich_bare_alt: rhsusf_mich_bare {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos;
class rhsusf_mich_bare_norotos_alt: rhsusf_mich_bare_norotos {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_arc;
class rhsusf_mich_bare_norotos_arc_alt: rhsusf_mich_bare_norotos_arc {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_semi;
class rhsusf_mich_bare_alt_semi: rhsusf_mich_bare_semi {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_semi;
class rhsusf_mich_bare_norotos_alt_semi: rhsusf_mich_bare_norotos_semi {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_arc_semi: rhsusf_mich_bare_norotos_alt_semi {
HEARING_PROTECTION_OPEN;
};
class rhsusf_mich_bare_norotos_arc_alt_semi: rhsusf_mich_bare_norotos_arc_semi {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_tan;
class rhsusf_mich_bare_alt_tan: rhsusf_mich_bare_tan {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_tan;
class rhsusf_mich_bare_norotos_alt_tan: rhsusf_mich_bare_norotos_tan {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_mich_bare_norotos_arc_tan;
class rhsusf_mich_bare_norotos_arc_alt_tan: rhsusf_mich_bare_norotos_arc_tan {
HEARING_PROTECTION_PELTOR;
};
class rhsusf_hgu56p: rhsusf_opscore_01 {
HEARING_PROTECTION_VICCREW;
};
class rhsusf_ihadss: rhsusf_opscore_01 {
HEARING_PROTECTION_VICCREW;
};
class H_HelmetB;
class RHS_jetpilot_usaf: H_HelmetB {
HEARING_PROTECTION_VICCREW;
};
};

View File

@ -0,0 +1,19 @@
#include "script_component.hpp"
#include "\z\ace\addons\hearing\script_macros_hearingProtection.hpp"
class CfgPatches {
class SUBADDON {
addonRootClass = QUOTE(COMPONENT);
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {
"rhsusf_main_loadorder",
"ace_hearing"
};
skipWhenMissingDependencies = 1;
VERSION_CONFIG;
};
};
#include "CfgWeapons.hpp"

View File

@ -0,0 +1,3 @@
#define SUBCOMPONENT hearing
#define SUBCOMPONENT_BEAUTIFIED Hearing
#include "..\script_component.hpp"

View File

@ -1,5 +1,4 @@
#include "script_component.hpp"
#include "\z\ace\addons\hearing\script_macros_hearingProtection.hpp"
class CfgPatches {
class ADDON {
@ -7,7 +6,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"rhsusf_main_loadorder"};
requiredAddons[] = {"ace_common", "rhsusf_main_loadorder"};
skipWhenMissingDependencies = 1;
author = ECSTRING(common,ACETeam);
authors[] = {"Ruthberg", "GitHawk", "BaerMitUmlaut", "Fyuran"};

View File

@ -16,7 +16,7 @@ private _inherited = [];
private _config = _x;
private _configEnabled = (getNumber (_config >> QUOTE(ADDON) >> "enabled")) == 1;
if (_configEnabled) then {
private _configExplicit = (count configProperties [_config, "configName _x == 'ace_csw'", false]) == 1;
private _configExplicit = (count configProperties [_config, toString {configName _x == QUOTE(ADDON)}, false]) == 1;
if (_configExplicit) then {
_explicitBases pushBack (configName _config);
_inherited pushBack [];
@ -43,8 +43,8 @@ private _inherited = [];
INFO("------ Logging static magazines with no carry version -------");
private _hash = createHashMap;
// private _logAll = true; // logs all possible weapon magazines (even if not used in a static weapon)
private _logAll = false;
private _logAll = false; // logs all possible weapon magazines (even if not used in a static weapon) when set to true
{
private _vehicleType = configName _x;
private _turretConfig = [_vehicleType, [0]] call CBA_fnc_getTurret;

View File

@ -1,11 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Helper function for ace_rearm; Gets magazines that should be loaded by csw
* Helper function for ace_rearm; Gets magazines that should be loaded by csw.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Specific Turret or pass bool to check all turrets <ARRAY><BOOL>(default: true)
* 0: CSW <OBJECT>
* 1: Specific Turret or pass bool to check all turrets <ARRAY|BOOL> (default: true)
*
* Return Value:
* [0: compatible veh mags, 1: carry mags] <ARRAY>

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Handles AI Fired EH
* Handles AI Fired EH.
*
* Arguments:
* Fired EH

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: Grim
* Handles AI GetIn on an empty weapon
* Author: LinkIsGrim
* Handles AI GetIn on an empty CSW.
*
* Arguments:
* GetIn EH

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror, modified by Grim
* Handles AI reloading
* Author: PabstMirror, LinkIsGrim
* Handles AI reloading.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 0: CSW <OBJECT>
* 1: Gunner <OBJECT>
* 2: Weapon <STRING>
* 3: Magazine <STRING> (default: "")
@ -15,7 +15,7 @@
* Public: No
*/
params ["_staticWeapon", "_gunner", "_weapon", ["_magazine", ""]];
params ["_vehicle", "_gunner", "_weapon", ["_magazine", ""]];
private _turretPath = [_gunner] call EFUNC(common,getTurretIndex);
private _reloadSource = objNull;
@ -24,7 +24,7 @@ private _reloadNeededAmmo = -1;
private _cfgMagGroups = configFile >> QGVAR(groups);
private _nearSupplies = [_gunner] + ((_staticWeapon nearSupplies 10) select {
private _nearSupplies = [_gunner] + ((_vehicle nearSupplies 10) select {
isNull (group _x) ||
{!([_x] call EFUNC(common,isPlayer)) && {[side group _gunner, side group _x] call BIS_fnc_sideIsFriendly}}
});
@ -49,7 +49,7 @@ private _nearSupplies = [_gunner] + ((_staticWeapon nearSupplies 10) select {
private _xWeaponMag = _x;
{
if ((getNumber (_cfgMagGroups >> _x >> _xWeaponMag)) == 1) then {
private _loadInfo = [_staticWeapon, _turretPath, _x, _xSource] call FUNC(reload_canLoadMagazine);
private _loadInfo = [_vehicle, _turretPath, _x, _xSource] call FUNC(reload_canLoadMagazine);
if (_loadInfo select 0) then {
_reloadMag = _x;
_reloadSource = _xSource;
@ -81,16 +81,16 @@ if (_bestAmmoToSend == -1) exitWith {ERROR("No ammo");};
[_reloadSource, _reloadMag, _bestAmmoToSend] call EFUNC(common,removeSpecificMagazine);
private _timeToLoad = 1;
if (!isNull(configOf _staticWeapon >> QUOTE(ADDON) >> "ammoLoadTime")) then {
_timeToLoad = getNumber(configOf _staticWeapon >> QUOTE(ADDON) >> "ammoLoadTime");
if (!isNull(configOf _vehicle >> QUOTE(ADDON) >> "ammoLoadTime")) then {
_timeToLoad = getNumber(configOf _vehicle >> QUOTE(ADDON) >> "ammoLoadTime");
};
TRACE_1("Reloading in progress",_timeToLoad);
[{
params ["_staticWeapon", "_turretPath", "_gunner", "_reloadMag", "_bestAmmoToSend"];
if ((!alive _staticWeapon) || {!alive _gunner} || {(_staticWeapon distance _gunner) > 10}) exitWith {TRACE_1("invalid state",_this);};
params ["_vehicle", "_turretPath", "_gunner", "_reloadMag", "_bestAmmoToSend"];
if ((!alive _vehicle) || {!alive _gunner} || {(_vehicle distance _gunner) > 10}) exitWith {TRACE_1("invalid state",_this);};
// Reload the static weapon
TRACE_5("calling addTurretMag event",_staticWeapon,_turretPath,_gunner,_reloadMag,_bestAmmoToSend);
TRACE_5("calling addTurretMag event",_vehicle,_turretPath,_gunner,_reloadMag,_bestAmmoToSend);
[QGVAR(addTurretMag), _this] call CBA_fnc_globalEvent;
}, [_staticWeapon, _turretPath, _gunner, _reloadMag, _bestAmmoToSend], _timeToLoad] call CBA_fnc_waitAndExecute;
}, [_vehicle, _turretPath, _gunner, _reloadMag, _bestAmmoToSend], _timeToLoad] call CBA_fnc_waitAndExecute;

View File

@ -1,14 +1,14 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Checks if you can deploy a weapon on the tripod
* Checks if you can deploy a weapon on the tripod.
*
* Arguments:
* 0: Target Tripod <OBJECT>
* 0: Target <OBJECT>
* 1: Player <OBJECT>
*
* Return Value:
* Wether or not you can deploy the weapon <BOOL>
* Whether or not you can deploy the weapon <BOOL>
*
* Example:
* [cursorObject, player] call ace_csw_fnc_assemble_canDeployWeapon

View File

@ -1,23 +1,23 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* If the CSW is mounted or in use this will not allow you to dismount the weapon
* If the CSW is mounted or in use this will not allow you to dismount the weapon.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 0: CSW <OBJECT>
*
* Return Value:
* Can Dismount <BOOL>
* Can dismount weapon <BOOL>
*
* Example:
* [cursorObject] call ace_csw_fnc_assemble_canPickupWeapon
* cursorObject call ace_csw_fnc_assemble_canPickupWeapon
*
* Public: No
*/
params ["_staticWeapon"];
params ["_vehicle"];
// Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default]
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_staticWeapon getVariable [QGVAR(assemblyMode), 3]);
private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_vehicle getVariable [QGVAR(assemblyMode), 3]);
_assemblyMode && {alive _staticWeapon} && {((crew _staticWeapon) findIf {alive _x && {!unitIsUAV _x}}) == -1} // return
_assemblyMode && {alive _vehicle} && {((crew _vehicle) findIf {alive _x && {!unitIsUAV _x}}) == -1} // return

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Deploys the tripod
* Deploys the tripod.
*
* Arguments:
* 0: Unit <OBJECT>
@ -10,7 +10,7 @@
* None
*
* Example:
* [player] call ace_csw_fnc_assemble_deployTripod
* player call ace_csw_fnc_assemble_deployTripod
*
* Public: No
*/
@ -34,7 +34,7 @@
_args params ["_player", "_secondaryWeaponClassname", "_secondaryWeaponInfo"];
TRACE_3("deployTripod finish",_player,_secondaryWeaponClassname,_secondaryWeaponInfo);
private _tripodClassname = getText(configFile >> "CfgWeapons" >> _secondaryWeaponClassname >> QUOTE(ADDON) >> "deploy");
private _tripodClassname = getText (configFile >> "CfgWeapons" >> _secondaryWeaponClassname >> QUOTE(ADDON) >> "deploy");
// Create a tripod
private _cswTripod = createVehicle [_tripodClassname, [0, 0, 0], [], 0, "NONE"];
@ -96,6 +96,6 @@
} forEach _secondaryWeaponInfo;
};
private _deployTime = getNumber(configFile >> "CfgWeapons" >> _secondaryWeaponClassname >> QUOTE(ADDON) >> "deployTime");
private _deployTime = getNumber (configFile >> "CfgWeapons" >> _secondaryWeaponClassname >> QUOTE(ADDON) >> "deployTime");
[TIME_PROGRESSBAR(_deployTime), [_player, _secondaryWeaponClassname, _secondaryWeaponInfo], _onFinish, _onFailure, LLSTRING(PlaceTripod_progressBar)] call EFUNC(common,progressBar);
}, _this] call CBA_fnc_execNextFrame;

View File

@ -1,11 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Deploys the current CSW
* Deploys the current CSW.
*
* Arguments:
* 0: Target <OBJECT>
* 1: Unit <OBJECT>
* 1: Player <OBJECT>
* 2: Args <ANY>
* 3: Action Data <ARRAY>
*

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Modifies interaction for deploying weapon
* Modifies interaction for deploying weapon.
*
* Arguments:
* 0: Target <OBJECT>
@ -21,7 +21,7 @@
params ["_target", "_player", "", "_actionData"];
private _carryWeaponClassname = secondaryWeapon _player;
private _assembleTo = (getText(configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "assembleTo" >> (typeOf _target)));
private _assembleTo = getText (configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "assembleTo" >> typeOf _target);
private _icon = getText (configFile >> "CfgVehicles" >> _assembleTo >> "picture");
TRACE_2("",_assembleTo,_icon);

View File

@ -1,11 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Picks up the tripod and adds it to the player launcher slot
* Picks up the tripod and adds it to the player launcher slot.
*
* Arguments:
* 0: Tripod <OBJECT>
* 1: Unit <OBJECT>
* 1: Player <OBJECT>
*
* Return Value:
* None
@ -56,7 +56,7 @@
if (isNull _weaponHolder || {_tripodPos distance _weaponHolder > 2}) then {
_weaponHolder = createVehicle ["GroundWeaponHolder", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_weaponHolder setDir random [0, 180, 360];
_weaponHolder setVehiclePosition [_tripodPos, [], 0, "CAN_COLLIDE"]; // places object on surface below
_weaponHolder setVehiclePosition [_tripodPos, [], 0, "CAN_COLLIDE"]; // Places object on surface below
};
_weaponHolder addWeaponCargoGlobal [_tripodClassname, 1];

View File

@ -1,11 +1,11 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Dismounts the weapon from the tripod and drops its backpack beside
* Dismounts the weapon from the tripod and drops its backpack beside.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 1: Unit <OBJECT>
* 0: CSW <OBJECT>
* 1: Player <OBJECT>
*
* Return Value:
* None
@ -17,10 +17,10 @@
*/
[{
params ["_staticWeapon", "_player"];
TRACE_2("assemble_pickupWeapon",_staticWeapon,_player);
params ["_vehicle", "_player"];
TRACE_2("assemble_pickupWeapon",_vehicle,_player);
private _weaponConfig = configOf _staticWeapon >> QUOTE(ADDON);
private _weaponConfig = configOf _vehicle >> QUOTE(ADDON);
private _carryWeaponClassname = getText (_weaponConfig >> "disassembleWeapon");
if (!isClass (configFile >> "CfgWeapons" >> _carryWeaponClassname)) exitWith {
@ -37,15 +37,15 @@
private _onDisassembleFunc = getText (_weaponConfig >> "disassembleFunc");
private _pickupTime = getNumber (configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "pickupTime");
TRACE_4("",typeOf _staticWeapon,_carryWeaponClassname,_turretClassname,_pickupTime);
TRACE_4("",typeOf _vehicle,_carryWeaponClassname,_turretClassname,_pickupTime);
private _onFinish = {
params ["_args"];
_args params ["_staticWeapon", "_player", "_carryWeaponClassname", "_turretClassname", "_onDisassembleFunc"];
TRACE_4("disassemble finish",_staticWeapon,_player,_carryWeaponClassname,_turretClassname);
_args params ["_vehicle", "_player", "_carryWeaponClassname", "_turretClassname", "_onDisassembleFunc"];
TRACE_4("disassemble finish",_vehicle,_player,_carryWeaponClassname,_turretClassname);
private _weaponPos = (getPosATL _staticWeapon) vectorAdd [0, 0, 0.1];
private _weaponDir = getDir _staticWeapon;
private _weaponPos = (getPosATL _vehicle) vectorAdd [0, 0, 0.1];
private _weaponDir = getDir _vehicle;
private _carryWeaponMag = [];
private _carryWeaponMags = compatibleMagazines _carryWeaponClassname;
@ -64,7 +64,7 @@
TRACE_2("Removing ammo",_xMag,_carryMag);
[_player, _carryMag, _xAmmo] call FUNC(reload_handleReturnAmmo);
};
} forEach (magazinesAllTurrets _staticWeapon);
} forEach (magazinesAllTurrets _vehicle);
if (_turretClassname isNotEqualTo "") then {
private _cswTripod = createVehicle [_turretClassname, [0, 0, 0], [], 0, "NONE"];
@ -76,7 +76,7 @@
_cswTripod setVelocity [0, 0, -0.05];
_cswTripod setVectorUp (surfaceNormal _weaponPos);
}, [_cswTripod, _weaponDir, _weaponPos]] call CBA_fnc_execNextFrame;
[_cswTripod, _staticWeapon] call (missionNamespace getVariable _onDisassembleFunc);
[_cswTripod, _vehicle] call (missionNamespace getVariable _onDisassembleFunc);
};
[{
@ -99,7 +99,7 @@
// Create a new weapon holder (don't try to get an existing one, as no guarantee where it could be)
private _weaponHolder = createVehicle ["GroundWeaponHolder", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_weaponHolder setDir random [0, 180, 360];
_weaponHolder setVehiclePosition [_weaponPos, [], 0, "CAN_COLLIDE"]; // places object on surface below
_weaponHolder setVehiclePosition [_weaponPos, [], 0, "CAN_COLLIDE"]; // Places object on surface below
_weaponHolder addWeaponWithAttachmentsCargoGlobal [[_carryWeaponClassname, "", "", "", _carryWeaponMag, [], ""], 1];
}, [_player, _weaponPos, _carryWeaponClassname, _carryWeaponMag, _turretClassname]] call CBA_fnc_execNextFrame;
@ -108,23 +108,23 @@
// Eject dead units (all crew are dead or UAV at this point, otherwise condition would have failed), but ignore UAV units
{
if (unitIsUAV _x) then {
_staticWeapon deleteVehicleCrew _x;
_vehicle deleteVehicleCrew _x;
} else {
moveOut _x;
};
} forEach (crew _staticWeapon);
} forEach (crew _vehicle);
deleteVehicle _staticWeapon;
deleteVehicle _vehicle;
LOG("end");
};
private _condition = {
params ["_args"];
_args params ["_staticWeapon"];
_args params ["_vehicle"];
_staticWeapon call FUNC(assemble_canPickupWeapon)
_vehicle call FUNC(assemble_canPickupWeapon)
};
[TIME_PROGRESSBAR(_pickupTime), [_staticWeapon, _player, _carryWeaponClassname, _turretClassname, _onDisassembleFunc], _onFinish, {}, LLSTRING(DisassembleCSW_progressBar), _condition] call EFUNC(common,progressBar);
[TIME_PROGRESSBAR(_pickupTime), [_vehicle, _player, _carryWeaponClassname, _turretClassname, _onDisassembleFunc], _onFinish, {}, LLSTRING(DisassembleCSW_progressBar), _condition] call EFUNC(common,progressBar);
}, _this] call CBA_fnc_execNextFrame;

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Checks if the unit can deploy a tripod
* Checks if the player can deploy the tripod.
*
* Arguments:
* 0: Unit <OBJECT>
* 0: Player <OBJECT>
*
* Return Value:
* Can deploy <BOOL>
@ -15,8 +15,8 @@
* Public: No
*/
params ["_unit"];
params ["_player"];
private _secondaryWeapon = secondaryWeapon _unit;
private _secondaryWeapon = secondaryWeapon _player;
_secondaryWeapon != "" && {getText (configFile >> "CfgWeapons" >> _secondaryWeapon >> QUOTE(ADDON) >> "type") == "mount"} // return

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Checks if it's possible to get in the CSW
* Checks if it's possible to get in the CSW.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 0: CSW <OBJECT>
*
* Return Value:
* None

View File

@ -1,17 +1,16 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Checks if the unit can pickup the tripod
* Checks if the player can pickup the tripod.
*
* Arguments:
* 0: Tripod <OBJECT>
* 1: Unit (not used) <OBJECT>
*
* Return Value:
* Can pickup <BOOL>
*
* Example:
* [cursorObject, player] call ace_csw_fnc_canPickupTripod
* cursorObject call ace_csw_fnc_canPickupTripod
*
* Public: No
*/

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror, Dystopian
* Gets magazine that the player can carry, suitable to vehicle magazine
* Gets magazine that the player can carry, suitable to vehicle magazine.
*
* Arguments:
* 0: Vehicle Magazine <STRING>

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Gets sub actions for what the unit can load into the CSW
* Gets sub actions for what the player can load into the CSW.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 0: CSW <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
@ -35,7 +35,7 @@ private _condition = {
([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0
};
private _cfgMagazines = configFile >> "CfgMagazines"; // micro-optimization
private _cfgMagazines = configFile >> "CfgMagazines"; // Micro-optimization
private _actions = [];
{
_x params ["_carryMag", "", "_loadInfo"];

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Initializes CSW systems on vehicle
* Initializes CSW systems on vehicle.
*
* Arguments:
* 0: Vehicle <OBJECT>
@ -78,7 +78,7 @@ if (hasInterface && {!(_typeOf in GVAR(initializedStaticTypes))}) then {
if ((GVAR(ammoHandling) == 0) && {!([false, true, true, GVAR(defaultAssemblyMode)] select (_target getVariable [QGVAR(assemblyMode), 3]))}) exitWith { false };
[_player, _target, ["isNotSwimming", "isNotSitting"]] call EFUNC(common,canInteractWith)
};
private _childenCode = {
private _childrenCode = {
BEGIN_COUNTER(getActions); // can remove for final release
private _ret = (call FUNC(getLoadActions)) + (call FUNC(getUnloadActions));
END_COUNTER(getActions);
@ -86,10 +86,10 @@ if (hasInterface && {!(_typeOf in GVAR(initializedStaticTypes))}) then {
};
if (_configEnabled && {_magazineLocation != ""}) then {
private _positionCode = compile _magazineLocation;
private _ammoAction = [QGVAR(magazine), LLSTRING(AmmoHandling_displayName), "", {}, _condition, _childenCode, [], _positionCode, 4] call EFUNC(interact_menu,createAction);
private _ammoAction = [QGVAR(magazine), LLSTRING(AmmoHandling_displayName), "", {}, _condition, _childrenCode, [], _positionCode, 4] call EFUNC(interact_menu,createAction);
_ammoActionPath = [_typeOf, 0, [], _ammoAction] call EFUNC(interact_menu,addActionToClass);
} else {
private _ammoAction = [QGVAR(magazine), LLSTRING(AmmoHandling_displayName), "", {}, _condition, _childenCode] call EFUNC(interact_menu,createAction);
private _ammoAction = [QGVAR(magazine), LLSTRING(AmmoHandling_displayName), "", {}, _condition, _childrenCode] call EFUNC(interact_menu,createAction);
_ammoActionPath = [_typeOf, 0, ["ACE_MainActions"], _ammoAction] call EFUNC(interact_menu,addActionToClass);
};

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: tcvm, PabstMirror
* Handles the use of proxy weapons to bypass engine reload times
* Handles the use of proxy weapons to fix engine-reload times.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 0: CSW <OBJECT>
* 1: Turret <ARRAY>
* 2: Proxy weapon needed <BOOL>
* 2: Weapon should be emptied <BOOL>

View File

@ -1,16 +1,16 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror &tcvm
* Tests if unit can load a magazine into a static weapon.
* Author: PabstMirror, tcvm
* Tests if unit can load a magazine into a CSW.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 0: CSW <OBJECT>
* 1: Turret Path <ARRAY>
* 2: Carryable Magazine <STRING>
* 3: Supplier <OBJECT>
* 3: Supplier <OBJECT> (default: objNull)
*
* Return Value:
* [CanLoad<BOOL>, LoadedMag<STRING>, AmmoNeeded<NUMBER>, IsBeltLinking<BOOL>]<ARRAY>
* [Can Load <BOOL>, Loaded Mag <STRING>, Ammo Needed <NUMBER>, Is Belt Linking <BOOL>] <ARRAY>
*
* Example:
* [cursorObject, [0], "ACE_csw_100Rnd_127x99_mag_red", player] call ace_csw_fnc_reload_canLoadMagazine
@ -28,7 +28,7 @@ if (!alive _vehicle) exitWith { _return };
// Verify holder has carry magazine
if (
(!isNull _magSource) &&
{!((_magSource isKindOf "Bag_Base") || {_magSource isKindOf "ContainerSupply"})} && // hacky workaround for magazines within dropped backpacks
{!((_magSource isKindOf "Bag_Base") || {_magSource isKindOf "ContainerSupply"})} && // Hacky workaround for magazines within dropped backpacks
{
((_vehicle distance _magSource) > 10) ||
{((magazineCargo _magSource) findIf {_x == _carryMag}) == -1}
@ -42,7 +42,7 @@ private _cfgGroupsCarryMag = configFile >> QGVAR(groups) >> _carryMag;
private _desiredAmmo = getNumber (configOf _vehicle >> QUOTE(ADDON) >> "desiredAmmo");
if (_desiredAmmo == 0) then { _desiredAmmo = 100; };
private _ammoNeeded = _desiredAmmo min getNumber (_cfgMagazinesCarryMag >> "count"); // assume it needs full carry mag
private _ammoNeeded = _desiredAmmo min getNumber (_cfgMagazinesCarryMag >> "count"); // Assume it needs full carry mag
private _loadedMag = "";
private _isBeltLinking = false;
@ -62,7 +62,7 @@ scopeName "main";
};
private _maxMagazineAmmo = _desiredAmmo min getNumber (_cfgMagazines >> _xMag >> "count");
if (_xAmmo >= _maxMagazineAmmo) exitWith {
[false, _loadedMag, -6, false] breakOut "main"; // Already at capicity
[false, _loadedMag, -6, false] breakOut "main"; // Already at capacity
};
_ammoNeeded = _maxMagazineAmmo - _xAmmo;
_isBeltLinking = true;

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Tests if unit can unload a magazine from a static weapon.
* Tests if unit can unload a magazine from a CSW.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 0: CSW <OBJECT>
* 1: Turret Path <ARRAY>
* 2: Player <OBJECT>
* 3: Carryable Magazine <STRING>

View File

@ -1,15 +1,15 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Gets magazines that the player is carrying that can be loaded into the static weapon
* Gets nearby magazines that can be loaded into the CSW.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Player <OBJECT>
* 0: CSW <OBJECT>
* 1: Unit <OBJECT>
*
* Return Value:
* Mags <ARRAY>
* [Carry Magazine <STRING>, Turret Path <ARRAY>, Load Info <NUMBER>, Magazine Source <OBJECT>]
* [Carry Magazine <STRING>, Turret Path <ARRAY>, Load Info <ARRAY>, Magazine Source <OBJECT>]
*
* Example:
* [cursorObject, player] call ace_csw_fnc_reload_getLoadableMagazines

View File

@ -4,7 +4,7 @@
* Finds the best vehicle magazines to create from a carryable magazine for a given weapon.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 0: CSW <OBJECT>
* 1: Turret <ARRAY>
* 2: Magazine that is carryable <STRING>
*

View File

@ -1,16 +1,16 @@
#include "..\script_component.hpp"
/*
* Author: tcvm, PabstMirror
* Handles adding ammo to a turret
* Called from a global event but only runs where turret is local
* Handles adding ammo to a turret.
* Called from a global event but only runs where turret is local.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 0: CSW <OBJECT>
* 1: Turret Path <ARRAY>
* 2: Source of magazine <OBJECT>
* 3: Vehicle Magazine <STRING>
* 4: Ammo in magazine <NUMBER>
* 5: Unit or object to return ammo to <OBJECT>
* 5: Unit or object to return ammo to <OBJECT> (default: Source of magazine)
*
* Return Value:
* None
@ -21,7 +21,8 @@
* Public: No
*/
params ["_vehicle", "_turret", "_magSource", "_carryMag", "_ammoReceived", ["_returnTo", _magSource]];
params ["_vehicle", "_turret", "_magSource", "_carryMag", "_ammoReceived"];
private _returnTo = param [5, _magSource];
TRACE_6("reload_handleAddTurretMag",_vehicle,_turret,_magSource,_carryMag,_ammoReceived,_returnTo);
TRACE_2("",local _vehicle,_vehicle turretLocal _turret);

View File

@ -1,13 +1,13 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Handles removing ammo from a turret
* Called from a global event but only runs where turret is local
* Handles removing ammo from a turret.
* Called from a global event but only runs where turret is local.
*
* Arguments:
* 0: Static Weapon <OBJECT>
* 0: CSW <OBJECT>
* 1: Turret Path <ARRAY>
* 2: Magainze Unit Can Carry <STRING>
* 2: Magazine Unit Can Carry <STRING>
* 3: Magazine To Remove From Static <STRING>
* 4: Unit or container to unload to <OBJECT>
*

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: tcvm and PabstMirror
* Handles returned ammo (either from unloading or leftovers from linking)
* Author: tcvm, PabstMirror
* Handles returned ammo (either from unloading or leftovers from linking).
*
* Arguments:
* 0: Man or Vehicle <OBJECT>
@ -18,13 +18,15 @@
*/
params ["_unloadTo", "_carryMag", "_ammo"];
TRACE_3("reload_handleReturnAmmo",_unloadTo,_carryMag,_ammo);
TRACE_4("reload_handleReturnAmmo",_unloadTo,typeOf _unloadTo,_carryMag,_ammo);
private _carryMaxAmmo = getNumber (configFile >> "CfgMagazines" >> _carryMag >> "count");
private _fullMagazines = floor (_ammo / _carryMaxAmmo);
private _bulletsRemaining = _ammo % _carryMaxAmmo;
if (_unloadTo isKindOf "CaManBase") then {
private _unloadToUnit = _unloadTo isKindOf "CAManBase";
if (_unloadToUnit) then {
while {(_fullMagazines > 0) && {[_unloadTo, _carryMag] call CBA_fnc_canAddItem}} do {
_unloadTo addMagazine [_carryMag, _carryMaxAmmo];
_fullMagazines = _fullMagazines - 1;
@ -37,19 +39,21 @@ if (_unloadTo isKindOf "CaManBase") then {
if ((_fullMagazines == 0) && {_bulletsRemaining == 0}) exitWith {};
// Try to use existing container
private _container = _unloadTo getVariable [QGVAR(container), objNull];
if ((_container distance _unloadTo) > 10) then { _container = objNull; };
if (isNull _container) then {
_container = (nearestObjects [_unloadTo, [["GroundWeaponHolder"], [QGVAR(ammo_holder)]] select GVAR(handleExtraMagazinesType), 10]) param [0, objNull];
// Try to use object inventory or existing container
private _container = [_unloadTo, objNull] select _unloadToUnit;
if ((maxLoad _container) isEqualTo 0) then {
_container = _unloadTo getVariable [QGVAR(container), objNull];
if ((_container distance _unloadTo) > 10) then { _container = objNull; };
if (isNull _container) then {
_container = (nearestObjects [_unloadTo, [["GroundWeaponHolder"], [QGVAR(ammo_holder)]] select GVAR(handleExtraMagazinesType), 10]) param [0, objNull];
};
};
if (isNull _container) then {
// Create ammo storage container
private _weaponRelPos = _unloadTo getRelPos RELATIVE_DIRECTION(270);
_weaponRelPos set [2, ((getPosATL _unloadTo) select 2) + 0.05];
_container = createVehicle [["GroundWeaponHolder", QGVAR(ammo_holder)] select GVAR(handleExtraMagazinesType), [0, 0, 0], [], 0, "NONE"];
_container = createVehicle [["GroundWeaponHolder", QGVAR(ammo_holder)] select GVAR(handleExtraMagazinesType), [0, 0, 0], [], 0, "CAN_COLLIDE"];
_unloadTo setVariable [QGVAR(container), _container, true];
_container setDir random [0, 180, 360];
_container setPosATL _weaponRelPos;
@ -59,7 +63,7 @@ if (isNull _container) then {
TRACE_2("Creating NEW Container",_container,_weaponRelPos);
};
TRACE_3("adding to container",_container,_fullMagazines,_bulletsRemaining);
TRACE_4("adding to container",_container,typeOf _container,_fullMagazines,_bulletsRemaining);
if (_fullMagazines > 0) then {
_container addMagazineAmmoCargo [_carryMag, _fullMagazines, _carryMaxAmmo];

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: PabstMirror
* Loads a magazine into a static weapon from a magazine carried by or next to the player.
* Loads a magazine into a CSW from a magazine carried by or next to the player.
*
* Arguments:
* 0: Vehicle <OBJECT>
* 0: CSW <OBJECT>
* 1: Turret <ARRAY>
* 2: Unit Carried Magazine <STRING>
* 3: Magazine source <OBJECT>
@ -52,8 +52,19 @@ private _onFinish = {
[_magSource, _carryMag, _bestAmmoToSend] call EFUNC(common,removeSpecificMagazine);
if (_bestAmmoToSend == 0) exitWith {};
TRACE_6("calling addTurretMag event",_vehicle,_turret,_magSource,_carryMag,_bestAmmoToSend,_unit);
[QGVAR(addTurretMag), [_vehicle, _turret, _magSource, _carryMag, _bestAmmoToSend, _unit]] call CBA_fnc_globalEvent;
// Workaround for removeSpecificMagazine and WeaponHolders being deleted when empty, give back to the unit if the weapon holder was deleted
// TODO: Pass type and position of deleted object to create a new one
// TODO: Use '_magSource getEntityInfo 14' in 2.18 and the isSetForDeletion flag to execute in same frame
[{
params ["_magSource", "_unit", "_args"];
if (isNull _magSource) then {
_args pushBack _unit;
};
TRACE_1("calling addTurretMag event",_args);
[QGVAR(addTurretMag), _args] call CBA_fnc_globalEvent;
}, [_magSource, _unit, [_vehicle, _turret, _magSource, _carryMag, _bestAmmoToSend]]] call CBA_fnc_execNextFrame;
};

View File

@ -1,11 +1,12 @@
#include "..\script_component.hpp"
/*
* Author: tcvm, PabstMirror
* Dumps ammo to container
* Dumps ammo to container.
*
* Arguments:
* 0: Weapon <OBJECT>
* 0: CSW <OBJECT>
* 1: Using advanced assembly <BOOL>
* 2: Empty weapon <BOOL>
*
* Return Value:
* None
@ -16,11 +17,11 @@
* Public: No
*/
params ["_staticWeapon", "_assemblyMode", "_emptyWeapon"];
TRACE_3("staticWeaponInit_unloadExtraMags",_staticWeapon,_assemblyMode,_emptyWeapon);
params ["_vehicle", "_assemblyMode", "_emptyWeapon"];
TRACE_3("staticWeaponInit_unloadExtraMags",_vehicle,_assemblyMode,_emptyWeapon);
if (!_assemblyMode) exitWith {};
private _desiredAmmo = getNumber (configOf _staticWeapon >> QUOTE(ADDON) >> "desiredAmmo");
private _desiredAmmo = getNumber (configOf _vehicle >> QUOTE(ADDON) >> "desiredAmmo");
private _storeExtraMagazines = GVAR(handleExtraMagazines);
if (_emptyWeapon) then {
_desiredAmmo = 0;
@ -56,41 +57,41 @@ private _containerMagazineCount = [];
} else {
if ((_xMag select [0,4]) != "fake") then { WARNING_1("Unable to unload [%1] - No matching carry mag",_xMag); };
};
} forEach (magazinesAllTurrets _staticWeapon);
} forEach (magazinesAllTurrets _vehicle);
TRACE_1("Remove all loaded magazines",_magsToRemove);
{
_staticWeapon removeMagazinesTurret _x;
_vehicle removeMagazinesTurret _x;
if ((_loadedMagazineInfo select [0,2]) isEqualTo _x) then {
TRACE_1("Re-add the starting mag",_loadedMagazineInfo);
_staticWeapon addMagazineTurret _loadedMagazineInfo;
_vehicle addMagazineTurret _loadedMagazineInfo;
};
} forEach _magsToRemove;
private _secondaryWeaponMagazines = _staticWeapon getVariable [QGVAR(secondaryWeaponMagazines), []];
private _secondaryWeaponMagazines = _vehicle getVariable [QGVAR(secondaryWeaponMagazines), []];
if (_secondaryWeaponMagazines isNotEqualTo []) then {
// Check if the static weapon can take magazines
private _turret = (allTurrets _staticWeapon) param [0, []];
private _compatibleMagazinesTurret = flatten ((_staticWeapon weaponsTurret _turret) apply {compatibleMagazines _x});
private _turret = (allTurrets _vehicle) param [0, []];
private _compatibleMagazinesTurret = flatten ((_vehicle weaponsTurret _turret) apply {compatibleMagazines _x});
private _container = objNull;
{
private _vehicleMag = [_staticWeapon, _turret, _x select 0] call FUNC(reload_getVehicleMagazine);
private _vehicleMag = [_vehicle, _turret, _x select 0] call FUNC(reload_getVehicleMagazine);
TRACE_3("Re-add previous mag",_x select 0,_turret,_vehicleMag);
// If the magazine can be added to the static weapon, do it now
if (_vehicleMag in _compatibleMagazinesTurret) then {
_staticWeapon addMagazineTurret [_vehicleMag, _turret, _x select 1];
_vehicle addMagazineTurret [_vehicleMag, _turret, _x select 1];
} else {
// Find a suitable container to place items in if necessary
if (isNull _container) then {
_container = (nearestObjects [_staticWeapon, ["GroundWeaponHolder"], 10]) param [0, objNull];
_container = (nearestObjects [_vehicle, ["GroundWeaponHolder"], 10]) param [0, objNull];
// Create ammo storage container
if (isNull _container) then {
_container = createVehicle ["GroundWeaponHolder", getPosATL _staticWeapon, [], 0, "NONE"];
_container = createVehicle ["GroundWeaponHolder", getPosATL _vehicle, [], 0, "NONE"];
};
};
@ -99,12 +100,12 @@ if (_secondaryWeaponMagazines isNotEqualTo []) then {
};
} forEach _secondaryWeaponMagazines;
_staticWeapon setVariable [QGVAR(secondaryWeaponMagazines), nil, true];
_vehicle setVariable [QGVAR(secondaryWeaponMagazines), nil, true];
};
if (_storeExtraMagazines) then {
TRACE_1("saving extra mags to container",_containerMagazineCount);
{
[_staticWeapon, _x, _containerMagazineCount select _forEachIndex] call FUNC(reload_handleReturnAmmo);
[_vehicle, _x, _containerMagazineCount select _forEachIndex] call FUNC(reload_handleReturnAmmo);
} forEach _containerMagazineClassnames;
};

View File

@ -3,11 +3,13 @@ class Extended_PreStart_EventHandlers {
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
};
};
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_preInit));
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));

View File

@ -4,7 +4,7 @@ class CfgVehicles {
class ACE_Actions {
class ACE_Dogtag {
displayName = CSTRING(itemName);
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canTakeDogtag));
condition = QUOTE([ARR_2(_player,_target)] call FUNC(canCheckDogtag));
statement = "";
exceptions[] = {"isNotSwimming", "isNotInside"};
showDisabled = 0;

View File

@ -16,8 +16,8 @@ class CfgWeapons {
author = ECSTRING(common,ACETeam);
scope = 0;
displayName = CSTRING(itemName);
model = QUOTE(PATHTOF(data\ace_dogtag.p3d));
picture = QUOTE(PATHTOF(data\dogtagSingle.paa));
model = QPATHTOF(data\ace_dogtag.p3d);
picture = QPATHTOF(data\dogtagSingle.paa);
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 0; //too small to for 1 ?
};

View File

@ -1,13 +1,11 @@
PREP(addDogtagActions);
PREP(addDogtagItem);
PREP(bloodType);
PREP(canCheckDogtag);
PREP(canTakeDogtag);
PREP(checkDogtag);
PREP(disableFactionDogtags);
PREP(getDogtagData);
PREP(getDogtagItem);
PREP(showDogtag);
PREP(ssn);
PREP(takeDogtag);
PREP(disableFactionDogtags);

View File

@ -1,12 +1,20 @@
#include "script_component.hpp"
[QGVAR(showDogtag), LINKFUNC(showDogtag)] call CBA_fnc_addEventHandler;
[QGVAR(getDogtagItem), LINKFUNC(getDogtagItem)] call CBA_fnc_addEventHandler;
[QGVAR(addDogtagItem), LINKFUNC(addDogtagItem)] call CBA_fnc_addEventHandler;
if (hasInterface || isServer) then {
[QGVAR(broadcastDogtagInfo), {
GVAR(dogtagsData) set _this;
if (isNil "CBA_fnc_renameInventoryItem") exitWith {}; // requires https://github.com/CBATeam/CBA_A3/pull/1329
params ["_item", "_dogTagData"];
private _name = _dogtagData param [0, ""];
// If data doesn't exist or body has no name, set name as "unknown"
if (_name == "") then {
_name = LELSTRING(common,unknown);
};
_name = [LLSTRING(itemName), ": ", _name] joinString "";
[_item, _name] call CBA_fnc_renameInventoryItem;
}] call CBA_fnc_addEventHandler;
if (isServer) then {
@ -18,69 +26,29 @@ if (hasInterface || isServer) then {
[QGVAR(broadcastDogtagInfo), [_x, _y], _clientOwner] call CBA_fnc_ownerEvent;
} forEach GVAR(dogtagsData);
}] call CBA_fnc_addEventHandler;
[QGVAR(getDogtagItem), LINKFUNC(getDogtagItem)] call CBA_fnc_addEventHandler;
} else {
// To be here, hasInterface must be true
[QGVAR(requestSyncDogtagDataJIP), clientOwner] call CBA_fnc_serverEvent;
};
};
// Add actions and event handlers only if ace_medical is enabled
// - Adding actions via config would create a dependency
["CBA_settingsInitialized", {
if !(GETEGVAR(medical,enabled,false)) exitWith {};
if (hasInterface) then {
// If the arsenal is loaded, show the custom names for dog tags when in the arsenal
if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(arsenal,rightPanelFilled), {
params ["_display", "_leftPanelIDC", "_rightPanelIDC"];
if (hasInterface) then {
private _checkTagAction = [
"ACE_CheckDogtag",
format ["%1: %2", localize LSTRING(itemName), localize LSTRING(checkDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player,_target] call FUNC(checkDogtag)},
{!isNil {_target getVariable QGVAR(dogtagData)}}
] call EFUNC(interact_menu,createAction);
if !(_leftPanelIDC in [2010, 2012, 2014] && {_rightPanelIDC == 38}) exitWith {};
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _checkTagAction, true] call EFUNC(interact_menu,addActionToClass);
private _takeTagAction = [
"ACE_TakeDogtag",
format ["%1: %2", localize LSTRING(itemName), localize LSTRING(takeDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player,_target] call FUNC(takeDogtag)},
{(!isNil {_target getVariable QGVAR(dogtagData)}) && {((_target getVariable [QGVAR(dogtagTaken), objNull]) != _target)}}
] call EFUNC(interact_menu,createAction);
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _takeTagAction, true] call EFUNC(interact_menu,addActionToClass);
};
if (isServer) then {
["ace_placedInBodyBag", {
params ["_target", "_bodyBag", "_isGrave"];
if (_isGrave) exitWith {};
TRACE_2("ace_placedInBodyBag eh",_target,_bodyBag);
private _dogTagData = [_target] call FUNC(getDogtagData);
_bodyBag setVariable [QGVAR(dogtagData), _dogTagData, true];
if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then {
_bodyBag setVariable [QGVAR(dogtagTaken), _bodyBag, true];
};
}] call CBA_fnc_addEventHandler;
};
}] call CBA_fnc_addEventHandler;
// If the arsenal is loaded, show the custom names for dog tags when in the arsenal
if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
[QEGVAR(arsenal,rightPanelFilled), {
params ["_display", "_leftPanelIDC", "_rightPanelIDC"];
if (_leftPanelIDC in [2010, 2012, 2014] && {_rightPanelIDC == 38}) then {
LOG("passed");
private _rightPanel = _display displayCtrl 15;
private _cfgWeapons = configFile >> "CfgWeapons";
private _item = "";
private _dogtagData = [];
TRACE_1("passed",_rightPanel);
for "_i" from 0 to (lnbSize _rightPanel select 0) - 1 do {
_item = _rightPanel lnbData [_i, 0];
private _item = _rightPanel lnbData [_i, 0];
if (_item isKindOf ["ACE_dogtag", _cfgWeapons]) then {
private _name = (GVAR(dogtagsData) getOrDefault [_item, []]) param [0, ""];
@ -93,27 +61,71 @@ if (["ace_arsenal"] call EFUNC(common,isModLoaded)) then {
_rightPanel lnbSetText [[_i, 1], [LLSTRING(itemName), ": ", _name] joinString ""];
};
};
};
}] call CBA_fnc_addEventHandler;
}] call CBA_fnc_addEventHandler;
};
// Add context menu option
[
"ACE_dogtag",
["GROUND", "CARGO", "CONTAINER"],
LLSTRING(checkItem),
nil,
QPATHTOF(data\dogtag_icon_ca.paa),
[
{true},
{true}
],
{
[GVAR(dogtagsData) getOrDefault [_this select 2, []]] call FUNC(showDogtag);
false
}
] call CBA_fnc_addItemContextMenuOption;
};
// Add context menu option
[
"ACE_dogtag",
["GROUND", "CARGO", "CONTAINER"],
LLSTRING(checkItem),
nil,
QPATHTOF(data\dogtag_icon_ca.paa),
[
{true},
{true}
],
{
[GVAR(dogtagsData) getOrDefault [_this select 2, []]] call FUNC(showDogtag);
// Add actions and event handlers only if ace_medical is enabled
// - Adding actions via config would create a dependency
["CBA_settingsInitialized", {
if !(GETEGVAR(medical,enabled,false)) exitWith {};
false
}
] call CBA_fnc_addItemContextMenuOption;
if (hasInterface) then {
private _checkTagAction = [
"ACE_CheckDogtag",
format ["%1: %2", LLSTRING(itemName), LLSTRING(checkDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player, _target] call FUNC(checkDogtag)},
{!isNil {_target getVariable QGVAR(dogtagData)}}
] call EFUNC(interact_menu,createAction);
// Disable dogtags for civilians
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _checkTagAction, true] call EFUNC(interact_menu,addActionToClass);
private _takeTagAction = [
"ACE_TakeDogtag",
format ["%1: %2", LLSTRING(itemName), LLSTRING(takeDogtag)],
QPATHTOF(data\dogtag_icon_ca.paa),
{[_player, _target] call FUNC(takeDogtag)},
{(!isNil {_target getVariable QGVAR(dogtagData)}) && {((_target getVariable [QGVAR(dogtagTaken), objNull]) != _target)}}
] call EFUNC(interact_menu,createAction);
["ACE_bodyBagObject", 0, ["ACE_MainActions"], _takeTagAction, true] call EFUNC(interact_menu,addActionToClass);
};
if (isServer) then {
["ace_placedInBodyBag", {
params ["_target", "_bodyBag", "_isGrave"];
if (_isGrave) exitWith {};
TRACE_2("ace_placedInBodyBag eh",_target,_bodyBag);
private _dogtagData = _target call FUNC(getDogtagData);
_bodyBag setVariable [QGVAR(dogtagData), _dogtagData, true];
if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then {
_bodyBag setVariable [QGVAR(dogtagTaken), _bodyBag, true];
};
}] call CBA_fnc_addEventHandler;
};
}] call CBA_fnc_addEventHandler;
// Disable dog tags for civilians
"CIV_F" call FUNC(disableFactionDogtags);

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL, mharis001
* Returns children actions for checking dogtags in player's inventory.
* Returns children actions for checking dog tags in the player's inventory.
*
* Arguments:
* 0: Player <OBJECT>
@ -10,7 +10,7 @@
* Actions <ARRAY>
*
* Example:
* [_player] call ace_dogtags_fnc_addDogtagActions
* player call ace_dogtags_fnc_addDogtagActions
*
* Public: No
*/
@ -23,14 +23,21 @@ private _fnc_getActions = {
{
private _config = _cfgWeapons >> _x;
if (getNumber (_config >> QGVAR(tagID)) > 0) then {
private _displayName = getText (_config >> "displayName");
private _picture = getText (_config >> "picture");
private _action = [_x, _displayName, _picture, {
[GVAR(dogtagsData) getOrDefault [_this select 2, []]] call FUNC(showDogtag);
}, {true}, {}, _x] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _player];
if (getNumber (_config >> QGVAR(tagID)) > 0) then {
_actions pushBack [
[
_x,
getText (_config >> "displayName"),
getText (_config >> "picture"),
{[GVAR(dogtagsData) getOrDefault [_this select 2, []]] call FUNC(showDogtag)},
{true},
{},
_x
] call EFUNC(interact_menu,createAction),
[],
_player
];
};
} forEach (_player call EFUNC(common,uniqueItems));

View File

@ -1,38 +0,0 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL
* Adds dogtag item to unit (triggered by server).
*
* Arguments:
* 0: Item class <STRING>
* 1: Dogtag data <ARRAY>
*
* Return Value:
* None
*
* Example:
* ["itemClass", ["name", "610-27-5955", "A POS"]] call ace_dogtags_fnc_addDogtagItem
*
* Public: No
*/
params ["_item", "_dogtagData"];
if (_item == "") exitWith {};
// Verify that the unit has inventory space, otherwise drop the dogtag on the ground
[ace_player, _item, true] call CBA_fnc_addItem;
_dogtagData params ["_name"];
// If data doesn't exist or body has no name, set name as "unknown"
if (_name == "") then {
_name = LELSTRING(common,unknown);
};
private _displayText = format [localize LSTRING(takeDogtagSuccess), _name];
// display message
[{
[_this, 2.5] call EFUNC(common,displayTextStructured);
}, _displayText, DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;

View File

@ -1,16 +1,16 @@
#include "..\script_component.hpp"
/*
* Author: commy2
* Reports a blood type depending on the units name.
* Reports a blood type depending on the unit's name.
*
* Arguments:
* 0: Name of a unit <STRING>
* 0: Unit name <STRING>
*
* Return Value:
* A random blood type <STRING>
*
* Example:
* _bloodType = ["name"] call ace_dogtags_fnc_bloodType
* "name" call ace_dogtags_fnc_bloodType
*
* Public: No
*/

View File

@ -1,26 +1,26 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL
* Checks if dogtag can be checked.
* Checks if the target's dog tag can be checked by the unit.
*
* Arguments:
* 0: Player <OBJECT>
* 0: Player (not used) <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* True if dogtag can be checked <BOOL>
* If dog tag can be checked <BOOL>
*
* Example:
* _canCheck = [player, unit] call ace_dogtags_fnc_canCheckDogtag
* [player, cursorObject] call ace_dogtags_fnc_canCheckDogtag
*
* Public: No
*/
params ["_player", "_target"];
params ["", "_target"];
if (isNull _target) exitWith {false};
// check if disabled for faction
// Check if disabled for faction
if ((faction _target) in GVAR(disabledFactions)) exitWith {false};
!(_target call EFUNC(common,isAwake))

View File

@ -1,17 +1,17 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL
* Checks if dogtag can be taken.
* Checks if the target's dog tag can be taken by the unit.
*
* Arguments:
* 0: Player <OBJECT>
* 1: Target <OBJECT>
*
* Return Value:
* True if dogtag can be taken <BOOL>
* If dog tag can be taken <BOOL>
*
* Example:
* _canTake = [player, unit] call ace_dogtags_fnc_canTakeDogtag
* [player, cursorObject] call ace_dogtags_fnc_canTakeDogtag
*
* Public: No
*/
@ -20,7 +20,10 @@ params ["_player", "_target"];
if (isNull _target) exitWith {false};
// check if disabled for faction
// Check if disabled for faction
if ((faction _target) in GVAR(disabledFactions)) exitWith {false};
!(_target call EFUNC(common,isAwake)) && {_player canAdd ["ACE_dogtag_1", 1/*, true*/]} // Todo: Uncomment in 2.18
// CBA_fnc_canAddItem doesn't account for mass 0 items and unit not having any containers
!(_target call EFUNC(common,isAwake)) && {(uniform _player + vest _player + backpack _player) != ""} && {[_player, "ACE_dogtag_1"] call CBA_fnc_canAddItem}
// Todo: Use code below in 2.18
// _player canAdd ["ACE_dogtag_1", 1, true]

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL
* Checks unit dogtag.
* Checks the unit's dog tag.
*
* Arguments:
* 0: Player <OBJECT>
@ -11,17 +11,17 @@
* None
*
* Example:
* [player, unit] call ace_dogtags_fnc_checkDogtag
* [player, cursorObject] call ace_dogtags_fnc_checkDogtag
*
* Public: No
*/
params ["_player", "_target"];
// animation
// Animation
_player call EFUNC(common,goKneeling);
// sound
// Sound
private _position = _target modelToWorldWorld (_target selectionPosition "neck");
playSound3D [
@ -34,10 +34,8 @@ playSound3D [
50
];
// display dogtag
// Display dog tag
private _doubleTags = (_target getVariable [QGVAR(dogtagTaken), objNull]) != _target;
private _dogTagData = [_target] call FUNC(getDogTagData);
private _dogtagData = _target call FUNC(getDogtagData);
[{
[QGVAR(showDogtag), _this] call CBA_fnc_localEvent;
}, [_dogTagData, _doubleTags], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;
[LINKFUNC(showDogtag), [_dogtagData, _doubleTags], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: commy2
* Disable this faction from using dogtags.
* Disables this faction from using dog tags.
*
* Arguments:
* 0: Faction <STRING>

View File

@ -1,19 +1,19 @@
#include "..\script_component.hpp"
/*
* Author: esteldunedain
* Get unit dogtag data.
* Gets unit's dog tag data.
*
* Arguments:
* 0: Target <OBJECT>
*
* Return Value:
* Dogtag Data <ARRAY>
* Dog tag Data <ARRAY>
* 0: Name <STRING>
* 1: SSN <STRING>
* 2: Blood Type <STRING>
*
* Example:
* _dogtagData = [unit, player] call ace_dogtags_fnc_getDogtagData
* player call ace_dogtags_fnc_getDogtagData
*
* Public: No
*/
@ -21,17 +21,20 @@
params ["_target"];
// Check if the data was already created
private _dogTagData = _target getVariable QGVAR(dogtagData);
if (!isNil "_dogTagData") exitWith {_dogTagData};
private _dogtagData = _target getVariable QGVAR(dogtagData);
if (!isNil "_dogtagData") exitWith {_dogtagData};
// Create dog tag data once for the unit: nickname, code (eg. 135-13-900) and blood type
private _targetName = [_target, false, true] call EFUNC(common,getName);
private _dogTagData = [
private _dogtagData = [
_targetName,
_targetName call FUNC(ssn),
_targetName call FUNC(bloodType)
];
// Store it
_target setVariable [QGVAR(dogtagData), _dogTagData, true];
_dogTagData
_target setVariable [QGVAR(dogtagData), _dogtagData, true];
_dogtagData

View File

@ -1,7 +1,8 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL
* Server: creates new dogtag item and send it to client.
* Server: Creates a new dog tag item and sends it to client.
* It broacasts the dog tag info to all machines with interfaces.
*
* Arguments:
* 0: Player <OBJECT>
@ -11,12 +12,12 @@
* None
*
* Example:
* [player, unit] call ace_dogtags_fnc_getDogtagItem
* [player, cursorObject] call ace_dogtags_fnc_getDogtagItem
*
* Public: No
*/
if(!isServer) exitWith {};
if (!isServer) exitWith {};
params ["_player", "_target"];
TRACE_2("getDogtagItem",_player,_target);
@ -28,7 +29,20 @@ if (GVAR(idCounter) > 999) exitWith {ERROR("Ran out of IDs");};
private _dogTagData = [_target] call FUNC(getDogTagData);
private _item = format ["ACE_dogtag_%1", GVAR(idCounter)];
[QGVAR(addDogtagItem), [_item, _dogTagData], [_player]] call CBA_fnc_targetEvent;
// Broadcast data globally, so that clients can use it where needed
[QGVAR(broadcastDogtagInfo), [_item, _dogTagData]] call CBA_fnc_globalEvent;
// Dog tags have no mass, so no need to check if it can fit in container, but check if unit has an inventory at all
[_player, _item, true] call CBA_fnc_addItem;
private _name = _dogtagData param [0, ""];
// If data doesn't exist or body has no name, set name as "unknown"
if (_name == "") then {
_name = LELSTRING(common,unknown);
};
// Display message
[{
[QEGVAR(common,displayTextStructured), [_this select 0, 2.5], _this select 1] call CBA_fnc_targetEvent;
}, [format [LLSTRING(takeDogtagSuccess), _name], _player], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;

View File

@ -1,10 +1,10 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL
* Shows dogtag.
* Shows dog tag.
*
* Arguments:
* 0: Dogtag data <ARRAY>
* 0: Dog tag data <ARRAY>
* 1: Display as double tag <BOOLEAN>
*
* Return Value:
@ -27,8 +27,10 @@ if (_doubleTags) then {
} else {
(QGVAR(tag) call BIS_fnc_rscLayer) cutRsc [QGVAR(singleTag), "PLAIN", 1, true];
};
private _display = uiNamespace getvariable [QGVAR(tag), displayNull];
if(isNull _display) exitWith {};
private _display = uiNamespace getVariable [QGVAR(tag), displayNull];
if (isNull _display) exitWith {};
private _control = _display displayCtrl 1001;
_dogtagData params ["_name", "_code", "_bloodType"];

View File

@ -1,16 +1,16 @@
#include "..\script_component.hpp"
/*
* Author: kymckay
* Reports a social security number generated from the units name.
* Reports a social security number generated from the unit's name.
*
* Arguments:
* 0: Name of a unit <STRING>
* 0: Unit name <STRING>
*
* Return Value:
* A random three/two/four format social security number <STRING>
*
* Example:
* _ssn = ["AAA"] call ace_dogtags_fnc_ssn
* "name" call ace_dogtags_fnc_ssn
*
* Public: No
*/
@ -18,19 +18,20 @@
params ["_name"];
private _chars = toArray _name;
private _length = count _chars;
// Warning, for strings containing non-latin characters, `_count _name` != `_count _chars`
private _length = count _chars;
_chars pushBack _length;
_length = _length + 1;
private _remainder = 0;
private _nums = [0,0,0,0,0,0,0,0,0];
private _nums = [0, 0, 0, 0, 0, 0, 0, 0, 0];
for "_index" from 0 to (8 max _length) do {
private _inputChar = _chars select (_index % _length);
_nums set [(_index % 9), ((_nums select (_index % 9)) + _inputChar + _remainder) % 10];
_nums set [_index % 9, ((_nums select (_index % 9)) + _inputChar + _remainder) % 10];
_remainder = (_inputChar + _remainder) % 256;
};
([_nums select [0,3],_nums select [3,2], _nums select [5,4]] apply { _x joinString "" }) joinString "-"
([_nums select [0, 3], _nums select [3, 2], _nums select [5, 4]] apply { _x joinString "" }) joinString "-"

View File

@ -1,8 +1,8 @@
#include "..\script_component.hpp"
/*
* Author: SzwedzikPL
* If dogtag is not already taken triggers event on server.
* If dogtag already taken displays info about it.
* If the dog tag hasn't already been taken, it triggers an event on the server.
* If the dog tag has already been taken, it displays info about it.
*
* Arguments:
* 0: Player <OBJECT>
@ -12,17 +12,17 @@
* None
*
* Example:
* [player, unit] call ace_dogtags_fnc_takeDogtag
* [player, cursorObject] call ace_dogtags_fnc_takeDogtag
*
* Public: No
*/
params ["_player", "_target"];
// animation
// Animation
_player call EFUNC(common,goKneeling);
// sound
// Sound
private _position = _target modelToWorldWorld (_target selectionPosition "neck");
playSound3D [
@ -35,12 +35,11 @@ playSound3D [
50
];
// display message
// Display message
if ((_target getVariable [QGVAR(dogtagTaken), objNull]) == _target) then {
[{
[_this, 2.5] call EFUNC(common,displayTextStructured);
}, localize LSTRING(dogtagAlreadyTaken), DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;
[EFUNC(common,displayTextStructured), [LLSTRING(dogtagAlreadyTaken), 2.5], DOGTAG_SHOW_DELAY] call CBA_fnc_waitAndExecute;
} else {
_target setVariable [QGVAR(dogtagTaken), _target, true];
[QGVAR(getDogtagItem), [_player, _target]] call CBA_fnc_serverEvent;
};

View File

@ -19,6 +19,12 @@
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
// If in ViV cargo, unload it first
// Warn user if it failed to unload (shouldn't happen)
if (!isNull isVehicleCargo _target && {!(objNull setVehicleCargo _target)}) then {
WARNING_1("ViV Unload Failed %1",_target);
};
// Get attachTo offset and direction
private _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
private _direction = _target getVariable [QGVAR(carryDirection), 0];
@ -60,10 +66,10 @@ private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew);
if (_UAVCrew isNotEqualTo []) then {
{
_target deleteVehicleCrew _x;
[_x, true] call EFUNC(common,disableAiUAV);
} forEach _UAVCrew;
_target setVariable [QGVAR(isUAV), true, true];
_target setVariable [QGVAR(isUAV), _UAVCrew, true];
};
// Check everything

View File

@ -73,8 +73,8 @@ if (_unit getHitPointDamage "HitLegs" >= 0.5) exitWith {
_idPFH call CBA_fnc_removePerFrameHandler;
};
// Drop static if crew is in it (UAV crew deletion may take a few frames)
if (_target isKindOf "StaticWeapon" && {!(_target getVariable [QGVAR(isUAV), false])} && {(crew _target) isNotEqualTo []}) exitWith {
// Drop static if either non-UAV crew or new UAV crew is in it (ignore saved UAV crew)
if (_target isKindOf "StaticWeapon" && {((crew _target) - (_target getVariable [QGVAR(isUAV), []])) isNotEqualTo []}) exitWith {
TRACE_2("static weapon crewed",_unit,_target);
[_unit, _target] call FUNC(dropObject_carry);

View File

@ -19,6 +19,12 @@
params ["_unit", "_target"];
TRACE_2("params",_unit,_target);
// If in ViV cargo, unload it first
// Warn user if it failed to unload (shouldn't happen)
if (!isNull isVehicleCargo _target && {!(objNull setVehicleCargo _target)}) then {
WARNING_1("ViV Unload Failed %1",_target);
};
// Get attachTo offset and direction.
private _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]];
private _direction = _target getVariable [QGVAR(dragDirection), 0];
@ -73,10 +79,10 @@ private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew);
if (_UAVCrew isNotEqualTo []) then {
{
_target deleteVehicleCrew _x;
[_x, true] call EFUNC(common,disableAiUAV);
} forEach _UAVCrew;
_target setVariable [QGVAR(isUAV), true, true];
_target setVariable [QGVAR(isUAV), _UAVCrew, true];
};
// Check everything

View File

@ -51,8 +51,8 @@ if (_unit distance _target > 10 && {(CBA_missionTime - _startTime) >= 1}) exitWi
_idPFH call CBA_fnc_removePerFrameHandler;
};
// Drop static if crew is in it (UAV crew deletion may take a few frames)
if (_target isKindOf "StaticWeapon" && {!(_target getVariable [QGVAR(isUAV), false])} && {(crew _target) isNotEqualTo []}) exitWith {
// Drop static if either non-UAV crew or new UAV crew is in it (ignore saved UAV crew)
if (_target isKindOf "StaticWeapon" && {((crew _target) - (_target getVariable [QGVAR(isUAV), []])) isNotEqualTo []}) exitWith {
TRACE_2("static weapon crewed",_unit,_target);
[_unit, _target] call FUNC(dropObject);

View File

@ -80,16 +80,16 @@ if (_unit getVariable ["ACE_isUnconscious", false]) then {
[_unit, "unconscious", 2] call EFUNC(common,doAnimation);
};
// Recreate UAV crew (add a frame delay or this may cause the vehicle to be moved to [0,0,0])
if (_target getVariable [QGVAR(isUAV), false]) then {
_target setVariable [QGVAR(isUAV), nil, true];
// Reenable UAV crew
private _UAVCrew = _target getVariable [QGVAR(isUAV), []];
[{
params ["_target"];
if (!alive _target) exitWith {};
TRACE_2("restoring uav crew",_target,getPosASL _target);
createVehicleCrew _target;
}, [_target]] call CBA_fnc_execNextFrame;
if (_UAVCrew isNotEqualTo []) then {
// Reenable AI
{
[_x, false] call EFUNC(common,disableAiUAV);
} forEach _UAVCrew;
_target setVariable [QGVAR(isUAV), nil, true];
};
// Fixes not being able to move when in combat pace

View File

@ -59,11 +59,12 @@ if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS})
_unit removeWeapon "ACE_FakePrimaryWeapon";
// Reselect weapon and re-enable sprint
private _previousWeaponIndex = _unit getVariable [QGVAR(previousWeapon), -1];
_unit setVariable [QGVAR(previousWeapon), nil, true];
private _previousWeaponState = _unit getVariable QGVAR(previousWeapon);
if (_previousWeaponIndex != -1) then {
_unit action ["SwitchWeapon", _unit, _unit, _previousWeaponIndex];
if (!isNil "_previousWeaponState") then {
_unit selectWeapon _previousWeaponState;
_unit setVariable [QGVAR(previousWeapon), nil, true];
};
[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
@ -86,16 +87,16 @@ if !(_target isKindOf "CAManBase") then {
[QEGVAR(common,fixFloating), _target, _target] call CBA_fnc_targetEvent;
};
// Recreate UAV crew (add a frame delay or this may cause the vehicle to be moved to [0,0,0])
if (_target getVariable [QGVAR(isUAV), false]) then {
_target setVariable [QGVAR(isUAV), nil, true];
// Reenable UAV crew
private _UAVCrew = _target getVariable [QGVAR(isUAV), []];
[{
params ["_target"];
if (!alive _target) exitWith {};
TRACE_2("restoring uav crew",_target,getPosASL _target);
createVehicleCrew _target;
}, [_target]] call CBA_fnc_execNextFrame;
if (_UAVCrew isNotEqualTo []) then {
// Reenable AI
{
[_x, false] call EFUNC(common,disableAiUAV);
} forEach _UAVCrew;
_target setVariable [QGVAR(isUAV), nil, true];
};
// Reset mass

View File

@ -11,7 +11,7 @@
* Weight <NUMBER>
*
* Example:
* [cursorTarget] call ace_dragging_fnc_getWeight
* cursorTarget call ace_dragging_fnc_getWeight
*
* Public: No
*/
@ -23,19 +23,20 @@ if (GVAR(weightCoefficient) == 0) exitWith {0};
private _weight = loadAbs _object;
if !(GVAR(skipContainerWeight)) then {
if (!GVAR(skipContainerWeight)) then {
// Add the mass of the object itself
// getMass handles PhysX mass, this should be 0 for SupplyX containers and WeaponHolders
// Use originalMass in case we're checking weight for a carried object
_weight = _weight + ((_object getVariable [QGVAR(originalMass), getMass _object]));
_weight = _weight + (_object getVariable [QGVAR(originalMass), getMass _object]);
};
// Contents of backpacks get counted twice (https://github.com/acemod/ACE3/pull/8457#issuecomment-1062522447 and https://feedback.bistudio.com/T167469)
// This is a workaround until that is fixed on BI's end
{
_x params ["", "_container"];
_weight = _weight - (loadAbs _container);
} forEach (everyContainer _object);
// Fixed in https://feedback.bistudio.com/T167469 on 2.16 profiling branch and for 2.18 stable
if ((productVersion select 3) < 152017) then {
{
_x params ["", "_container"];
_weight = _weight - (loadAbs _container);
} forEach (everyContainer _object);
};
// Mass in Arma isn't an exact amount but rather a volume/weight value
// This attempts to work around that by making it a usable value (sort of)

View File

@ -50,7 +50,7 @@ if (_target isKindOf "CAManBase") then {
};
// Select primary, otherwise the carry animation actions don't work
_unit selectWeapon _primaryWeapon;
_unit selectWeapon _primaryWeapon; // This turns off lasers/lights
// Move a bit closer and adjust direction when trying to pick up a person
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
@ -62,10 +62,11 @@ if (_target isKindOf "CAManBase") then {
_timer = CBA_missionTime + 10;
} else {
// Select no weapon and stop sprinting
private _previousWeaponIndex = [_unit] call EFUNC(common,getFiremodeIndex);
_unit setVariable [QGVAR(previousWeapon), _previousWeaponIndex, true];
if (currentWeapon _unit != "") then {
_unit setVariable [QGVAR(previousWeapon), (weaponState _unit) select [0, 3], true];
_unit action ["SwitchWeapon", _unit, _unit, 299];
_unit action ["SwitchWeapon", _unit, _unit, 299];
};
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);

View File

@ -46,7 +46,10 @@ if (!GVAR(dragAndFire)) then {
_primaryWeapon = "ACE_FakePrimaryWeapon";
};
_unit selectWeapon _primaryWeapon;
// Keep the laser/light on if the weapon is already selected
if (currentWeapon _unit != _primaryWeapon) then {
_unit selectWeapon _primaryWeapon;
};
} else { // Making sure the unit is holding a primary weapon or handgun
private _handgunWeapon = handgunWeapon _unit;

View File

@ -92,19 +92,6 @@ if (_detonator != "ACE_DeadManSwitch") then {
];
};
} else {
//Add action to detonate all explosives (including the inventory explosive):
_children pushBack [
[
"Explosive_All_Deadman",
LLSTRING(DetonateAll),
getText (configFile >> "CfgWeapons" >> _detonator >> "picture"),
{[_player] call FUNC(onIncapacitated)},
{true}
] call EFUNC(interact_menu,createAction),
[],
_unit
];
//Adds actions for the explosives you can connect to the deadman switch.
private _connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""];
if ((_connectedInventoryExplosive != "") && {!(_connectedInventoryExplosive in (magazines _unit))}) then {
@ -113,6 +100,22 @@ if (_detonator != "ACE_DeadManSwitch") then {
};
_connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""];
//Add action to detonate all explosives (including the inventory explosive):
if (_connectedInventoryExplosive != "" || {count _explosivesList > 1}) then {
_children pushBack [
[
"Explosive_All_Deadman",
LLSTRING(DetonateAll),
getText (configFile >> "CfgWeapons" >> _detonator >> "picture"),
{[_player] call FUNC(onIncapacitated)},
{true}
] call EFUNC(interact_menu,createAction),
[],
_unit
];
};
if (_connectedInventoryExplosive != "") then {
//Add the disconnect action
private _magConfig = configFile >> "CfgMagazines" >> _connectedInventoryExplosive;

View File

@ -1,25 +1,25 @@
#include "script_component.hpp"
[QGVAR(burn), LINKFUNC(burn)] call CBA_fnc_addEventHandler;
[QGVAR(burnEffects), LINKFUNC(burnEffects)] call CBA_fnc_addEventHandler;
[QGVAR(burnSimulation), LINKFUNC(burnSimulation)] call CBA_fnc_addEventHandler;
[QGVAR(playScream), {
params ["_scream", "_source"];
// Only play sound if enabled in settings and enabled for the unit
if (GVAR(enableScreams) && {_source getVariable [QGVAR(enableScreams), true]}) then {
_source say3D _scream;
};
}] call CBA_fnc_addEventHandler;
if (!isServer) exitWith {};
["CBA_settingsInitialized", {
TRACE_1("settingsInit",GVAR(enabled));
TRACE_1("settingsInitialized",GVAR(enabled));
if (!GVAR(enabled)) exitWith {};
[QGVAR(burn), LINKFUNC(burn)] call CBA_fnc_addEventHandler;
[QGVAR(burnEffects), LINKFUNC(burnEffects)] call CBA_fnc_addEventHandler;
[QGVAR(burnSimulation), LINKFUNC(burnSimulation)] call CBA_fnc_addEventHandler;
[QGVAR(playScream), {
params ["_scream", "_source"];
// Only play sound if enabled in settings and enabled for the unit
if (GVAR(enableScreams) && {_source getVariable [QGVAR(enableScreams), true]}) then {
_source say3D _scream;
};
}] call CBA_fnc_addEventHandler;
if (!isServer) exitWith {};
GVAR(fireSources) = createHashMap;
[QGVAR(addFireSource), {

View File

@ -1,3 +0,0 @@
[tools]
pboProject_noBinConfig = true
sqfvm_skipConfigChecks = true

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
class CfgPatches {
class SUBADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_medical_engine"};
skipWhenMissingDependencies = 1;
author = ECSTRING(common,ACETeam);
authors[] = {};
url = ECSTRING(main,URL);
VERSION_CONFIG;
addonRootClass = QUOTE(ADDON);
};
};
#include "ACE_Medical_Treatment_Actions.hpp"

View File

@ -0,0 +1,3 @@
#define SUBCOMPONENT medical_engine
#define SUBCOMPONENT_BEAUTIFIED Medical Engine
#include "..\script_component.hpp"

View File

@ -1,20 +1,12 @@
#include "script_component.hpp"
#pragma hemtt flag pe23_ignore_has_include
#if __has_include("\z\ace\addons\nomedical\script_component.hpp")
#define PATCH_SKIP "No Medical"
#endif
#ifdef PATCH_SKIP
ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP)
#else
class CfgPatches {
class ADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common", "ace_medical_engine"};
requiredAddons[] = {"ace_common"};
author = ECSTRING(common,ACETeam);
authors[] = {"commy2", "tcvm"};
url = ECSTRING(main,URL);
@ -25,7 +17,4 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
#include "CfgVehicles.hpp"
#include "ACE_Medical_Treatment_Actions.hpp"
#include "RscTitles.hpp"
#endif

View File

@ -148,20 +148,30 @@ params ["_unit", "_instigator"];
_unit call FUNC(burnReaction);
};
if (!isNull _instigator) then {
_unit setVariable [QEGVAR(medical,lastDamageSource), _instigator];
_unit setVariable [QEGVAR(medical,lastInstigator), _instigator];
// Keep pain around unconsciousness limit to allow for more fun interactions
private _painPercieved = (0 max ((_unit getVariable [QEGVAR(medical,pain), 0]) - (_unit getVariable [QEGVAR(medical,painSuppress), 0])) min 1);
private _painUnconscious = missionNamespace getVariable [QEGVAR(medical,painUnconsciousThreshold), 0];
private _damageToAdd = [0.15, _intensity / BURN_MAX_INTENSITY] select (!alive _unit || {_painPercieved < _painUnconscious + random 0.2});
if (GETEGVAR(medical,enabled,false)) then {
if (!isNull _instigator) then {
_unit setVariable [QEGVAR(medical,lastDamageSource), _instigator];
_unit setVariable [QEGVAR(medical,lastInstigator), _instigator];
};
// Common burn areas are the hands and face https://www.ncbi.nlm.nih.gov/pubmed/16899341/
private _bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] selectRandomWeighted [0.77, 0.5, 0.8, 0.8, 0.3, 0.3];
// Use event directly, as ace_medical_fnc_addDamageToUnit requires unit to be alive
[QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, "burn"]] call CBA_fnc_localEvent;
} else {
private _bodyParts = [["HitFace", "HitNeck", "HitHead"], ["HitPelvis", "HitAbdomen", "HitDiaphragm", "HitChest", "HitBody"], ["HitArms", "HitHands"], ["HitLegs"]] selectRandomWeighted [0.77, 0.5, 0.8, 0.3];
{
_unit setHitPointDamage [_x, (_unit getHitPointDamage _x) + _damageToAdd, true, _instigator, _instigator];
} forEach _bodyParts;
};
// Common burn areas are the hands and face https://www.ncbi.nlm.nih.gov/pubmed/16899341/
private _bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] selectRandomWeighted [0.77, 0.5, 0.8, 0.8, 0.3, 0.3];
// Keep pain around unconciousness limit to allow for more fun interactions
private _damageToAdd = [0.15, _intensity / BURN_MAX_INTENSITY] select (!alive _unit || {GET_PAIN_PERCEIVED(_unit) < (PAIN_UNCONSCIOUS + random 0.2)});
// Use event directly, as ace_medical_fnc_addDamageToUnit requires unit to be alive
[QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, "burn"]] call CBA_fnc_localEvent;
_unit setVariable [QGVAR(intensity), _intensity, true]; // Globally sync intensity across all clients to make sure simulation is deterministic
};
}, BURN_PROPAGATE_UPDATE, [_unit, _instigator]] call CBA_fnc_addPerFrameHandler;

View File

@ -5,7 +5,7 @@
LSTRING(Category_DisplayName),
true,
1,
{[QGVAR(fireEnabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
{[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)},
true // Needs mission restart
] call CBA_fnc_addSetting;

View File

@ -16,7 +16,6 @@
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\medical_engine\script_macros_medical.hpp"
#define FIRE_MANAGER_PFH_DELAY 0.25
#define FLARE_SIZE_MODIFIER 5

View File

@ -10,7 +10,7 @@
* Can Push <BOOL>
*
* Example:
* [target] call ace_interaction_fnc_canPush
* cursorObject call ace_interaction_fnc_canPush
*
* Public: No
*/
@ -19,4 +19,5 @@ params ["_target"];
alive _target &&
{getMass _target <= 2600 || getNumber (configOf _target >> QGVAR(canPush)) == 1} &&
{vectorMagnitude velocity _target < 3}
{vectorMagnitude velocity _target < 3} &&
{isNull isVehicleCargo _target} // Check if vehicle is loaded as ViV cargo

View File

@ -1,6 +1,6 @@
#include "..\script_component.hpp"
/*
* Author: mharis001, Dystopian
* Author: mharis001, Dystopian, PabstMirror, johnb43
* Returns children actions for weapon attachment switching.
*
* Arguments:
@ -21,48 +21,111 @@ params ["_unit"];
params ["_unit"];
private _currentWeapon = currentWeapon _unit;
if (_currentWeapon isEqualTo "") exitWith {[]};
private _weaponItems = _unit weaponAccessories _currentWeapon;
if (_currentWeapon == "") exitWith {[]};
private _cfgWeapons = configFile >> "CfgWeapons";
private _actions = [];
private _weaponItems = _unit weaponAccessories _currentWeapon;
// "attach" actions
private _items = _unit call EFUNC(common,uniqueItems);
private _compatibleItems = _currentWeapon call CBA_fnc_compatibleItems;
{
// Get current weapon attachments, as well as compatible attachments in inventory
private _allAttachments = (+_weaponItems) - [""];
_allAttachments append ((_unit call EFUNC(common,uniqueItems)) arrayIntersect (compatibleItems _currentWeapon));
(_allAttachments arrayIntersect _allAttachments) apply {
private _config = _cfgWeapons >> _x;
private _name = format [LLSTRING(weaponAttachmentsAttach), getText (_config >> "displayName")];
private _picture = getText (_config >> "picture");
private _type = getNumber (_config >> "itemInfo" >> "type");
private _oldAttachment = _weaponItems select ([TYPE_MUZZLE, TYPE_FLASHLIGHT, TYPE_OPTICS, TYPE_BIPOD] find _type);
private _action = [
_x, _name, _picture,
LINKFUNC(switchWeaponAttachment),
{true},
{},
[_currentWeapon, _x, _oldAttachment]
] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _unit];
} forEach ((_items arrayIntersect _compatibleItems) - _weaponItems);
// "detach" actions
{
if (_x isEqualTo "") then {continue};
private _config = _cfgWeapons >> _x;
private _name = format [LLSTRING(weaponAttachmentsDetach), getText (_config >> "displayName")];
private _name = getText (_config >> "displayName");
private _picture = getText (_config >> "picture");
private _action = [
_x, _name, _picture,
LINKFUNC(switchWeaponAttachment),
{true},
{},
[_currentWeapon, "", _x]
] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _unit];
} forEach _weaponItems;
[
[
_x,
_name,
_picture,
{},
{true},
{
params ["_unit", "", "_args"];
_args params ["_attachment", "_name", "_picture", "_weaponItems", "_currentWeapon"];
_actions
private _cfgWeapons = configFile >> "CfgWeapons";
private _attachmentNotOnGun = !(_attachment in _weaponItems);
private _actions = [];
// "attach" action
if (_attachmentNotOnGun && {[_unit, _attachment] call EFUNC(common,hasItem)}) then {
private _type = getNumber (_cfgWeapons >> _attachment >> "itemInfo" >> "type");
private _currentAttachment = _weaponItems select ([TYPE_MUZZLE, TYPE_FLASHLIGHT, TYPE_OPTICS, TYPE_BIPOD] find _type);
_actions pushBack [
[
QGVAR(attach_) + _attachment,
LLSTRING(weaponAttachmentsAttach),
_picture,
LINKFUNC(switchWeaponAttachment),
{true},
{},
[_currentWeapon, _attachment, _currentAttachment]
] call EFUNC(interact_menu,createAction),
[],
_unit
];
};
// Don't show interaction with attachments that aren't on the current weapon
if (_attachmentNotOnGun) exitWith {_actions};
// "detach" action
_actions pushBack [
[
QGVAR(detach_) + _attachment,
LLSTRING(weaponAttachmentsDetach),
_picture,
LINKFUNC(switchWeaponAttachment),
{true},
{},
[_currentWeapon, "", _attachment]
] call EFUNC(interact_menu,createAction),
[],
_unit
];
private _CBA_PIPItems = configFile >> "CBA_PIPItems";
// "switch" action
{
// Ignore 2D scopes when using a PIP scope (e.g. CUP uses this)
if (getText (_CBA_PIPItems >> _x) == _attachment) then {
continue;
};
private _config = _cfgWeapons >> _x;
private _modeName = getText (_config >> "MRT_SwitchItemHintText");
if (_modeName == "") then {
_modeName = getText (_config >> "displayName");
};
_actions pushBack [
[
QGVAR(switch_) + _x,
format ["%1: %2", localize "str_sensortype_switch", _modeName],
getText (_config >> "picture"),
LINKFUNC(switchWeaponAttachment),
{true},
{},
[_currentWeapon, _x, ""]
] call EFUNC(interact_menu,createAction),
[],
_unit
];
} forEach ((_attachment call CBA_fnc_switchableAttachments) - [_attachment]); // Don't allow switching to current mode
_actions
},
[_x, _name, _picture, _weaponItems, _currentWeapon]
] call EFUNC(interact_menu,createAction),
[],
_unit
]
} // return
}, _unit, QGVAR(weaponAttachmentsActions), 5, QGVAR(clearWeaponAttachmentsActionsCache)] call EFUNC(common,cachedCall);

View File

@ -1247,30 +1247,30 @@
<Korean>전면유리 부수기</Korean>
</Key>
<Key ID="STR_ACE_Interaction_weaponAttachmentsAttach">
<English>Attach %1</English>
<Russian>Установить %1</Russian>
<Japanese>%1 を取り付け</Japanese>
<Spanish>Acoplar %1</Spanish>
<French>Fixer %1</French>
<Polish>Przyczep %1</Polish>
<German>Befestige %1</German>
<Italian>Attacca %1</Italian>
<Chinesesimp>附加 %1</Chinesesimp>
<Korean>%1 붙이기</Korean>
<Portuguese>Fixar %1</Portuguese>
<English>Attach</English>
<Russian>Установить</Russian>
<Japanese>を取り付け</Japanese>
<Spanish>Acoplar</Spanish>
<French>Fixer</French>
<Polish>Przyczep</Polish>
<German>Befestige</German>
<Italian>Attacca</Italian>
<Chinesesimp>附加</Chinesesimp>
<Korean>붙이기</Korean>
<Portuguese>Fixar</Portuguese>
</Key>
<Key ID="STR_ACE_Interaction_weaponAttachmentsDetach">
<English>Detach %1</English>
<Russian>Снять %1</Russian>
<Japanese>%1 を外す</Japanese>
<Spanish>Desacoplar %1</Spanish>
<French>Retirer %1</French>
<Polish>Odczep %1</Polish>
<German>Löse %1</German>
<Italian>Stacca %1</Italian>
<Chinesesimp>拆卸 %1</Chinesesimp>
<Korean>%1 떼내기</Korean>
<Portuguese>Desfixar %1</Portuguese>
<English>Detach</English>
<Russian>Снять</Russian>
<Japanese>を外す</Japanese>
<Spanish>Desacoplar</Spanish>
<French>Retirer</French>
<Polish>Odczep</Polish>
<German>Löse</German>
<Italian>Stacca</Italian>
<Chinesesimp>拆卸</Chinesesimp>
<Korean>떼내기</Korean>
<Portuguese>Desfixar</Portuguese>
</Key>
<Key ID="STR_ACE_Interaction_weaponAttachments_Description">
<English>Enables attach/detach weapon attachment actions for current weapon.</English>

View File

@ -20,9 +20,9 @@ params ["_targetObject", "_vehicle"];
TRACE_2("params",_targetObject,_vehicle);
// Get the designator variables, or use defaults
private _waveLength = _vehicle getVariable [QEGVAR(laser,waveLength), ACE_DEFAULT_LASER_WAVELENGTH];
private _laserCode = _vehicle getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE];
private _beamSpread = _vehicle getVariable [QEGVAR(laser,beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD];
private _waveLength = _vehicle getVariable [QGVAR(waveLength), ACE_DEFAULT_LASER_WAVELENGTH];
private _laserCode = _vehicle getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
private _beamSpread = _vehicle getVariable [QGVAR(beamSpread), ACE_DEFAULT_LASER_BEAMSPREAD];
TRACE_3("codes",_waveLength,_laserCode,_beamSpread);
// Laser method is the method ACE_Laser will use to determine from where to where it should project the designator cone

View File

@ -29,7 +29,7 @@ GVAR(trackedLaserTargets) = GVAR(trackedLaserTargets) select {
TRACE_1("Laser off:",_laserUuid);
false
} else {
private _newCode = _owner getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE];
private _newCode = _owner getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
if (_laserCode != _newCode) then {
TRACE_2("code change",_newCode,_laserCode);
[QGVAR(updateCode), [_laserUuid, _newCode]] call CBA_fnc_globalEvent;

View File

@ -91,7 +91,7 @@ GVAR(pfID) = [{
// Do Laser Scan:
private _ammo = getText (configFile >> "CfgMagazines" >> _vehicle currentMagazineTurret _turretPath >> "ammo");
private _laserSource = _vehicle modelToWorldWorld (_vehicle selectionPosition _seekerSource);
private _laserCode = _vehicle getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE];
private _laserCode = _vehicle getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
private _seekerAngle = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_missileguidance" >> "seekerAngle");
private _seekerMaxRange = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ace_missileguidance" >> "seekerMaxRange");
private _laserResult = [_laserSource, vectorDir _vehicle, _seekerAngle, _seekerMaxRange, [ACE_DEFAULT_LASER_WAVELENGTH,ACE_DEFAULT_LASER_WAVELENGTH], _laserCode, _vehicle] call EFUNC(laser,seekerFindLaserSpot);

View File

@ -39,7 +39,7 @@ if (_enabled) exitWith {};
[_pfhID] call CBA_fnc_removePerFrameHandler;
};
private _laserCode = _vehicle getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE];
private _laserCode = _vehicle getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
private _angle = 25;
private _pos = _vehicle modelToWorldVisualWorld [0,0,0];

View File

@ -10,7 +10,11 @@ private _cfgWeapons = configFile >> "CfgWeapons";
private _cfgVehicles = configFile >> "CfgVehicles";
private _uniforms = "getNumber (_x >> 'scope') == 2 && {configName _x isKindOf ['Uniform_Base', _cfgWeapons]}" configClasses _cfgWeapons;
private _units = _uniforms apply {_cfgVehicles >> getText (_x >> "ItemInfo" >> "uniformClass")};
private _units = _uniforms apply {
private _unitCfg = _cfgVehicles >> getText (_x >> "ItemInfo" >> "uniformClass");
if (isNull _unitCfg) then { WARNING_2("%1 has invalid uniformClass %2",configName _x,getText (_x >> "ItemInfo" >> "uniformClass")) };
_unitCfg
};
if (param [0, false]) then { // Check all units (if naked)
INFO("checking ALL units");
_units append ((configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(getNumber (_x >> 'scope')) == 2} && {configName _x isKindOf 'CAManBase'}", true]));
@ -21,6 +25,7 @@ INFO_1("Checking uniforms for correct medical hitpoints [%1 units]",count _units
private _testPass = true;
{
private _typeOf = configName _x;
if (_typeOf == "") then { continue };
private _hitpoints = (configProperties [_x >> "HitPoints", "isClass _x", true]) apply {toLowerANSI configName _x};
private _expectedHitPoints = ["hitleftarm","hitrightarm","hitleftleg","hitrightleg","hithead","hitbody"];
private _missingHitPoints = _expectedHitPoints select {!(_x in _hitpoints)};

View File

@ -2,6 +2,7 @@
["CBA_settingsInitialized", {
TRACE_1("settingsInitialized",GVAR(enabledFor));
if (GVAR(enabledFor) == 0) exitWith {}; // 0: disabled
if ((GVAR(enabledFor) == 1) && {!isServer} && {hasInterface}) exitWith {}; // 1: Don't Run on non-hc Clients
@ -19,6 +20,16 @@
_unit setVariable [QGVAR(lastSuppressed), CBA_missionTime];
}] call CBA_fnc_addClassEventHandler;
#include "stateMachine.inc.sqf"
if (GVAR(requireItems) == 2) then {
["CAManBase", "InitPost", {
[{
params ["_unit"];
if ((!local _unit) || {!alive _unit} || {isPlayer _unit}) exitWith {};
TRACE_2("replacing medical items on AI",_unit,typeOf _unit);
[_unit] call EFUNC(common,replaceRegisteredItems);
}, _this] call CBA_fnc_execNextFrame; // need to delay a frame before modifying items in a backpack
}, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler;
};
#include "stateMachine.inc.sqf"
}] call CBA_fnc_addEventHandler;

View File

@ -13,6 +13,6 @@ if (isNil QGVAR(timeSafe_shoot)) then { GVAR(timeSafe_shoot) = 30; };
if (isNil QGVAR(timeSafe_hit)) then { GVAR(timeSafe_hit) = 30; };
if (isNil QGVAR(timeSafe_suppressed)) then { GVAR(timeSafe_suppressed) = 30; };
GVAR(itemHash) = uinamespace getVariable QGVAR(itemHash);
GVAR(itemHash) = uiNamespace getVariable QGVAR(itemHash);
ADDON = true;

View File

@ -4,13 +4,13 @@
* Checks if there is a medic available in the unit's group.
*
* Arguments:
* None
* Unit <OBJECT>
*
* Return Value:
* Can request medic <BOOL>
*
* Example:
* player call ACE_medical_ai_fnc_canRequestMedic
* player call ace_medical_ai_fnc_canRequestMedic
*
* Public: No
*/

View File

@ -4,13 +4,13 @@
* Makes the unit heal itself.
*
* Arguments:
* None
* Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* call ACE_medical_ai_fnc_healSelf
* cursorObject call ace_medical_ai_fnc_healSelf
*
* Public: No
*/

View File

@ -4,16 +4,17 @@
* Makes a medic heal the next unit that needs treatment.
*
* Arguments:
* None
* Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* call ACE_medical_ai_fnc_healUnit
* cursorObject call ace_medical_ai_fnc_healUnit
*
* Public: No
*/
// Player will have to do this manually of course
if ([_this] call EFUNC(common,isPlayer)) exitWith {};
// Can't heal other units when unconscious
@ -23,10 +24,10 @@ if IS_UNCONSCIOUS(_this) exitWith {
// Find next unit to treat
private _healQueue = _this getVariable [QGVAR(healQueue), []];
private _target = _healQueue select 0;
private _target = _healQueue param [0, objNull];
// If unit died or was healed, be lazy and wait for the next tick
if (isNull _target || {!alive _target} || {!(_target call FUNC(isInjured))}) exitWith {
if (!alive _target || {!(_target call FUNC(isInjured))}) exitWith {
_this forceSpeed -1;
_target forceSpeed -1;
_healQueue deleteAt 0;

View File

@ -1,7 +1,7 @@
#include "..\script_component.hpp"
/*
* Author: BaerMitUmlaut, PabstMirror
* Applies healing to target
* Applies healing to target.
*
* Arguments:
* 0: Healer <OBJECT>
@ -11,11 +11,14 @@
* Nothing
*
* Example:
* [a, b] call ACE_medical_ai_fnc_healingLogic
* [cursorObject, cursorObject] call ace_medical_ai_fnc_healingLogic
*
* Public: No
*/
// TODO: Add AI tourniquet behaviour
// For now, AI handle player or otherwise scripted tourniquets only
params ["_healer", "_target"];
(_healer getVariable [QGVAR(currentTreatment), [-1]]) params ["_finishTime", "_treatmentTarget", "_treatmentEvent", "_treatmentArgs", "_treatmentItem"];
@ -32,6 +35,23 @@ if (_finishTime > 0) exitWith {
};
if ((_treatmentTarget == _target) && {(_treatmentEvent select [0, 1]) != "#"}) then {
[_treatmentEvent, _treatmentArgs, _target] call CBA_fnc_targetEvent;
// Splints are already logged on their own
switch (_treatmentEvent) do {
case QEGVAR(medical_treatment,bandageLocal): {
[_target, "activity", ELSTRING(medical_treatment,Activity_bandagedPatient), [[_healer, false, true] call EFUNC(common,getName)]] call EFUNC(medical_treatment,addToLog);
};
case QEGVAR(medical_treatment,ivBagLocal): {
[_target, _treatmentArgs select 2] call EFUNC(medical_treatment,addToTriageCard);
[_target, "activity", ELSTRING(medical_treatment,Activity_gaveIV), [[_healer, false, true] call EFUNC(common,getName)]] call EFUNC(medical_treatment,addToLog);
};
case QEGVAR(medical_treatment,medicationLocal): {
private _usedItem = ["ACE_epinephrine", "ACE_morphine"] select (_treatmentArgs select 2 == "Morphine");
[_target, _usedItem] call EFUNC(medical_treatment,addToTriageCard);
[_target, "activity", ELSTRING(medical_treatment,Activity_usedItem), [[_healer, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _usedItem >> "displayName")]] call EFUNC(medical_treatment,addToLog);
};
};
#ifdef DEBUG_MODE_FULL
INFO_4("%1->%2: %3 - %4",_healer,_target,_treatmentEvent,_treatmentArgs);
systemChat format ["Applying [%1->%2]: %3", _healer, _treatmentTarget, _treatmentEvent];
@ -40,38 +60,80 @@ if (_finishTime > 0) exitWith {
};
};
// Find a suitable limb (no tourniquets) for injecting and giving IVs
private _fnc_findNoTourniquet = {
private _bodyPart = "";
private _bodyParts = ["leftarm", "rightarm", "leftleg", "rightleg"];
private _bodyPartsSaved = +_bodyParts;
while {_bodyParts isNotEqualTo []} do {
_bodyPart = selectRandom _bodyParts;
// If no tourniquet on, use that body part
if (_tourniquets select (ALL_BODY_PARTS find _bodyPart) == 0) exitWith {};
_bodyParts deleteAt (_bodyParts find _bodyPart);
};
// If all limbs have tourniquets, use random limb
if (_bodyPart == "") then {
_bodyPart = selectRandom _bodyPartsSaved;
};
_bodyPart
};
private _isMedic = [_healer] call EFUNC(medical_treatment,isMedic);
private _heartRate = GET_HEART_RATE(_target);
private _fractures = GET_FRACTURES(_target);
private _tourniquets = GET_TOURNIQUETS(_target);
private _treatmentEvent = "#none";
private _treatmentArgs = [];
private _treatmentTime = 6;
private _treatmentItem = "";
switch (true) do {
case ((GET_WOUND_BLEEDING(_target) > 0)
&& {([_healer, "@bandage"] call FUNC(itemCheck)) # 0}): {
if (true) then {
if (
(GET_WOUND_BLEEDING(_target) > 0) &&
{([_healer, "@bandage"] call FUNC(itemCheck)) # 0}
) exitWith {
// Select first bleeding wound and bandage it
private _selection = "?";
{
private _foundBleeding = _y findIf {
_x params ["", "_amount", "_percentage"];
(_amount * _percentage) > 0
};
if (_foundBleeding != -1) exitWith { _selection = _x; };
// Ignore tourniqueted limbs
if (_tourniquets select (ALL_BODY_PARTS find _x) == 0 && {
_y findIf {
_x params ["", "_amount", "_percentage"];
(_amount * _percentage) > 0
} != -1}
) exitWith { _selection = _x; };
} forEach GET_OPEN_WOUNDS(_target);
_treatmentEvent = QEGVAR(medical_treatment,bandageLocal);
_treatmentTime = 5;
_treatmentArgs = [_target, _selection, "FieldDressing"];
_treatmentItem = "@bandage";
};
case (IN_CRDC_ARRST(_target) && {EGVAR(medical_treatment,cprSuccessChanceMin) > 0}): {
private _hasIV = ([_healer, "@iv"] call FUNC(itemCheck)) # 0;
private _bloodVolume = GET_BLOOD_VOLUME(_target);
// If in cardiac arrest, first add some blood to injured if necessary, then do CPR (doing CPR when not enough blood is suboptimal if you have IVs)
// If healer has no IVs, allow AI to do CPR to keep injured alive
if (
IN_CRDC_ARRST(_target) &&
{EGVAR(medical_treatment,cprSuccessChanceMin) > 0} &&
{!_hasIV || {_bloodVolume >= BLOOD_VOLUME_CLASS_3_HEMORRHAGE}}
) exitWith {
_treatmentEvent = QEGVAR(medical_treatment,cprLocal);
_treatmentArgs = [_healer, _target];
_treatmentTime = 15;
};
case (_isMedic && {GET_BLOOD_VOLUME(_target) < MINIMUM_BLOOD_FOR_STABLE_VITALS}
&& {([_healer, "@iv"] call FUNC(itemCheck)) # 0}): {
private _needsIv = _bloodVolume < MINIMUM_BLOOD_FOR_STABLE_VITALS;
private _canGiveIv = _isMedic && _hasIV && _needsIv;
if (_canGiveIv) then {
// Check if patient's blood volume + remaining IV volume is enough to allow the patient to wake up
private _totalIvVolume = 0; //in ml
{
@ -79,33 +141,55 @@ switch (true) do {
_totalIvVolume = _totalIvVolume + _volumeRemaining;
} forEach (_target getVariable [QEGVAR(medical,ivBags), []]);
if (GET_BLOOD_VOLUME(_target) + (_totalIvVolume / 1000) > MINIMUM_BLOOD_FOR_STABLE_VITALS) exitWith {
_treatmentEvent = "#waitForBlood";
// Check if the medic has to wait, which allows for a little multitasking
if (_bloodVolume + (_totalIvVolume / 1000) >= MINIMUM_BLOOD_FOR_STABLE_VITALS) then {
_treatmentEvent = "#waitForIV";
_canGiveIv = false;
};
};
if (_canGiveIv) exitWith {
_treatmentEvent = QEGVAR(medical_treatment,ivBagLocal);
_treatmentTime = 5;
_treatmentArgs = [_target, selectRandom ["leftarm", "rightarm", "leftleg", "rightleg"], "SalineIV"];
_treatmentArgs = [_target, call _fnc_findNoTourniquet, "SalineIV"];
_treatmentItem = "@iv";
};
case ((count (_target getVariable [VAR_MEDICATIONS, []])) >= 6): {
_treatmentEvent = "#tooManyMeds";
};
case (((_fractures select 4) == 1)
&& {([_healer, "splint"] call FUNC(itemCheck)) # 0}): {
if (
((_fractures select 4) == 1) &&
{([_healer, "splint"] call FUNC(itemCheck)) # 0}
) exitWith {
_treatmentEvent = QEGVAR(medical_treatment,splintLocal);
_treatmentTime = 6;
_treatmentArgs = [_healer, _target, "leftleg"];
_treatmentItem = "splint";
};
case (((_fractures select 5) == 1)
&& {([_healer, "splint"] call FUNC(itemCheck)) # 0}): {
if (
((_fractures select 5) == 1) &&
{([_healer, "splint"] call FUNC(itemCheck)) # 0}
) exitWith {
_treatmentEvent = QEGVAR(medical_treatment,splintLocal);
_treatmentTime = 6;
_treatmentArgs = [_healer, _target, "rightleg"];
_treatmentItem = "splint";
};
case ((IS_UNCONSCIOUS(_target) || {_heartRate <= 50})
&& {([_healer, "epinephrine"] call FUNC(itemCheck)) # 0}): {
// Wait until the injured has enough blood before administering drugs
if (_needsIv) then {
_treatmentEvent = "#waitForIV"
};
if (_treatmentEvent == "#waitForIV") exitWith {};
if ((count (_target getVariable [VAR_MEDICATIONS, []])) >= 6) exitWith {
_treatmentEvent = "#tooManyMeds";
};
if (
((IS_UNCONSCIOUS(_target) && {_heartRate < 160}) || {_heartRate <= 50}) &&
{([_healer, "epinephrine"] call FUNC(itemCheck)) # 0}
) exitWith {
if (CBA_missionTime < (_target getVariable [QGVAR(nextEpinephrine), -1])) exitWith {
_treatmentEvent = "#waitForEpinephrineToTakeEffect";
};
@ -115,11 +199,14 @@ switch (true) do {
_target setVariable [QGVAR(nextEpinephrine), CBA_missionTime + 10];
_treatmentEvent = QEGVAR(medical_treatment,medicationLocal);
_treatmentTime = 2.5;
_treatmentArgs = [_target, selectRandom ["leftarm", "rightarm", "leftleg", "rightleg"], "Epinephrine"];
_treatmentArgs = [_target, call _fnc_findNoTourniquet, "Epinephrine"];
_treatmentItem = "epinephrine";
};
case (((GET_PAIN_PERCEIVED(_target) > 0.25) || {_heartRate >= 180})
&& {([_healer, "morphine"] call FUNC(itemCheck)) # 0}): {
if (
(((GET_PAIN_PERCEIVED(_target) > 0.25) && {_heartRate > 40}) || {_heartRate >= 180}) &&
{([_healer, "morphine"] call FUNC(itemCheck)) # 0}
) exitWith {
if (CBA_missionTime < (_target getVariable [QGVAR(nextMorphine), -1])) exitWith {
_treatmentEvent = "#waitForMorphineToTakeEffect";
};
@ -129,7 +216,7 @@ switch (true) do {
_target setVariable [QGVAR(nextMorphine), CBA_missionTime + 30];
_treatmentEvent = QEGVAR(medical_treatment,medicationLocal);
_treatmentTime = 2.5;
_treatmentArgs = [_target, selectRandom ["leftarm", "rightarm", "leftleg", "rightleg"], "Morphine"];
_treatmentArgs = [_target, call _fnc_findNoTourniquet, "Morphine"];
_treatmentItem = "morphine";
};
};
@ -140,6 +227,7 @@ _healer setVariable [QGVAR(currentTreatment), [CBA_missionTime + _treatmentTime,
if ((_treatmentEvent select [0,1]) != "#") then {
private _treatmentClassname = _treatmentArgs select 2;
if (_treatmentEvent == QEGVAR(medical_treatment,splintLocal)) then { _treatmentClassname = "Splint" };
if (_treatmentEvent == QEGVAR(medical_treatment,cprLocal)) then { _treatmentClassname = "CPR" };
[_healer, _treatmentClassname, (_healer == _target)] call FUNC(playTreatmentAnim);
};

View File

@ -10,7 +10,7 @@
* Does unit need treatment <BOOL>
*
* Example:
* player call ACE_medical_ai_fnc_isInjured
* cursorObject call ace_medical_ai_fnc_isInjured
*
* Public: No
*/

Some files were not shown because too many files have changed in this diff Show More