mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Dragging - Improve code (#9271)
* Code cleanup * Moved keybinds to initKeybinds.sqf * Update addons/dragging/initKeybinds.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/dragging/functions/fnc_carryObject.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Update addons/dragging/functions/fnc_getWeight.sqf Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com> * Rephrasing and adjustments for dragging --------- Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
parent
f070e3ff30
commit
dbe372cb48
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
class Extended_PreStart_EventHandlers {
|
class Extended_PreStart_EventHandlers {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
|
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
|
||||||
@ -20,34 +19,34 @@ class Extended_PostInit_EventHandlers {
|
|||||||
class Extended_Init_EventHandlers {
|
class Extended_Init_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initPerson));
|
init = QUOTE(_this call FUNC(initPerson));
|
||||||
exclude[] = {"VirtualMan_F"};
|
exclude[] = {"VirtualMan_F"};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class StaticWeapon {
|
class StaticWeapon {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call FUNC(initObject));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Thing {
|
class Thing {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call FUNC(initObject));
|
||||||
exclude[] = {"ModuleEmpty_F", "ThingEffect", "Wreck"};
|
exclude[] = {"ModuleEmpty_F", "ThingEffect", "Wreck"};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class NonStrategic {
|
class NonStrategic {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call FUNC(initObject));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class WeaponHolder {
|
class WeaponHolder {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call FUNC(initObject));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
class Land_Camping_Light_F {
|
class Land_Camping_Light_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call FUNC(initObject));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -55,7 +54,7 @@ class Extended_Init_EventHandlers {
|
|||||||
class Extended_Killed_EventHandlers {
|
class Extended_Killed_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
killed = QUOTE(_this call DFUNC(handleKilled));
|
killed = QUOTE(_this call FUNC(handleKilled));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ class CfgVehicles {
|
|||||||
GVAR(canDrag) = 0;
|
GVAR(canDrag) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ammo boxes
|
// Ammo boxes
|
||||||
class ThingX;
|
class ThingX;
|
||||||
class Items_base_F;
|
class Items_base_F;
|
||||||
class ReammoBox_F: ThingX {
|
class ReammoBox_F: ThingX {
|
||||||
@ -86,7 +86,7 @@ class CfgVehicles {
|
|||||||
GVAR(canCarry) = 0;
|
GVAR(canCarry) = 0;
|
||||||
GVAR(canDrag) = 0;
|
GVAR(canDrag) = 0;
|
||||||
};
|
};
|
||||||
//remove actions from Taru Pods
|
// Remove actions from Taru Pods
|
||||||
class Pod_Heli_Transport_04_base_F: Slingload_base_F {
|
class Pod_Heli_Transport_04_base_F: Slingload_base_F {
|
||||||
GVAR(canCarry) = 0;
|
GVAR(canCarry) = 0;
|
||||||
GVAR(canDrag) = 0;
|
GVAR(canDrag) = 0;
|
||||||
@ -160,7 +160,7 @@ class CfgVehicles {
|
|||||||
GVAR(canDrag) = 0;
|
GVAR(canDrag) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Plastic and metal case
|
// Plastic and metal case
|
||||||
class PlasticCase_01_base_F: Items_base_F {
|
class PlasticCase_01_base_F: Items_base_F {
|
||||||
GVAR(canCarry) = 1;
|
GVAR(canCarry) = 1;
|
||||||
GVAR(carryDirection) = 270;
|
GVAR(carryDirection) = 270;
|
||||||
@ -226,22 +226,22 @@ class CfgVehicles {
|
|||||||
GVAR(canCarry) = 1;
|
GVAR(canCarry) = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// weapons dropped from dead body
|
// Weapons dropped from dead body
|
||||||
class WeaponHolderSimulated: ThingX {
|
class WeaponHolderSimulated: ThingX {
|
||||||
GVAR(canCarry) = 1;
|
GVAR(canCarry) = 1;
|
||||||
GVAR(carryPosition[]) = {0,0.5,1.3};
|
GVAR(carryPosition[]) = {0,0.5,1.3};
|
||||||
GVAR(carryDirection) = 0;
|
GVAR(carryDirection) = 0;
|
||||||
|
|
||||||
// z-position floats from -1.2 to >0
|
// z-position floats from -1.2 to > 0
|
||||||
// it's OK for carrying but odd for dragging
|
// It's OK for carrying but odd for dragging
|
||||||
// needs workaround to drag correctly. Disabled ATM
|
// Needs workaround to drag correctly. Disabled ATM
|
||||||
GVAR(canDrag) = 0;
|
GVAR(canDrag) = 0;
|
||||||
GVAR(dragPosition[]) = {0,1,0};
|
GVAR(dragPosition[]) = {0,1,0};
|
||||||
GVAR(dragDirection) = 0;
|
GVAR(dragDirection) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReammoBox;
|
class ReammoBox;
|
||||||
// dropped weapons/gear
|
// Dropped weapons/gear
|
||||||
class WeaponHolder: ReammoBox {
|
class WeaponHolder: ReammoBox {
|
||||||
GVAR(canCarry) = 1;
|
GVAR(canCarry) = 1;
|
||||||
GVAR(carryPosition[]) = {0,0.5,1};
|
GVAR(carryPosition[]) = {0,0.5,1};
|
||||||
@ -265,7 +265,7 @@ class CfgVehicles {
|
|||||||
class FloatingStructure_F;
|
class FloatingStructure_F;
|
||||||
class Land_Camping_Light_F: FloatingStructure_F {
|
class Land_Camping_Light_F: FloatingStructure_F {
|
||||||
GVAR(canCarry) = 1;
|
GVAR(canCarry) = 1;
|
||||||
// if y < 0.9 player gets damage
|
// If y < 0.9 player gets damaged
|
||||||
GVAR(carryPosition)[] = {0,0.9,1};
|
GVAR(carryPosition)[] = {0,0.9,1};
|
||||||
|
|
||||||
GVAR(canDrag) = 1;
|
GVAR(canDrag) = 1;
|
||||||
@ -288,8 +288,7 @@ class CfgVehicles {
|
|||||||
GVAR(dragPosition)[] = {0,1,0};
|
GVAR(dragPosition)[] = {0,1,0};
|
||||||
};
|
};
|
||||||
|
|
||||||
// some terrain objects
|
// Some terrain objects
|
||||||
|
|
||||||
class Land_CampingTable_F: ThingX {
|
class Land_CampingTable_F: ThingX {
|
||||||
EGVAR(interaction,replaceTerrainObject) = 1;
|
EGVAR(interaction,replaceTerrainObject) = 1;
|
||||||
GVAR(canCarry) = 1;
|
GVAR(canCarry) = 1;
|
||||||
@ -400,8 +399,8 @@ class CfgVehicles {
|
|||||||
GVAR(canDrag) = 1;
|
GVAR(canDrag) = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
// static classes need XEH
|
|
||||||
|
|
||||||
|
// Static classes need XEH
|
||||||
class NonStrategic;
|
class NonStrategic;
|
||||||
class Land_Pallets_F: NonStrategic {
|
class Land_Pallets_F: NonStrategic {
|
||||||
XEH_INHERITED;
|
XEH_INHERITED;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
PREP(canCarry);
|
PREP(canCarry);
|
||||||
PREP(canDrag);
|
PREP(canDrag);
|
||||||
PREP(canDrop);
|
PREP(canDrop);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// by PabstMirror, commy2
|
// by PabstMirror, commy2
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
// Release object on disconnection. Function is identical to killed
|
||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
// 'HandleDisconnect' EH triggers too late
|
// 'HandleDisconnect' EH triggers too late
|
||||||
addMissionEventHandler ["PlayerDisconnected", {
|
addMissionEventHandler ["PlayerDisconnected", {
|
||||||
@ -29,6 +30,7 @@ if (isNil "ACE_maxWeightDrag") then {
|
|||||||
if (isNil "ACE_maxWeightCarry") then {
|
if (isNil "ACE_maxWeightCarry") then {
|
||||||
ACE_maxWeightCarry = 600;
|
ACE_maxWeightCarry = 600;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isNil QGVAR(maxWeightCarryRun)) then {
|
if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||||
GVAR(maxWeightCarryRun) = 50;
|
GVAR(maxWeightCarryRun) = 50;
|
||||||
};
|
};
|
||||||
@ -36,16 +38,16 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
|||||||
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
|
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||||
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
|
["isNotCarrying", {!((_this select 0) getVariable [QGVAR(isCarrying), false])}] call EFUNC(common,addCanInteractWithCondition);
|
||||||
|
|
||||||
// release object on player change. This does work when returning to lobby, but not when hard disconnecting.
|
// Release object on player change. This does work when returning to lobby, but not when hard disconnecting.
|
||||||
["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
|
["unit", LINKFUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
|
||||||
["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler;
|
["vehicle", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call CBA_fnc_addPlayerEventHandler;
|
||||||
["weapon", FUNC(handlePlayerWeaponChanged)] call CBA_fnc_addPlayerEventHandler;
|
["weapon", LINKFUNC(handlePlayerWeaponChanged)] call CBA_fnc_addPlayerEventHandler;
|
||||||
|
|
||||||
// handle waking up dragged unit and falling unconscious while dragging
|
// Handle waking up dragged unit and falling unconscious while dragging
|
||||||
["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler;
|
["ace_unconscious", LINKFUNC(handleUnconscious)] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
// display event handler
|
// Display event handler
|
||||||
["MouseZChanged", {_this select 1 call FUNC(handleScrollWheel)}] call CBA_fnc_addDisplayHandler;
|
["MouseZChanged", {(_this select 1) call FUNC(handleScrollWheel)}] call CBA_fnc_addDisplayHandler;
|
||||||
|
|
||||||
[QGVAR(carryingContainerClosed), {
|
[QGVAR(carryingContainerClosed), {
|
||||||
params ["_container", "_owner"];
|
params ["_container", "_owner"];
|
||||||
@ -57,13 +59,13 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
|||||||
_weight = [_container] call FUNC(getWeight);
|
_weight = [_container] call FUNC(getWeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
// drop the object if overweight
|
// Drop the object if overweight
|
||||||
if (_weight > ACE_maxWeightCarry) exitWith {
|
if (_weight > ACE_maxWeightCarry) exitWith {
|
||||||
[_owner, _container] call FUNC(dropObject_carry);
|
[_owner, _container] call FUNC(dropObject_carry);
|
||||||
};
|
};
|
||||||
private _canRun = [_weight] call FUNC(canRun_carry);
|
private _canRun = [_weight] call FUNC(canRun_carry);
|
||||||
|
|
||||||
// force walking based on weight
|
// Force walking based on weight
|
||||||
[_owner, "forceWalk", QUOTE(ADDON), !_canRun] call EFUNC(common,statusEffect_set);
|
[_owner, "forceWalk", QUOTE(ADDON), !_canRun] call EFUNC(common,statusEffect_set);
|
||||||
[_owner, "blockSprint", QUOTE(ADDON), _canRun] call EFUNC(common,statusEffect_set);
|
[_owner, "blockSprint", QUOTE(ADDON), _canRun] call EFUNC(common,statusEffect_set);
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
@ -78,53 +80,10 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
|||||||
_weight = [_container] call FUNC(getWeight);
|
_weight = [_container] call FUNC(getWeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
// drop the object if overweight
|
// Drop the object if overweight
|
||||||
if (_weight > ACE_maxWeightDrag) exitWith {
|
if (_weight > ACE_maxWeightDrag) exitWith {
|
||||||
[_owner, _container] call FUNC(dropObject);
|
[_owner, _container] call FUNC(dropObject);
|
||||||
};
|
};
|
||||||
}] call CBA_fnc_addEventHandler;
|
}] call CBA_fnc_addEventHandler;
|
||||||
|
|
||||||
//Add Keybind:
|
#include "initKeybinds.sqf"
|
||||||
["ACE3 Common", QGVAR(drag), (localize LSTRING(DragKeybind)), {
|
|
||||||
if (!alive ACE_player) exitWith {false};
|
|
||||||
if !([ACE_player, objNull, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
||||||
|
|
||||||
// If we are drag/carrying something right now then just drop it:
|
|
||||||
if (ACE_player getVariable [QGVAR(isDragging), false]) exitWith {
|
|
||||||
[ACE_player, ACE_player getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
|
||||||
false
|
|
||||||
};
|
|
||||||
if (ACE_player getVariable [QGVAR(isCarrying), false]) exitWith {
|
|
||||||
[ACE_player, ACE_player getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry);
|
|
||||||
false
|
|
||||||
};
|
|
||||||
|
|
||||||
private _cursor = cursorObject;
|
|
||||||
if ((isNull _cursor) || {(_cursor distance ACE_player) > 2.6}) exitWith {false};
|
|
||||||
if (!([ACE_player, _cursor] call FUNC(canDrag))) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player, _cursor] call FUNC(startDrag);
|
|
||||||
false
|
|
||||||
}, {}, [-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND
|
|
||||||
|
|
||||||
["ACE3 Common", QGVAR(carry), (localize LSTRING(CarryKeybind)), {
|
|
||||||
if (!alive ACE_player) exitWith {false};
|
|
||||||
if !([ACE_player, objNull, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
|
||||||
|
|
||||||
// If we are drag/carrying something right now then just drop it:
|
|
||||||
if (ACE_player getVariable [QGVAR(isDragging), false]) exitWith {
|
|
||||||
[ACE_player, ACE_player getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
|
||||||
false
|
|
||||||
};
|
|
||||||
if (ACE_player getVariable [QGVAR(isCarrying), false]) exitWith {
|
|
||||||
[ACE_player, ACE_player getVariable [QGVAR(carriedObject), objNull], true] call FUNC(dropObject_carry);
|
|
||||||
false
|
|
||||||
};
|
|
||||||
|
|
||||||
private _cursor = cursorObject;
|
|
||||||
if ((isNull _cursor) || {(_cursor distance ACE_player) > 2.6}) exitWith {false};
|
|
||||||
if (!([ACE_player, _cursor] call FUNC(canCarry))) exitWith {false};
|
|
||||||
|
|
||||||
[ACE_player, _cursor] call FUNC(startCarry);
|
|
||||||
false
|
|
||||||
}, {}, [-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2, Dystopian
|
* Author: commy2, Dystopian
|
||||||
* Check if unit can carry the object. Doesn't check weight.
|
* Checks if unit can carry the object. Doesn't check weight.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that should do the carrying <OBJECT>
|
* 0: Unit that should do the carrying <OBJECT>
|
||||||
@ -22,19 +22,19 @@ if !(alive _target && {_target getVariable [QGVAR(canCarry), false]} && {isNull
|
|||||||
|
|
||||||
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
|
||||||
//#2644 - Units with injured legs cannot bear the extra weight of carrying an object
|
// #2644 - Units with injured legs cannot bear the extra weight of carrying an object
|
||||||
//The fireman carry animation does not slow down for injured legs, so you could carry and run
|
// The fireman carry animation does not slow down for injured legs, so you could carry and run
|
||||||
if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false};
|
if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false};
|
||||||
|
|
||||||
// Static weapons need to be empty for carrying (ignore UAV AI)
|
// Static weapons need to be empty for carrying (ignore UAV AI)
|
||||||
if (_target isKindOf "StaticWeapon") exitWith {
|
if (_target isKindOf "StaticWeapon") exitWith {
|
||||||
crew _target findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1
|
(crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1
|
||||||
};
|
};
|
||||||
|
|
||||||
// Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues
|
// Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues
|
||||||
if (_target isKindOf "CAManBase") exitWith {
|
if (_target isKindOf "CAManBase") exitWith {
|
||||||
!(alive _target != isAwake _target) &&
|
!(alive _target != isAwake _target) &&
|
||||||
{lifeState _target isEqualTo "INCAPACITATED" ||
|
{lifeState _target == "INCAPACITATED" ||
|
||||||
{_target getHitPointDamage "HitLegs" >= 0.5}}
|
{_target getHitPointDamage "HitLegs" >= 0.5}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2, Dystopian
|
* Author: commy2, Dystopian
|
||||||
* Check if unit can drag the object. Doesn't check weight.
|
* Checks if unit can drag the object. Doesn't check weight.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that should do the dragging <OBJECT>
|
* 0: Unit that should do the dragging <OBJECT>
|
||||||
@ -24,13 +24,13 @@ if !([_unit, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)) exi
|
|||||||
|
|
||||||
// Static weapons need to be empty for dragging (ignore UAV AI)
|
// Static weapons need to be empty for dragging (ignore UAV AI)
|
||||||
if (_target isKindOf "StaticWeapon") exitWith {
|
if (_target isKindOf "StaticWeapon") exitWith {
|
||||||
crew _target findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1
|
(crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1
|
||||||
};
|
};
|
||||||
|
|
||||||
// Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues
|
// Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues
|
||||||
if (_target isKindOf "CAManBase") exitWith {
|
if (_target isKindOf "CAManBase") exitWith {
|
||||||
!(alive _target != isAwake _target) &&
|
!(alive _target != isAwake _target) &&
|
||||||
{lifeState _target isEqualTo "INCAPACITATED" ||
|
{lifeState _target == "INCAPACITATED" ||
|
||||||
{_target getHitPointDamage "HitLegs" >= 0.5}}
|
{_target getHitPointDamage "HitLegs" >= 0.5}}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Check if unit can drop the object.
|
* Checks if unit can drop the dragged object.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that currently drags a object <OBJECT>
|
* 0: Unit that is currently dragging an object <OBJECT>
|
||||||
* 1: Object that is dragged <OBJECT>
|
* 1: Object being dragged <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Can the unit drop the object? <BOOL>
|
* Can the unit drop the object? <BOOL>
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Check if unit can drop the carried object.
|
* Checks if unit can drop the carried object.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that currently carries a object <OBJECT>
|
* 0: Unit that is currently carrying an object <OBJECT>
|
||||||
* 1: Object that is carried <OBJECT>
|
* 1: Object being carried <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Can the unit drop the object? <BOOL>
|
* Can the unit drop the object? <BOOL>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Carry an object.
|
* Handles attaching and setting up a carried object. Called from ace_dragging_fnc_startCarryPFH.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that should do the carrying <OBJECT>
|
* 0: Unit that should do the carrying <OBJECT>
|
||||||
@ -19,56 +19,55 @@
|
|||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
TRACE_2("params",_unit,_target);
|
TRACE_2("params",_unit,_target);
|
||||||
|
|
||||||
// get attachTo offset and direction.
|
// Get attachTo offset and direction
|
||||||
|
|
||||||
private _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
|
private _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]];
|
||||||
private _direction = _target getVariable [QGVAR(carryDirection), 0];
|
private _direction = _target getVariable [QGVAR(carryDirection), 0];
|
||||||
|
|
||||||
// handle objects vs persons
|
// Handle objects vs. persons
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
|
|
||||||
[_unit, "AcinPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
[_unit, "AcinPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||||
[_target, "AinjPfalMstpSnonWnonDf_carried_dead", 2] call EFUNC(common,doAnimation);
|
[_target, "AinjPfalMstpSnonWnonDf_carried_dead", 2] call EFUNC(common,doAnimation);
|
||||||
|
|
||||||
// attach person
|
// Attach person
|
||||||
_target attachTo [_unit, _position, "LeftShoulder"];
|
_target attachTo [_unit, _position, "LeftShoulder"];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Add height offset of model
|
||||||
// add height offset of model
|
private _offset = ((_target modelToWorldVisual [0, 0, 0]) select 2) - ((_unit modelToWorldVisual [0, 0, 0]) select 2);
|
||||||
private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
|
|
||||||
|
|
||||||
_position = _position vectorAdd [0, 0, _offset];
|
_position = _position vectorAdd [0, 0, _offset];
|
||||||
|
|
||||||
// attach object
|
// Attach object
|
||||||
_target attachTo [_unit, _position];
|
_target attachTo [_unit, _position];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent;
|
[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent;
|
||||||
|
|
||||||
_unit setVariable [QGVAR(isCarrying), true, true];
|
_unit setVariable [QGVAR(isCarrying), true, true];
|
||||||
_unit setVariable [QGVAR(carriedObject), _target, true];
|
_unit setVariable [QGVAR(carriedObject), _target, true];
|
||||||
|
|
||||||
// add drop action
|
// Add drop action
|
||||||
_unit setVariable [QGVAR(ReleaseActionID), [
|
_unit setVariable [QGVAR(releaseActionID), [
|
||||||
_unit, "DefaultAction",
|
_unit, "DefaultAction",
|
||||||
{!isNull ((_this select 0) getVariable [QGVAR(carriedObject), objNull])},
|
{!isNull ((_this select 0) getVariable [QGVAR(carriedObject), objNull])},
|
||||||
{[_this select 0, (_this select 0) getVariable [QGVAR(carriedObject), objNull], true] call FUNC(dropObject_carry)}
|
{[_this select 0, (_this select 0) getVariable [QGVAR(carriedObject), objNull], true] call FUNC(dropObject_carry)}
|
||||||
] call EFUNC(common,addActionEventHandler)];
|
] call EFUNC(common,addActionEventHandler)];
|
||||||
|
|
||||||
// add anim changed EH
|
// Add anim changed EH
|
||||||
[_unit, "AnimChanged", FUNC(handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler;
|
[_unit, "AnimChanged", FUNC(handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler;
|
||||||
|
|
||||||
// check everything
|
// Check everything
|
||||||
[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
|
[FUNC(carryObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
// reset current dragging height.
|
// Reset current dragging height
|
||||||
GVAR(currentHeightChange) = 0;
|
GVAR(currentHeightChange) = 0;
|
||||||
|
|
||||||
// prevent UAVs from firing
|
// Prevent UAVs from firing
|
||||||
private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew);
|
private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew);
|
||||||
|
|
||||||
if (_UAVCrew isNotEqualTo []) then {
|
if (_UAVCrew isNotEqualTo []) then {
|
||||||
{_target deleteVehicleCrew _x} count _UAVCrew;
|
{
|
||||||
|
_target deleteVehicleCrew _x;
|
||||||
|
} forEach _UAVCrew;
|
||||||
|
|
||||||
_target setVariable [QGVAR(isUAV), true, true];
|
_target setVariable [QGVAR(isUAV), true, true];
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* PFH for Carry Object
|
* PFH for carrying an object.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: ARGS <ARRAY>
|
* 0: Arguments <ARRAY>
|
||||||
* 0: Unit <OBJECT>
|
* 0.0: Unit <OBJECT>
|
||||||
* 1: Target <OBJECT>
|
* 0.1: Target <OBJECT>
|
||||||
* 2: Start time <NUMBER>
|
* 0.2: Start time <NUMBER>
|
||||||
* 1: PFEH Id <NUMBER>
|
* 1: PFEH Id <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [[player, target], 20] call ace_dragging_fnc_carryObjectPFH;
|
* [[player, cursorTarget, CBA_missionTime], _idPFH] call ace_dragging_fnc_carryObjectPFH;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -28,33 +28,40 @@ _args params ["_unit", "_target", "_startTime"];
|
|||||||
|
|
||||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||||
TRACE_2("carry false",_unit,_target);
|
TRACE_2("carry false",_unit,_target);
|
||||||
|
|
||||||
_unit setVariable [QGVAR(hint), nil];
|
_unit setVariable [QGVAR(hint), nil];
|
||||||
[] call EFUNC(interaction,hideMouseHint);
|
call EFUNC(interaction,hideMouseHint);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
||||||
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
// drop if the crate is destroyed OR target moved away from carrier (weapon disassembled) OR carrier starts limping
|
// Drop if the crate is destroyed OR target moved away from carrier (weapon disassembled) OR carrier starts limping
|
||||||
if !(alive _target && {_unit distance _target <= 10} && {_unit getHitPointDamage "HitLegs" < 0.5}) exitWith {
|
if !(alive _target && {_unit distance _target <= 10} && {_unit getHitPointDamage "HitLegs" < 0.5}) exitWith {
|
||||||
TRACE_2("dead/distance",_unit,_target);
|
TRACE_2("dead/distance",_unit,_target);
|
||||||
|
|
||||||
if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith {
|
if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith {
|
||||||
//attachTo seems to have some kind of network delay and target can return an odd position during the first few frames,
|
// attachTo seems to have some kind of network delay and target can return an odd position during the first few frames,
|
||||||
//so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos)
|
// So wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos)
|
||||||
TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime);
|
TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
[_unit, _target] call FUNC(dropObject_carry);
|
[_unit, _target] call FUNC(dropObject_carry);
|
||||||
|
|
||||||
_unit setVariable [QGVAR(hint), nil];
|
_unit setVariable [QGVAR(hint), nil];
|
||||||
[] call EFUNC(interaction,hideMouseHint);
|
call EFUNC(interaction,hideMouseHint);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
||||||
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mouse hint
|
// Mouse hint
|
||||||
private _hintLMB = localize LSTRING(Drop);
|
private _hintLMB = LLSTRING(Drop);
|
||||||
getCursorObjectParams params ["_cursorObject", "", "_distance"];
|
getCursorObjectParams params ["_cursorObject", "", "_distance"];
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!isNull _cursorObject
|
!isNull _cursorObject &&
|
||||||
&& {_distance < MAX_LOAD_DISTANCE}
|
{_distance < MAX_LOAD_DISTANCE} &&
|
||||||
&& {([_unit, _cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith))}
|
{[_unit, _cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith)} &&
|
||||||
&& {
|
{
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
[_cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat) isNotEqualTo []
|
[_cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat) isNotEqualTo []
|
||||||
} else {
|
} else {
|
||||||
@ -63,15 +70,17 @@ if (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
) then {
|
) then {
|
||||||
_hintLMB = localize ELSTRING(common,loadObject);
|
_hintLMB = LELSTRING(common,loadObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _hintMMB = localize LSTRING(RaiseLowerRotate);
|
private _hintMMB = LLSTRING(RaiseLowerRotate);
|
||||||
|
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
_hintMMB = "";
|
_hintMMB = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
private _hint = [_hintLMB, "", _hintMMB];
|
private _hint = [_hintLMB, "", _hintMMB];
|
||||||
|
|
||||||
if (_hint isNotEqualTo (_unit getVariable [QGVAR(hint), []])) then {
|
if (_hint isNotEqualTo (_unit getVariable [QGVAR(hint), []])) then {
|
||||||
_unit setVariable [QGVAR(hint), _hint];
|
_unit setVariable [QGVAR(hint), _hint];
|
||||||
_hint call EFUNC(interaction,showMouseHint);
|
_hint call EFUNC(interaction,showMouseHint);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2, Malbryn
|
* Author: commy2, Malbryn
|
||||||
* Drag an object. Called from ace_dragging_fnc_startDrag
|
* Handles attaching and setting up a dragged object. Called from ace_dragging_fnc_startDragPFH.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that should do the dragging <OBJECT>
|
* 0: Unit that should do the dragging <OBJECT>
|
||||||
@ -19,20 +19,24 @@
|
|||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
TRACE_2("params",_unit,_target);
|
TRACE_2("params",_unit,_target);
|
||||||
|
|
||||||
// get attachTo offset and direction.
|
// Get attachTo offset and direction.
|
||||||
private _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]];
|
private _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]];
|
||||||
private _direction = _target getVariable [QGVAR(dragDirection), 0];
|
private _direction = _target getVariable [QGVAR(dragDirection), 0];
|
||||||
|
|
||||||
// add height offset of model
|
// Add height offset of model
|
||||||
private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
|
private _offset = ((_target modelToWorldVisual [0, 0, 0]) select 2) - ((_unit modelToWorldVisual [0, 0, 0]) select 2);
|
||||||
|
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
_offset = 0;
|
_offset = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
_position = _position vectorAdd [0, 0, _offset];
|
_position = _position vectorAdd [0, 0, _offset];
|
||||||
|
|
||||||
// attach object
|
// Attach object
|
||||||
TRACE_3("attaching",_position,_offset,_direction);
|
TRACE_3("attaching",_position,_offset,_direction);
|
||||||
|
|
||||||
_target attachTo [_unit, _position];
|
_target attachTo [_unit, _position];
|
||||||
|
|
||||||
[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent;
|
[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent;
|
||||||
|
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
@ -42,17 +46,17 @@ if (_target isKindOf "CAManBase") then {
|
|||||||
_unit setVariable [QGVAR(isDragging), true, true];
|
_unit setVariable [QGVAR(isDragging), true, true];
|
||||||
_unit setVariable [QGVAR(draggedObject), _target, true];
|
_unit setVariable [QGVAR(draggedObject), _target, true];
|
||||||
|
|
||||||
// add drop action
|
// Add drop action
|
||||||
GVAR(unit) = _unit;
|
GVAR(unit) = _unit;
|
||||||
|
|
||||||
GVAR(releaseActionID) = [0xF1, [false, false, false], {
|
GVAR(releaseActionID) = [0xF1, [false, false, false], {
|
||||||
[GVAR(unit), GVAR(unit) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
[GVAR(unit), GVAR(unit) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
||||||
}, "keydown", "", false, 0] call CBA_fnc_addKeyHandler;
|
}, "keydown", "", false, 0] call CBA_fnc_addKeyHandler;
|
||||||
|
|
||||||
// show mouse hint
|
// Show mouse hint
|
||||||
["", localize LSTRING(Drop)] call EFUNC(interaction,showMouseHint);
|
["", LLSTRING(Drop)] call EFUNC(interaction,showMouseHint);
|
||||||
|
|
||||||
// block firing
|
// Block firing
|
||||||
if !(GVAR(dragAndFire)) then {
|
if !(GVAR(dragAndFire)) then {
|
||||||
_unit setVariable [QGVAR(blockFire), [
|
_unit setVariable [QGVAR(blockFire), [
|
||||||
_unit, "DefaultAction",
|
_unit, "DefaultAction",
|
||||||
@ -61,22 +65,25 @@ if !(GVAR(dragAndFire)) then {
|
|||||||
] call EFUNC(common,addActionEventHandler)];
|
] call EFUNC(common,addActionEventHandler)];
|
||||||
};
|
};
|
||||||
|
|
||||||
// add anim changed EH
|
// Add anim changed EH
|
||||||
[_unit, "AnimChanged", FUNC(handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler;
|
[_unit, "AnimChanged", FUNC(handleAnimChanged), [_unit]] call CBA_fnc_addBISEventHandler;
|
||||||
|
|
||||||
// check everything
|
// Check everything
|
||||||
[FUNC(dragObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
|
[FUNC(dragObjectPFH), 0.5, [_unit, _target, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
// reset current dragging height.
|
// Reset current dragging height.
|
||||||
GVAR(currentHeightChange) = 0;
|
GVAR(currentHeightChange) = 0;
|
||||||
|
|
||||||
// prevent UAVs from firing
|
// Prevent UAVs from firing
|
||||||
private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew);
|
private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew);
|
||||||
|
|
||||||
// fixes not being able to move when in combat pace
|
// Fixes not being able to move when in combat pace
|
||||||
[_unit, "forceWalk", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
[_unit, "forceWalk", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
if (_UAVCrew isNotEqualTo []) then {
|
if (_UAVCrew isNotEqualTo []) then {
|
||||||
{_target deleteVehicleCrew _x} count _UAVCrew;
|
{
|
||||||
|
_target deleteVehicleCrew _x;
|
||||||
|
} forEach _UAVCrew;
|
||||||
|
|
||||||
_target setVariable [QGVAR(isUAV), true, true];
|
_target setVariable [QGVAR(isUAV), true, true];
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* PFH for Drag Object
|
* PFH for dragging an object.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: ARGS <ARRAY>
|
* 0: Arguments <ARRAY>
|
||||||
* 0: Unit <OBJECT>
|
* 0.0: Unit <OBJECT>
|
||||||
* 1: Target <OBJECT>
|
* 0.1: Target <OBJECT>
|
||||||
* 2: Start time <NUMBER>
|
* 0.2: Start time <NUMBER>
|
||||||
* 1: PFEH Id <NUMBER>
|
* 1: PFEH Id <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [[player, target], 20] call ace_dragging_fnc_dragObjectPFH;
|
* [[player, cursorTarget, CBA_missionTime], _idPFH] call ace_dragging_fnc_dragObjectPFH;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -28,17 +28,20 @@ _args params ["_unit", "_target", "_startTime"];
|
|||||||
|
|
||||||
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
||||||
TRACE_2("drag false",_unit,_target);
|
TRACE_2("drag false",_unit,_target);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
// drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled))
|
// Drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled))
|
||||||
if (!alive _target || {_unit distance _target > 10}) then {
|
if (!alive _target || {_unit distance _target > 10}) then {
|
||||||
TRACE_2("dead/distance",_unit,_target);
|
TRACE_2("dead/distance",_unit,_target);
|
||||||
|
|
||||||
if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith {
|
if ((_unit distance _target > 10) && {(CBA_missionTime - _startTime) < 1}) exitWith {
|
||||||
//attachTo seems to have some kind of network delay and target can return an odd position during the first few frames,
|
// attachTo seems to have some kind of network delay and target can return an odd position during the first few frames,
|
||||||
//so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos)
|
// So wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos)
|
||||||
TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime);
|
TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
[_unit, _target] call FUNC(dropObject);
|
[_unit, _target] call FUNC(dropObject);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
||||||
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2, Malbryn
|
* Author: commy2, Malbryn
|
||||||
* Drop a dragged object.
|
* Drops a dragged object.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that drags the other object <OBJECT>
|
* 0: Unit that drags the other object <OBJECT>
|
||||||
@ -19,26 +19,26 @@
|
|||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
TRACE_2("params",_unit,_target);
|
TRACE_2("params",_unit,_target);
|
||||||
|
|
||||||
// remove drop action
|
// Remove drop action
|
||||||
[GVAR(releaseActionID), "keydown"] call CBA_fnc_removeKeyHandler;
|
[GVAR(releaseActionID), "keydown"] call CBA_fnc_removeKeyHandler;
|
||||||
|
|
||||||
// stop blocking
|
// Stop blocking
|
||||||
if !(GVAR(dragAndFire)) then {
|
if !(GVAR(dragAndFire)) then {
|
||||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(blockFire), -1]] call EFUNC(common,removeActionEventHandler);
|
[_unit, "DefaultAction", _unit getVariable [QGVAR(blockFire), -1]] call EFUNC(common,removeActionEventHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _inBuilding = [_unit] call FUNC(isObjectOnObject);
|
private _inBuilding = _unit call FUNC(isObjectOnObject);
|
||||||
|
|
||||||
|
// Play release animation
|
||||||
if !(_unit getVariable ["ACE_isUnconscious", false]) then {
|
if !(_unit getVariable ["ACE_isUnconscious", false]) then {
|
||||||
// play release animation
|
|
||||||
[_unit, "released"] call EFUNC(common,doGesture);
|
[_unit, "released"] call EFUNC(common,doGesture);
|
||||||
};
|
};
|
||||||
|
|
||||||
// prevent collision damage
|
// Prevent collision damage
|
||||||
[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent;
|
[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent;
|
||||||
[QEGVAR(common,fixCollision), _target, _target] call CBA_fnc_targetEvent;
|
[QEGVAR(common,fixCollision), _target, _target] call CBA_fnc_targetEvent;
|
||||||
|
|
||||||
// release object
|
// Release object
|
||||||
detach _target;
|
detach _target;
|
||||||
|
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
@ -53,19 +53,19 @@ _unit removeWeapon "ACE_FakePrimaryWeapon";
|
|||||||
|
|
||||||
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
// prevent object from flipping inside buildings
|
// Prevent object from flipping inside buildings
|
||||||
if (_inBuilding) then {
|
if (_inBuilding) then {
|
||||||
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
||||||
TRACE_2("setPos",getPosASL _unit,getPosASL _target);
|
TRACE_2("setPos",getPosASL _unit,getPosASL _target);
|
||||||
};
|
};
|
||||||
|
|
||||||
// hide mouse hint
|
// Hide mouse hint
|
||||||
[] call EFUNC(interaction,hideMouseHint);
|
call EFUNC(interaction,hideMouseHint);
|
||||||
|
|
||||||
_unit setVariable [QGVAR(isDragging), false, true];
|
_unit setVariable [QGVAR(isDragging), false, true];
|
||||||
_unit setVariable [QGVAR(draggedObject), objNull, true];
|
_unit setVariable [QGVAR(draggedObject), objNull, true];
|
||||||
|
|
||||||
// make object accessible for other units
|
// Make object accessible for other units
|
||||||
[objNull, _target, true] call EFUNC(common,claim);
|
[objNull, _target, true] call EFUNC(common,claim);
|
||||||
|
|
||||||
if !(_target isKindOf "CAManBase") then {
|
if !(_target isKindOf "CAManBase") then {
|
||||||
@ -77,17 +77,17 @@ if (_unit getVariable ["ACE_isUnconscious", false]) then {
|
|||||||
[_unit, "unconscious", 2] call EFUNC(common,doAnimation);
|
[_unit, "unconscious", 2] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
|
||||||
// recreate UAV crew
|
// Recreate UAV crew
|
||||||
if (_target getVariable [QGVAR(isUAV), false]) then {
|
if (_target getVariable [QGVAR(isUAV), false]) then {
|
||||||
createVehicleCrew _target;
|
createVehicleCrew _target;
|
||||||
};
|
};
|
||||||
|
|
||||||
// fixes not being able to move when in combat pace
|
// Fixes not being able to move when in combat pace
|
||||||
[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
// reset mass
|
// Reset mass
|
||||||
private _mass = _target getVariable [QGVAR(originalMass), 0];
|
private _mass = _target getVariable [QGVAR(originalMass), 0];
|
||||||
|
|
||||||
if (_mass != 0) then {
|
if (_mass != 0) then {
|
||||||
[QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // force global sync
|
[QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // Force global sync
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Drop a carried object.
|
* Drops a carried object.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that carries the other object <OBJECT>
|
* 0: Unit that carries the other object <OBJECT>
|
||||||
* 1: Carried object to drop <OBJECT>
|
* 1: Carried object to drop <OBJECT>
|
||||||
|
* 2: Try loading object into vehicle <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
@ -19,19 +20,19 @@
|
|||||||
params ["_unit", "_target", ["_tryLoad", false]];
|
params ["_unit", "_target", ["_tryLoad", false]];
|
||||||
TRACE_1("params",_this);
|
TRACE_1("params",_this);
|
||||||
|
|
||||||
// remove drop action
|
// Remove drop action
|
||||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler);
|
[_unit, "DefaultAction", _unit getVariable [QGVAR(releaseActionID), -1]] call EFUNC(common,removeActionEventHandler);
|
||||||
|
|
||||||
private _inBuilding = [_unit] call FUNC(isObjectOnObject);
|
private _inBuilding = _unit call FUNC(isObjectOnObject);
|
||||||
|
|
||||||
// prevent collision damage
|
// Prevent collision damage
|
||||||
[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent;
|
[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent;
|
||||||
[QEGVAR(common,fixCollision), _target, _target] call CBA_fnc_targetEvent;
|
[QEGVAR(common,fixCollision), _target, _target] call CBA_fnc_targetEvent;
|
||||||
|
|
||||||
// release object
|
// Release object
|
||||||
detach _target;
|
detach _target;
|
||||||
|
|
||||||
// fix anim when aborting carrying persons
|
// Fix anim when aborting carrying persons
|
||||||
if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS}) then {
|
if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS}) then {
|
||||||
if (vehicle _unit == _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
if (vehicle _unit == _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||||
[_unit, "", 2] call EFUNC(common,doAnimation);
|
[_unit, "", 2] call EFUNC(common,doAnimation);
|
||||||
@ -44,10 +45,10 @@ if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS})
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// properly remove fake weapon
|
// Properly remove fake weapon
|
||||||
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||||
|
|
||||||
// reselect weapon and re-enable sprint
|
// Reselect weapon and re-enable sprint
|
||||||
private _previousWeaponIndex = _unit getVariable [QGVAR(previousWeapon), -1];
|
private _previousWeaponIndex = _unit getVariable [QGVAR(previousWeapon), -1];
|
||||||
_unit setVariable [QGVAR(previousWeapon), nil, true];
|
_unit setVariable [QGVAR(previousWeapon), nil, true];
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ if (_previousWeaponIndex != -1) then {
|
|||||||
[_unit, "blockSprint", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
[_unit, "blockSprint", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
||||||
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
// prevent object from flipping inside buildings
|
// Prevent object from flipping inside buildings
|
||||||
if (_inBuilding) then {
|
if (_inBuilding) then {
|
||||||
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
||||||
};
|
};
|
||||||
@ -67,7 +68,7 @@ if (_inBuilding) then {
|
|||||||
_unit setVariable [QGVAR(isCarrying), false, true];
|
_unit setVariable [QGVAR(isCarrying), false, true];
|
||||||
_unit setVariable [QGVAR(carriedObject), objNull, true];
|
_unit setVariable [QGVAR(carriedObject), objNull, true];
|
||||||
|
|
||||||
// make object accesable for other units
|
// Make object accessible for other units
|
||||||
[objNull, _target, true] call EFUNC(common,claim);
|
[objNull, _target, true] call EFUNC(common,claim);
|
||||||
|
|
||||||
if !(_target isKindOf "CAManBase") then {
|
if !(_target isKindOf "CAManBase") then {
|
||||||
@ -75,38 +76,41 @@ if !(_target isKindOf "CAManBase") then {
|
|||||||
[QEGVAR(common,fixFloating), _target, _target] call CBA_fnc_targetEvent;
|
[QEGVAR(common,fixFloating), _target, _target] call CBA_fnc_targetEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
// recreate UAV crew
|
// Recreate UAV crew
|
||||||
if (_target getVariable [QGVAR(isUAV), false]) then {
|
if (_target getVariable [QGVAR(isUAV), false]) then {
|
||||||
createVehicleCrew _target;
|
createVehicleCrew _target;
|
||||||
};
|
};
|
||||||
|
|
||||||
// reset mass
|
// Reset mass
|
||||||
private _mass = _target getVariable [QGVAR(originalMass), 0];
|
private _mass = _target getVariable [QGVAR(originalMass), 0];
|
||||||
|
|
||||||
if (_mass != 0) then {
|
if (_mass != 0) then {
|
||||||
[QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // force global sync
|
[QEGVAR(common,setMass), [_target, _mass]] call CBA_fnc_globalEvent; // Force global sync
|
||||||
};
|
};
|
||||||
|
|
||||||
// reset temp direction
|
// Reset temp direction
|
||||||
_target setVariable [QGVAR(carryDirection_temp), nil];
|
_target setVariable [QGVAR(carryDirection_temp), nil];
|
||||||
|
|
||||||
// try loading into vehicle
|
private _cursorObject = cursorObject;
|
||||||
if (_tryLoad && {!isNull cursorObject} && {([ACE_player, cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith))}) then {
|
|
||||||
|
// Try loading into vehicle
|
||||||
|
if (_tryLoad && {!isNull _cursorObject} && {[_unit, _cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith)}) then {
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
private _vehicles = [cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat);
|
private _vehicles = [_cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat);
|
||||||
if ([cursorObject] isEqualTo _vehicles) then {
|
|
||||||
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
|
if ([_cursorObject] isEqualTo _vehicles) then {
|
||||||
[_unit, _target, cursorObject] call EFUNC(medical_treatment,loadUnit);
|
if (["ace_medical"] call EFUNC(common,isModLoaded)) then {
|
||||||
|
[_unit, _target, _cursorObject] call EFUNC(medical_treatment,loadUnit);
|
||||||
} else {
|
} else {
|
||||||
[_unit, _target, cursorObject] call EFUNC(common,loadPerson);
|
[_unit, _target, _cursorObject] call EFUNC(common,loadPerson);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
["ace_cargo"] call EFUNC(common,isModLoaded) &&
|
["ace_cargo"] call EFUNC(common,isModLoaded) &&
|
||||||
{[_target, cursorObject] call EFUNC(cargo,canLoadItemIn)}
|
{[_target, _cursorObject] call EFUNC(cargo,canLoadItemIn)}
|
||||||
) then {
|
) then {
|
||||||
[player, _target, cursorObject] call EFUNC(cargo,startLoadIn);
|
[_unit, _target, _cursorObject] call EFUNC(cargo,startLoadIn);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* Weight <NUMBER>
|
* Weight <NUMBER>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [_object] call ace_dragging_fnc_getWeight
|
* [cursorTarget] call ace_dragging_fnc_getWeight
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -36,4 +36,4 @@ if !(GVAR(skipContainerWeight)) then {
|
|||||||
|
|
||||||
// Mass in Arma isn't an exact amount but rather a volume/weight value
|
// Mass in Arma isn't an exact amount but rather a volume/weight value
|
||||||
// This attempts to work around that by making it a usable value (sort of)
|
// This attempts to work around that by making it a usable value (sort of)
|
||||||
_weight * 0.5;
|
_weight * 0.5 // return
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Handle the animaion for a Unit for Dragging Module
|
* Handle the animation for a unit for the dragging module.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
* 1: animaion <STRING>
|
* 1: Animaion <STRING>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [_unit, "amovpercmstpsnonwnondnon"] call ace_dragging_fnc_handleAnimChanged;
|
* [player, "amovpercmstpsnonwnondnon"] call ace_dragging_fnc_handleAnimChanged;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//IGNORE_PRIVATE_WARNING ["_thisArgs", "_thisID"]; // From CBA_fnc_addBISEventHandler;
|
|
||||||
|
|
||||||
params ["_unit", "_anim"];
|
params ["_unit", "_anim"];
|
||||||
_thisArgs params ["_realUnit"];
|
_thisArgs params ["_realUnit"];
|
||||||
TRACE_4("params",_unit,_anim,_realUnit,_thisID);
|
TRACE_4("params",_unit,_anim,_realUnit,_thisID);
|
||||||
@ -28,8 +26,7 @@ if (_unit != _realUnit) exitWith {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||||
|
// Drop dragged object when not in valid animation
|
||||||
// drop dragged object when not in valid animation
|
|
||||||
if (!(_anim in DRAG_ANIMATIONS) && {!(_unit call EFUNC(common,isSwimming))}) then {
|
if (!(_anim in DRAG_ANIMATIONS) && {!(_unit call EFUNC(common,isSwimming))}) then {
|
||||||
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||||
|
|
||||||
@ -39,10 +36,8 @@ if (_unit getVariable [QGVAR(isDragging), false]) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
||||||
|
// Drop carried object when not standing; also some exceptions when picking up crate
|
||||||
// drop carried object when not standing; also some exceptions when picking up crate
|
|
||||||
if (stance _unit != "STAND" && {_anim != "amovpercmstpsnonwnondnon"}) then {
|
if (stance _unit != "STAND" && {_anim != "amovpercmstpsnonwnondnon"}) then {
|
||||||
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Handle death of the dragger
|
* Handle death of the dragger/carrier.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
@ -10,7 +10,7 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [_unit] call ace_dragging_fnc_handleKilled;
|
* [player] call ace_dragging_fnc_handleKilled;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Handle player changes.
|
* Handles player changes.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: New Player Unit <OBJECT>
|
* 0: New Player Unit <OBJECT>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Handle the Weapon Changed Event
|
* Handles the weapon changed event.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [_unit, "gun"] call ace_dragging_fnc_handlePlayerWeaponChanged;
|
* [player, primaryWeapon player] call ace_dragging_fnc_handlePlayerWeaponChanged;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -20,32 +20,25 @@ params ["_unit", "_weapon"];
|
|||||||
TRACE_2("params",_unit,_weapon);
|
TRACE_2("params",_unit,_weapon);
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||||
|
// Drop dragged object when changing weapon
|
||||||
// drop dragged object when changing weapon
|
|
||||||
if (_weapon != _unit getVariable [QGVAR(currentWeapon), ""]) then {
|
if (_weapon != _unit getVariable [QGVAR(currentWeapon), ""]) then {
|
||||||
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||||
|
|
||||||
[_unit, _draggedObject] call FUNC(dropObject);
|
[_unit, _draggedObject] call FUNC(dropObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
||||||
|
|
||||||
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||||
|
|
||||||
if (_carriedObject isKindOf "CAManBase") then {
|
if (_carriedObject isKindOf "CAManBase") then {
|
||||||
|
|
||||||
if (_weapon != primaryWeapon _unit) then {
|
if (_weapon != primaryWeapon _unit) then {
|
||||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||||
};
|
};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Drop carried object when selecting any weapon
|
||||||
// drop carried object when selecting any weapon
|
|
||||||
if (_weapon != "") then {
|
if (_weapon != "") then {
|
||||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -24,13 +24,12 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false};
|
|||||||
|
|
||||||
private _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull];
|
private _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||||
|
|
||||||
//disabled for persons
|
// Disabled for persons
|
||||||
if (_carriedItem isKindOf "CAManBase") exitWith {false};
|
if (_carriedItem isKindOf "CAManBase") exitWith {false};
|
||||||
|
|
||||||
if !(cba_events_control) then {
|
if !(CBA_events_control) then {
|
||||||
// raise/lower
|
// Raise/lower
|
||||||
|
// Move carried item 15 cm per scroll interval
|
||||||
// move carried item 15 cm per scroll interval
|
|
||||||
_scrollAmount = _scrollAmount * 0.15;
|
_scrollAmount = _scrollAmount * 0.15;
|
||||||
|
|
||||||
private _position = getPosASL _carriedItem;
|
private _position = getPosASL _carriedItem;
|
||||||
@ -38,7 +37,7 @@ if !(cba_events_control) then {
|
|||||||
|
|
||||||
_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];
|
_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];
|
||||||
|
|
||||||
// move up/down object and reattach at current position
|
// Move up/down object and reattach at current position
|
||||||
detach _carriedItem;
|
detach _carriedItem;
|
||||||
|
|
||||||
// Uses this method of selecting position because setPosATL did not have immediate effect
|
// Uses this method of selecting position because setPosATL did not have immediate effect
|
||||||
@ -47,15 +46,15 @@ if !(cba_events_control) then {
|
|||||||
_selectionPosition = _selectionPosition vectorAdd _positionChange;
|
_selectionPosition = _selectionPosition vectorAdd _positionChange;
|
||||||
_carriedItem attachTo [_unit, _selectionPosition];
|
_carriedItem attachTo [_unit, _selectionPosition];
|
||||||
|
|
||||||
//reset the carry direction
|
// Reset the carry direction
|
||||||
private _direction = _carriedItem getVariable [QGVAR(carryDirection_temp), _carriedItem getVariable [QGVAR(carryDirection), 0]];
|
private _direction = _carriedItem getVariable [QGVAR(carryDirection_temp), _carriedItem getVariable [QGVAR(carryDirection), 0]];
|
||||||
[QEGVAR(common,setDir), [_carriedItem, _direction], _carriedItem] call CBA_fnc_targetEvent;
|
[QEGVAR(common,setDir), [_carriedItem, _direction], _carriedItem] call CBA_fnc_targetEvent;
|
||||||
} else {
|
} else {
|
||||||
// rotate
|
// Rotate
|
||||||
|
|
||||||
private _direction = _carriedItem getVariable [QGVAR(carryDirection_temp), _carriedItem getVariable [QGVAR(carryDirection), 0]];
|
private _direction = _carriedItem getVariable [QGVAR(carryDirection_temp), _carriedItem getVariable [QGVAR(carryDirection), 0]];
|
||||||
_scrollAmount = _scrollAmount * 10;
|
_scrollAmount = _scrollAmount * 10;
|
||||||
_direction = _direction + _scrollAmount;
|
_direction = _direction + _scrollAmount;
|
||||||
|
|
||||||
[QEGVAR(common,setDir), [_carriedItem, _direction], _carriedItem] call CBA_fnc_targetEvent;
|
[QEGVAR(common,setDir), [_carriedItem, _direction], _carriedItem] call CBA_fnc_targetEvent;
|
||||||
_carriedItem setVariable [QGVAR(carryDirection_temp), _direction];
|
_carriedItem setVariable [QGVAR(carryDirection_temp), _direction];
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Handle the Unconscious of a Unit while Dragging
|
* Handles consciousness change of a unit while dragging / carrying.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
@ -10,7 +10,7 @@
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [_unit] call ace_dragging_fnc_handleUnconscious;
|
* [player] call ace_dragging_fnc_handleUnconscious;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -20,30 +20,28 @@ params ["_unit"];
|
|||||||
private _player = ACE_player;
|
private _player = ACE_player;
|
||||||
|
|
||||||
if (_player getVariable [QGVAR(isDragging), false]) then {
|
if (_player getVariable [QGVAR(isDragging), false]) then {
|
||||||
|
|
||||||
private _draggedObject = _player getVariable [QGVAR(draggedObject), objNull];
|
private _draggedObject = _player getVariable [QGVAR(draggedObject), objNull];
|
||||||
|
|
||||||
// handle falling unconscious
|
// Handle falling unconscious
|
||||||
if (_unit == _player) then {
|
if (_unit == _player) then {
|
||||||
[_unit, _draggedObject] call FUNC(dropObject);
|
[_unit, _draggedObject] call FUNC(dropObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
// handle waking up dragged unit
|
// Handle waking up dragged unit
|
||||||
if (_unit == _draggedObject) then {
|
if (_unit == _draggedObject) then {
|
||||||
[_player, _draggedObject] call FUNC(dropObject);
|
[_player, _draggedObject] call FUNC(dropObject);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_player getVariable [QGVAR(isCarrying), false]) then {
|
if (_player getVariable [QGVAR(isCarrying), false]) then {
|
||||||
|
|
||||||
private _carriedObject = _player getVariable [QGVAR(carriedObject), objNull];
|
private _carriedObject = _player getVariable [QGVAR(carriedObject), objNull];
|
||||||
|
|
||||||
// handle falling unconscious
|
// Handle falling unconscious
|
||||||
if (_unit == _player) then {
|
if (_unit == _player) then {
|
||||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||||
};
|
};
|
||||||
|
|
||||||
// handle waking up dragged unit
|
// Handle waking up dragged unit
|
||||||
if (_unit == _carriedObject) then {
|
if (_unit == _carriedObject) then {
|
||||||
[_player, _carriedObject] call FUNC(dropObject_carry);
|
[_player, _carriedObject] call FUNC(dropObject_carry);
|
||||||
};
|
};
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Initialize variables for drag or carryable objects. Called from init EH.
|
* Initializes variables for draggable / carryable objects. Called from init EH.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Any object <OBJECT>
|
* 0: Object <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [box] call ace_dragging_fnc_initObject;
|
* [cursorTarget] call ace_dragging_fnc_initObject;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Initialize variables for drag or carryable persons. Called from init EH.
|
* Initialize variables for draggable / carryable persons. Called from init EH.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
@ -17,5 +17,5 @@
|
|||||||
|
|
||||||
params ["_unit"];
|
params ["_unit"];
|
||||||
|
|
||||||
[_unit, true, [0,1.1,0.092], 180] call FUNC(setDraggable);
|
[_unit, true, [0, 1.1, 0.092], 180] call FUNC(setDraggable);
|
||||||
[_unit, true, [0.4,-0.1,-1.25], 195] call FUNC(setCarryable); // hard-coded selection: "LeftShoulder"
|
[_unit, true, [0.4, -0.1, -1.25], 195] call FUNC(setCarryable); // Hard-coded selection: "LeftShoulder"
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Check if Object is Overlapping
|
* Checks if an object is overlapping another object.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Object <OBJECT>
|
* 0: Object <OBJECT>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Boolean <BOOL>
|
* If object is overlapping another <BOOL>
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [player] call ace_dragging_fnc_isObjectOnObject
|
* [player] call ace_dragging_fnc_isObjectOnObject;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
@ -1,46 +1,45 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2, PiZZADOX
|
* Author: commy2, PiZZADOX
|
||||||
* Enable the object to be carried.
|
* Enables the object to be carried.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Any object <OBJECT>
|
* 0: Object <OBJECT>
|
||||||
* 1: true to enable carrying, false to disable <BOOL>
|
* 1: True to enable carrying, false to disable <BOOL>
|
||||||
* 2: Position offset for attachTo command <ARRAY> (default: [0,1,1])
|
* 2: Position offset for attachTo command <ARRAY> (default: [0, 1, 1])
|
||||||
* 3: Direction in degree to rotate the object after attachTo <NUMBER> (default: 0)
|
* 3: Direction in degrees to rotate the object after attachTo <NUMBER> (default: 0)
|
||||||
* 4: Override weight limit (optional; default: false) <BOOL>
|
* 4: Override weight limit <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [object, true, [0,1,1], 0, false] call ace_dragging_fnc_setCarryable;
|
* [cursorTarget, true, [0, 1, 1], 0, false] call ace_dragging_fnc_setCarryable;
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//IGNORE_PRIVATE_WARNING ["_player", "_target"];
|
|
||||||
params ["_object", "_enableCarry", "_position", "_direction", ["_ignoreWeightCarry", false, [false]]];
|
params ["_object", "_enableCarry", "_position", "_direction", ["_ignoreWeightCarry", false, [false]]];
|
||||||
|
|
||||||
if (isNil "_position") then {
|
if (isNil "_position") then {
|
||||||
_position = _object getVariable [QGVAR(carryPosition), [0,1,1]];
|
_position = _object getVariable [QGVAR(carryPosition), [0, 1, 1]];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isNil "_direction") then {
|
if (isNil "_direction") then {
|
||||||
_direction = _object getVariable [QGVAR(carryDirection), 0];
|
_direction = _object getVariable [QGVAR(carryDirection), 0];
|
||||||
};
|
};
|
||||||
|
|
||||||
// update variables
|
// Update variables
|
||||||
_object setVariable [QGVAR(canCarry), _enableCarry];
|
_object setVariable [QGVAR(canCarry), _enableCarry];
|
||||||
_object setVariable [QGVAR(carryPosition), _position];
|
_object setVariable [QGVAR(carryPosition), _position];
|
||||||
_object setVariable [QGVAR(carryDirection), _direction];
|
_object setVariable [QGVAR(carryDirection), _direction];
|
||||||
_object setVariable [QGVAR(ignoreWeightCarry), _ignoreWeightCarry];
|
_object setVariable [QGVAR(ignoreWeightCarry), _ignoreWeightCarry];
|
||||||
|
|
||||||
// add action to class if it is not already present
|
// Add action to class if it is not already present
|
||||||
private _type = typeOf _object;
|
private _type = typeOf _object;
|
||||||
private _initializedClasses = GETGVAR(initializedClasses_carry,[]);
|
private _initializedClasses = GETGVAR(initializedClasses_carry,[]);
|
||||||
|
|
||||||
// do nothing if the class is already initialized
|
// Do nothing if the class is already initialized
|
||||||
if (_type in _initializedClasses) exitWith {};
|
if (_type in _initializedClasses) exitWith {};
|
||||||
|
|
||||||
_initializedClasses pushBack _type;
|
_initializedClasses pushBack _type;
|
||||||
@ -57,8 +56,8 @@ GVAR(initializedClasses_carry) = _initializedClasses;
|
|||||||
|
|
||||||
private _icon = [QUOTE(PATHTOF(UI\icons\box_carry.paa)), QUOTE(PATHTOF(UI\icons\person_carry.paa))] select (_object isKindOf "Man");
|
private _icon = [QUOTE(PATHTOF(UI\icons\box_carry.paa)), QUOTE(PATHTOF(UI\icons\person_carry.paa))] select (_object isKindOf "Man");
|
||||||
|
|
||||||
private _carryAction = [QGVAR(carry), localize LSTRING(Carry), _icon, {[_player, _target] call FUNC(startCarry)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction);
|
private _carryAction = [QGVAR(carry), LLSTRING(Carry), _icon, {[_player, _target] call FUNC(startCarry)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction);
|
||||||
private _dropAction = [QGVAR(drop_carry), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction);
|
private _dropAction = [QGVAR(drop_carry), LLSTRING(Drop), "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction);
|
||||||
|
|
||||||
[_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass);
|
[_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
@ -1,25 +1,24 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2, PiZZADOX
|
* Author: commy2, PiZZADOX
|
||||||
* Enable the object to be dragged.
|
* Enables the object to be dragged.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Any object <OBJECT>
|
* 0: 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, 1.5, 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 degrees to rotate the object after attachTo (optional; default: 0) <NUMBER>
|
||||||
* 4: Override weight limit (optional; default: false) <BOOL>
|
* 4: Override weight limit <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [object, true, [0,0,0], 0, false] call ace_dragging_fnc_setDraggable;
|
* [cursorTarget, true, [0, 0, 0], 0, false] call ace_dragging_fnc_setDraggable;
|
||||||
*
|
*
|
||||||
* Public: Yes
|
* Public: Yes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//IGNORE_PRIVATE_WARNING ["_player", "_target"];
|
|
||||||
params ["_object", "_enableDrag", "_position", "_direction", ["_ignoreWeightDrag", false, [false]]];
|
params ["_object", "_enableDrag", "_position", "_direction", ["_ignoreWeightDrag", false, [false]]];
|
||||||
|
|
||||||
if (isNil "_position") then {
|
if (isNil "_position") then {
|
||||||
@ -30,17 +29,17 @@ if (isNil "_direction") then {
|
|||||||
_direction = _object getVariable [QGVAR(dragDirection), 0];
|
_direction = _object getVariable [QGVAR(dragDirection), 0];
|
||||||
};
|
};
|
||||||
|
|
||||||
// update variables
|
// Update variables
|
||||||
_object setVariable [QGVAR(canDrag), _enableDrag];
|
_object setVariable [QGVAR(canDrag), _enableDrag];
|
||||||
_object setVariable [QGVAR(dragPosition), _position];
|
_object setVariable [QGVAR(dragPosition), _position];
|
||||||
_object setVariable [QGVAR(dragDirection), _direction];
|
_object setVariable [QGVAR(dragDirection), _direction];
|
||||||
_object setVariable [QGVAR(ignoreWeightDrag), _ignoreWeightDrag];
|
_object setVariable [QGVAR(ignoreWeightDrag), _ignoreWeightDrag];
|
||||||
|
|
||||||
// add action to class if it is not already present
|
// Add action to class if it is not already present
|
||||||
private _type = typeOf _object;
|
private _type = typeOf _object;
|
||||||
private _initializedClasses = GETGVAR(initializedClasses,[]);
|
private _initializedClasses = GETGVAR(initializedClasses,[]);
|
||||||
|
|
||||||
// do nothing if the class is already initialized
|
// Do nothing if the class is already initialized
|
||||||
if (_type in _initializedClasses) exitWith {};
|
if (_type in _initializedClasses) exitWith {};
|
||||||
|
|
||||||
_initializedClasses pushBack _type;
|
_initializedClasses pushBack _type;
|
||||||
@ -58,8 +57,8 @@ GVAR(initializedClasses) = _initializedClasses;
|
|||||||
|
|
||||||
private _icon = [QUOTE(PATHTOF(UI\icons\box_drag.paa)), QUOTE(PATHTOF(UI\icons\person_drag.paa))] select (_object isKindOf "Man");
|
private _icon = [QUOTE(PATHTOF(UI\icons\box_drag.paa)), QUOTE(PATHTOF(UI\icons\person_drag.paa))] select (_object isKindOf "Man");
|
||||||
|
|
||||||
private _dragAction = [QGVAR(drag), localize LSTRING(Drag), _icon, {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}] call EFUNC(interact_menu,createAction);
|
private _dragAction = [QGVAR(drag), LLSTRING(Drag), _icon, {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}] call EFUNC(interact_menu,createAction);
|
||||||
private _dropAction = [QGVAR(drop), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction);
|
private _dropAction = [QGVAR(drop), LLSTRING(Drop), "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction);
|
||||||
|
|
||||||
[_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass);
|
[_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
[_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2, PiZZADOX
|
* Author: commy2, PiZZADOX
|
||||||
* Start the carrying process.
|
* Starts the carrying process.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that should do the carrying <OBJECT>
|
* 0: Unit that should do the carrying <OBJECT>
|
||||||
@ -19,72 +19,74 @@
|
|||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
TRACE_2("params",_unit,_target);
|
TRACE_2("params",_unit,_target);
|
||||||
|
|
||||||
private _weight = [_target] call FUNC(getWeight);
|
// Exempt from weight check if object has override variable set
|
||||||
|
|
||||||
// exempt from weight check if object has override variable set
|
|
||||||
private _weight = 0;
|
private _weight = 0;
|
||||||
|
|
||||||
if !(_target getVariable [QGVAR(ignoreWeightCarry), false]) then {
|
if !(_target getVariable [QGVAR(ignoreWeightCarry), false]) then {
|
||||||
_weight = [_target] call FUNC(getWeight);
|
_weight = _target call FUNC(getWeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
// exit if object weight is over global var value
|
// Exit if object weight is over global var value
|
||||||
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
|
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
|
||||||
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
[LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
|
|
||||||
private _timer = CBA_missionTime + 5;
|
private _timer = CBA_missionTime + 5;
|
||||||
|
|
||||||
// handle objects vs persons
|
// Handle objects vs. persons
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
|
private _primaryWeapon = primaryWeapon _unit;
|
||||||
|
|
||||||
// add a primary weapon if the unit has none.
|
// Add a primary weapon if the unit has none
|
||||||
if (primaryWeapon _unit isEqualto "") then {
|
if (_primaryWeapon == "") then {
|
||||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||||
|
_primaryWeapon = "ACE_FakePrimaryWeapon";
|
||||||
};
|
};
|
||||||
|
|
||||||
// select primary, otherwise the drag animation actions don't work.
|
// Select primary, otherwise the drag animation actions don't work
|
||||||
_unit selectWeapon primaryWeapon _unit;
|
_unit selectWeapon _primaryWeapon;
|
||||||
|
|
||||||
// move a bit closer and adjust direction when trying to pick up a person
|
// Move a bit closer and adjust direction when trying to pick up a person
|
||||||
_target setDir (getDir _unit + 180);
|
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
||||||
_target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit));
|
_target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit));
|
||||||
|
|
||||||
[_unit, "AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
[_unit, "AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||||
[_target, "AinjPfalMstpSnonWrflDnon_carried_Up", 2] call EFUNC(common,doAnimation);
|
[_target, "AinjPfalMstpSnonWrflDnon_carried_Up", 2] call EFUNC(common,doAnimation);
|
||||||
|
|
||||||
_timer = CBA_missionTime + 10;
|
_timer = CBA_missionTime + 10;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// select no weapon and stop sprinting
|
// Select no weapon and stop sprinting
|
||||||
private _previousWeaponIndex = [_unit] call EFUNC(common,getFiremodeIndex);
|
private _previousWeaponIndex = [_unit] call EFUNC(common,getFiremodeIndex);
|
||||||
_unit setVariable [QGVAR(previousWeapon), _previousWeaponIndex, true];
|
_unit setVariable [QGVAR(previousWeapon), _previousWeaponIndex, true];
|
||||||
|
|
||||||
_unit action ["SwitchWeapon", _unit, _unit, 299];
|
_unit action ["SwitchWeapon", _unit, _unit, 299];
|
||||||
|
|
||||||
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);
|
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);
|
||||||
|
|
||||||
private _canRun = [_weight] call FUNC(canRun_carry);
|
private _canRun = _weight call FUNC(canRun_carry);
|
||||||
// only force walking if we're overweight
|
|
||||||
|
// Only force walking if we're overweight
|
||||||
[_unit, "forceWalk", QUOTE(ADDON), !_canRun] call EFUNC(common,statusEffect_set);
|
[_unit, "forceWalk", QUOTE(ADDON), !_canRun] call EFUNC(common,statusEffect_set);
|
||||||
[_unit, "blockSprint", QUOTE(ADDON), _canRun] call EFUNC(common,statusEffect_set);
|
[_unit, "blockSprint", QUOTE(ADDON), _canRun] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
// prevent multiple players from accessing the same object
|
// Prevent multiple players from accessing the same object
|
||||||
[_unit, _target, true] call EFUNC(common,claim);
|
[_unit, _target, true] call EFUNC(common,claim);
|
||||||
|
|
||||||
// prevents draging and carrying at the same time
|
// Prevents dragging and carrying at the same time
|
||||||
_unit setVariable [QGVAR(isCarrying), true, true];
|
_unit setVariable [QGVAR(isCarrying), true, true];
|
||||||
|
|
||||||
// required for aborting animation
|
// Required for aborting animation
|
||||||
_unit setVariable [QGVAR(carriedObject), _target, true];
|
_unit setVariable [QGVAR(carriedObject), _target, true];
|
||||||
|
|
||||||
[FUNC(startCarryPFH), 0.2, [_unit, _target, _timer]] call CBA_fnc_addPerFrameHandler;
|
[FUNC(startCarryPFH), 0.2, [_unit, _target, _timer]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
// disable collisions by setting the physx mass to almost zero
|
// Disable collisions by setting the PhysX mass to almost zero
|
||||||
private _mass = getMass _target;
|
private _mass = getMass _target;
|
||||||
|
|
||||||
if (_mass > 1) then {
|
if (_mass > 1) then {
|
||||||
_target setVariable [QGVAR(originalMass), _mass, true];
|
_target setVariable [QGVAR(originalMass), _mass, true];
|
||||||
[QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // force global sync
|
[QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Carry PFH
|
* Checks for carrying conditions. If these are met, the unit will start carrying. Called from ace_dragging_fnc_startCarry.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: ARGS <ARRAY>
|
* 0: Arguments <ARRAY>
|
||||||
* 0: Unit <OBJECT>
|
* 0.0: Unit <OBJECT>
|
||||||
* 1: Target <OBJECT>
|
* 0.1: Target <OBJECT>
|
||||||
* 2: Timeout <NUMBER>
|
* 0.2: Timeout <NUMBER>
|
||||||
* 1: PFEH Id <NUMBER>
|
* 1: PFEH Id <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [[player, target, 100], 20] call ace_dragging_fnc_startCarryPFH;
|
* [[player, cursorTarget, 10], _idPFH] call ace_dragging_fnc_startCarryPFH;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -26,42 +26,44 @@
|
|||||||
params ["_args", "_idPFH"];
|
params ["_args", "_idPFH"];
|
||||||
_args params ["_unit", "_target", "_timeOut"];
|
_args params ["_unit", "_target", "_timeOut"];
|
||||||
|
|
||||||
// handle aborting carry
|
// Handle aborting carry
|
||||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||||
TRACE_4("carry false",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("carry false",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
// same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled))
|
// Same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled))
|
||||||
if (!alive _target || {_unit distance _target > 10}) then {
|
if (!alive _target || {_unit distance _target > 10}) then {
|
||||||
TRACE_4("dead/distance",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("dead/distance",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_unit, _target] call FUNC(dropObject_carry);
|
[_unit, _target] call FUNC(dropObject_carry);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
||||||
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
// handle persons vs objects
|
// Handle persons vs. objects
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
|
// Drop if in timeout
|
||||||
if (CBA_missionTime > _timeOut) exitWith {
|
if (CBA_missionTime > _timeOut) exitWith {
|
||||||
TRACE_4("Start carry person",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("Start carry person",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_unit, _target] call FUNC(carryObject);
|
[_unit, _target] call FUNC(carryObject);
|
||||||
|
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
// Drop if in timeout
|
||||||
if (CBA_missionTime > _timeOut) exitWith {
|
if (CBA_missionTime > _timeOut) exitWith {
|
||||||
TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
|
|
||||||
// drop if in timeout
|
|
||||||
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||||
[_unit, _draggedObject] call FUNC(dropObject_carry);
|
[_unit, _draggedObject] call FUNC(dropObject_carry);
|
||||||
};
|
};
|
||||||
|
|
||||||
// wait for the unit to stand up
|
// Wait for the unit to stand up
|
||||||
if (stance _unit isEqualto "STAND") exitWith {
|
if (stance _unit == "STAND") exitWith {
|
||||||
TRACE_4("Start carry object",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("Start carry object",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_unit, _target] call FUNC(carryObject);
|
[_unit, _target] call FUNC(carryObject);
|
||||||
|
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2, PiZZADOX, Malbryn
|
* Author: commy2, PiZZADOX, Malbryn
|
||||||
* Start the dragging process.
|
* Starts the dragging process.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that should do the dragging <OBJECT>
|
* 0: Unit that should do the dragging <OBJECT>
|
||||||
@ -19,38 +19,43 @@
|
|||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
TRACE_2("params",_unit,_target);
|
TRACE_2("params",_unit,_target);
|
||||||
|
|
||||||
// exempt from weight check if object has override variable set
|
// Exempt from weight check if object has override variable set
|
||||||
private _weight = 0;
|
private _weight = 0;
|
||||||
|
|
||||||
if !(_target getVariable [QGVAR(ignoreWeightDrag), false]) then {
|
if !(_target getVariable [QGVAR(ignoreWeightDrag), false]) then {
|
||||||
_weight = [_target] call FUNC(getWeight);
|
_weight = _target call FUNC(getWeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
// exit if object weight is over global var value
|
// Exit if object weight is over global var value
|
||||||
if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith {
|
if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith {
|
||||||
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
[LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private _primaryWeapon = primaryWeapon _unit;
|
||||||
|
|
||||||
// Add a primary weapon if the unit has none
|
// Add a primary weapon if the unit has none
|
||||||
if !(GVAR(dragAndFire)) then {
|
if !(GVAR(dragAndFire)) then {
|
||||||
if (primaryWeapon _unit isEqualto "") then {
|
if (_primaryWeapon == "") then {
|
||||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||||
_unit selectWeapon primaryWeapon _unit;
|
_primaryWeapon = "ACE_FakePrimaryWeapon";
|
||||||
} else {
|
|
||||||
_unit selectWeapon primaryWeapon _unit;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_unit selectWeapon _primaryWeapon;
|
||||||
} else { // Making sure the unit is holding a primary weapon or handgun
|
} else { // Making sure the unit is holding a primary weapon or handgun
|
||||||
if !(currentWeapon _unit in [primaryWeapon _unit, handgunWeapon _unit]) then {
|
private _handgunWeapon = handgunWeapon _unit;
|
||||||
if (primaryWeapon _unit != "") then {
|
|
||||||
|
if !(currentWeapon _unit in [_primaryWeapon, _handgunWeapon]) then {
|
||||||
|
if (_primaryWeapon != "") then {
|
||||||
// Use primary if possible
|
// Use primary if possible
|
||||||
_unit selectWeapon primaryWeapon _unit;
|
_unit selectWeapon _primaryWeapon;
|
||||||
} else {
|
} else {
|
||||||
if (handgunWeapon _unit != "") then {
|
if (_handgunWeapon != "") then {
|
||||||
// Use pistol if unit has no primary
|
// Use pistol if unit has no primary
|
||||||
_unit selectWeapon handgunWeapon _unit;
|
_unit selectWeapon _handgunWeapon;
|
||||||
} else {
|
} else {
|
||||||
// Add fake weapon if no weapons besides launcher are available
|
// Add fake weapon if no weapons besides launcher are available
|
||||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||||
_unit selectWeapon primaryWeapon _unit;
|
_unit selectWeapon "ACE_FakePrimaryWeapon";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -61,10 +66,10 @@ _unit setVariable [QGVAR(currentWeapon), currentWeapon _unit];
|
|||||||
|
|
||||||
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set);
|
||||||
|
|
||||||
// prevent multiple players from accessing the same object
|
// Prevent multiple players from accessing the same object
|
||||||
[_unit, _target, true] call EFUNC(common,claim);
|
[_unit, _target, true] call EFUNC(common,claim);
|
||||||
|
|
||||||
// can't play action that depends on weapon if it was added the same frame
|
// Can't play action that depends on weapon if it was added the same frame
|
||||||
if !(_unit call EFUNC(common,isSwimming)) then {
|
if !(_unit call EFUNC(common,isSwimming)) then {
|
||||||
[{
|
[{
|
||||||
private _unitWeapon = _this getVariable [QGVAR(currentWeapon), ""];
|
private _unitWeapon = _this getVariable [QGVAR(currentWeapon), ""];
|
||||||
@ -77,23 +82,23 @@ if !(_unit call EFUNC(common,isSwimming)) then {
|
|||||||
}, _unit] call CBA_fnc_execNextFrame;
|
}, _unit] call CBA_fnc_execNextFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
// move a bit closer and adjust direction when trying to pick up a person
|
// Move a bit closer and adjust direction when trying to pick up a person
|
||||||
if (_target isKindOf "CAManBase") then {
|
if (_target isKindOf "CAManBase") then {
|
||||||
_target setDir (getDir _unit + 180);
|
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
||||||
_target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit vectorMultiply 1.5));
|
_target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit vectorMultiply 1.5));
|
||||||
|
|
||||||
[_target, "AinjPpneMrunSnonWnonDb_grab", 2] call EFUNC(common,doAnimation);
|
[_target, "AinjPpneMrunSnonWnonDb_grab", 2] call EFUNC(common,doAnimation);
|
||||||
};
|
};
|
||||||
|
|
||||||
// prevents draging and carrying at the same time
|
// Prevents dragging and carrying at the same time
|
||||||
_unit setVariable [QGVAR(isDragging), true, true];
|
_unit setVariable [QGVAR(isDragging), true, true];
|
||||||
|
|
||||||
[FUNC(startDragPFH), 0.2, [_unit, _target, CBA_missionTime + 5]] call CBA_fnc_addPerFrameHandler;
|
[FUNC(startDragPFH), 0.2, [_unit, _target, CBA_missionTime + 5]] call CBA_fnc_addPerFrameHandler;
|
||||||
|
|
||||||
// disable collisions by setting the physx mass to almost zero
|
// Disable collisions by setting the physx mass to almost zero
|
||||||
private _mass = getMass _target;
|
private _mass = getMass _target;
|
||||||
|
|
||||||
if (_mass > 1) then {
|
if (_mass > 1) then {
|
||||||
_target setVariable [QGVAR(originalMass), _mass, true];
|
_target setVariable [QGVAR(originalMass), _mass, true];
|
||||||
[QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // force global sync
|
[QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
* Drag PFH
|
* Checks for dragging conditions. If these are met, the unit will start dragging. Called from ace_dragging_fnc_startDrag.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: ARGS <ARRAY>
|
* 0: Arguments <ARRAY>
|
||||||
* 0: Unit <OBJECT>
|
* 0.0: Unit <OBJECT>
|
||||||
* 1: Target <OBJECT>
|
* 0.1: Target <OBJECT>
|
||||||
* 2: Timeout <NUMBER>
|
* 0.2: Timeout <NUMBER>
|
||||||
* 1: PFEH Id <NUMBER>
|
* 1: PFEH Id <NUMBER>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [[player, target, 100], 20] call ace_dragging_fnc_startDragPFH;
|
* [[player, cursorTarget, 10], _idPFH] call ace_dragging_fnc_startDragPFH;
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
@ -26,33 +26,34 @@
|
|||||||
params ["_args", "_idPFH"];
|
params ["_args", "_idPFH"];
|
||||||
_args params ["_unit", "_target", "_timeOut"];
|
_args params ["_unit", "_target", "_timeOut"];
|
||||||
|
|
||||||
// handle aborting drag
|
// Handle aborting drag
|
||||||
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
||||||
TRACE_4("drag false",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("drag false",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
// same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled))
|
// Same as dragObjectPFH, checks if object is deleted, dead or target moved away from carrier (e.g. weapon disassembled)
|
||||||
if (!alive _target || {_unit distance _target > 10}) then {
|
if (!alive _target || {_unit distance _target > 10}) then {
|
||||||
TRACE_4("dead/distance",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("dead/distance",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_unit, _target] call FUNC(dropObject);
|
[_unit, _target] call FUNC(dropObject);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
|
||||||
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
// timeout. Do nothing. Quit. CBA_missionTime, because anim length is linked to ingame time.
|
// Timeout: Do nothing, quit. CBA_missionTime, because anim length is linked to ingame time
|
||||||
if (CBA_missionTime > _timeOut) exitWith {
|
if (CBA_missionTime > _timeOut) exitWith {
|
||||||
TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("timeout",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
|
|
||||||
// drop if in timeout
|
// Drop if in timeout
|
||||||
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||||
[_unit, _draggedObject] call FUNC(dropObject);
|
[_unit, _draggedObject] call FUNC(dropObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
// unit is ready to start dragging
|
// Unit is ready to start dragging
|
||||||
if (animationState _unit in DRAG_ANIMATIONS || {_unit call EFUNC(common,isSwimming)}) exitWith {
|
if (animationState _unit in DRAG_ANIMATIONS || {_unit call EFUNC(common,isSwimming)}) exitWith {
|
||||||
TRACE_4("Start Dragging",_unit,_target,_timeOut,CBA_missionTime);
|
TRACE_4("Start Dragging",_unit,_target,_timeOut,CBA_missionTime);
|
||||||
[_unit, _target] call FUNC(dragObject);
|
[_unit, _target] call FUNC(dragObject);
|
||||||
|
|
||||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||||
};
|
};
|
||||||
|
58
addons/dragging/initKeybinds.sqf
Normal file
58
addons/dragging/initKeybinds.sqf
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// Add Keybinds
|
||||||
|
["ACE3 Common", QGVAR(drag), LLSTRING(DragKeybind), {
|
||||||
|
private _player = ACE_player;
|
||||||
|
|
||||||
|
if (!alive _player) exitWith {false};
|
||||||
|
if !([_player, objNull, ["isNotDragging", "isNotCarrying", "isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
|
||||||
|
// If we are drag/carrying something right now then just drop it:
|
||||||
|
if (_player getVariable [QGVAR(isDragging), false]) exitWith {
|
||||||
|
[_player, _player getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
||||||
|
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_player getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||||
|
[_player, _player getVariable [QGVAR(carriedObject), objNull]] call FUNC(dropObject_carry);
|
||||||
|
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
private _cursorObject = cursorObject;
|
||||||
|
|
||||||
|
if (isNull _cursorObject || {(_cursorObject distance _player) > 2.6}) exitWith {false};
|
||||||
|
if !([_player, _cursorObject] call FUNC(canDrag)) exitWith {false};
|
||||||
|
|
||||||
|
[_player, _cursorObject] call FUNC(startDrag);
|
||||||
|
|
||||||
|
false
|
||||||
|
}, {}, [-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND
|
||||||
|
|
||||||
|
["ACE3 Common", QGVAR(carry), LLSTRING(CarryKeybind), {
|
||||||
|
private _player = ACE_player;
|
||||||
|
|
||||||
|
if (!alive _player) exitWith {false};
|
||||||
|
if !([_player, objNull, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||||
|
|
||||||
|
// If we are drag/carrying something right now then just drop it:
|
||||||
|
if (_player getVariable [QGVAR(isDragging), false]) exitWith {
|
||||||
|
[_player, _player getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
||||||
|
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
if (_player getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||||
|
[_player, _player getVariable [QGVAR(carriedObject), objNull], true] call FUNC(dropObject_carry);
|
||||||
|
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
private _cursorObject = cursorObject;
|
||||||
|
|
||||||
|
if (isNull _cursorObject || {(_cursorObject distance _player) > 2.6}) exitWith {false};
|
||||||
|
if !([_player, _cursorObject] call FUNC(canCarry)) exitWith {false};
|
||||||
|
|
||||||
|
[_player, _cursorObject] call FUNC(startCarry);
|
||||||
|
|
||||||
|
false
|
||||||
|
}, {}, [-1, [false, false, false]]] call CBA_fnc_addKeybind; // UNBOUND
|
@ -2,9 +2,8 @@
|
|||||||
QGVAR(dragAndFire),
|
QGVAR(dragAndFire),
|
||||||
"CHECKBOX",
|
"CHECKBOX",
|
||||||
[LSTRING(DragAndFire_DisplayName), LSTRING(DragAndFire_Description)],
|
[LSTRING(DragAndFire_DisplayName), LSTRING(DragAndFire_Description)],
|
||||||
localize LSTRING(SettingsName),
|
LLSTRING(SettingsName),
|
||||||
true,
|
true
|
||||||
false
|
|
||||||
] call CBA_fnc_addSetting;
|
] call CBA_fnc_addSetting;
|
||||||
|
|
||||||
[
|
[
|
||||||
|
Loading…
Reference in New Issue
Block a user