-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to view inventory of players within 100m radius
- Loading branch information
Showing
8 changed files
with
187 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
|
||
|
||
PREP(createPresetFromBox); | ||
PREP(createPresetFromPlayer); | ||
PREP(fillPresetIntoBox); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: dedmen | ||
* Generates a preset from the contents of a players inventory | ||
* | ||
* Arguments: | ||
* 0: Source Player <OBJECT> | ||
* 1: Preset Name <STRING> | ||
* 2: Preset Description <STRING> | ||
* | ||
* Return Value: | ||
* New Preset <ARRAY> | ||
* | ||
* Example: | ||
* [_target, "new Preset", "This is a preset"] call wolf_logistics_main_fnc_createPresetFromPlayer | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params ["_target", "_presetName", "_presetDescription"]; | ||
|
||
private _presetContents = []; | ||
private _newPreset = [_presetName, _presetDescription, _presetContents]; | ||
|
||
// Player only has containers and weapons and assigned items | ||
|
||
{ | ||
_presetContents pushBack _x; | ||
} forEach weaponsItems _target; // [weapon, muzzle, flashlight, optics, primaryMag, secondaryMag, bipod] | ||
|
||
{ | ||
_presetContents pushBack [_x, 1]; | ||
} forEach assignedItems [_target, true, false]; | ||
|
||
// This is basically all of the rest of the inventory | ||
|
||
private _backpackCargo = [ | ||
[uniform _target, uniformContainer _target], | ||
[vest _target, vestContainer _target], | ||
[backpack _target, backpackContainer _target] | ||
] select {(_x select 0) != ""}; | ||
|
||
{ | ||
_x params ["_type", "_object"]; | ||
_presetContents pushBack [_type, [_object, "", ""] call wolf_logistics_main_fnc_createPresetFromBox, 1]; // [name, contentPreset, dummy] | ||
} forEach _backpackCargo; | ||
|
||
_newPreset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#include "script_component.hpp" | ||
#include "..\ui\IDs.hpp" | ||
/* | ||
* Author: Alganthe, Dedmen | ||
* Handles selection changes on loadouts panel. | ||
* | ||
* Arguments: | ||
* 0: Loadouts panel control <CONTROL> | ||
* 1: Loadouts panel selection <SCALAR> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_display", "_control", "_curSel"]; | ||
|
||
private _saveButtonCtrl = _display displayCtrl IDC_buttonSave; | ||
private _packIntoBoxButtonCtrl = _display displayCtrl IDC_buttonPackIntoBox; | ||
private _clearBoxButtonCtrl = _display displayCtrl IDC_buttonClearBox; | ||
private _exportBoxButtonCtrl = _display displayCtrl IDC_buttonShareBox; | ||
private _exportPresetButtonCtrl = _display displayCtrl IDC_buttonSharePreset; | ||
private _renameButtonCtrl = _display displayCtrl IDC_buttonRename; | ||
private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete; | ||
private _loadoutInfoCtrl = _display displayCtrl IDC_loadoutInfo; | ||
private _textEditBoxCtrl = _display displayCtrl IDC_textLoadoutName; | ||
|
||
|
||
private _contentPanelCtrl = _display displayCtrl IDC_playerList; | ||
private _playerHash = _contentPanelCtrl lbData _curSel; | ||
|
||
private _player = (allPlayers select {hashValue _x == _playerHash}) param [0, objNull]; | ||
|
||
if (isNull _player) exitWith {}; | ||
|
||
private _loadout = [_player, name _player, format ["Player inventory view %1", name _player]] call wolf_logistics_main_fnc_createPresetFromPlayer; | ||
|
||
private _loadoutDescription = [_loadout] call wolf_logistics_ui_fnc_generateLoadoutDescription; | ||
|
||
tvClear _loadoutInfoCtrl; | ||
private _addTreeItem = { | ||
params ["_item", "_parentPath"]; | ||
|
||
if (_item isEqualType []) then { | ||
private _nodeItem = _loadoutInfoCtrl tvAdd [_parentPath, _item select 1]; | ||
private _nodePath = _parentPath + [_nodeItem]; | ||
_loadoutInfoCtrl tvSetPicture [_nodePath, getText ((_item select 0) >> "picture")]; | ||
_loadoutInfoCtrl tvSetTooltip [_nodePath, configName (_item select 0)]; // Classname tooltip | ||
|
||
if (count _item > 2) then { // item with sub content | ||
{ | ||
[_x, _nodePath] call _addTreeItem; | ||
} forEach (_item select 2); | ||
} | ||
} else { | ||
_loadoutInfoCtrl tvAdd [_parentPath, _item]; | ||
} | ||
}; | ||
|
||
{ | ||
[_x, []] call _addTreeItem; | ||
} forEach _loadoutDescription; | ||
|
||
//#TODO extra features, click item in tree and delete it out of existing lodaout | ||
|
||
tvExpandAll _loadoutInfoCtrl; | ||
|
||
_textEditBoxCtrl ctrlSetText (_control lnbText [_curSel, 1]); | ||
|
||
// We enable them all, then we disable what we can't have | ||
|
||
{ | ||
_x ctrlEnable true; | ||
_x ctrlCommit 0; | ||
} foreach [ | ||
// First row | ||
_saveButtonCtrl, _renameButtonCtrl, _deleteButtonCtrl, // Preset edit buttons | ||
_clearBoxButtonCtrl, _packIntoBoxButtonCtrl, _exportBoxButtonCtrl, | ||
// Second row | ||
_exportPresetButtonCtrl | ||
]; | ||
|
||
// No box | ||
{ | ||
_x ctrlEnable false; | ||
_x ctrlCommit 0; | ||
} foreach [_saveButtonCtrl, _clearBoxButtonCtrl, _packIntoBoxButtonCtrl, _exportBoxButtonCtrl]; | ||
|
||
// No preset | ||
{ | ||
_x ctrlEnable false; | ||
_x ctrlCommit 0; | ||
} foreach [_renameButtonCtrl, _deleteButtonCtrl, _packIntoBoxButtonCtrl, _exportPresetButtonCtrl]; | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters