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

Dragging - Add more objects configs #8104

Merged
merged 6 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
5 changes: 3 additions & 2 deletions addons/dragging/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ class Extended_Init_EventHandlers {
init = QUOTE(_this call DFUNC(initObject));
};
};
class ThingX {
class Thing {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
exclude[] = {"ModuleEmpty_F", "ThingEffect", "Wreck"};
};
};
class Land_PortableLight_single_F {
class NonStrategic {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
Expand Down
174 changes: 122 additions & 52 deletions addons/dragging/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define XEH_INHERITED class EventHandlers {class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};}

class CBA_Extended_EventHandlers;

Expand All @@ -7,11 +8,9 @@ class CfgVehicles {
class StaticWeapon: LandVehicle {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1.2,0};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
};

class StaticCannon: StaticWeapon {
Expand All @@ -23,11 +22,9 @@ class CfgVehicles {
class Mortar_01_base_F: StaticMortar {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1.2,0};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
};

// Big 1.70 and 1.84 Autonomous AA Turrets
Expand Down Expand Up @@ -74,12 +71,9 @@ class CfgVehicles {
class Items_base_F;
class ReammoBox_F: ThingX {
GVAR(canCarry) = 0;
GVAR(carryPosition)[] = {0,1,1};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 0;
GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
};

class Slingload_base_F: ReammoBox_F {
Expand Down Expand Up @@ -162,43 +156,27 @@ class CfgVehicles {

//Plastic and metal case
class PlasticCase_01_base_F: Items_base_F {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 270;

GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 270;
};
class MetalCase_01_base_F: Items_base_F {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 270;

GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0};
GVAR(dragDirection) = 0;
GVAR(dragPosition)[] = {0,1.2,0};
};

// Barrier
class RoadCone_F: ThingX {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};

GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,1};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
};

class RoadBarrier_F: RoadCone_F {
Expand All @@ -208,59 +186,37 @@ class CfgVehicles {
// Misc crates
class Constructions_base_F;
class Land_WoodenBox_F: Constructions_base_F {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.4,0};
GVAR(dragDirection) = 0;
GVAR(dragPosition)[] = {0,1.4,0};
};
class Land_WoodenCrate_01_F: ThingX {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 270;

GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.5,0};
GVAR(dragDirection) = 90;
};
class Land_PaperBox_01_small_closed_base_F: Items_base_F {
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.5,0};
GVAR(dragDirection) = 90;
};
class Box_UAV_06_base_F: Items_base_F {
GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.5,0};
GVAR(dragDirection) = 0;
};
class ACE_RepairItem_Base: ThingX {};

class ACE_Track: ACE_RepairItem_Base {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,1};
GVAR(carryDirection) = 0;
};

class ACE_Wheel: ACE_RepairItem_Base {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,1};
GVAR(carryDirection) = 0;
};

class Lamps_base_F;
Expand All @@ -278,19 +234,133 @@ class CfgVehicles {
GVAR(canCarry) = 1;
// if y < 0.9 player gets damage
GVAR(carryPosition)[] = {0,0.9,1};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,0.7,0};
GVAR(dragDirection) = 0;
};
class Land_Camping_Light_off_F: ThingX {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.9,1};
GVAR(carryDirection) = 0;

GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,0.7,0};
GVAR(dragDirection) = 0;
};

// some terrain objects

class Land_CampingTable_F: ThingX {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,0.5};
};
class Land_CampingTable_small_F: ThingX {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,0.5};
};
class Land_GarbageContainer_closed_F: ThingX {
GVAR(canDrag) = 1;
GVAR(dragDirection) = 180;
};
class Land_GarbageContainer_open_F: ThingX {
GVAR(canDrag) = 1;
GVAR(dragDirection) = 180;
};
class Land_Sun_chair_F: ThingX {
GVAR(canCarry) = 1;
GVAR(carryDirection) = 90;

GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1,0};
GVAR(dragDirection) = 90;
};
class Land_TablePlastic_01_F: ThingX {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,0};

GVAR(canDrag) = 1;
};
class Land_Tyre_F: ThingX {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.6,1};
};
class Land_WoodenTable_large_F: ThingX {
GVAR(canDrag) = 1;
GVAR(dragDirection) = 90;
};
class Land_BarrelSand_F: Items_base_F {
GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1,0};
};
class Land_BarrelWater_F: Items_base_F {
GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1,0};
};
class Land_Bucket_F: Items_base_F {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.6,1};
};
class Land_CanisterPlastic_F: Items_base_F {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.6,0};
};
class Land_GarbageBarrel_01_english_F: Items_base_F {
GVAR(canDrag) = 1;
};
class Land_MetalBarrel_F: Items_base_F {
GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1,0};
};
class Land_Pallet_F: Constructions_base_F {
GVAR(canCarry) = 1;

GVAR(canDrag) = 1;
};
class Land_Pallet_vertical_F: Constructions_base_F {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.6,0.6};
GVAR(carryDirection) = 180;
};
class Land_WheelCart_F: Constructions_base_F {
GVAR(canDrag) = 1;
};
class Land_WorkStand_F: Constructions_base_F {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,0};

GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1,0};
};
class Market_base_F;
class Land_Basket_F: Market_base_F {
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.6,0.5};
};
class Land_WoodenCart_F: Market_base_F {
GVAR(canDrag) = 1;
};

// static classes need XEH

class NonStrategic;
class Land_Pallets_F: NonStrategic {
XEH_INHERITED;
GVAR(canDrag) = 1;
};
class Camping_base_F;
class Land_CampingChair_V1_folded_F: Camping_base_F {
XEH_INHERITED;
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.6,1};
};
class Stall_base_F;
class Land_CratesPlastic_F: Stall_base_F {
XEH_INHERITED;
GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.6,1};
};
class House_Small_F;
class Land_MetalBarrel_empty_F: House_Small_F {
XEH_INHERITED;
GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1,0};
};
};
4 changes: 2 additions & 2 deletions addons/dragging/functions/fnc_initObject.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ params ["_object"];
private _config = configOf _object;

if (getNumber (_config >> QGVAR(canDrag)) == 1) then {
private _position = getArray (_config >> QGVAR(dragPosition));
private _position = [_config >> QGVAR(dragPosition), "ARRAY", [0, 1.5, 0]] call CBA_fnc_getConfigEntry;
private _direction = getNumber (_config >> QGVAR(dragDirection));

[_object, true, _position, _direction] call FUNC(setDraggable);
};

if (getNumber (_config >> QGVAR(canCarry)) == 1) then {
private _position = getArray (_config >> QGVAR(carryPosition));
private _position = [_config >> QGVAR(carryPosition), "ARRAY", [0, 1, 1]] call CBA_fnc_getConfigEntry;
private _direction = getNumber (_config >> QGVAR(carryDirection));

[_object, true, _position, _direction] call FUNC(setCarryable);
Expand Down
4 changes: 2 additions & 2 deletions addons/dragging/functions/fnc_setDraggable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Arguments:
* 0: Any object <OBJECT>
* 1: true to enable dragging, false to disable <BOOL>
* 2: Position offset for attachTo command (optional; default: [0,0,0])<ARRAY>
* 2: Position offset for attachTo command (optional; default: [0, 1.5, 0]) <ARRAY>
* 3: Direction in degree to rotate the object after attachTo (optional; default: 0) <NUMBER>
* 4: Override weight limit (optional; default: false) <BOOL>
*
Expand All @@ -23,7 +23,7 @@
params ["_object", "_enableDrag", "_position", "_direction", ["_ignoreWeightDrag", false, [false]]];

if (isNil "_position") then {
_position = _object getVariable [QGVAR(dragPosition), [0,0,0]];
_position = _object getVariable [QGVAR(dragPosition), [0, 1.5, 0]];
};

if (isNil "_direction") then {
Expand Down
10 changes: 5 additions & 5 deletions docs/wiki/framework/dragging-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ class CfgVehicles {
class MyVehicle {
// Dragging
ace_dragging_canDrag = 1; // Can be dragged (0-no, 1-yes)
ace_dragging_dragPosition[] = {0, 1.2, 0}; // Offset of the model from the body while dragging (same as attachTo)
ace_dragging_dragDirection = 0; // Model direction while dragging (same as setDir after attachTo)
ace_dragging_dragPosition[] = {0, 1.2, 0}; // Offset of the model from the body while dragging (same as attachTo) (optional; default: [0, 1.5, 0])
jonpas marked this conversation as resolved.
Show resolved Hide resolved
ace_dragging_dragDirection = 0; // Model direction while dragging (same as setDir after attachTo) (optional; default: 0)
jonpas marked this conversation as resolved.
Show resolved Hide resolved

// Carrying
ace_dragging_canCarry = 1; // Can be carried (0-no, 1-yes)
ace_dragging_carryPosition[] = {0, 1.2, 0}; // Offset of the model from the body while dragging (same as attachTo)
ace_dragging_carryDirection = 0; // Model direction while dragging (same as setDir after attachTo)
ace_dragging_carryPosition[] = {0, 1.2, 0}; // Offset of the model from the body while dragging (same as attachTo) (optional; default: [0, 1, 1])
jonpas marked this conversation as resolved.
Show resolved Hide resolved
ace_dragging_carryDirection = 0; // Model direction while dragging (same as setDir after attachTo) (optional; default: 0)
jonpas marked this conversation as resolved.
Show resolved Hide resolved
};
};
```
Expand All @@ -48,7 +48,7 @@ You will **not** be able to carry / drag objects that are too heavy, the mass is
---| --------- | ---- | ------------------------
0 | Any object | Object | Required
1 | Enable dragging, true to enable, false to disable | Boolean | Required
2 | Position to offset the object from player | Array | Optional (default: `[0, 0, 0]`)
2 | Position to offset the object from player | Array | Optional (default: `[0, 1.5, 0]`)
3 | Direction in degree to rotate the object | Number | Optional (default: `0`)
**R** | None | None | Return value

Expand Down