mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
257d9536cc
* First Push Added the ability to edit cargo objects (crates/boxes only) names. Either via in-game action on the object it self or via 3den attributes. Added a single function which spawns the UI to edit the name and also edits it. This is an scripted UI, it could be changed to a config version if wanted, but as I'm not good in UI coding I left it on this simple version mainly for testing. Added 4 new stringtable entries, 2 for action and 2 for 3den attributes. * Add extra stringtable Forgot to add the UI to the stringtable. * Update fnc_renameObject.sqf fixing tabs * Show custom name only behind Added new function "getNameItem" that will get the items name. Put the custom name behind the original name between brackets "[...]". * Added "Hide Rename Action" setting Also removed an unused _itemClass from postInit. * Apply suggestions from code review Co-authored-by: jonpas <jonpas33@gmail.com> * Update AUTHORS.txt Added my name * Applied the sugesstions. * Fixed function crash * Moved to dialog. * Removed unused comment/code * Update renameMenu.hpp Fixed tabs to spaces. * Update renameMenu.hpp * move rename to common * Update addons/arsenal/ui/RscAttributes.hpp * style and use addActionToObject Co-authored-by: jonpas <jonpas33@gmail.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
93 lines
3.1 KiB
Plaintext
93 lines
3.1 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: Glowbal
|
|
* Start unload action.
|
|
*
|
|
* Arguments:
|
|
* None
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [] call ace_cargo_fnc_startUnload
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
disableSerialization;
|
|
|
|
private _display = uiNamespace getVariable QGVAR(menuDisplay);
|
|
if (isNil "_display") exitWith {};
|
|
|
|
private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []];
|
|
if (_loaded isEqualTo []) exitWith {};
|
|
|
|
private _ctrl = _display displayCtrl 100;
|
|
|
|
private _selected = (lbCurSel _ctrl) max 0;
|
|
|
|
if (count _loaded <= _selected) exitWith {};
|
|
private _item = _loaded select _selected; // This can be an object or a classname string
|
|
|
|
if (GVAR(interactionParadrop)) exitWith {
|
|
// If drop time is 0 don't show a progress bar
|
|
if (GVAR(paradropTimeCoefficent) == 0) exitWith {
|
|
[QGVAR(paradropItem), [_item, GVAR(interactionVehicle)]] call CBA_fnc_localEvent;
|
|
};
|
|
|
|
// Start progress bar - paradrop
|
|
private _size = [_item] call FUNC(getSizeItem);
|
|
[
|
|
GVAR(paradropTimeCoefficent) * _size,
|
|
[_item, GVAR(interactionVehicle), ACE_player],
|
|
{
|
|
(_this select 0) params ["_item", "_target", "_player"];
|
|
[QGVAR(paradropItem), [_item, _target]] call CBA_fnc_localEvent;
|
|
},
|
|
{
|
|
params ["_args", "", "", "_errorCode"]; // show warning if we failed because of flight conditions
|
|
if (_errorCode == 3) then {
|
|
_args params ["_item", "_target", "_player"];
|
|
[localize LSTRING(unlevelFlightWarning)] call EFUNC(common,displayTextStructured);
|
|
};
|
|
},
|
|
localize LSTRING(UnloadingItem),
|
|
{
|
|
(_this select 0) params ["_item", "_target", "_player"];
|
|
if ((acos ((vectorUp _target) select 2)) > 30) exitWith {false}; // check flight level
|
|
if (((getPos _target) select 2) < 25) exitWith {false}; // check height
|
|
if ((speed _target) < -5) exitWith {false}; // check reverse
|
|
true
|
|
},
|
|
["isNotSwimming", "isNotInside"]
|
|
] call EFUNC(common,progressBar);
|
|
};
|
|
|
|
|
|
// Start progress bar - normal ground unload
|
|
if ([_item, GVAR(interactionVehicle), ACE_player] call FUNC(canUnloadItem)) then {
|
|
private _size = [_item] call FUNC(getSizeItem);
|
|
|
|
[
|
|
GVAR(loadTimeCoefficient) * _size,
|
|
[_item, GVAR(interactionVehicle), ACE_player],
|
|
{TRACE_1("unload finish",_this); ["ace_unloadCargo", _this select 0] call CBA_fnc_localEvent},
|
|
{TRACE_1("unload fail",_this);},
|
|
localize LSTRING(UnloadingItem),
|
|
{
|
|
(_this select 0) params ["_item", "_target", "_player"];
|
|
|
|
(alive _target)
|
|
&& {locked _target < 2}
|
|
&& {([_player, _target] call EFUNC(interaction,getInteractionDistance)) < MAX_LOAD_DISTANCE}
|
|
&& {_item in (_target getVariable [QGVAR(loaded), []])}
|
|
},
|
|
["isNotSwimming"]
|
|
] call EFUNC(common,progressBar);
|
|
} else {
|
|
private _displayName = [_item, true] call FUNC(getNameItem);
|
|
|
|
[[LSTRING(UnloadingFailed), _displayName], 3] call EFUNC(common,displayTextStructured);
|
|
};
|