mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
- Added proper handling of pistol mags and regular mags in gear to prevent magazine overflow - Added pre-check if return change will overflow gear + backpack free space. If change will not fit in gear + backpack free space then buy is prevented with a message notifying the player. In the case of a sale it proceeds anyway, but notifies player if overflow occurs (see comments in returnChange) - Consolidated duplicate code for calculating free space and returning cargo of an object into new calcFreeSpace - Old calculateFreeSpace renamed to displayFreeSpace - Added Weps/Mags/Bags icons to free slot numbers display
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
/**
|
|
* call Z_getVehicleItems
|
|
*
|
|
* Gets all your items stored in your vehicle and innitiates the selling list.
|
|
**/
|
|
private ["_vehicle","_pos","_list","_formattedText","_pic","_normalMags","_normalWeaps","_freeSpace"];
|
|
#include "defines.hpp"
|
|
|
|
Z_vehicle = objNull;
|
|
call Z_clearLists;
|
|
Z_SellableArray = [];
|
|
Z_SellArray = [];
|
|
_vehicle = objNull;
|
|
|
|
_pos = [player] call FNC_GetPos;
|
|
_list = nearestObjects [_pos, ["Air","LandVehicle","Ship"], Z_VehicleDistance];
|
|
{
|
|
if (!isNull _x && local _x && alive _x) then {
|
|
_vehicle = _x;
|
|
};
|
|
} count _list;
|
|
|
|
if (!isNull _vehicle) then {
|
|
systemChat format[localize "STR_EPOCH_TRADE_SELECTED",typeOf _vehicle];
|
|
_pic = getText (configFile >> 'CfgVehicles' >> (typeOf _vehicle) >> 'picture');
|
|
|
|
_formattedText = format [
|
|
"<img image='%1' size='3' align='center'/>"
|
|
, _pic
|
|
];
|
|
|
|
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText;
|
|
Z_vehicle = _vehicle;
|
|
_freeSpace = [_vehicle,0,0,0,0] call Z_calcFreeSpace;
|
|
_normalMags = _freeSpace select 5;
|
|
_normalWeaps = _freeSpace select 6;
|
|
//_normalBags = _freeSpace select 7;
|
|
// Can't sell backpacks from vehicle because there is currently no command to remove single backpacks from cargo (only clearBackpackCargo which removes all)
|
|
|
|
[_normalWeaps,_normalMags,typeOf _vehicle,[]] call Z_checkArrayInConfig;
|
|
};
|