Skip to content

Commit 9ccbe8f

Browse files
authored
refactor: standardize extension command names to :RESOURCE:ACTION: pattern (#80)
Rename all command strings from inconsistent naming (overloaded :NEW:, mixed verb/noun ordering, bare nouns) to a consistent :RESOURCE:ACTION: pattern. This is a coordinated change with the extension repo. Key changes: - System commands namespaced under :SYS: (INIT, VERSION, LOG, DIR) - Entity commands use :RESOURCE:CREATE/STATE: (SOLDIER, VEHICLE, PLACED, MARKER) - Event commands namespaced under :EVENT: (GENERAL, KILL, PROJECTILE, CHAT, RADIO) - Mission commands flipped to :MISSION:START/SAVE: - Telemetry uses :TELEMETRY:FRAME: - Callbacks aligned (:EXT:READY: → :SYS:READY:, :GETDIR: → :SYS:DIR:)
1 parent 483a631 commit 9ccbe8f

19 files changed

Lines changed: 45 additions & 41 deletions

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,9 @@ Author:
9797
---------------------------------------------------------------------------- */
9898
```
9999

100+
### Extension Commands
101+
102+
Commands sent to the extension DLL via `callExtension` follow a `:RESOURCE:ACTION:` naming convention. New commands must use this pattern — resource noun first, then verb/qualifier (e.g., `:SOLDIER:CREATE:`, `:EVENT:KILL:`, `:SYS:INIT:`).
103+
100104
### ACE3 Integration
101105
ACE3 support is optional with graceful fallback. `fnc_aceExplosives.sqf` handles placed explosives and detonation tracking.

addons/extension/fnc_initSession.sqf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,49 @@ addMissionEventHandler ["ExtensionCallback", {
1616

1717
TRACE_3("ExtensionCallback",_name,_function,_data);
1818

19-
if (_function isEqualTo ":VERSION:") exitWith {
19+
if (_function isEqualTo ":SYS:VERSION:") exitWith {
2020
// version return is automatic during extension init process
2121
private _ver = _data#0;
2222
GVAR(dllVersion) = _ver;
2323
publicVariable QGVAR(dllVersion);
2424
INFO_1("Extension version: %1",str _ver);
2525
};
2626

27-
if (_function isEqualTo ":GETDIR:ARMA:") exitWith {
27+
if (_function isEqualTo ":SYS:DIR:ARMA:") exitWith {
2828
// arma dir return is automatic during extension init process
2929
private _dir = _data#0;
3030
GVAR(armaDir) = _dir;
3131
INFO_1("Arma directory: %1",_dir);
3232
};
3333

34-
if (_function isEqualTo ":GETDIR:MODULE:") exitWith {
34+
if (_function isEqualTo ":SYS:DIR:MODULE:") exitWith {
3535
// module dir return is automatic during extension init process
3636
private _dir = _data#0;
3737
GVAR(addonDir) = _dir;
3838
INFO_1("Addon directory: %1",_dir);
3939
};
4040

41-
if (_function isEqualTo ":GETDIR:OCAPLOG:") exitWith {
41+
if (_function isEqualTo ":SYS:DIR:LOG:") exitWith {
4242
// logging dir return is automatic during extension init process
4343
private _dir = _data#0;
4444
GVAR(logPath) = _dir;
4545
INFO_1("Extension logging path: %1",_dir);
4646
};
4747

48-
if (_function isEqualTo ":EXT:READY:") exitWith {
48+
if (_function isEqualTo ":SYS:READY:") exitWith {
4949
INFO("Extension ready.");
5050
// extension is ready, send version
51-
[":ADDON:VERSION:", [QUOTE(VERSION_STR)], 'ocap_recorder'] call FUNC(sendData);
51+
[":SYS:ADDON_VERSION:", [QUOTE(VERSION_STR)], 'ocap_recorder'] call FUNC(sendData);
5252

5353
// get arma dir and module dir
54-
[":GETDIR:ARMA:", [], 'ocap_recorder'] call FUNC(sendData);
55-
[":GETDIR:MODULE:", [], 'ocap_recorder'] call FUNC(sendData);
54+
[":SYS:DIR:ARMA:", [], 'ocap_recorder'] call FUNC(sendData);
55+
[":SYS:DIR:MODULE:", [], 'ocap_recorder'] call FUNC(sendData);
5656

5757
// get logging dir
58-
[":GETDIR:OCAPLOG:", [], 'ocap_recorder'] call FUNC(sendData);
58+
[":SYS:DIR:LOG:", [], 'ocap_recorder'] call FUNC(sendData);
5959

6060
INFO("Initializing storage...");
61-
[":INIT:STORAGE:", [], 'ocap_recorder'] call FUNC(sendData);
61+
[":STORAGE:INIT:", [], 'ocap_recorder'] call FUNC(sendData);
6262
};
6363

6464

@@ -146,7 +146,7 @@ addMissionEventHandler ["ExtensionCallback", {
146146
// Save mission and world context
147147
INFO("Saving mission and world context");
148148
TRACE_2("World and mission context",GVAR(worldContext),GVAR(missionContext));
149-
[":NEW:MISSION:", [GVAR(worldContext), GVAR(missionContext)], 'ocap_recorder'] call FUNC(sendData);
149+
[":MISSION:START:", [GVAR(worldContext), GVAR(missionContext)], 'ocap_recorder'] call FUNC(sendData);
150150
};
151151

152152
if (_function isEqualTo ":MISSION:OK:") exitWith {
@@ -159,5 +159,5 @@ addMissionEventHandler ["ExtensionCallback", {
159159

160160
INFO("Initializing extension...");
161161
GVAR(initTimer) = diag_tickTime;
162-
[":INIT:", []] call FUNC(sendData);
162+
[":SYS:INIT:", []] call FUNC(sendData);
163163
true

addons/extension/fnc_newMission.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ if (isNil QGVAR(worldContext) || isNil QGVAR(missionContext)) exitWith {
3434

3535
INFO("Re-registering new mission with extension");
3636
GVAR(initTimer) = diag_tickTime;
37-
[":NEW:MISSION:", [GVAR(worldContext), GVAR(missionContext)], 'ocap_recorder'] call FUNC(sendData);
37+
[":MISSION:START:", [GVAR(worldContext), GVAR(missionContext)], 'ocap_recorder'] call FUNC(sendData);

addons/main/script_macros.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
// MACRO: LOG
2323
// Used for logging messages to the extension (ocap-ext log file).
24-
#define OCAPEXTLOG(_args) [":LOG:", _args] call EFUNC(extension,sendData)
24+
#define OCAPEXTLOG(_args) [":SYS:LOG:", _args] call EFUNC(extension,sendData)
2525

2626
// MACRO: SYSCHAT
2727
// Used for debug purposes to send a string to all clients with interfaces.

addons/recorder/fnc_aceExplosives.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FUNCTION: OCAP_recorder_fnc_aceExplosives
55
66
Description:
77
Integrates ACE3-placed explosives into the placed object pipeline.
8-
Sends :NEW:PLACED: data and attaches lifecycle EHs (HitExplosion, Explode,
8+
Sends :PLACED:CREATE: data and attaches lifecycle EHs (HitExplosion, Explode,
99
Deleted) identical to vanilla mines in fnc_eh_fired_client.sqf.
1010
1111
Called by <ace_explosives_place> CBA listener.
@@ -50,7 +50,7 @@ if (_unitOcapId isEqualTo -1) exitWith {};
5050

5151
_explosive setVariable [QGVARMAIN(detonated), false];
5252

53-
// Build :NEW:PLACED: data — same format as vanilla mines in fnc_eh_fired_client.sqf
53+
// Build :PLACED:CREATE: data — same format as vanilla mines in fnc_eh_fired_client.sqf
5454
private _placedData = [
5555
EGVAR(recorder,captureFrameNo), // 0: captureFrameNo
5656
-1, // 1: placedId (assigned by server)

addons/recorder/fnc_captureLoop.sqf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ GVAR(PFHObject) = [
112112

113113
[
114114
{missionNamespace getVariable [QEGVAR(extension,sessionReady), false]},
115-
{[":NEW:SOLDIER:", _this] call EFUNC(extension,sendData);},
115+
{[":SOLDIER:CREATE:", _this] call EFUNC(extension,sendData);},
116116
_newUnit,
117117
30
118118
] call CBA_fnc_waitUntilAndExecute;
@@ -168,7 +168,7 @@ GVAR(PFHObject) = [
168168
];
169169

170170
if (_x getVariable ["unitData", []] isNotEqualTo _unitData) then {
171-
[":NEW:SOLDIER:STATE:", _unitData] call EFUNC(extension,sendData);
171+
[":SOLDIER:STATE:", _unitData] call EFUNC(extension,sendData);
172172
_x setVariable [QGVARMAIN(unitData), _unitData];
173173
};
174174
};
@@ -217,7 +217,7 @@ GVAR(PFHObject) = [
217217

218218
[
219219
{missionNamespace getVariable [QEGVAR(extension,sessionReady), false]},
220-
{[":NEW:VEHICLE:", _this] call EFUNC(extension,sendData);},
220+
{[":VEHICLE:CREATE:", _this] call EFUNC(extension,sendData);},
221221
_newVehicleData,
222222
30
223223
] call CBA_fnc_waitUntilAndExecute;
@@ -260,11 +260,11 @@ GVAR(PFHObject) = [
260260
// Stop tracking parachutes/ejection seats that are empty or dead
261261
if ((_x getVariable [QGVARMAIN(vehicleClass), ""]) isEqualTo "parachute" && {!((alive _x) && {_crew isNotEqualTo []})}) then {
262262
_vehicleData set [3, 0];
263-
[":NEW:VEHICLE:STATE:", _vehicleData] call EFUNC(extension,sendData);
263+
[":VEHICLE:STATE:", _vehicleData] call EFUNC(extension,sendData);
264264
_x setVariable [QGVARMAIN(exclude), true, true];
265265
GVAR(trackedVehicles) deleteAt _ocapId;
266266
} else {
267-
[":NEW:VEHICLE:STATE:", _vehicleData] call EFUNC(extension,sendData);
267+
[":VEHICLE:STATE:", _vehicleData] call EFUNC(extension,sendData);
268268
GVAR(trackedVehicles) set [_ocapId, [_x, _pos, round getDir _x, side _x, vectorDir _x, vectorUp _x]];
269269
};
270270
};
@@ -276,7 +276,7 @@ GVAR(PFHObject) = [
276276
{
277277
(GVAR(trackedVehicles) get _x) params ["_obj", "_lastPos", "_lastDir", "_lastSide", "_lastVectorDir", "_lastVectorUp"];
278278
if (isNull _obj) then {
279-
[":NEW:VEHICLE:STATE:", [
279+
[":VEHICLE:STATE:", [
280280
_x, _lastPos, _lastDir, 0, [], GVAR(captureFrameNo),
281281
0, 1, false, false, _lastSide, _lastVectorDir, _lastVectorUp, 0, 0
282282
]] call EFUNC(extension,sendData);

addons/recorder/fnc_eh_connected.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
3232
if (_owner isEqualTo 2) exitWith {};
3333

3434
// log to timeline
35-
[":EVENT:", [
35+
[":EVENT:GENERAL:", [
3636
GVAR(captureFrameNo),
3737
"connected",
3838
_name,

addons/recorder/fnc_eh_disconnected.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
params ["_unit", "_id", "_uid", "_name"];
2929

30-
[":EVENT:", [
30+
[":EVENT:GENERAL:", [
3131
GVAR(captureFrameNo),
3232
"disconnected",
3333
_name,

addons/recorder/fnc_eh_fired_client.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ _projectile setVariable [QGVARMAIN(projectileData), _data];
113113
if (_weapon == "put") then {
114114
_projectile setVariable [QGVARMAIN(detonated), false];
115115

116-
// Build :NEW:PLACED: data — placedId assigned server-side (GVAR(nextId) only exists there)
116+
// Build :PLACED:CREATE: data — placedId assigned server-side (GVAR(nextId) only exists there)
117117
private _placedData = [
118118
EGVAR(recorder,captureFrameNo), // 0: captureFrameNo
119119
-1, // 1: placedId (assigned by server)

addons/recorder/fnc_eh_fired_server.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
TRACE_1("Sending fired data to extension",_data);
128128
_data spawn {
129129
sleep 2;
130-
[":PROJECTILE:", _this] call EFUNC(extension,sendData);
130+
[":EVENT:PROJECTILE:", _this] call EFUNC(extension,sendData);
131131
};
132132
}] call CBA_fnc_addEventHandler;
133133

@@ -140,7 +140,7 @@
140140
_data set [1, _placedId];
141141
_projectile setVariable [QGVARMAIN(placedId), _placedId, true];
142142
TRACE_2("Sending placed object data to extension",_placedId,_data);
143-
[":NEW:PLACED:", _data] call EFUNC(extension,sendData);
143+
[":PLACED:CREATE:", _data] call EFUNC(extension,sendData);
144144
}] call CBA_fnc_addEventHandler;
145145

146146
// Handle placed object lifecycle events (detonation, deletion)

0 commit comments

Comments
 (0)