Compare commits

...

11 Commits

27 changed files with 417 additions and 5 deletions

View File

@@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project badly attempts [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.1.2] - 2024-01-04
### Added
- Add forgotten code file file for medical overlay
## [3.1.1] - 2024-01-04
### Changed
- Spelling Fixes
- Update class binding for vehicle flag interaction
## [3.1.0] - 2023-12-17
### Added
- Vehicles now have an ace interaction to allow the mounting of flags onto them for identification. Contributed by IndigoFox
- Added inventory validation checks
- Added empty group removal code due to ownership issues on entity transfers
- Added medical card visibility to medics for triage purposes
## [3.0.2] - 2023-10-14
### Changed

View File

@@ -32,12 +32,16 @@ class milsim
class bindEventHandlers { postInit = 1; };
class bindVehicleActions { postInit = 1; };
class addClientStatsPFH {};
class addMedicalOverlayPFH { postInit = 1; }; // nees refactor
class calculateClientStats {};
class initVehicleFlags { postInit = 1; };
class bindEmptyGroupGarbageCleanup { postInit = 1; };
};
class server {
class addServerStatsPFH {};
class calculateServerStats {};
class logPlayerInventory {};
};
class resupply {

View File

@@ -0,0 +1,79 @@
// Enable/Disable the script
if (isNil "milsim_client_medState3D_enabled") then {
milsim_client_medState3D_enabled = true;
};
// List of units to draw icons for
milsim_client_medState3D_drawTargets = [];
// Range to draw icons for
milsim_client_medState3D_drawRange = 10;
// ACE Triage colors, for consistency across UIs and functions
// #define TRIAGE_COLOR_NONE 0.5, 0.5, 0.5, 0.1
// #define TRIAGE_COLOR_MINIMAL 0, 0.5, 0, 0.9
// #define TRIAGE_COLOR_DELAYED 1, 0.84, 0, 0.9
// #define TRIAGE_COLOR_IMMEDIATE 1, 0, 0, 0.9
// #define TRIAGE_COLOR_DECEASED 0, 0, 0, 0.9
// ACE Triage colors, for consistency across UIs and functions
milsim_client_medState3D_colors = [
[0, 0.5, 0, 0.9], // TRIAGE_COLOR_MINIMAL
[1, 0.84, 0, 0.9], // TRIAGE_COLOR_DELAYED
[1, 0, 0, 0.9], // TRIAGE_COLOR_IMMEDIATE
[0, 0, 0, 0.9], // TRIAGE_COLOR_DECEASED
[0.5, 0.5, 0.5, 0] // TRIAGE_COLOR_NONE
];
// Per-frame handler to draw icons
milsim_client_medState3D_pfh = [
{
// if disabled, skip processing
if (!milsim_client_medState3D_enabled) exitWith {};
// if no targets, skip processing
if (count milsim_client_medState3D_drawTargets == 0) exitWith {};
if !([player] call ace_medical_treatment_fnc_isMedic) exitWith {};
{
// distance within 10 meters
if (player distance _x > milsim_client_medState3D_drawRange) then {continue};
// check unit not null, not conscious, and not in a vehicle
if (
isNull _x ||
!(_x getVariable ["ACE_isUnconscious", false]) ||
!isNull (objectParent _x)
) then {continue};
// color based on triage level
private _color = milsim_client_medState3D_colors select ((_x getVariable ["ace_medical_triageLevel", -1]) -1);
// draw position, slightly above the prone unit
private _drawPos = (visiblePosition _x) vectorAdd [0, 0, 0.5];
// draw icon
drawIcon3D [
"\A3\ui_f\data\map\markers\military\dot_CA.paa", // icon texture
_color, // color
_drawPos, // position AGL
1, // width
1, // height
0 // angle
// further params optional, omitted
];
} forEach milsim_client_medState3D_drawTargets;
},
0,
[]
] call CBA_fnc_addPerFrameHandler;
[
"Man",
"InitPost",
{
params ["_unit"];
milsim_client_medState3D_drawTargets pushBack _unit;
},
true,
[],
true
] call CBA_fnc_addClassEventHandler;

View File

@@ -0,0 +1,23 @@
diag_log text format ["[MILSIM] (client) initializing empty group deletion PFH"];
_emptyGroupPFH = [
{
{
if (local _x) then {
if ((count units _x) == 0) then {
deleteGroup _x;
};
};
} forEach allGroups;
},
300,
[],
{ diag_log text format ["[MILSIM] (client) Empty Group Deletion PFH loaded"] },
{ diag_log text format ["[MILSIM] (client) Empty Group Deletion"] },
{ true },
{ false },
[]
] call CBA_fnc_createPerFrameHandlerObject;

View File

@@ -38,6 +38,14 @@ addMissionEventHandler ["HandleChatMessage",
];
["ace_arsenal_displayClosed", {
player remoteExec["milsim_fnc_logPlayerInventory", 0];
}] call CBA_fnc_addEventHandler;
[missionNamespace, "arsenalClosed", {
player remoteExec["milsim_fnc_logPlayerInventory", 0];
}] call BIS_fnc_addScriptedEventHandler;
diag_log text "[MILSIM] (client) event handlers bound";
nil;

View File

@@ -0,0 +1,225 @@
milsim_vehicleflag_options = [
["Chevron IDs", [
["flag_chevron_id1", createHashMapFromArray [
["Title", "Flag 1"],
["Texture", "textures\flag_number\flag_id_1_co.paa"]
]],
["flag_chevron_id2", createHashMapFromArray [
["Title", "Flag 2"],
["Texture", "textures\flag_number\flag_id_2_co.paa"]
]],
["flag_chevron_id3", createHashMapFromArray [
["Title", "Flag 3"],
["Texture", "textures\flag_number\flag_id_3_co.paa"]
]],
["flag_chevron_id4", createHashMapFromArray [
["Title", "Flag 4"],
["Texture", "textures\flag_number\flag_id_4_co.paa"]
]],
["flag_chevron_id5", createHashMapFromArray [
["Title", "Flag 5"],
["Texture", "textures\flag_number\flag_id_5_co.paa"]
]],
["flag_chevron_id6", createHashMapFromArray [
["Title", "Flag 6"],
["Texture", "textures\flag_number\flag_id_6_co.paa"]
]],
["flag_chevron_id7", createHashMapFromArray [
["Title", "Flag 7"],
["Texture", "textures\flag_number\flag_id_7_co.paa"]
]],
["flag_chevron_id8", createHashMapFromArray [
["Title", "Flag 8"],
["Texture", "textures\flag_number\flag_id_8_co.paa"]
]],
["flag_chevron_id9", createHashMapFromArray [
["Title", "Flag 9"],
["Texture", "textures\flag_number\flag_id_9_co.paa"]
]],
["flag_chevron_id10", createHashMapFromArray [
["Title", "Flag 10"],
["Texture", "textures\flag_number\flag_id_10_co.paa"]
]],
["flag_chevron_hq", createHashMapFromArray [
["Title", "Flag HQ"],
["Texture", "textures\flag_number\flag_id_hq_co.paa"]
]]
]],
["Simple Shapes", [
["flag_simpleshape_greenoctagon", createHashMapFromArray [
["Title", "Green Octagon"],
["Texture", "textures\simple_shape\flag_simpleshape_greenoctagon_co.paa"]
]],
["flag_simpleshape_bluecircle", createHashMapFromArray [
["Title", "Blue Circle"],
["Texture", "textures\simple_shape\flag_simpleshape_bluecircle_co.paa"]
]],
["flag_simpleshape_orangesquare", createHashMapFromArray [
["Title", "Orange Square"],
["Texture", "textures\simple_shape\flag_simpleshape_orangesquare_co.paa"]
]],
["flag_simpleshape_pinktriangle", createHashMapFromArray[
["Title", "Pink Triangle"],
["Texture", "textures\simple_shape\flag_simpleshape_pinktriangle_co.paa"]
]],
["flag_simpleshape_redpentagon", createHashMapFromArray [
["Title", "Red Pentagon"],
["Texture", "textures\simple_shape\flag_simpleshape_redpentagon_co.paa"]
]]
]],
["Miscellaneous", [
["flag_17th_emblem", createHashMapFromArray [
["Title", "17th Emblem"],
["Texture", "textures\flags_misc\flag_17th_emblem_co.paa"]
]],
["flag_redcross", createHashMapFromArray [
["Title", "Red Cross"],
["Texture", "textures\flags_misc\flag_redcross_co.paa"]
]]
]]
];
private _appliedParentClasses = [
"LandVehicle",
"Helicopter"
];
private _modelsWithoutFlagProxies = [
"TF373_SOAR_MH47G_Base", // MH-47G Chinook
"RHS_MELB_base", // MELB AH-6M/MH-6M/H-6M Little Bird
"USAF_C17", // C17 Globemaster III
"USAF_C130J", // C130J Super Hercules
"USAF_AC130U", // AC130 Spooky II
"ej_UH60M_base", // UH-60M Black Hawk + DAP variants
"rhsusf_fmtv_base" // M1083A1P2 variants + SOV SOCOM variants
];
{
private _parentClass = _x;
[_parentClass, "InitPost", {
private _flagActionID = "SetVehicleFlag";
private _flagMasterAction = [
_flagActionID, // id
"Set Vehicle Flag", // displayed title
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
{true}, // statement
{
params ["_target", "_player", "_params"];
private _modelsWithoutFlagProxies = _params select 1;
// check if hierarchy includes any of the models without flag proxies
private _excluded = false;
{
if (_excluded) exitWith {false};
_excluded = _target isKindOf _x;
} forEach _modelsWithoutFlagProxies;
if (_excluded) exitWith {false};
// check if vehicle is alive
alive _target;
}, // condition
{
params ["_target", "_player", "_params"];
private _flagActionID = _params#0;
private _actions = [];
{
_x params ["_flagCategory", "_flagOptions"];
// diag_log format ["NewFlagCategory: %1 %2", _flagCategory, _flagOptions];
private _flagCategoryOption = [
_flagActionID + "_" + _flagCategory, // id
_flagCategory, // displayed title
(_flagOptions#0#1) get "Texture", // flag icon
{true}, // statement
{
params ["_target", "_player", "_params"];
alive _target;
// true;
}, // condition
{
params ["_target", "_player", "_params"];
_params params ["_flagActionID", "_flagCategoryID", "_flagOptions"];
private _categoryOptions = [];
{
_x params ["_flagOptionID", "_flagOptionData"];
// diag_log format ["NewFlagOption: %1 %2", _flagOptionID, _flagOptionData];
private _newFlagOption = [
_flagActionID + "_" + _flagCategory + "_" + _flagOptionID, // id
_flagOptionData get "Title", // displayed title
_flagOptionData get "Texture", // flag icon
{
params ["_target", "_player", "_params"];
_target forceFlagTexture (_params select 2);
}, // statement
{
params ["_target", "_player", "_params"];
alive _target;
// true;
}, // condition
nil, // child code
[_flagActionID, _flagCategoryID, getMissionPath (_flagOptionData get "Texture")], // params
nil, // position
4, // distance
[false, false, false, false, false] // other params
] call ace_interact_menu_fnc_createAction;
_categoryOptions pushBack [_newFlagOption, [], _target];
} forEach _flagOptions;
_categoryOptions;
}, // child code
[_flagActionID, _flagCategoryID, _flagOptions], // params
nil, // position
4, // distance
[false, false, false, false, false], // other params
nil // modifier function code
] call ace_interact_menu_fnc_createAction;
_actions pushBack [_flagCategoryOption, [], _target];
} forEach milsim_vehicleflag_options;
_actions;
}, // child code
[_flagActionID, _modelsWithoutFlagProxies], // params
nil, // position
4, // distance
[false, false, false, false, false], // other params
nil // modifier function code
] call ace_interact_menu_fnc_createAction;
// add action to add flag
[
(_this select 0), // object
0, // action 0 or self-action 1
["ACE_MainActions"], // parent
_flagMasterAction // action
] call ace_interact_menu_fnc_addActionToObject;
// add action to remove flag
private _removeFlagAction = [
_flagActionID + "_removeflag", // id
"Remove Flag", // displayed title
"\A3\ui_f\data\map\markers\flags\nato_ca.paa", // flag icon
{
params ["_target", "_player", "_params"];
_target forceFlagTexture "";
}, // statement
{
params ["_target", "_player", "_params"];
alive _target && getForcedFlagTexture _target != "";
}, // condition
nil // child code
] call ace_interact_menu_fnc_createAction;
[
(_this select 0), // object
0, // action 0 or self-action 1
["ACE_MainActions", _flagActionID], // parent
_removeFlagAction // action
] call ace_interact_menu_fnc_addActionToObject;
}, true, [], true] call CBA_fnc_addClassEventHandler;
} forEach _appliedParentClasses;
nil;

View File

@@ -0,0 +1,40 @@
params [
["_player", objNull, [objNull]]
];
if (!isPlayer _player) exitWith { diag_log("exitWith inventotry")};
_items = [];
_items append uniformItems _player;
_items append vestItems _player;
_items append backpackItems _player;
_items pushback hmd _player;
_items pushback binocular _player;
_items append primaryWeaponItems _player;
{
_item = _x;
_modes = getArray(configfile >> "CfgWeapons" >> _item >> "visionMode");
_subModes = [configfile >> "CfgWeapons" >> _item >> "ItemInfo" >> "OpticsModes", 1] call BIS_fnc_returnChildren;
{
_modes append getArray( _x >> "visionMode" );
} forEach _subModes;
_restrictedItemList = ["A3_GPNVG18b_REC_TI","A3_GPNVG18_REC_TI","A3_GPNVG18b_TI","A3_GPNVG18_TI","A3_GPNVG18b_REC_BLK_TI","A3_GPNVG18_REC_BLK_TI","A3_GPNVG18b_BLK_TI","A3_GPNVG18_BLK_TI","NVGogglesB_gry_F","NVGogglesB_grn_F","NVGogglesB_blk_F","optic_Nightstalker","rhsusf_acc_anpas13gv1","Tier1_ANPVS10_Tan","rhsusf_acc_anpvs27","optic_tws_mg","optic_tws"];
if ( _x in _restrictedItemList ) then {
diag_log text format["[MILSIM] (logPlayerInventory): %1 has a restricted inventory item: %2", name _player, getText( configfile >> "CfgWeapons" >> _item >> "displayName" )];
} else if ((count _modes) isNotEqualTo 0) then {
_modes = _modes apply { toLower _x };
if ( "ti" in _modes ) then {
diag_log text format["[MILSIM] (logPlayerInventory): %1 has an unlisted thermal item: %2", name _player, getText( configfile >> "CfgWeapons" >> _item >> "displayName" )];
};
} else {
diag_log text format["[MILSIM] (logPlayerInventory): %1 inventory in compliance", name _player];
}
} forEach _items;
nil

View File

@@ -6,7 +6,7 @@
"milsim_sideChat",
"CHECKBOX",
"Side Chat Text Enabled",
["17th Batallion", "Side Chat"],
["17th Battalion", "Side Chat"],
false,
true,
{
@@ -25,7 +25,7 @@
"milsim_server_cps_enable",
"CHECKBOX",
"CPS Metrics Enabled",
["17th Batallion", "Server Metrics"],
["17th Battalion", "Server Metrics"],
true,
true,
{
@@ -40,7 +40,7 @@
"milsim_server_cps_interval",
"TIME",
"Metrics Interval",
["17th Batallion", "Server Metrics"],
["17th Battalion", "Server Metrics"],
[60,300,120],
true,
{
@@ -71,7 +71,7 @@
"milsim_client_cps_enable",
"CHECKBOX",
"CPS Metrics Enabled",
["17th Batallion", "Client Metrics"],
["17th Battalion", "Client Metrics"],
true,
true,
{
@@ -86,7 +86,7 @@
"milsim_client_cps_interval",
"TIME",
"CPS Metrics Interval",
["17th Batallion", "Client Metrics"],
["17th Battalion", "Client Metrics"],
[60,300,120],
true,
{
@@ -104,6 +104,17 @@
}
] call CBA_fnc_addSetting;
//---------------------
// Medical Overlay
//---------------------
[
"milsim_client_medState3D_enabled",
"CHECKBOX",
["Enable 3D Triage Card State", "Draws a colored dot over units within 10m indicating current ACE Triage State"],
"Medical",
true
] call CBA_fnc_addSetting;
diag_log text "[MILSIM] (settings) Custom CBA settings initialized";

View File

@@ -6,6 +6,8 @@ onLoadMission = "THIS APPEARS BELOW THE LOADING SCREEN IMAGE";
briefingName = "THIS IS THE NAME ON THE #MISSIONS LIST";
overviewText = "THIS IS WHERE YOU DESCRIBE THE MISSION IN THE #MISSION LIST";
missionSeries = "";
// activate via #ace-fortify west base 2000
class ACEX_Fortify_Presets {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.