Commit 992d0f4f authored by Ryan Grupp's avatar Ryan Grupp
Browse files

Combat Feedback

parent a4ffdab6
......@@ -45,6 +45,7 @@ You're now free to make edits to this file however you wish. __Note: Do not edit
| [Ambient Sounds](#module-ambient-sounds) | ✓ |
| [Car Radio](#module-car-radio) | |
| [CBRN](#module-cbrn) | ✓ |
| [Combat Feedback](#module-combat-feedback) | ✓ |
| [Components](#module-components) | |
| [LZ Select](#module-lz-select) | |
| [Spectrum Device](#module-spectrum-device) | ✓ |
......@@ -174,6 +175,53 @@ CBRN module adds NBC threats to the mission, and ways for player to protect them
### Module - Combat Feedback
_This module requires the use of [TSM Configuraiton](#using-tsm-configuration)._
Combat Feedback creates temporary markers on unit death.
<dl>
<dd><h4>Config Reference</h4></dd>
<dd>
<details>
<summary><strong>tsm_configuration.hpp</strong></summary>
| __Config Setting__ | __Type__ | __Description__ |
| ------------------ | -------- | --------------- |
| report_targets | Array | <pre>/* An array of arrays, each element with a string value of the representing the side of a unit getting killed and array of strings representing the sides of the players that should get the report.
* Argument 1:
* Side of the unit that will die
* Argument 2:
* Array of sides that will get notified
* Valid Values:
* EAST
* WEST
* INDEPENDENT
* CIVILIAN
*/
</pre> |
| report_delay | Integer | Amount of time in seconds after the death of a unit that the marker appears. |
| marker_duration | Integer | Amount of time in seconds after the marker was created that it will be deleted. |
| marker_size | Array | Array for controlling marker size:<ul><li>If 1 element is given, and it is an array with 2 numbers, then the marker size will be a linear conversion between the 2 values based on the number of units in the killed unit's group.</li><li>If 1 element is given, and it is a number, then the size will be scaled multiplicatively with the number of dead units in the unit's group.</li><li>If more than one element is given, a static value depending on number dead, with the 1 dead using the first value, 2 dead using the second, and so on.</li></ul> |
<br>
<br>
</details>
</dd>
</dl>
<br>
<br>
### Module - Components
......
......@@ -12,7 +12,9 @@ tsm_modules = [
'ambient_sounds',
'car_radio',
'cbrn',
'combat_feedback',
'components',
// 'fireworks',
// 'jammer',
'lz_select',
'spectrum_device',
......
params ['_objects', ['_threshold', 0]];
private _vars = _this apply {call compile _x};
private _count = {!isNil {_x} && {alive _x}} count _vars;
(_count <= _threshold)
\ No newline at end of file
tsm_combat_feedback_fnc_checkAndReport = compile preprocessFileLineNumbers 'tsm\combat_feedback\functions\fnc_checkAndReport.sqf';
tsm_combat_feedback_fnc_handleKilled = compile preprocessFileLineNumbers 'tsm\combat_feedback\functions\fnc_handleKilled.sqf';
tsm_combat_feedback_fnc_markerCreate = compile preprocessFileLineNumbers 'tsm\combat_feedback\functions\fnc_markerCreate.sqf';
tsm_combat_feedback_fnc_markerSize = compile preprocessFileLineNumbers 'tsm\combat_feedback\functions\fnc_markerSize.sqf';
call compile preprocessFileLineNumbers 'tsm\combat_feedback\load_config.sqf';
if (hasInterface) then {
tsm_combat_feedback_var_marker_info = [[], 0] call CBA_fnc_hashCreate;
};
['CAManBase', 'Killed', tsm_combat_feedback_fnc_handleKilled] call CBA_fnc_addClassEventHandler;
\ No newline at end of file
params ['_group', '_position'];
private _alive = {alive _x} count (units _group);
if (_alive isEqualTo 0) exitWith {};
private _targets = [tsm_combat_feedback_cfg_report_targets, str side _group] call CBA_fnc_hashGet;
private _netId = _group call BIS_fnc_netId;
[_position, _netId, count units _group] remoteExec ['tsm_combat_feedback_fnc_createMarker', _targets];
\ No newline at end of file
params ['_unit'];
private _group = group _unit;
private _targets = [tsm_combat_feedback_cfg_report_targets, str side _group] call CBA_fnc_hashGet;
if (_targets isEqualTo []) exitWith {};
[tsm_combat_feedback_fnc_checkAndReport, [_group, position _unit], tsm_combat_feedback_cfg_report_delay] call CBA_fnc_waitAndExecute;
\ No newline at end of file
params ['_position', '_id', '_maxSize'];
private _marker = format ['TSM_COMBAT_FEEDBACK_%1', _id];
diag_log format ['RUN MARKER LOGIC FOR MARKER: %1 --- %2', _marker, _position];
private _info = [tsm_combat_feedback_var_marker_info, _marker] call CBA_fnc_hashGet;
private _newInfo = _info + 1;
[tsm_combat_feedback_var_marker_info, _marker, _newInfo] call CBA_fnc_hashSet;
if (_info isEqualTo 0) then
{
createMarkerLocal [_marker, _position];
_marker setMarkerShapeLocal "ELLIPSE";
_marker setMarkerColorLocal "ColorRed";
};
private _markerSize = [_maxSize, _newInfo] call tsm_combat_feedback_fnc_getMarkerSize;
systemChat format ['Marker Sized: %1 --- %2', _newInfo, _markerSize];
_marker setMarkerSizeLocal [_markerSize, _markerSize];
[{
private _info = [tsm_combat_feedback_var_marker_info, _this] call CBA_fnc_hashGet;
if ((_info-1) <= 0) exitWith {
[tsm_combat_feedback_var_marker_info, _this] call CBA_fnc_hashRem;
deleteMarkerLocal _this;
};
[tsm_combat_feedback_var_marker_info, _this, _info-1] call CBA_fnc_hashSet;
}, _marker, tsm_combat_feedback_cfg_marker_duration] call CBA_fnc_waitAndExecute;
\ No newline at end of file
params ['_maxSize', '_info'];
_info = _info max 1;
if (count tsm_combat_feedback_cfg_marker_size isEqualTo 1) exitWith
{
private _item = (tsm_combat_feedback_cfg_marker_size#0);
if (_item isEqualType []) exitWith
{
linearConversion [0, _maxSize-1, _info, _item#0, _item#1];
};
(_item * _info)
};
private _index = _info - 1;
private _sizeOptions = count tsm_combat_feedback_cfg_marker_size;
if (_info > _sizeOptions) exitWith {tsm_combat_feedback_cfg_marker_size#(_sizeOptions-1)};
(tsm_combat_feedback_cfg_marker_size select _index)
\ No newline at end of file
private _report_targets = ['combat_feedback', 'report_targets', []] call tsm_core_fnc_getConfigValue;
tsm_combat_feedback_cfg_report_delay = ['combat_feedback', 'report_delay', 30] call tsm_core_fnc_getConfigValue;
tsm_combat_feedback_cfg_marker_duration = ['combat_feedback', 'marker_duration', 300] call tsm_core_fnc_getConfigValue;
tsm_combat_feedback_cfg_marker_size = ['combat_feedback', 'marker_size', [10, 100]] call tsm_core_fnc_getConfigValue;
tsm_combat_feedback_cfg_report_targets = [[], []] call CBA_fnc_hashCreate;
{
_x params ['_from', '_to'];
_from = toUpper _from;
private _targets = _to apply {call compile _x};
[tsm_combat_feedback_cfg_report_targets, _from, _targets] call CBA_fnc_hashSet;
false
} count _report_targets;
\ No newline at end of file
......@@ -127,4 +127,44 @@ class TSM_Config
/* Monitors the client's selected signal and sends an event with state changes, may cause lag */
monitorSelectedSignals = 0;
};
class combat_feedback
{
/* An array of arrays, each element with a string value of the representing the side of a unit getting killed and array of strings representing the sides of the players that should get the report.
* Argument 1:
* Side of the unit that will die
* Argument 2:
* Array of sides that will get notified
* Valid Values:
* EAST
* WEST
* INDEPENDENT
* CIVILIAN
*/
report_targets[] = {
{"EAST", {"EAST"}},
{"WEST", {}},
{"GUER", {}},
{"CIV", {}}
};
/* How long after a units death in seconds for the marker to be created */
report_delay = 30;
/* How long in seconds a marker last for */
marker_duration = 300;
/* Settings for marker scaling
* If 1 element given, as a number, use multiplicative scaling.
* Ex: marker_size[] = {10};
* If 1 element given, as an array with 2 elements, size is a linear conversion between the values, based on number of units in the group
* Ex: marker_size[] = {{10, 100}};
* If more than one element is given, a static value depending on number dead, with the 1 dead using the first value, 2 dead using the second, and so on.
* Ex: marker_size[] = {10, 25, 25, 50, 100};
*/
marker_size[] = {
{10, 100}
};
};
};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment