Dragging - Add more objects configs (#8104)

Co-authored-by: jonpas <jonpas33@gmail.com>
This commit is contained in:
Dystopian 2021-07-23 17:11:57 +03:00 committed by GitHub
parent c81f371f5d
commit ad41bf2c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 134 additions and 63 deletions

View File

@ -29,12 +29,13 @@ class Extended_Init_EventHandlers {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
}; };
}; };
class ThingX { class Thing {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
exclude[] = {"ModuleEmpty_F", "ThingEffect", "Wreck"};
}; };
}; };
class Land_PortableLight_single_F { class NonStrategic {
class ADDON { class ADDON {
init = QUOTE(_this call DFUNC(initObject)); init = QUOTE(_this call DFUNC(initObject));
}; };

View File

@ -1,3 +1,4 @@
#define XEH_INHERITED class EventHandlers {class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};}
class CBA_Extended_EventHandlers; class CBA_Extended_EventHandlers;
@ -7,11 +8,9 @@ class CfgVehicles {
class StaticWeapon: LandVehicle { class StaticWeapon: LandVehicle {
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1.2,0}; GVAR(carryPosition)[] = {0,1.2,0};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1.2,0}; GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
}; };
class StaticCannon: StaticWeapon { class StaticCannon: StaticWeapon {
@ -23,11 +22,9 @@ class CfgVehicles {
class Mortar_01_base_F: StaticMortar { class Mortar_01_base_F: StaticMortar {
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1.2,0}; GVAR(carryPosition)[] = {0,1.2,0};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1.2,0}; GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
}; };
// Big 1.70 and 1.84 Autonomous AA Turrets // Big 1.70 and 1.84 Autonomous AA Turrets
@ -74,12 +71,9 @@ class CfgVehicles {
class Items_base_F; class Items_base_F;
class ReammoBox_F: ThingX { class ReammoBox_F: ThingX {
GVAR(canCarry) = 0; GVAR(canCarry) = 0;
GVAR(carryPosition)[] = {0,1,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 0; GVAR(canDrag) = 0;
GVAR(dragPosition)[] = {0,1.2,0}; GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
}; };
class Slingload_base_F: ReammoBox_F { class Slingload_base_F: ReammoBox_F {
@ -162,43 +156,27 @@ class CfgVehicles {
//Plastic and metal case //Plastic and metal case
class PlasticCase_01_base_F: Items_base_F { class PlasticCase_01_base_F: Items_base_F {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 270; GVAR(carryDirection) = 270;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0}; GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 270; GVAR(dragDirection) = 270;
}; };
class MetalCase_01_base_F: Items_base_F { class MetalCase_01_base_F: Items_base_F {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 270; GVAR(carryDirection) = 270;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.2,0}; GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
}; };
// Barrier // Barrier
class RoadCone_F: ThingX { class RoadCone_F: ThingX {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,1.2,0}; GVAR(dragPosition)[] = {0,1.2,0};
GVAR(dragDirection) = 0;
}; };
class RoadBarrier_F: RoadCone_F { class RoadBarrier_F: RoadCone_F {
@ -208,59 +186,37 @@ class CfgVehicles {
// Misc crates // Misc crates
class Constructions_base_F; class Constructions_base_F;
class Land_WoodenBox_F: Constructions_base_F { class Land_WoodenBox_F: Constructions_base_F {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.4,0}; GVAR(dragPosition)[] = {0,1.4,0};
GVAR(dragDirection) = 0;
}; };
class Land_WoodenCrate_01_F: ThingX { class Land_WoodenCrate_01_F: ThingX {
class EventHandlers {
class CBA_Extended_EventHandlers: CBA_Extended_EventHandlers {};
};
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 270; GVAR(carryDirection) = 270;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.5,0};
GVAR(dragDirection) = 90; GVAR(dragDirection) = 90;
}; };
class Land_PaperBox_01_small_closed_base_F: Items_base_F { class Land_PaperBox_01_small_closed_base_F: Items_base_F {
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.5,0};
GVAR(dragDirection) = 90; GVAR(dragDirection) = 90;
}; };
class Box_UAV_06_base_F: Items_base_F { class Box_UAV_06_base_F: Items_base_F {
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition[]) = {0,1,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition[]) = {0,1.5,0};
GVAR(dragDirection) = 0;
}; };
class ACE_RepairItem_Base: ThingX {}; class ACE_RepairItem_Base: ThingX {};
class ACE_Track: ACE_RepairItem_Base { class ACE_Track: ACE_RepairItem_Base {
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,1};
GVAR(carryDirection) = 0;
}; };
class ACE_Wheel: ACE_RepairItem_Base { class ACE_Wheel: ACE_RepairItem_Base {
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,1,1};
GVAR(carryDirection) = 0;
}; };
class Lamps_base_F; class Lamps_base_F;
@ -278,19 +234,133 @@ class CfgVehicles {
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
// if y < 0.9 player gets damage // if y < 0.9 player gets damage
GVAR(carryPosition)[] = {0,0.9,1}; GVAR(carryPosition)[] = {0,0.9,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,0.7,0}; GVAR(dragPosition)[] = {0,0.7,0};
GVAR(dragDirection) = 0;
}; };
class Land_Camping_Light_off_F: ThingX { class Land_Camping_Light_off_F: ThingX {
GVAR(canCarry) = 1; GVAR(canCarry) = 1;
GVAR(carryPosition)[] = {0,0.9,1}; GVAR(carryPosition)[] = {0,0.9,1};
GVAR(carryDirection) = 0;
GVAR(canDrag) = 1; GVAR(canDrag) = 1;
GVAR(dragPosition)[] = {0,0.7,0}; 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};
}; };
}; };

View File

@ -20,14 +20,14 @@ params ["_object"];
private _config = configOf _object; private _config = configOf _object;
if (getNumber (_config >> QGVAR(canDrag)) == 1) then { 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)); private _direction = getNumber (_config >> QGVAR(dragDirection));
[_object, true, _position, _direction] call FUNC(setDraggable); [_object, true, _position, _direction] call FUNC(setDraggable);
}; };
if (getNumber (_config >> QGVAR(canCarry)) == 1) then { 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)); private _direction = getNumber (_config >> QGVAR(carryDirection));
[_object, true, _position, _direction] call FUNC(setCarryable); [_object, true, _position, _direction] call FUNC(setCarryable);

View File

@ -6,7 +6,7 @@
* Arguments: * Arguments:
* 0: Any object <OBJECT> * 0: Any object <OBJECT>
* 1: true to enable dragging, false to disable <BOOL> * 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> * 3: Direction in degree to rotate the object after attachTo (optional; default: 0) <NUMBER>
* 4: Override weight limit (optional; default: false) <BOOL> * 4: Override weight limit (optional; default: false) <BOOL>
* *
@ -23,7 +23,7 @@
params ["_object", "_enableDrag", "_position", "_direction", ["_ignoreWeightDrag", false, [false]]]; params ["_object", "_enableDrag", "_position", "_direction", ["_ignoreWeightDrag", false, [false]]];
if (isNil "_position") then { 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 { if (isNil "_direction") then {

View File

@ -19,13 +19,13 @@ class CfgVehicles {
class MyVehicle { class MyVehicle {
// Dragging // Dragging
ace_dragging_canDrag = 1; // Can be dragged (0-no, 1-yes) 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_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) ace_dragging_dragDirection = 0; // Model direction while dragging (same as setDir after attachTo) (default: 0)
// Carrying // Carrying
ace_dragging_canCarry = 1; // Can be carried (0-no, 1-yes) 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_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) 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 0 | Any object | Object | Required
1 | Enable dragging, true to enable, false to disable | Boolean | 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`) 3 | Direction in degree to rotate the object | Number | Optional (default: `0`)
**R** | None | None | Return value **R** | None | None | Return value