-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CBA_MiscItem to virtual arsenal #744
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class CfgWeapons { | ||
class ItemCore; | ||
class InventoryItem_Base_F; | ||
class CBA_MiscItem_ItemInfo: InventoryItem_Base_F { | ||
type = 302; // "bipod" | ||
}; | ||
class CBA_MiscItem: ItemCore { // type = 131072; | ||
class ItemInfo: CBA_MiscItem_ItemInfo {}; | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,7 @@ if (hasInterface) then { | |
GVAR(actionListUpdated) = false; // Set true to force recreation of actions. | ||
GVAR(nextActionIndex) = 0; // Next index that will be given out. | ||
GVAR(actionListPFEH) = false; | ||
|
||
// Add CBA_MiscItems to VirtualArsenal | ||
[missionnamespace, "arsenalOpened", {call CBA_fnc_handleArsenalOpened}] call bis_fnc_addscriptedeventhandler; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check camelCase capitalization in: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [missionNamespace, "arsenalOpened", {call CBA_fnc_handleArsenalOpened}] call BIS_fnc_addScriptedEventHandler; |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ class CfgPatches { | |
|
||
#include "CfgVehicles.hpp" | ||
#include "CfgLocationTypes.hpp" | ||
#include "CfgWeapons.hpp" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#define DEBUG_MODE_FULL | ||
#include "script_component.hpp" | ||
|
||
#define IDC_RSCDISPLAYARSENAL_LIST 960 | ||
#define IDC_RSCDISPLAYARSENAL_TAB_CARGOMISC 24 | ||
#define IDC_RSCDISPLAYARSENAL_SORT 800 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are already part of: #include "\a3\ui_f\hpp\defineResinclDesign.inc" But that file cannot be included in the components script_component.hpp, because it has a double define that crashes the binarizer. It can be included in this file though. |
||
|
||
|
||
params ["_display"]; | ||
TRACE_1("handleArsenalOpened",_display); | ||
|
||
if (missionNamespace getVariable [QGVAR(arsenalDataModified), false]) exitWith { | ||
TRACE_1("Already set", bis_fnc_arsenal_data select 24) | ||
}; | ||
|
||
private _cbaMiscItems = []; | ||
{ | ||
private _class = _x; | ||
private _scope = if (isnumber (_class >> "scopeArsenal")) then {getnumber (_class >> "scopeArsenal")} else {getnumber (_class >> "scope")}; | ||
TRACE_2("",_class,_scope); | ||
if (_scope == 2 && {gettext (_class >> "model") != ""}) then { | ||
_cbaMiscItems pushBack (configName _class); | ||
}; | ||
} forEach (configProperties [configFile >> "CfgWeapons", "(isClass _x) && {(configName _x) isKindOf ['CBA_MiscItem', configFile >> 'CfgWeapons']}"]); | ||
TRACE_2("Items to add",count _cbaMiscItems,_cbaMiscItems); | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant whitespace? |
||
// Much of this is from fn_arsenal.sqf -> "ListAdd" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same? |
||
private _fullVersion = missionnamespace getvariable ["BIS_fnc_arsenal_fullArsenal",false]; | ||
private _center = (missionnamespace getvariable ["BIS_fnc_arsenal_center",player]); | ||
private _cargo = (missionnamespace getvariable ["BIS_fnc_arsenal_cargo",objnull]); | ||
|
||
private _virtualItemCargo = | ||
(missionnamespace call bis_fnc_getVirtualItemCargo) + | ||
(_cargo call bis_fnc_getVirtualItemCargo) + | ||
items _center + | ||
assigneditems _center + | ||
primaryweaponitems _center + | ||
secondaryweaponitems _center + | ||
handgunitems _center + | ||
[uniform _center,vest _center,headgear _center,goggles _center]; | ||
|
||
private _ctrlList = _display displayctrl (IDC_RSCDISPLAYARSENAL_LIST + IDC_RSCDISPLAYARSENAL_TAB_CARGOMISC); | ||
private _virtualCargo = _virtualItemCargo; | ||
private _virtualAll = _fullVersion || {"%ALL" in _virtualCargo}; | ||
private _columns = count lnbGetColumnsPosition _ctrlList; | ||
{ | ||
// Add item to display list if allowed: | ||
if (_virtualAll || {_x in _virtualCargo}) then { | ||
private _xCfg = configfile >> "cfgweapons" >> _x; | ||
private _lbAdd = _ctrlList lnbaddrow ["",gettext (_xCfg >> "displayName"),str 0]; | ||
_ctrlList lnbsetdata [[_lbAdd,0],_x]; | ||
_ctrlList lnbsetpicture [[_lbAdd,0],gettext (_xCfg >> "picture")]; | ||
_ctrlList lnbsetvalue [[_lbAdd,0],getnumber (_xCfg >> "itemInfo" >> "mass")]; | ||
_ctrlList lbsettooltip [_lbAdd * _columns,format ["%1\n%2",gettext (_xCfg >> "displayName"),_x]]; | ||
}; | ||
|
||
// Add item to main list (will be used on next arsenalOpened automaticly) | ||
(bis_fnc_arsenal_data select IDC_RSCDISPLAYARSENAL_TAB_CARGOMISC) pushBack _x; | ||
} foreach _cbaMiscItems; | ||
|
||
missionNamespace setVariable [QGVAR(arsenalDataModified), true]; | ||
TRACE_1("finished",GVAR(arsenalDataModified)); | ||
|
||
nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this class (
CBA_MiscItem_ItemInfo
) is really needed or if the modified entries couldn't just be put inCBA_MiscItem/ItemInfo
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes configs easier IMHO because you just add the 2 parent defines instead of having to add the full inhertiance from the parent.
Also makes it a drop in replacement for our existing configs (just change
InventoryItem_Base_F
):