Skip to content
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

Improve context menu action configs and UX #286

Merged
merged 8 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ KoffeinFlummi
PabstMirror
SilentSpike
Tuupertunut
veteran29
4 changes: 2 additions & 2 deletions addons/area_markers/CfgContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class EGVAR(context_menu,actions) {
displayName = CSTRING(CreateAreaMarker);
icon = ICON_MARKERS;
condition = QUOTE(visibleMap);
statement = QUOTE([ARR_2(QQGVAR(create),[_contextPosASL])] call CBA_fnc_serverEvent);
priority = -98;
statement = QUOTE([ARR_2(QQGVAR(create),[_position])] call CBA_fnc_serverEvent);
priority = 100;
};
};
6 changes: 3 additions & 3 deletions addons/common/functions/fnc_teleportIntoVehicle.sqf
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3
* Teleports units into the given vehicle.
* Teleports the given units into the given vehicle.
* Will only teleport if there is enough space in the vehicle for all units.
*
* Arguments:
* 0: Units <ARRAY>
* 1: Vehicle <OBJECT>
*
* Return Value:
* Success <BOOL>
* Successful <BOOL>
*
* Example:
* [[player1, player2, player3], vehicle player] call zen_common_fnc_teleportIntoVehicle
* [_units, _vehicle] call zen_common_fnc_teleportIntoVehicle
*
* Public: No
*/
Expand Down
417 changes: 204 additions & 213 deletions addons/context_actions/CfgContext.hpp

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion addons/context_actions/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
PREP(canEditInventory);
PREP(canEditLoadout);
PREP(canEditVehicleAppearance);
PREP(canHealUnits);
PREP(canPasteVehicleAppearance);
PREP(canRearmVehicles);
PREP(canRefuelVehicles);
PREP(canRepairVehicles);
PREP(copyVehicleAppearance);
PREP(editableObjects);
PREP(healUnits);
PREP(pasteVehicleAppearance);
PREP(rearmVehicles);
PREP(refuelVehicles);
PREP(repairVehicles);
PREP(setBehaviour);
PREP(setCombatMode);
PREP(setFormation);
PREP(setSpeed);
PREP(setSpeedMode);
PREP(setStance);
PREP(teleportPlayers);
PREP(teleportZeus);
3 changes: 2 additions & 1 deletion addons/context_actions/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class CfgPatches {
requiredAddons[] = {
"zen_context_menu",
"zen_garage",
"zen_inventory"
"zen_inventory",
"zen_remote_control"
};
author = ECSTRING(main,Author);
authors[] = {"mharis001"};
Expand Down
22 changes: 22 additions & 0 deletions addons/context_actions/functions/fnc_canEditInventory.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Checks if the inventory of the given entity can be edited.
*
* Arguments:
* 0: Entity <ANY>
*
* Return Value:
* Can Edit Inventory <BOOL>
*
* Example:
* [_entity] call zen_context_actions_fnc_canEditInventory
*
* Public: No
*/

params ["_entity"];

_entity isEqualType objNull
&& {alive _entity}
&& {getNumber (configFile >> "CfgVehicles" >> typeOf _entity >> "maximumLoad") > 0}
20 changes: 20 additions & 0 deletions addons/context_actions/functions/fnc_canEditLoadout.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Checks if the loadout of the given entity can be edited.
*
* Arguments:
* 0: Entity <ANY>
*
* Return Value:
* Can Edit Loadout <BOOL>
*
* Example:
* [_entity] call zen_context_actions_fnc_canEditLoadout
*
* Public: No
*/

params ["_entity"];

_entity isEqualType objNull && {alive _entity} && {_entity isKindOf "CAManBase"}
22 changes: 22 additions & 0 deletions addons/context_actions/functions/fnc_canEditVehicleAppearance.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Checks if the given entity is a vehicle whose appearance can be edited.
*
* Arguments:
* 0: Entity <ANY>
*
* Return Value:
* Can Edit Appearance <BOOL>
*
* Example:
* [_entity] call zen_context_actions_fnc_canEditVehicleAppearance
*
* Public: No
*/

params ["_entity"];

_entity isEqualType objNull
&& {alive _entity}
&& {_entity isKindOf "LandVehicle" || {_entity isKindOf "Air"} || {_entity isKindOf "Ship"}}
23 changes: 23 additions & 0 deletions addons/context_actions/functions/fnc_canHealUnits.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3, veteran29
* Checks if infantry units from the given objects list can be healed based on the mode.
*
* Arguments:
* 0: Objects <ARRAY>
* 1: Mode (0 - All, 1 - Players, 2 - AI) <NUMBER>
*
* Return Value:
* None
*
* Example:
* [_objects, 2] call zen_context_actions_fnc_canHealUnits
*
* Public: No
*/

params ["_objects", "_mode"];

private _fnc_filter = [{true}, {isPlayer _x}, {!isPlayer _x}] select _mode;

_objects findIf {crew _x findIf {alive _x && {_x isKindOf "CAManBase"} && _fnc_filter} != -1} != -1
20 changes: 20 additions & 0 deletions addons/context_actions/functions/fnc_canPasteVehicleAppearance.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Checks if a previously copied appearance can be applied to the given vehicle.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* Can Paste Appearance <BOOL>
*
* Example:
* [_vehicle] call zen_context_actions_fnc_canPasteVehicleAppearance
*
* Public: No
*/

params ["_vehicle"];

!isNil {GVAR(appearances) getVariable typeOf _vehicle}
21 changes: 21 additions & 0 deletions addons/context_actions/functions/fnc_canRearmVehicles.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3
* Checks if the given objects list contains vehicles that can be rearmed.
*
* Arguments:
* N: Objects <OBJECT>
*
* Return Value:
* Can Rearm Vehicles <BOOL>
*
* Example:
* [_object] call zen_context_actions_fnc_canRearmVehicles
*
* Public: No
*/

_this findIf {
private _ammo = [_x] call EFUNC(common,getVehicleAmmo);
_ammo != -1 && {_ammo < 1}
} != -1
18 changes: 18 additions & 0 deletions addons/context_actions/functions/fnc_canRefuelVehicles.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3
* Checks if the given objects list contains vehicles that can be refueled.
*
* Arguments:
* N: Objects <OBJECT>
*
* Return Value:
* Can Refuel Vehicles <BOOL>
*
* Example:
* [_object] call zen_context_actions_fnc_canRefuelVehicles
*
* Public: No
*/

_this findIf {fuel _x < 1} != -1
18 changes: 18 additions & 0 deletions addons/context_actions/functions/fnc_canRepairVehicles.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3
* Checks if the given objects list contains vehicles that can be repaired.
*
* Arguments:
* N: Objects <OBJECT>
*
* Return Value:
* Can Repair Vehicles <BOOL>
*
* Example:
* [_object] call zen_context_actions_fnc_canRepairVehicles
*
* Public: No
*/

_this findIf {damage _x > 0 && {_x isKindOf "AllVehicles"} && {!(_x isKindOf "CAManBase")}} != -1
21 changes: 21 additions & 0 deletions addons/context_actions/functions/fnc_copyVehicleAppearance.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Copies and stores the given vehicle's appearance.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_vehicle] call zen_context_actions_fnc_copyVehicleAppearance
*
* Public: No
*/

params ["_vehicle"];

private _customization = _vehicle call BIS_fnc_getVehicleCustomization;
GVAR(appearances) setVariable [typeOf _vehicle, _customization];
6 changes: 3 additions & 3 deletions addons/context_actions/functions/fnc_healUnits.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3, veteran29
* Heals all infantry units from the given objects list based on the mode.
* Heals infantry units from the given objects list based on the mode.
* Handles healing units currently in vehicles.
*
* Arguments:
Expand All @@ -12,7 +12,7 @@
* None
*
* Example:
* [[player1, player2, player3], 2] call zen_context_actions_fnc_healUnits
* [_objects, 2] call zen_context_actions_fnc_healUnits
*
* Public: No
*/
Expand All @@ -28,7 +28,7 @@ private _units = [];
private _fnc_filter = [{true}, {isPlayer _x}, {!isPlayer _x}] select _mode;

{
if (_x isKindOf "CAManBase" && {alive _x} && _fnc_filter) then {
if (alive _x && {_x isKindOf "CAManBase"} && _fnc_filter) then {
[_x] call EFUNC(common,healUnit);
};
} forEach (_units arrayIntersect _units);
23 changes: 23 additions & 0 deletions addons/context_actions/functions/fnc_pasteVehicleAppearance.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"
/*
* Author: mharis001
* Applies the previously copied appearance to the given vehicle.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_vehicle] call zen_context_actions_fnc_pasteVehicleAppearance
*
* Public: No
*/

params ["_vehicle"];

private _customization = GVAR(appearances) getVariable typeOf _vehicle;
_customization params ["_textures", "_animations"];

[_vehicle, _textures, _animations, true] call BIS_fnc_initVehicle;
13 changes: 6 additions & 7 deletions addons/context_actions/functions/fnc_rearmVehicles.sqf
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3
* Rearms units in given selection.
* Rearms vehicles from the objects list.
*
* Arguments:
* N: Selected Objects <ARRAY>
* N: Objects <OBJECT>
*
* Return Value:
* None
*
* Example:
* [vehicle1, vehicle2, vehicle3] call zen_context_actions_fnc_rearmVehicles
* [_object] call zen_context_actions_fnc_rearmVehicles
*
* Public: No
*/

private _vehicles = _this select {
alive _x
&& {_x isKindOf "AllVehicles"}
&& {!(_x isKindOf "CAManBase")}
&& {
private _ammo = [_x] call EFUNC(common,getVehicleAmmo);
_ammo != -1
&& {_ammo < 1}
_ammo != -1 && {_ammo < 1}
}
&& {_x isKindOf "AllVehicles"}
&& {!(_x isKindOf 'CAManBase')}
};

{
Expand Down
8 changes: 4 additions & 4 deletions addons/context_actions/functions/fnc_refuelVehicles.sqf
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include "script_component.hpp"
/*
* Author: 3Mydlo3
* Refuels units in given selection.
* Refuels vehicles from the objects list.
*
* Arguments:
* N: Selected Objects <ARRAY>
* N: Objects <OBJECT>
*
* Return Value:
* None
*
* Example:
* [vehicle1, vehicle2, vehicle3] call zen_context_actions_fnc_refuelVehicles
* [_object] call zen_context_actions_fnc_refuelVehicles
*
* Public: No
*/
Expand All @@ -19,7 +19,7 @@ private _vehicles = _this select {
alive _x
&& {fuel _x < 1}
&& {_x isKindOf "AllVehicles"}
&& {!(_x isKindOf 'CAManBase')}
&& {!(_x isKindOf "CAManBase")}
};

{
Expand Down
Loading