diff --git a/addons/dragging/CfgEventHandlers.hpp b/addons/dragging/CfgEventHandlers.hpp index 233c4bf79d..7d3381340e 100644 --- a/addons/dragging/CfgEventHandlers.hpp +++ b/addons/dragging/CfgEventHandlers.hpp @@ -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)); }; diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index 4c43dd814e..055013f727 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -1,3 +1,4 @@ +#define XEH_INHERITED class EventHandlers {class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};} class CBA_Extended_EventHandlers; @@ -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 { @@ -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 @@ -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 { @@ -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 { @@ -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; @@ -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}; }; }; diff --git a/addons/dragging/functions/fnc_initObject.sqf b/addons/dragging/functions/fnc_initObject.sqf index a687a52b99..054f016a67 100644 --- a/addons/dragging/functions/fnc_initObject.sqf +++ b/addons/dragging/functions/fnc_initObject.sqf @@ -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); diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index 50a07b515b..99729ebd63 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: Any object * 1: true to enable dragging, false to disable - * 2: Position offset for attachTo command (optional; default: [0,0,0]) + * 2: Position offset for attachTo command (optional; default: [0, 1.5, 0]) * 3: Direction in degree to rotate the object after attachTo (optional; default: 0) * 4: Override weight limit (optional; default: false) * @@ -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 { diff --git a/docs/wiki/framework/dragging-framework.md b/docs/wiki/framework/dragging-framework.md index 962e6af1d4..800b52539b 100644 --- a/docs/wiki/framework/dragging-framework.md +++ b/docs/wiki/framework/dragging-framework.md @@ -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) (default: [0, 1.5, 0]) + ace_dragging_dragDirection = 0; // Model direction while dragging (same as setDir after attachTo) (default: 0) // 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) (default: [0, 1, 1]) + ace_dragging_carryDirection = 0; // Model direction while dragging (same as setDir after attachTo) (default: 0) }; }; ``` @@ -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