Skip to content

Commit

Permalink
ready for playtesting?
Browse files Browse the repository at this point in the history
  • Loading branch information
indig0fox committed Mar 29, 2022
1 parent 5606d06 commit 89659ec
Show file tree
Hide file tree
Showing 20 changed files with 601 additions and 422 deletions.
2 changes: 2 additions & 0 deletions x/ocap2/addons/extension/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class CfgPatches
};
};

cba_settings_whitelist[] = {"admin"};

class Extended_PreInit_EventHandlers {
class ADDON {
// This will be executed once in 3DEN, main menu and before briefing has started for every mission
Expand Down
2 changes: 2 additions & 0 deletions x/ocap2/addons/main/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class CfgPatches
};
};

cba_settings_whitelist[] = {"admin"};

This comment has been minimized.

Copy link
@veteran29

veteran29 Mar 30, 2022

Contributor

What's the reason for adding this in every component?

This comment has been minimized.

Copy link
@indig0fox

indig0fox Mar 30, 2022

Author Member

https://github.com/CBATeam/CBA_A3/pull/892/files/b8ece9bd3006eac63446001ad85f01add2c819a4#diff-d7937152d0169f8276215eae0c0eae35eb5dd2eb6ba31ef7eb26d3989af93aa6

Technically the extension has no settings right now so it's not needed there, but just figured I'd be consistent.

This comment has been minimized.

Copy link
@veteran29

veteran29 Mar 30, 2022

Contributor

But this is root config, you're setting this for everybody. Does make no sense to set the whitelist in this kind of addon, communities should set it in their own addons.

Also adding it in every component makes even less sense as one would be enough.

This comment has been minimized.

Copy link
@indig0fox

indig0fox Mar 30, 2022

Author Member

Woops, yeah if it's root config then I'll remove. I didn't realize.

This comment has been minimized.

Copy link
@veteran29

veteran29 Mar 31, 2022

Contributor

I think you probably misunderstood how the addon config works. All config.cpp/bin end up in same namespace.


class Extended_PreInit_EventHandlers {
class ADDON {
// This will be executed once in 3DEN, main menu and before briefing has started for every mission
Expand Down
28 changes: 14 additions & 14 deletions x/ocap2/addons/recorder/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,6 @@ GVAR(allSettings) = [
false // requires restart to apply
],

[
QEGVAR(settings,pauseOnEmpty),
"CHECKBOX", // setting type
[
"Auto-Save When No Players", // Pretty name shown inside the ingame settings menu. Can be stringtable entry.
"Will automatically save recording when there are 0 players on the server and existing data accounts for more time than the minumum save duration setting. Default: true"
],
[COMPONENT_NAME, "Recording Settings"], // Pretty name of the category where the setting can be found. Can be stringtable entry.
true, // default enabled
true, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
{}, // function that will be executed once on mission start and every time the setting is changed.
false // requires restart to apply
],

[
QEGVAR(settings,trackTimes),
"CHECKBOX", // setting type
Expand Down Expand Up @@ -194,6 +180,20 @@ GVAR(allSettings) = [
false // requires restart to apply
],

[
QEGVAR(settings,saveOnEmpty),
"CHECKBOX", // setting type
[
"Auto-Save When No Players", // Pretty name shown inside the ingame settings menu. Can be stringtable entry.
"Will automatically save recording when there are 0 players on the server and existing data accounts for more time than the minimum save duration setting. Default: true"
],
[COMPONENT_NAME, "Recording Settings"], // Pretty name of the category where the setting can be found. Can be stringtable entry.
true, // default enabled
true, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
{}, // function that will be executed once on mission start and every time the setting is changed.
false // requires restart to apply
],

[
QEGVAR(settings,minMissionTime),
"SLIDER", // setting type
Expand Down
4 changes: 3 additions & 1 deletion x/ocap2/addons/recorder/XEH_prep.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ PREP(eh_hit);
PREP(eh_killed);
PREP(getInstigator);
PREP(getEventWeaponText);
PREP(getAmmoData);
PREP(getAmmoMarkerData);
PREP(getWeaponDisplayData);

PREP(projectileMonitors);
PREP(aceThrowing);
PREP(aceExplosives);

Expand Down
2 changes: 2 additions & 0 deletions x/ocap2/addons/recorder/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class CfgPatches
};
};

cba_settings_whitelist[] = {"admin"};

class Extended_PreInit_EventHandlers {
class ADDON {
// This will be executed once in 3DEN, main menu and before briefing has started for every mission
Expand Down
13 changes: 8 additions & 5 deletions x/ocap2/addons/recorder/fnc_aceExplosives.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ EGVAR(listener,aceExplosives) = ["ace_explosives_place", {
_explType = typeOf _explosive;
_explosiveMag = getText(configFile >> "CfgAmmo" >> _explType >> "defaultMagazine");
_explosiveDisp = getText(configFile >> "CfgMagazines" >> _explosiveMag >> "displayName");
_explosivePic = getText(configFile >> "CfgMagazines" >> _explosiveMag >> "picture");

_placedPos = getPosASL _explosive;
_unit addOwnedMine _explosive;
Expand All @@ -50,15 +51,17 @@ EGVAR(listener,aceExplosives) = ["ace_explosives_place", {
_markColor = "ColorRed";
_markerType = "Minefield";

if (GVARMAIN(isDebug)) then {
format["Created explosive placed marker, %1, %2", _markName, _explosiveDisp] SYSCHAT;
OCAPEXTLOG(ARR3("Created explosive placed marker", _markName, _explosiveDisp));
};

[QGVARMAIN(handleMarker), [
"CREATED", _markName, _unit, _placedPos, _markerType, "ICON", [1,1], 0, "Solid", "ColorRed", 1, _markTextLocal, true
]] call CBA_fnc_localEvent;

if (GVARMAIN(isDebug)) then {
// add to map draw array
private _debugArr = [_explosive, _explosivePic, format["%1 %2 - %3", str side group _unit, name _unit, _markTextLocal], [side group _unit] call BIS_fnc_sideColor];
GVAR(liveDebugMagIcons) pushBack _debugArr;
publicVariable QGVAR(liveDebugMagIcons);
};


[{isNull (_this#0)}, { // wait until the mine is null (exploded), and mark this for playback

Expand Down
180 changes: 74 additions & 106 deletions x/ocap2/addons/recorder/fnc_aceThrowing.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,135 +27,103 @@ EGVAR(listener,aceThrowing) = ["ace_throwableThrown", {

if (!SHOULDSAVEEVENTS) exitWith {};

_this spawn {
params["_unit", "_projectile"];

params["_unit", "_projectile"];
if (isNull _projectile) then {
_projectile = nearestObject [_unit, "CA_Magazine"];
};

if (isNull _projectile) then {
_projectile = nearestObject [_unit, "CA_Magazine"];
};
// systemChat str _this;

// systemChat str _this;
// note that thrown objects outside of ACE explosives do not include a "default magazine" property in their config.
// this script will attempt to find a matching classname in CfgMagazines, as some chemlights and smokes are built this way.
// if not found, a default magazine value will be assigned (m67 frag, white smoke, green chemlight)

// note that thrown objects outside of ACE explosives do not include a "default magazine" property in their config.
// this script will attempt to find a matching classname in CfgMagazines, as some chemlights and smokes are built this way.
// if not found, a default magazine value will be assigned (m67 frag, white smoke, green chemlight)
_projType = typeOf _projectile;
_projConfig = configOf _projectile;
_projName = getText(configFile >> "CfgAmmo" >> _projType >> "displayName");

_projType = typeOf _projectile;
_projConfig = configOf _projectile;
_projName = getText(configFile >> "CfgAmmo" >> _projType >> "displayName");
// systemChat format["Config name: %1", configOf _projectile];

if (GVARMAIN(isDebug)) then {
format["Detected ACE throwing of %1", _projName] SYSCHAT;
OCAPEXTLOG(ARR2("Detected ACE throwing of ", _projName));
};
_ammoSimType = getText(configFile >> "CfgAmmo" >> _projType >> "simulation");
// systemChat format["Projectile type: %1", _ammoSimType];

// systemChat format["Config name: %1", configOf _projectile];
_markerType = "";
_markColor = "";
_magDisp = "";
_magPic = "";

_ammoSimType = getText(configFile >> "CfgAmmo" >> _projType >> "simulation");
// systemChat format["Projectile type: %1", _ammoSimType];
_magType = getText(_projConfig >> "defaultMagazine");
if (_magType == "") then {
_magType = configName(configfile >> "CfgMagazines" >> _projType)
};

_markerType = "";
_markColor = "";
_magDisp = "";
_magPic = "";
if (!(_magType isEqualTo "")) then {
// systemChat format["Mag type: %1", _magType];

_magType = getText(_projConfig >> "defaultMagazine");
if (_magType == "") then {
_magType = configName(configfile >> "CfgMagazines" >> _projType)
_magDisp = getText(configFile >> "CfgMagazines" >> _magType >> "displayNameShort");
if (_magDisp == "") then {
_magDisp = getText(configFile >> "CfgMagazines" >> _magType >> "displayName")
};
if (_magDisp == "") then {
_magDisp = _projName;
};

if (!(_magType isEqualTo "")) then {
// systemChat format["Mag type: %1", _magType];

_magDisp = getText(configFile >> "CfgMagazines" >> _magType >> "displayNameShort");
if (_magDisp == "") then {
_magDisp = getText(configFile >> "CfgMagazines" >> _magType >> "displayName")
};
if (_magDisp == "") then {
_magDisp = _projName;
};

_magPic = (getText(configfile >> "CfgMagazines" >> _magType >> "picture"));
// hint parseText format["Projectile fired:<br/><img image='%1'/>", _magPic];
if (_magPic == "") then {
_markerType = "mil_triangle";
_markColor = "ColorRed";
} else {
_magPicSplit = _magPic splitString "\";
_magPic = _magPicSplit#((count _magPicSplit) - 1);
_markerType = format["magIcons/%1", _magPic];
_markColor = "ColorWhite";
};
} else {
_magPic = (getText(configfile >> "CfgMagazines" >> _magType >> "picture"));
// hint parseText format["Projectile fired:<br/><img image='%1'/>", _magPic];
if (_magPic == "") then {
_markerType = "mil_triangle";
_markColor = "ColorRed";
// set defaults based on ammo sim type, if no magazine could be matched
switch (_ammoSimType) do {
case "shotGrenade":{
_magPic = "\A3\Weapons_F\Data\UI\gear_M67_CA.paa";
_magDisp = "Frag";
};
case "shotSmokeX":{
_magPic = "\A3\Weapons_f\data\ui\gear_smokegrenade_white_ca.paa";
_magDisp = "Smoke";
};
case "shotIlluminating":{
_magPic = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa";
_magDisp = "Flare";
};
default {
_magPic = "\A3\Weapons_F\Data\UI\gear_M67_CA.paa";
_magDisp = "Frag";
};
};
// hint parseText format["Projectile fired:<br/><img image='%1'/>", _magPic];
} else {
_magPicSplit = _magPic splitString "\";
_magPic = _magPicSplit#((count _magPicSplit) - 1);
_markerType = format["magIcons/%1", _magPic];
_markColor = "ColorWhite";
};
} else {
_markerType = "mil_triangle";
_markColor = "ColorRed";
// set defaults based on ammo sim type, if no magazine could be matched
switch (_ammoSimType) do {
case "shotGrenade":{
_magPic = "\A3\Weapons_F\Data\UI\gear_M67_CA.paa";
_magDisp = "Frag";
};
case "shotSmokeX":{
_magPic = "\A3\Weapons_f\data\ui\gear_smokegrenade_white_ca.paa";
_magDisp = "Smoke";
};
case "shotIlluminating":{
_magPic = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa";
_magDisp = "Flare";
};
default {
_magPic = "\A3\Weapons_F\Data\UI\gear_M67_CA.paa";
_magDisp = "Frag";
};
};
// hint parseText format["Projectile fired:<br/><img image='%1'/>", _magPic];
_magPicSplit = _magPic splitString "\";
_magPic = _magPicSplit#((count _magPicSplit) - 1);
_markerType = format["magIcons/%1", _magPic];
_markColor = "ColorWhite";
};

if (!(_ammoSimType isEqualTo "shotBullet")) then {

_int = random 2000;

_markTextLocal = format["%1", _magDisp];
_markName = format["Projectile#%1", _int];

_throwerPos = getPosASL _unit;

[QGVARMAIN(handleMarker), ["CREATED", _markName, _unit, _throwerPos, _markerType, "ICON", [1,1], 0, "Solid", _markColor, 1, _markTextLocal, true]] call CBA_fnc_serverEvent;
_int = random 2000;

private _lastPos = [];
waitUntil {
_pos = getPosASL _projectile;
if (((_pos select 0) isEqualTo 0) || isNull _projectile) exitWith {
true
};
_lastPos = _pos;
[QGVARMAIN(handleMarker), ["UPDATED", _markName, _unit, _pos, "", "", "", 0, "", "", 1]] call CBA_fnc_serverEvent;
_markTextLocal = format["%1", _magDisp];
_markName = format["Projectile#%1", _int];

// here, monitor fast moving missiles/rockets/shells every 0.3 seconds. monitor smokes, grenades, flares, mines in line with the configured frame capture delay
sleep (([0.3, GVAR(frameCaptureDelay)] select {_ammoSimType in ["ShotSmokeX","ShotGrenade","ShotIlluminating","ShotMine"]})#0);
false;
};
// MAKE MARKER FOR PLAYBACK
_throwerPos = getPosASL _unit;
[QGVARMAIN(handleMarker), ["CREATED", _markName, _unit, _throwerPos, _markerType, "ICON", [1,1], 0, "Solid", _markColor, 1, _markTextLocal, true]] call CBA_fnc_serverEvent;

if !((count _lastPos) isEqualTo 0) then {
isNil {
// for non-bullets, set the last fired variable of the soldier so hits/kills are recorded accurately
if (_ammoSimType == "shotGrenade") then {
_unit setVariable [
QGVARMAIN(lastFired),
_projName
];
};
};
[QGVARMAIN(handleMarker), ["UPDATED", _markName, _unit, _lastPos, "", "", "", 0, "", "", 1]] call CBA_fnc_serverEvent;
};
GVAR(liveGrenades) pushBack [_projectile, _magazine, _unit, getPosASL _projectile, _markName, _markTextLocal, _ammoSimType];

sleep 10;
[QGVARMAIN(handleMarker), ["DELETED", _markName]] call CBA_fnc_serverEvent;
};
if (GVARMAIN(isDebug)) then {
// add to map draw array
private _debugArr = [_projectile, _magPic, format["%1 %2 - %3", str side group _unit, name _unit, _markTextLocal], [side group _unit] call BIS_fnc_sideColor];
GVAR(liveDebugMagIcons) pushBack _debugArr;
publicVariable QGVAR(liveDebugMagIcons);
};
}] call CBA_fnc_addEventHandler;
Loading

0 comments on commit 89659ec

Please sign in to comment.