Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
OverlordZorn committed Nov 16, 2024
2 parents 61772eb + f59d782 commit cf7b018
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .hemtt/missions/CSC.Altis/init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,10 @@ params [
] call cvo_csc_fnc_register;

["B_Slingload_01_Ammo_F", "ACE Medical Box"] call cvo_csc_fnc_link;
[source, "ACE Medical Box"] call cvo_csc_fnc_link;
["B_Slingload_01_Ammo_F", "ACE Medical Box"] call cvo_csc_fnc_link;
["B_Slingload_01_Ammo_F", "ACE Medical Box 2"] call cvo_csc_fnc_link;
["B_Slingload_01_Ammo_F", "ACE Medical Box 2"] call cvo_csc_fnc_link;
[source, "ACE Medical Box"] call cvo_csc_fnc_link;
[source, "ACE Medical Box"] call cvo_csc_fnc_link;
[source, "ACE Medical Box 2"] call cvo_csc_fnc_link;
[source, "ACE Medical Box 2"] call cvo_csc_fnc_link;
23 changes: 18 additions & 5 deletions addons/csc/functions/fn_link.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ if (_target isEqualTo "404") exitWith {ZRN_LOG_MSG(No target provided);};

private _cat = [_catName] call FUNC(catalog);
if (_cat isEqualTo "404") exitWith {ZRN_LOG_MSG_1(Catalog not found,_catName);};

private _links = _cat get _entryName getOrDefault ["links", [[],[]]];
private _cat_links = _cat getOrDefault ["CAT Links", [[],[]]];


ZRN_LOG_1(_links);

Expand All @@ -48,22 +51,29 @@ private _fn_obj = {
// Add action to Object
if (isNull _target) exitWith {ZRN_LOG_MSG(FAILED: Target Null)};

if !(_target in _links#1) then {
if !(_target in (_cat_links#1)) then {
private _aceAction = [_catName] call FUNC(createAction);
[_target, 0, ["ACE_MainActions"], _aceAction] call ace_interact_menu_fnc_addActionToObject;

(_cat_links#1) pushBackUnique _target;
};

// Add Object to Entry-Links
_links#1 pushBackUnique _target;
(_links#1) pushBackUnique _target;
};

private _fn_class = {
if !(isClass (configFile >> "CfgVehicles" >> _target)) exitWith {ZRN_LOG_MSG(FAILED: Target Class not found in CfgVehicles);};

if !(_target in _links#0) then {
if !(_target in (_cat_links#0)) then {
private _aceAction = [_catName] call FUNC(createAction);
[_target, 0, ["ACE_MainActions"], _aceAction] call ace_interact_menu_fnc_addActionToClass;

(_cat_links#0) pushBackUnique _target;
};
_links#0 pushBackUnique _target;

// Add Class to the Classname links.
(_links#0) pushBackUnique _target;
};


Expand All @@ -72,4 +82,7 @@ switch (true) do {
case (_target isEqualTo "ZEUS"): _fn_zeus;
case (_target isEqualType ""): _fn_class;
default { };
}
}


// if has node, then only add to link.
1 change: 1 addition & 0 deletions addons/csc/functions/internal/fn_catalog.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ private _cat = missionNamespace getVariable [_catalogName, "404"];
if (_cat isEqualTo "404") then {
_cat = createHashMap;
_cat set ["Default Entry", [] call FUNC(defaultEntry)];
_cat set ["CAT Links", [[],[]]];

missionNamespace setVariable [_catalogName, _cat];

Expand Down
4 changes: 2 additions & 2 deletions addons/csc/functions/internal/fn_createAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ private _children = {
private _code = switch (_mode) do {
case "ZEUS": {
{
if (_x isEqualTo "Default Entry" OR {typeName _y isNotEqualTo "HASHMAP"}) then {continue};
if (_x in ["Default Entry", "CAT Links"] OR {typeName _y isNotEqualTo "HASHMAP"}) then {continue};
private _zeusEnabled = _y getOrDefault ["zeus_enabled", false];
if (_zeusEnabled) then {_entries pushBack _x};
}
};

case "NORMAL": {
{
if (_x isEqualTo "Default Entry" OR {typeName _y isNotEqualTo "HASHMAP"}) then {continue};
if (_x in ["Default Entry", "CAT Links"] OR {typeName _y isNotEqualTo "HASHMAP"}) then {continue};
private _links = _y get "links";
if (_target_classname in _links#0 || {_target in _links#1}) then { _entries pushBack _x };
}
Expand Down

0 comments on commit cf7b018

Please sign in to comment.