mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge branch 'master' into corpse-carry-continued2
This commit is contained in:
commit
d40346d202
@ -1,4 +1,3 @@
|
||||
|
||||
class Extended_PreStart_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE(call COMPILE_SCRIPT(XEH_preStart));
|
||||
@ -20,34 +19,34 @@ class Extended_PostInit_EventHandlers {
|
||||
class Extended_Init_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initPerson));
|
||||
init = QUOTE(_this call FUNC(initPerson));
|
||||
exclude[] = {"VirtualMan_F"};
|
||||
};
|
||||
};
|
||||
class StaticWeapon {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
init = QUOTE(_this call FUNC(initObject));
|
||||
};
|
||||
};
|
||||
class Thing {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
init = QUOTE(_this call FUNC(initObject));
|
||||
exclude[] = {"ModuleEmpty_F", "ThingEffect", "Wreck"};
|
||||
};
|
||||
};
|
||||
class NonStrategic {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
init = QUOTE(_this call FUNC(initObject));
|
||||
};
|
||||
};
|
||||
class WeaponHolder {
|
||||
class ADDON {
|
||||
init = QUOTE(_this call DFUNC(initObject));
|
||||
init = QUOTE(_this call FUNC(initObject));
|
||||
};
|
||||
};
|
||||
class Land_Camping_Light_F {
|
||||
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 CAManBase {
|
||||
class ADDON {
|
||||
killed = QUOTE(_this call DFUNC(handleKilled));
|
||||
killed = QUOTE(_this call FUNC(handleKilled));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -75,7 +75,7 @@ class CfgVehicles {
|
||||
GVAR(canDrag) = 0;
|
||||
};
|
||||
|
||||
// ammo boxes
|
||||
// Ammo boxes
|
||||
class ThingX;
|
||||
class Items_base_F;
|
||||
class ReammoBox_F: ThingX {
|
||||
@ -89,7 +89,7 @@ class CfgVehicles {
|
||||
GVAR(canCarry) = 0;
|
||||
GVAR(canDrag) = 0;
|
||||
};
|
||||
//remove actions from Taru Pods
|
||||
// Remove actions from Taru Pods
|
||||
class Pod_Heli_Transport_04_base_F: Slingload_base_F {
|
||||
GVAR(canCarry) = 0;
|
||||
GVAR(canDrag) = 0;
|
||||
@ -163,7 +163,7 @@ class CfgVehicles {
|
||||
GVAR(canDrag) = 0;
|
||||
};
|
||||
|
||||
//Plastic and metal case
|
||||
// Plastic and metal case
|
||||
class PlasticCase_01_base_F: Items_base_F {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(carryDirection) = 270;
|
||||
@ -229,22 +229,22 @@ class CfgVehicles {
|
||||
GVAR(canCarry) = 1;
|
||||
};
|
||||
|
||||
// weapons dropped from dead body
|
||||
// Weapons dropped from dead body
|
||||
class WeaponHolderSimulated: ThingX {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(carryPosition[]) = {0,0.5,1.3};
|
||||
GVAR(carryDirection) = 0;
|
||||
|
||||
// z-position floats from -1.2 to >0
|
||||
// it's OK for carrying but odd for dragging
|
||||
// needs workaround to drag correctly. Disabled ATM
|
||||
// z-position floats from -1.2 to > 0
|
||||
// It's OK for carrying but odd for dragging
|
||||
// Needs workaround to drag correctly. Disabled ATM
|
||||
GVAR(canDrag) = 0;
|
||||
GVAR(dragPosition[]) = {0,1,0};
|
||||
GVAR(dragDirection) = 0;
|
||||
};
|
||||
|
||||
class ReammoBox;
|
||||
// dropped weapons/gear
|
||||
// Dropped weapons/gear
|
||||
class WeaponHolder: ReammoBox {
|
||||
GVAR(canCarry) = 1;
|
||||
GVAR(carryPosition[]) = {0,0.5,1};
|
||||
@ -268,7 +268,7 @@ class CfgVehicles {
|
||||
class FloatingStructure_F;
|
||||
class Land_Camping_Light_F: FloatingStructure_F {
|
||||
GVAR(canCarry) = 1;
|
||||
// if y < 0.9 player gets damage
|
||||
// If y < 0.9 player gets damaged
|
||||
GVAR(carryPosition)[] = {0,0.9,1};
|
||||
|
||||
GVAR(canDrag) = 1;
|
||||
@ -291,8 +291,7 @@ class CfgVehicles {
|
||||
GVAR(dragPosition)[] = {0,1,0};
|
||||
};
|
||||
|
||||
// some terrain objects
|
||||
|
||||
// Some terrain objects
|
||||
class Land_CampingTable_F: ThingX {
|
||||
EGVAR(interaction,replaceTerrainObject) = 1;
|
||||
GVAR(canCarry) = 1;
|
||||
@ -403,8 +402,8 @@ class CfgVehicles {
|
||||
GVAR(canDrag) = 1;
|
||||
};
|
||||
|
||||
// static classes need XEH
|
||||
|
||||
// Static classes need XEH
|
||||
class NonStrategic;
|
||||
class Land_Pallets_F: NonStrategic {
|
||||
XEH_INHERITED;
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
PREP(canCarry);
|
||||
PREP(canDrag);
|
||||
PREP(canDrop);
|
||||
|
@ -1,6 +1,7 @@
|
||||
// by PabstMirror, commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Release object on disconnection. Function is identical to killed
|
||||
if (isServer) then {
|
||||
// 'HandleDisconnect' EH triggers too late
|
||||
addMissionEventHandler ["PlayerDisconnected", {
|
||||
@ -8,6 +9,16 @@ if (isServer) then {
|
||||
|
||||
_unit call FUNC(handleKilled);
|
||||
}];
|
||||
|
||||
// Handle surrending and handcuffing
|
||||
["ace_captiveStatusChanged", {
|
||||
params ["_unit", "_state"];
|
||||
|
||||
// If surrended or handcuffed, drop dragged/carried object
|
||||
if (_state) then {
|
||||
_unit call FUNC(handleKilled);
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
if (!hasInterface) exitWith {};
|
||||
@ -19,6 +30,7 @@ if (isNil "ACE_maxWeightDrag") then {
|
||||
if (isNil "ACE_maxWeightCarry") then {
|
||||
ACE_maxWeightCarry = 600;
|
||||
};
|
||||
|
||||
if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||
GVAR(maxWeightCarryRun) = 50;
|
||||
};
|
||||
@ -31,13 +43,13 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||
["isNotDragging", {!((_this select 0) getVariable [QGVAR(isDragging), 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.
|
||||
["unit", FUNC(handlePlayerChanged)] call CBA_fnc_addPlayerEventHandler;
|
||||
// Release object on player change. This does work when returning to lobby, but not when hard disconnecting.
|
||||
["unit", LINKFUNC(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
|
||||
["ace_unconscious", {_this call FUNC(handleUnconscious)}] call CBA_fnc_addEventHandler;
|
||||
// Handle waking up dragged unit and falling unconscious while dragging
|
||||
["ace_unconscious", LINKFUNC(handleUnconscious)] call CBA_fnc_addEventHandler;
|
||||
|
||||
// Handle local effect commands for clones
|
||||
[QGVAR(cloneCreated), {
|
||||
@ -47,8 +59,8 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||
_clone setMimic "unconscious";
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// display event handler
|
||||
["MouseZChanged", {_this select 1 call FUNC(handleScrollWheel)}] call CBA_fnc_addDisplayHandler;
|
||||
// Display event handler
|
||||
["MouseZChanged", {(_this select 1) call FUNC(handleScrollWheel)}] call CBA_fnc_addDisplayHandler;
|
||||
|
||||
[QGVAR(carryingContainerClosed), {
|
||||
params ["_container", "_owner"];
|
||||
@ -60,13 +72,13 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||
_weight = [_container] call FUNC(getWeight);
|
||||
};
|
||||
|
||||
// drop the object if overweight
|
||||
// Drop the object if overweight
|
||||
if (_weight > ACE_maxWeightCarry) exitWith {
|
||||
[_owner, _container] call FUNC(dropObject_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, "blockSprint", QUOTE(ADDON), _canRun] call EFUNC(common,statusEffect_set);
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
@ -81,55 +93,10 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||
_weight = [_container] call FUNC(getWeight);
|
||||
};
|
||||
|
||||
// drop the object if overweight
|
||||
// Drop the object if overweight
|
||||
if (_weight > ACE_maxWeightDrag) exitWith {
|
||||
[_owner, _container] call FUNC(dropObject);
|
||||
};
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
//@todo Captivity?
|
||||
|
||||
//Add Keybind:
|
||||
["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
|
||||
#include "initKeybinds.sqf"
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* 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:
|
||||
* 0: Unit that should do the carrying <OBJECT>
|
||||
@ -22,19 +22,19 @@ if !((alive _target || {_target isKindOf "CAManBase"}) && {_target getVariable [
|
||||
|
||||
if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
|
||||
//#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
|
||||
// #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
|
||||
if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false};
|
||||
|
||||
// Static weapons need to be empty for carrying (ignore UAV AI)
|
||||
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
|
||||
if (_target isKindOf "CAManBase") exitWith {
|
||||
!(alive _target != isAwake _target) &&
|
||||
{lifeState _target isEqualTo "INCAPACITATED" ||
|
||||
{lifeState _target == "INCAPACITATED" ||
|
||||
{_target getHitPointDamage "HitLegs" >= 0.5} ||
|
||||
{(animationState _target) in ["", "unconscious", "deadstate"]}}
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* 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:
|
||||
* 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)
|
||||
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
|
||||
if (_target isKindOf "CAManBase") exitWith {
|
||||
!(alive _target != isAwake _target) &&
|
||||
{lifeState _target isEqualTo "INCAPACITATED" ||
|
||||
{lifeState _target == "INCAPACITATED" ||
|
||||
{_target getHitPointDamage "HitLegs" >= 0.5} ||
|
||||
{(animationState _target) in ["", "unconscious", "deadstate"]}}
|
||||
};
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Check if unit can drop the object.
|
||||
* Checks if unit can drop the dragged object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that currently drags a object <OBJECT>
|
||||
* 1: Object that is dragged <OBJECT>
|
||||
* 0: Unit that is currently dragging an object <OBJECT>
|
||||
* 1: Object being dragged <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can the unit drop the object? <BOOL>
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Check if unit can drop the carried object.
|
||||
* Checks if unit can drop the carried object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that currently carries a object <OBJECT>
|
||||
* 1: Object that is carried <OBJECT>
|
||||
* 0: Unit that is currently carrying an object <OBJECT>
|
||||
* 1: Object being carried <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Can the unit drop the object? <BOOL>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Carry an object.
|
||||
* Handles attaching and setting up a carried object. Called from ace_dragging_fnc_startCarryPFH.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that should do the carrying <OBJECT>
|
||||
@ -19,56 +19,55 @@
|
||||
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 _direction = _target getVariable [QGVAR(carryDirection), 0];
|
||||
|
||||
// handle objects vs persons
|
||||
// Handle objects vs. persons
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
|
||||
[_unit, "AcinPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
[_target, "AinjPfalMstpSnonWnonDf_carried_dead", 2] call EFUNC(common,doAnimation);
|
||||
|
||||
// attach person
|
||||
// Attach person
|
||||
_target attachTo [_unit, _position, "LeftShoulder"];
|
||||
|
||||
} else {
|
||||
|
||||
// add height offset of model
|
||||
private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
|
||||
// Add height offset of model
|
||||
private _offset = ((_target modelToWorldVisual [0, 0, 0]) select 2) - ((_unit modelToWorldVisual [0, 0, 0]) select 2);
|
||||
|
||||
_position = _position vectorAdd [0, 0, _offset];
|
||||
|
||||
// attach object
|
||||
// Attach object
|
||||
_target attachTo [_unit, _position];
|
||||
|
||||
};
|
||||
|
||||
[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent;
|
||||
|
||||
_unit setVariable [QGVAR(isCarrying), true, true];
|
||||
_unit setVariable [QGVAR(carriedObject), _target, true];
|
||||
|
||||
// add drop action
|
||||
_unit setVariable [QGVAR(ReleaseActionID), [
|
||||
// Add drop action
|
||||
_unit setVariable [QGVAR(releaseActionID), [
|
||||
_unit, "DefaultAction",
|
||||
{!isNull ((_this select 0) getVariable [QGVAR(carriedObject), objNull])},
|
||||
{[_this select 0, (_this select 0) getVariable [QGVAR(carriedObject), objNull], true] call FUNC(dropObject_carry)}
|
||||
] call EFUNC(common,addActionEventHandler)];
|
||||
|
||||
// add anim changed EH
|
||||
// Add anim changed EH
|
||||
[_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;
|
||||
|
||||
// reset current dragging height.
|
||||
// Reset current dragging height
|
||||
GVAR(currentHeightChange) = 0;
|
||||
|
||||
// prevent UAVs from firing
|
||||
// Prevent UAVs from firing
|
||||
private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew);
|
||||
|
||||
if (_UAVCrew isNotEqualTo []) then {
|
||||
{_target deleteVehicleCrew _x} count _UAVCrew;
|
||||
{
|
||||
_target deleteVehicleCrew _x;
|
||||
} forEach _UAVCrew;
|
||||
|
||||
_target setVariable [QGVAR(isUAV), true, true];
|
||||
};
|
||||
|
@ -1,20 +1,20 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* PFH for Carry Object
|
||||
* PFH for carrying an object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ARGS <ARRAY>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Start time <NUMBER>
|
||||
* 0: Arguments <ARRAY>
|
||||
* 0.0: Unit <OBJECT>
|
||||
* 0.1: Target <OBJECT>
|
||||
* 0.2: Start time <NUMBER>
|
||||
* 1: PFEH Id <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[player, target], 20] call ace_dragging_fnc_carryObjectPFH;
|
||||
* [[player, cursorTarget, CBA_missionTime], _idPFH] call ace_dragging_fnc_carryObjectPFH;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -28,33 +28,40 @@ _args params ["_unit", "_target", "_startTime"];
|
||||
|
||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||
TRACE_2("carry false",_unit,_target);
|
||||
|
||||
_unit setVariable [QGVAR(hint), nil];
|
||||
[] call EFUNC(interaction,hideMouseHint);
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
|
||||
_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 {
|
||||
TRACE_2("dead/distance",_unit,_target);
|
||||
|
||||
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,
|
||||
//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)
|
||||
// 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)
|
||||
TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime);
|
||||
};
|
||||
|
||||
[_unit, _target] call FUNC(dropObject_carry);
|
||||
|
||||
_unit setVariable [QGVAR(hint), nil];
|
||||
[] call EFUNC(interaction,hideMouseHint);
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
|
||||
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
||||
// Mouse hint
|
||||
private _hintLMB = localize LSTRING(Drop);
|
||||
private _hintLMB = LLSTRING(Drop);
|
||||
getCursorObjectParams params ["_cursorObject", "", "_distance"];
|
||||
|
||||
if (
|
||||
!isNull _cursorObject
|
||||
&& {_distance < MAX_LOAD_DISTANCE}
|
||||
&& {([_unit, _cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith))}
|
||||
&& {
|
||||
!isNull _cursorObject &&
|
||||
{_distance < MAX_LOAD_DISTANCE} &&
|
||||
{[_unit, _cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith)} &&
|
||||
{
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
[_cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat) isNotEqualTo []
|
||||
} else {
|
||||
@ -63,15 +70,17 @@ if (
|
||||
}
|
||||
}
|
||||
) then {
|
||||
_hintLMB = localize ELSTRING(common,loadObject);
|
||||
_hintLMB = LELSTRING(common,loadObject);
|
||||
};
|
||||
|
||||
private _hintMMB = localize LSTRING(RaiseLowerRotate);
|
||||
private _hintMMB = LLSTRING(RaiseLowerRotate);
|
||||
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
_hintMMB = "";
|
||||
};
|
||||
|
||||
private _hint = [_hintLMB, "", _hintMMB];
|
||||
|
||||
if (_hint isNotEqualTo (_unit getVariable [QGVAR(hint), []])) then {
|
||||
_unit setVariable [QGVAR(hint), _hint];
|
||||
_hint call EFUNC(interaction,showMouseHint);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* 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:
|
||||
* 0: Unit that should do the dragging <OBJECT>
|
||||
@ -19,20 +19,24 @@
|
||||
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 _direction = _target getVariable [QGVAR(dragDirection), 0];
|
||||
|
||||
// add height offset of model
|
||||
private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
|
||||
// Add height offset of model
|
||||
private _offset = ((_target modelToWorldVisual [0, 0, 0]) select 2) - ((_unit modelToWorldVisual [0, 0, 0]) select 2);
|
||||
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
_offset = 0;
|
||||
};
|
||||
|
||||
_position = _position vectorAdd [0, 0, _offset];
|
||||
|
||||
// attach object
|
||||
// Attach object
|
||||
TRACE_3("attaching",_position,_offset,_direction);
|
||||
|
||||
_target attachTo [_unit, _position];
|
||||
|
||||
[QEGVAR(common,setDir), [_target, _direction], _target] call CBA_fnc_targetEvent;
|
||||
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
@ -42,17 +46,17 @@ if (_target isKindOf "CAManBase") then {
|
||||
_unit setVariable [QGVAR(isDragging), true, true];
|
||||
_unit setVariable [QGVAR(draggedObject), _target, true];
|
||||
|
||||
// add drop action
|
||||
// Add drop action
|
||||
GVAR(unit) = _unit;
|
||||
|
||||
GVAR(releaseActionID) = [0xF1, [false, false, false], {
|
||||
[GVAR(unit), GVAR(unit) getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject);
|
||||
}, "keydown", "", false, 0] call CBA_fnc_addKeyHandler;
|
||||
|
||||
// show mouse hint
|
||||
["", localize LSTRING(Drop)] call EFUNC(interaction,showMouseHint);
|
||||
// Show mouse hint
|
||||
["", LLSTRING(Drop)] call EFUNC(interaction,showMouseHint);
|
||||
|
||||
// block firing
|
||||
// Block firing
|
||||
if !(GVAR(dragAndFire)) then {
|
||||
_unit setVariable [QGVAR(blockFire), [
|
||||
_unit, "DefaultAction",
|
||||
@ -61,22 +65,25 @@ if !(GVAR(dragAndFire)) then {
|
||||
] call EFUNC(common,addActionEventHandler)];
|
||||
};
|
||||
|
||||
// add anim changed EH
|
||||
// Add anim changed EH
|
||||
[_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;
|
||||
|
||||
// reset current dragging height.
|
||||
// Reset current dragging height.
|
||||
GVAR(currentHeightChange) = 0;
|
||||
|
||||
// prevent UAVs from firing
|
||||
// Prevent UAVs from firing
|
||||
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);
|
||||
|
||||
if (_UAVCrew isNotEqualTo []) then {
|
||||
{_target deleteVehicleCrew _x} count _UAVCrew;
|
||||
{
|
||||
_target deleteVehicleCrew _x;
|
||||
} forEach _UAVCrew;
|
||||
|
||||
_target setVariable [QGVAR(isUAV), true, true];
|
||||
};
|
||||
|
@ -1,20 +1,20 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* PFH for Drag Object
|
||||
* PFH for dragging an object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ARGS <ARRAY>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Start time <NUMBER>
|
||||
* 0: Arguments <ARRAY>
|
||||
* 0.0: Unit <OBJECT>
|
||||
* 0.1: Target <OBJECT>
|
||||
* 0.2: Start time <NUMBER>
|
||||
* 1: PFEH Id <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[player, target], 20] call ace_dragging_fnc_dragObjectPFH;
|
||||
* [[player, cursorTarget, CBA_missionTime], _idPFH] call ace_dragging_fnc_dragObjectPFH;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -28,17 +28,20 @@ _args params ["_unit", "_target", "_startTime"];
|
||||
|
||||
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
||||
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 {
|
||||
TRACE_2("dead/distance",_unit,_target);
|
||||
|
||||
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,
|
||||
//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)
|
||||
// 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)
|
||||
TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,CBA_missionTime);
|
||||
};
|
||||
|
||||
[_unit, _target] call FUNC(dropObject);
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2, Malbryn
|
||||
* Drop a dragged object.
|
||||
* Drops a dragged object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that drags the other object <OBJECT>
|
||||
@ -19,15 +19,15 @@
|
||||
params ["_unit", "_target"];
|
||||
TRACE_2("params",_unit,_target);
|
||||
|
||||
// remove drop action
|
||||
// Remove drop action
|
||||
[GVAR(releaseActionID), "keydown"] call CBA_fnc_removeKeyHandler;
|
||||
|
||||
// stop blocking
|
||||
// Stop blocking
|
||||
if !(GVAR(dragAndFire)) then {
|
||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(blockFire), -1]] call EFUNC(common,removeActionEventHandler);
|
||||
};
|
||||
|
||||
private _inBuilding = [_unit] call FUNC(isObjectOnObject);
|
||||
private _inBuilding = _unit call FUNC(isObjectOnObject);
|
||||
private _isClone = _target isKindOf QGVAR(clone);
|
||||
|
||||
// Drop cloned dead units
|
||||
@ -35,16 +35,16 @@ if (_isClone) then {
|
||||
_target = [_unit, _target, _inBuilding] call FUNC(dropClone);
|
||||
};
|
||||
|
||||
// Play release animation
|
||||
if !(_unit getVariable ["ACE_isUnconscious", false]) then {
|
||||
// play release animation
|
||||
[_unit, "released"] call EFUNC(common,doGesture);
|
||||
};
|
||||
|
||||
// prevent collision damage
|
||||
// Prevent collision damage
|
||||
[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent;
|
||||
[QEGVAR(common,fixCollision), _target, _target] call CBA_fnc_targetEvent;
|
||||
|
||||
// release object
|
||||
// Release object
|
||||
detach _target;
|
||||
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
@ -59,19 +59,19 @@ _unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
|
||||
[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set);
|
||||
|
||||
// prevent object from flipping inside buildings
|
||||
// Prevent object from flipping inside buildings
|
||||
if (_inBuilding && {!_isClone}) then {
|
||||
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
||||
TRACE_2("setPos",getPosASL _unit,getPosASL _target);
|
||||
};
|
||||
|
||||
// hide mouse hint
|
||||
[] call EFUNC(interaction,hideMouseHint);
|
||||
// Hide mouse hint
|
||||
call EFUNC(interaction,hideMouseHint);
|
||||
|
||||
_unit setVariable [QGVAR(isDragging), false, 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);
|
||||
|
||||
if !(_target isKindOf "CAManBase") then {
|
||||
@ -83,17 +83,17 @@ if (_unit getVariable ["ACE_isUnconscious", false]) then {
|
||||
[_unit, "unconscious", 2] call EFUNC(common,doAnimation);
|
||||
};
|
||||
|
||||
// recreate UAV crew
|
||||
// Recreate UAV crew
|
||||
if (_target getVariable [QGVAR(isUAV), false]) then {
|
||||
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);
|
||||
|
||||
// reset mass
|
||||
// Reset mass
|
||||
private _mass = _target getVariable [QGVAR(originalMass), 0];
|
||||
|
||||
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"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Drop a carried object.
|
||||
* Drops a carried object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that carries the other object <OBJECT>
|
||||
* 1: Carried object to drop <OBJECT>
|
||||
* 2: Try loading object into vehicle <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -19,10 +20,10 @@
|
||||
params ["_unit", "_target", ["_tryLoad", false]];
|
||||
TRACE_1("params",_this);
|
||||
|
||||
// remove drop action
|
||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler);
|
||||
// Remove drop action
|
||||
[_unit, "DefaultAction", _unit getVariable [QGVAR(releaseActionID), -1]] call EFUNC(common,removeActionEventHandler);
|
||||
|
||||
private _inBuilding = [_unit] call FUNC(isObjectOnObject);
|
||||
private _inBuilding = _unit call FUNC(isObjectOnObject);
|
||||
private _isClone = _target isKindOf QGVAR(clone);
|
||||
|
||||
// Drop cloned dead units
|
||||
@ -30,14 +31,14 @@ if (_isClone) then {
|
||||
_target = [_unit, _target, _inBuilding] call FUNC(dropClone);
|
||||
};
|
||||
|
||||
// prevent collision damage
|
||||
// Prevent collision damage
|
||||
[QEGVAR(common,fixCollision), _unit] call CBA_fnc_localEvent;
|
||||
[QEGVAR(common,fixCollision), _target, _target] call CBA_fnc_targetEvent;
|
||||
|
||||
// release object
|
||||
// Release object
|
||||
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 (vehicle _unit == _unit && {!(_unit getVariable ["ACE_isUnconscious", false])}) then {
|
||||
[_unit, "", 2] call EFUNC(common,doAnimation);
|
||||
@ -50,10 +51,10 @@ if (_target isKindOf "CAManBase" || {animationState _unit in CARRY_ANIMATIONS})
|
||||
};
|
||||
};
|
||||
|
||||
// properly remove fake weapon
|
||||
// Properly remove fake weapon
|
||||
_unit removeWeapon "ACE_FakePrimaryWeapon";
|
||||
|
||||
// reselect weapon and re-enable sprint
|
||||
// Reselect weapon and re-enable sprint
|
||||
private _previousWeaponIndex = _unit getVariable [QGVAR(previousWeapon), -1];
|
||||
_unit setVariable [QGVAR(previousWeapon), nil, true];
|
||||
|
||||
@ -65,7 +66,7 @@ if (_previousWeaponIndex != -1) then {
|
||||
[_unit, "blockSprint", 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 && {!_isClone}) then {
|
||||
_target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]);
|
||||
TRACE_2("setPos",getPosASL _unit,getPosASL _target);
|
||||
@ -74,7 +75,7 @@ if (_inBuilding && {!_isClone}) then {
|
||||
_unit setVariable [QGVAR(isCarrying), false, 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);
|
||||
|
||||
if !(_target isKindOf "CAManBase") then {
|
||||
@ -82,38 +83,41 @@ if !(_target isKindOf "CAManBase") then {
|
||||
[QEGVAR(common,fixFloating), _target, _target] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
||||
// recreate UAV crew
|
||||
// Recreate UAV crew
|
||||
if (_target getVariable [QGVAR(isUAV), false]) then {
|
||||
createVehicleCrew _target;
|
||||
};
|
||||
|
||||
// reset mass
|
||||
// Reset mass
|
||||
private _mass = _target getVariable [QGVAR(originalMass), 0];
|
||||
|
||||
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];
|
||||
|
||||
// try loading into vehicle
|
||||
if (_tryLoad && {!isNull cursorObject} && {([ACE_player, cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith))}) then {
|
||||
private _cursorObject = cursorObject;
|
||||
|
||||
// Try loading into vehicle
|
||||
if (_tryLoad && {!isNull _cursorObject} && {[_unit, _cursorObject, ["isNotCarrying"]] call EFUNC(common,canInteractWith)}) then {
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
private _vehicles = [cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat);
|
||||
if ([cursorObject] isEqualTo _vehicles) then {
|
||||
if (["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
|
||||
[_unit, _target, cursorObject] call EFUNC(medical_treatment,loadUnit);
|
||||
private _vehicles = [_cursorObject, 0, true] call EFUNC(common,nearestVehiclesFreeSeat);
|
||||
|
||||
if ([_cursorObject] isEqualTo _vehicles) then {
|
||||
if (["ace_medical"] call EFUNC(common,isModLoaded)) then {
|
||||
[_unit, _target, _cursorObject] call EFUNC(medical_treatment,loadUnit);
|
||||
} else {
|
||||
[_unit, _target, cursorObject] call EFUNC(common,loadPerson);
|
||||
[_unit, _target, _cursorObject] call EFUNC(common,loadPerson);
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if (
|
||||
["ace_cargo"] call EFUNC(common,isModLoaded) &&
|
||||
{[_target, cursorObject] call EFUNC(cargo,canLoadItemIn)}
|
||||
{[_target, _cursorObject] call EFUNC(cargo,canLoadItemIn)}
|
||||
) then {
|
||||
[player, _target, cursorObject] call EFUNC(cargo,startLoadIn);
|
||||
[_unit, _target, _cursorObject] call EFUNC(cargo,startLoadIn);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Weight <NUMBER>
|
||||
*
|
||||
* Example:
|
||||
* [_object] call ace_dragging_fnc_getWeight
|
||||
* [cursorTarget] call ace_dragging_fnc_getWeight
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -36,4 +36,4 @@ if !(GVAR(skipContainerWeight)) then {
|
||||
|
||||
// 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)
|
||||
_weight * 0.5;
|
||||
_weight * 0.5 // return
|
||||
|
@ -1,23 +1,21 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handle the animaion for a Unit for Dragging Module
|
||||
* Handle the animation for a unit for the dragging module.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: animaion <STRING>
|
||||
* 1: Animaion <STRING>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit, "amovpercmstpsnonwnondnon"] call ace_dragging_fnc_handleAnimChanged;
|
||||
* [player, "amovpercmstpsnonwnondnon"] call ace_dragging_fnc_handleAnimChanged;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
//IGNORE_PRIVATE_WARNING ["_thisArgs", "_thisID"]; // From CBA_fnc_addBISEventHandler;
|
||||
|
||||
params ["_unit", "_anim"];
|
||||
_thisArgs params ["_realUnit"];
|
||||
TRACE_4("params",_unit,_anim,_realUnit,_thisID);
|
||||
@ -28,8 +26,7 @@ if (_unit != _realUnit) exitWith {
|
||||
};
|
||||
|
||||
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 {
|
||||
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
@ -39,10 +36,8 @@ if (_unit getVariable [QGVAR(isDragging), false]) then {
|
||||
};
|
||||
};
|
||||
} else {
|
||||
|
||||
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 {
|
||||
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handle death of the dragger
|
||||
* Handle death of the dragger/carrier.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit] call ace_dragging_fnc_handleKilled;
|
||||
* [player] call ace_dragging_fnc_handleKilled;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handle player changes.
|
||||
* Handles player changes.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: New Player Unit <OBJECT>
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handle the Weapon Changed Event
|
||||
* Handles the weapon changed event.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
@ -11,7 +11,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit, "gun"] call ace_dragging_fnc_handlePlayerWeaponChanged;
|
||||
* [player, primaryWeapon player] call ace_dragging_fnc_handlePlayerWeaponChanged;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -20,32 +20,25 @@ params ["_unit", "_weapon"];
|
||||
TRACE_2("params",_unit,_weapon);
|
||||
|
||||
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 {
|
||||
private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
if (_unit getVariable [QGVAR(isCarrying), false]) then {
|
||||
|
||||
private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
if (_carriedObject isKindOf "CAManBase") then {
|
||||
|
||||
if (_weapon != primaryWeapon _unit) then {
|
||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||
};
|
||||
|
||||
} else {
|
||||
|
||||
// drop carried object when selecting any weapon
|
||||
// Drop carried object when selecting any weapon
|
||||
if (_weapon != "") then {
|
||||
[_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];
|
||||
|
||||
//disabled for persons
|
||||
// Disabled for persons
|
||||
if (_carriedItem isKindOf "CAManBase") exitWith {false};
|
||||
|
||||
if !(cba_events_control) then {
|
||||
// raise/lower
|
||||
|
||||
// move carried item 15 cm per scroll interval
|
||||
if !(CBA_events_control) then {
|
||||
// Raise/lower
|
||||
// Move carried item 15 cm per scroll interval
|
||||
_scrollAmount = _scrollAmount * 0.15;
|
||||
|
||||
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];
|
||||
|
||||
// move up/down object and reattach at current position
|
||||
// Move up/down object and reattach at current position
|
||||
detach _carriedItem;
|
||||
|
||||
// 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;
|
||||
_carriedItem attachTo [_unit, _selectionPosition];
|
||||
|
||||
//reset the carry direction
|
||||
// Reset the carry direction
|
||||
private _direction = _carriedItem getVariable [QGVAR(carryDirection_temp), _carriedItem getVariable [QGVAR(carryDirection), 0]];
|
||||
[QEGVAR(common,setDir), [_carriedItem, _direction], _carriedItem] call CBA_fnc_targetEvent;
|
||||
} else {
|
||||
// rotate
|
||||
|
||||
// Rotate
|
||||
private _direction = _carriedItem getVariable [QGVAR(carryDirection_temp), _carriedItem getVariable [QGVAR(carryDirection), 0]];
|
||||
_scrollAmount = _scrollAmount * 10;
|
||||
_direction = _direction + _scrollAmount;
|
||||
|
||||
[QEGVAR(common,setDir), [_carriedItem, _direction], _carriedItem] call CBA_fnc_targetEvent;
|
||||
_carriedItem setVariable [QGVAR(carryDirection_temp), _direction];
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handle the Unconscious of a Unit while Dragging
|
||||
* Handles consciousness change of a unit while dragging / carrying.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
@ -10,7 +10,7 @@
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [_unit] call ace_dragging_fnc_handleUnconscious;
|
||||
* [player] call ace_dragging_fnc_handleUnconscious;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -20,30 +20,28 @@ params ["_unit"];
|
||||
private _player = ACE_player;
|
||||
|
||||
if (_player getVariable [QGVAR(isDragging), false]) then {
|
||||
|
||||
private _draggedObject = _player getVariable [QGVAR(draggedObject), objNull];
|
||||
|
||||
// handle falling unconscious
|
||||
// Handle falling unconscious
|
||||
if (_unit == _player) then {
|
||||
[_unit, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
// handle waking up dragged unit
|
||||
// Handle waking up dragged unit
|
||||
if (_unit == _draggedObject) then {
|
||||
[_player, _draggedObject] call FUNC(dropObject);
|
||||
};
|
||||
};
|
||||
|
||||
if (_player getVariable [QGVAR(isCarrying), false]) then {
|
||||
|
||||
private _carriedObject = _player getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
// handle falling unconscious
|
||||
// Handle falling unconscious
|
||||
if (_unit == _player) then {
|
||||
[_unit, _carriedObject] call FUNC(dropObject_carry);
|
||||
};
|
||||
|
||||
// handle waking up dragged unit
|
||||
// Handle waking up dragged unit
|
||||
if (_unit == _carriedObject) then {
|
||||
[_player, _carriedObject] call FUNC(dropObject_carry);
|
||||
};
|
||||
|
@ -1,16 +1,16 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Initialize variables for drag or carryable objects. Called from init EH.
|
||||
* Initializes variables for draggable / carryable objects. Called from init EH.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Any object <OBJECT>
|
||||
* 0: Object <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [box] call ace_dragging_fnc_initObject;
|
||||
* [cursorTarget] call ace_dragging_fnc_initObject;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Initialize variables for drag or carryable persons. Called from init EH.
|
||||
* Initialize variables for draggable / carryable persons. Called from init EH.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
@ -17,5 +17,5 @@
|
||||
|
||||
params ["_unit"];
|
||||
|
||||
[_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, 1.1, 0.092], 180] call FUNC(setDraggable);
|
||||
[_unit, true, [0.4, -0.1, -1.25], 195] call FUNC(setCarryable); // Hard-coded selection: "LeftShoulder"
|
||||
|
@ -1,15 +1,15 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Check if Object is Overlapping
|
||||
* Checks if an object is overlapping another object.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Object <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Boolean <BOOL>
|
||||
* If object is overlapping another <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_dragging_fnc_isObjectOnObject
|
||||
* [player] call ace_dragging_fnc_isObjectOnObject;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
@ -1,46 +1,45 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2, PiZZADOX
|
||||
* Enable the object to be carried.
|
||||
* Enables the object to be carried.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Any object <OBJECT>
|
||||
* 1: true to enable carrying, false to disable <BOOL>
|
||||
* 2: Position offset for attachTo command <ARRAY> (default: [0,1,1])
|
||||
* 3: Direction in degree to rotate the object after attachTo <NUMBER> (default: 0)
|
||||
* 4: Override weight limit (optional; default: false) <BOOL>
|
||||
* 0: Object <OBJECT>
|
||||
* 1: True to enable carrying, false to disable <BOOL>
|
||||
* 2: Position offset for attachTo command <ARRAY> (default: [0, 1, 1])
|
||||
* 3: Direction in degrees to rotate the object after attachTo <NUMBER> (default: 0)
|
||||
* 4: Override weight limit <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
//IGNORE_PRIVATE_WARNING ["_player", "_target"];
|
||||
params ["_object", "_enableCarry", "_position", "_direction", ["_ignoreWeightCarry", false, [false]]];
|
||||
|
||||
if (isNil "_position") then {
|
||||
_position = _object getVariable [QGVAR(carryPosition), [0,1,1]];
|
||||
_position = _object getVariable [QGVAR(carryPosition), [0, 1, 1]];
|
||||
};
|
||||
|
||||
if (isNil "_direction") then {
|
||||
_direction = _object getVariable [QGVAR(carryDirection), 0];
|
||||
};
|
||||
|
||||
// update variables
|
||||
// Update variables
|
||||
_object setVariable [QGVAR(canCarry), _enableCarry];
|
||||
_object setVariable [QGVAR(carryPosition), _position];
|
||||
_object setVariable [QGVAR(carryDirection), _direction];
|
||||
_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 _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 {};
|
||||
|
||||
_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 _carryAction = [QGVAR(carry), localize LSTRING(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 _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), 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, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||
|
@ -1,25 +1,24 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2, PiZZADOX
|
||||
* Enable the object to be dragged.
|
||||
* Enables the object to be dragged.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Any object <OBJECT>
|
||||
* 1: true to enable dragging, false to disable <BOOL>
|
||||
* 0: Object <OBJECT>
|
||||
* 1: True to enable dragging, false to disable <BOOL>
|
||||
* 2: Position offset for attachTo command (optional; default: [0, 1.5, 0]) <ARRAY>
|
||||
* 3: Direction in degree to rotate the object after attachTo (optional; default: 0) <NUMBER>
|
||||
* 4: Override weight limit (optional; default: false) <BOOL>
|
||||
* 3: Direction in degrees to rotate the object after attachTo (optional; default: 0) <NUMBER>
|
||||
* 4: Override weight limit <BOOL> (default: false)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
//IGNORE_PRIVATE_WARNING ["_player", "_target"];
|
||||
params ["_object", "_enableDrag", "_position", "_direction", ["_ignoreWeightDrag", false, [false]]];
|
||||
|
||||
if (isNil "_position") then {
|
||||
@ -30,17 +29,17 @@ if (isNil "_direction") then {
|
||||
_direction = _object getVariable [QGVAR(dragDirection), 0];
|
||||
};
|
||||
|
||||
// update variables
|
||||
// Update variables
|
||||
_object setVariable [QGVAR(canDrag), _enableDrag];
|
||||
_object setVariable [QGVAR(dragPosition), _position];
|
||||
_object setVariable [QGVAR(dragDirection), _direction];
|
||||
_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 _initializedClasses = GETGVAR(initializedClasses,[]);
|
||||
|
||||
// do nothing if the class is already initialized
|
||||
// Do nothing if the class is already initialized
|
||||
if (_type in _initializedClasses) exitWith {};
|
||||
|
||||
_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 _dragAction = [QGVAR(drag), localize LSTRING(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 _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), 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, [], _dropAction] call EFUNC(interact_menu,addActionToClass);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2, PiZZADOX
|
||||
* Start the carrying process.
|
||||
* Starts the carrying process.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that should do the carrying <OBJECT>
|
||||
@ -19,76 +19,79 @@
|
||||
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;
|
||||
|
||||
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 {
|
||||
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||
[LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
private _timer = CBA_missionTime + 5;
|
||||
|
||||
// handle objects vs persons
|
||||
// Handle objects vs. persons
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
// Create clone for dead units
|
||||
if (!alive _target) then {
|
||||
_target = _target call FUNC(createClone);
|
||||
};
|
||||
|
||||
private _primaryWeapon = primaryWeapon _unit;
|
||||
|
||||
// add a primary weapon if the unit has none.
|
||||
if (primaryWeapon _unit isEqualto "") then {
|
||||
// Add a primary weapon if the unit has none
|
||||
if (_primaryWeapon == "") then {
|
||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||
_primaryWeapon = "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
|
||||
// select primary, otherwise the drag animation actions don't work.
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
// Select primary, otherwise the drag animation actions don't work
|
||||
_unit selectWeapon _primaryWeapon;
|
||||
|
||||
// move a bit closer and adjust direction when trying to pick up a person
|
||||
_target setDir (getDir _unit + 180);
|
||||
// Move a bit closer and adjust direction when trying to pick up a person
|
||||
[QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent;
|
||||
_target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit));
|
||||
|
||||
[_unit, "AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon", 2] call EFUNC(common,doAnimation);
|
||||
[_target, "AinjPfalMstpSnonWrflDnon_carried_Up", 2] call EFUNC(common,doAnimation);
|
||||
|
||||
_timer = CBA_missionTime + 10;
|
||||
|
||||
} else {
|
||||
// select no weapon and stop sprinting
|
||||
// Select no weapon and stop sprinting
|
||||
private _previousWeaponIndex = [_unit] call EFUNC(common,getFiremodeIndex);
|
||||
_unit setVariable [QGVAR(previousWeapon), _previousWeaponIndex, true];
|
||||
|
||||
_unit action ["SwitchWeapon", _unit, _unit, 299];
|
||||
|
||||
[_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation);
|
||||
|
||||
private _canRun = [_weight] call FUNC(canRun_carry);
|
||||
// only force walking if we're overweight
|
||||
private _canRun = _weight call FUNC(canRun_carry);
|
||||
|
||||
// Only force walking if we're overweight
|
||||
[_unit, "forceWalk", 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);
|
||||
|
||||
// prevent multiple players from accessing the same object
|
||||
// Prevent multiple players from accessing the same object
|
||||
[_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];
|
||||
|
||||
// required for aborting animation
|
||||
// Required for aborting animation
|
||||
_unit setVariable [QGVAR(carriedObject), _target, true];
|
||||
|
||||
[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;
|
||||
|
||||
if (_mass > 1) then {
|
||||
_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"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Carry PFH
|
||||
* Checks for carrying conditions. If these are met, the unit will start carrying. Called from ace_dragging_fnc_startCarry.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ARGS <ARRAY>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Timeout <NUMBER>
|
||||
* 0: Arguments <ARRAY>
|
||||
* 0.0: Unit <OBJECT>
|
||||
* 0.1: Target <OBJECT>
|
||||
* 0.2: Timeout <NUMBER>
|
||||
* 1: PFEH Id <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[player, target, 100], 20] call ace_dragging_fnc_startCarryPFH;
|
||||
* [[player, cursorTarget, 10], _idPFH] call ace_dragging_fnc_startCarryPFH;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -26,42 +26,44 @@
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit", "_target", "_timeOut"];
|
||||
|
||||
// handle aborting carry
|
||||
// Handle aborting carry
|
||||
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
|
||||
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 {
|
||||
TRACE_4("dead/distance",_unit,_target,_timeOut,CBA_missionTime);
|
||||
[_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 {
|
||||
// Drop if in timeout
|
||||
if (CBA_missionTime > _timeOut) exitWith {
|
||||
TRACE_4("Start carry person",_unit,_target,_timeOut,CBA_missionTime);
|
||||
[_unit, _target] call FUNC(carryObject);
|
||||
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
} else {
|
||||
// Drop if in timeout
|
||||
if (CBA_missionTime > _timeOut) exitWith {
|
||||
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];
|
||||
[_unit, _draggedObject] call FUNC(dropObject_carry);
|
||||
};
|
||||
|
||||
// wait for the unit to stand up
|
||||
if (stance _unit isEqualto "STAND") exitWith {
|
||||
// Wait for the unit to stand up
|
||||
if (stance _unit == "STAND") exitWith {
|
||||
TRACE_4("Start carry object",_unit,_target,_timeOut,CBA_missionTime);
|
||||
[_unit, _target] call FUNC(carryObject);
|
||||
|
||||
[_idPFH] call CBA_fnc_removePerFrameHandler;
|
||||
_idPFH call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: commy2, PiZZADOX, Malbryn
|
||||
* Start the dragging process.
|
||||
* Starts the dragging process.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit that should do the dragging <OBJECT>
|
||||
@ -19,15 +19,16 @@
|
||||
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;
|
||||
|
||||
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 {
|
||||
[localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||
[LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
// Create clone for dead units
|
||||
@ -35,27 +36,31 @@ if (!alive _target) then {
|
||||
_target = _target call FUNC(createClone);
|
||||
};
|
||||
|
||||
private _primaryWeapon = primaryWeapon _unit;
|
||||
|
||||
// Add a primary weapon if the unit has none
|
||||
if !(GVAR(dragAndFire)) then {
|
||||
if (primaryWeapon _unit isEqualto "") then {
|
||||
if (_primaryWeapon == "") then {
|
||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
} else {
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
_primaryWeapon = "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
|
||||
_unit selectWeapon _primaryWeapon;
|
||||
} else { // Making sure the unit is holding a primary weapon or handgun
|
||||
if !(currentWeapon _unit in [primaryWeapon _unit, handgunWeapon _unit]) then {
|
||||
if (primaryWeapon _unit != "") then {
|
||||
private _handgunWeapon = handgunWeapon _unit;
|
||||
|
||||
if !(currentWeapon _unit in [_primaryWeapon, _handgunWeapon]) then {
|
||||
if (_primaryWeapon != "") then {
|
||||
// Use primary if possible
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
_unit selectWeapon _primaryWeapon;
|
||||
} else {
|
||||
if (handgunWeapon _unit != "") then {
|
||||
if (_handgunWeapon != "") then {
|
||||
// Use pistol if unit has no primary
|
||||
_unit selectWeapon handgunWeapon _unit;
|
||||
_unit selectWeapon _handgunWeapon;
|
||||
} else {
|
||||
// Add fake weapon if no weapons besides launcher are available
|
||||
_unit addWeapon "ACE_FakePrimaryWeapon";
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
_unit selectWeapon "ACE_FakePrimaryWeapon";
|
||||
};
|
||||
};
|
||||
};
|
||||
@ -66,10 +71,10 @@ _unit setVariable [QGVAR(currentWeapon), currentWeapon _unit];
|
||||
|
||||
[_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);
|
||||
|
||||
// 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 {
|
||||
[{
|
||||
private _unitWeapon = _this getVariable [QGVAR(currentWeapon), ""];
|
||||
@ -82,23 +87,23 @@ if !(_unit call EFUNC(common,isSwimming)) then {
|
||||
}, _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 {
|
||||
_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, "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];
|
||||
|
||||
[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;
|
||||
|
||||
if (_mass > 1) then {
|
||||
_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"
|
||||
/*
|
||||
* Author: commy2
|
||||
* Drag PFH
|
||||
* Checks for dragging conditions. If these are met, the unit will start dragging. Called from ace_dragging_fnc_startDrag.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: ARGS <ARRAY>
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Target <OBJECT>
|
||||
* 2: Timeout <NUMBER>
|
||||
* 0: Arguments <ARRAY>
|
||||
* 0.0: Unit <OBJECT>
|
||||
* 0.1: Target <OBJECT>
|
||||
* 0.2: Timeout <NUMBER>
|
||||
* 1: PFEH Id <NUMBER>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [[player, target, 100], 20] call ace_dragging_fnc_startDragPFH;
|
||||
* [[player, cursorTarget, 10], _idPFH] call ace_dragging_fnc_startDragPFH;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
@ -26,33 +26,34 @@
|
||||
params ["_args", "_idPFH"];
|
||||
_args params ["_unit", "_target", "_timeOut"];
|
||||
|
||||
// handle aborting drag
|
||||
// Handle aborting drag
|
||||
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
|
||||
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 {
|
||||
TRACE_4("dead/distance",_unit,_target,_timeOut,CBA_missionTime);
|
||||
[_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 {
|
||||
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];
|
||||
[_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 {
|
||||
TRACE_4("Start Dragging",_unit,_target,_timeOut,CBA_missionTime);
|
||||
[_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),
|
||||
"CHECKBOX",
|
||||
[LSTRING(DragAndFire_DisplayName), LSTRING(DragAndFire_Description)],
|
||||
localize LSTRING(SettingsName),
|
||||
true,
|
||||
false
|
||||
LLSTRING(SettingsName),
|
||||
true
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
|
@ -34,4 +34,9 @@ class CfgFontFamilies {
|
||||
spaceWidth = 0.5;
|
||||
spacing = 0.065;
|
||||
};
|
||||
class ACE_Stencil {
|
||||
fonts[] = {
|
||||
QPATHTOF(SairaStencilOne\ace_stencil64)
|
||||
};
|
||||
};
|
||||
};
|
||||
|
BIN
addons/fonts/SairaStencilOne/ace_stencil64-01.paa
Normal file
BIN
addons/fonts/SairaStencilOne/ace_stencil64-01.paa
Normal file
Binary file not shown.
BIN
addons/fonts/SairaStencilOne/ace_stencil64.fxy
Normal file
BIN
addons/fonts/SairaStencilOne/ace_stencil64.fxy
Normal file
Binary file not shown.
@ -22,7 +22,15 @@ params ["_menuType"];
|
||||
if (GVAR(openedMenuType) == _menuType) exitWith {true};
|
||||
|
||||
// Conditions: Don't open when editing a text box
|
||||
private _isTextEditing = (allDisplays findIf {(ctrlType (focusedCtrl _x)) == CT_EDIT}) != -1;
|
||||
private _focusedTextIndex = allDisplays findIf {(ctrlType (focusedCtrl _x)) == CT_EDIT};
|
||||
private _isTextEditing = _focusedTextIndex != -1;
|
||||
|
||||
// Map's controls remain open and focused despite map not being visible, workaround
|
||||
if (_isTextEditing) then {
|
||||
if (ctrlIDD (allDisplays select _focusedTextIndex) == IDD_MAIN_MAP) then {
|
||||
_isTextEditing = visibleMap;
|
||||
};
|
||||
};
|
||||
|
||||
// Conditions: canInteract (these don't apply to zeus)
|
||||
if (
|
||||
|
@ -10,7 +10,7 @@
|
||||
#define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD
|
||||
|
||||
// MINIMAL required version for the Mod. Components can specify others..
|
||||
#define REQUIRED_VERSION 2.10
|
||||
#define REQUIRED_VERSION 2.12
|
||||
#define REQUIRED_CBA_VERSION {3,15,7}
|
||||
|
||||
#ifdef COMPONENT_BEAUTIFIED
|
||||
|
@ -19,7 +19,11 @@ params ["_vehicle"];
|
||||
|
||||
private _selectionClan = getText (configOf _vehicle >> "selectionClan");
|
||||
if !(_selectionClan in selectionNames _vehicle) exitWith {
|
||||
TRACE_2("vehicle does not have 'selectionClan' selection",_vehicle,_selectionLogo);
|
||||
TRACE_2("vehicle does not have 'selectionClan' selection",_vehicle,_selectionClan);
|
||||
};
|
||||
|
||||
if (_vehicle getVariable [QEGVAR(tagging,hasTag), false]) exitWith {
|
||||
TRACE_1("vehicle has tag applied",_vehicle);
|
||||
};
|
||||
|
||||
TRACE_1("replacing clan logo with empty texture",_vehicle);
|
||||
|
20
addons/tagging/CfgEden.hpp
Normal file
20
addons/tagging/CfgEden.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
class Cfg3DEN {
|
||||
class Object {
|
||||
class AttributeCategories {
|
||||
class ace_attributes {
|
||||
class Attributes {
|
||||
class GVAR(stencilVehicle) {
|
||||
property = QGVAR(stencilVehicle);
|
||||
control = "Edit";
|
||||
displayName = CSTRING(stencilVehicle);
|
||||
tooltip = CSTRING(stencilVehicle_tooltip);
|
||||
expression = QUOTE( [ARR_2(_this,_value)] call FUNC(stencilVehicle); );
|
||||
condition = "objectVehicle";
|
||||
defaultValue = "''";
|
||||
typeName = "STRING";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
@ -14,20 +14,24 @@ class CfgWeapons {
|
||||
class ItemInfo: CBA_MiscItem_ItemInfo {
|
||||
mass = 10;
|
||||
};
|
||||
GVAR(textColor) = "000000FE";
|
||||
};
|
||||
class ACE_SpraypaintRed: ACE_SpraypaintBlack {
|
||||
displayname = CSTRING(spraypaintRed);
|
||||
picture = QPATHTOF(UI\items\itemSpraypaintRed.paa);
|
||||
hiddenSelectionsTextures[] = {QPATHTOF(data\spraycanRed_co.paa)};
|
||||
GVAR(textColor) = "FF0000FE";
|
||||
};
|
||||
class ACE_SpraypaintGreen: ACE_SpraypaintBlack {
|
||||
displayname = CSTRING(spraypaintGreen);
|
||||
picture = QPATHTOF(UI\items\itemSpraypaintGreen.paa);
|
||||
hiddenSelectionsTextures[] = {QPATHTOF(data\spraycanGreen_co.paa)};
|
||||
GVAR(textColor) = "00FF00FE";
|
||||
};
|
||||
class ACE_SpraypaintBlue: ACE_SpraypaintBlack {
|
||||
displayname = CSTRING(spraypaintBlue);
|
||||
picture = QPATHTOF(UI\items\itemSpraypaintBlue.paa);
|
||||
hiddenSelectionsTextures[] = {QPATHTOF(data\spraycanBlue_co.paa)};
|
||||
GVAR(textColor) = "0000FFFE";
|
||||
};
|
||||
};
|
||||
|
@ -1,12 +1,15 @@
|
||||
PREP(addCustomTag);
|
||||
PREP(addStencilTag);
|
||||
PREP(addTagActions);
|
||||
PREP(applyCustomTag);
|
||||
PREP(checkTaggable);
|
||||
PREP(compileConfigTags);
|
||||
PREP(compileTagAction);
|
||||
PREP(createTag);
|
||||
PREP(generateStencilTexture);
|
||||
PREP(moduleInit);
|
||||
PREP(parseConfigTag);
|
||||
PREP(quickTag);
|
||||
PREP(stencilVehicle);
|
||||
PREP(tag);
|
||||
PREP(tagTestingThread);
|
||||
|
@ -30,3 +30,7 @@ private _cfgBase = configFile >> "CfgNonAIVehicles";
|
||||
|
||||
uiNamespace setVariable [QGVAR(cacheStaticModels), compileFinal str _cacheStaticModels];
|
||||
TRACE_1("compiled",count _cacheStaticModels);
|
||||
|
||||
// force preload of stencil texture to avoid error popup
|
||||
// Warning Message: Cannot load mipmap z\ace\addons\fonts\sairastencilone\ace_stencil64-01.paa
|
||||
"Test" getTextWidth ["ACE_Stencil", 0.3];
|
||||
|
@ -19,3 +19,4 @@ class CfgPatches {
|
||||
#include "CfgEventHandlers.hpp"
|
||||
#include "CfgVehicles.hpp"
|
||||
#include "CfgWeapons.hpp"
|
||||
#include "CfgEden.hpp"
|
||||
|
@ -33,25 +33,27 @@ params [
|
||||
|
||||
// Verify
|
||||
if (_identifier == "") exitWith {
|
||||
ERROR("Failed adding custom tag - missing identifier");
|
||||
ERROR("Failed adding custom tag - missing identifier"); false
|
||||
};
|
||||
|
||||
if (_displayName == "") exitWith {
|
||||
ERROR_1("Failed adding custom tag: %1 - missing displayName",_identifier);
|
||||
ERROR_1("Failed adding custom tag: %1 - missing displayName",_identifier); false
|
||||
};
|
||||
|
||||
if (_requiredItem == "") exitWith {
|
||||
ERROR_1("Failed adding custom tag: %1 - missing requiredItem",_identifier);
|
||||
ERROR_1("Failed adding custom tag: %1 - missing requiredItem",_identifier); false
|
||||
};
|
||||
if (!isClass (configFile >> "CfgWeapons" >> _requiredItem)) exitWith {
|
||||
ERROR_2("Failed adding custom tag: %1 - requiredItem %2 does not exist",_identifier,_requiredItem);
|
||||
ERROR_2("Failed adding custom tag: %1 - requiredItem %2 does not exist",_identifier,_requiredItem); false
|
||||
};
|
||||
|
||||
if (_textures isEqualTo []) exitWith {
|
||||
ERROR_1("Failed adding custom tag: %1 - missing textures",_identifier);
|
||||
ERROR_1("Failed adding custom tag: %1 - missing textures",_identifier); false
|
||||
};
|
||||
|
||||
_identifier = [_identifier] call CBA_fnc_removeWhitespace;
|
||||
|
||||
// Add
|
||||
[QGVAR(applyCustomTag), [_identifier, _displayName, _requiredItem, _textures, _icon, _materials, _tagModel]] call CBA_fnc_globalEventJIP;
|
||||
|
||||
true
|
||||
|
50
addons/tagging/functions/fnc_addStencilTag.sqf
Normal file
50
addons/tagging/functions/fnc_addStencilTag.sqf
Normal file
@ -0,0 +1,50 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Adds custom text tag. Has to be executed on one machine only.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Display Text <STRING>
|
||||
* 1: Text Size <NUMBER> (default: 0.3)
|
||||
* 2: Required Item <STRING> (default: "ACE_SpraypaintBlack")
|
||||
* 3: Text Color (in HEX 6 or 8) <STRING> (default: based on spray item)
|
||||
* 4: Background Color (in HEX 6 or 8) <STRING> (default: "00000000" - transparent)
|
||||
* 5: Auto newlines <BOOL> (default: true)
|
||||
*
|
||||
* Return Value:
|
||||
* Sucessfully Added Tag <BOOL>
|
||||
*
|
||||
* Example:
|
||||
* ["Orcs Go Home", 0.22] call ace_tagging_fnc_addStencilTag
|
||||
* ["LOGI-2", 0.3, "ACE_SpraypaintBlack", "f7e9e1"] call ace_tagging_fnc_addStencilTag
|
||||
*
|
||||
* Public: Yes
|
||||
*/
|
||||
|
||||
params [
|
||||
["_text", "", [""]],
|
||||
["_textSize", 0.3, [0]],
|
||||
["_requiredItem", "ACE_SpraypaintBlack", [""]],
|
||||
["_textColor", "", [""]],
|
||||
["_backgroundColor", "00000000", [""]],
|
||||
["_autoMultiline", true, [false]]
|
||||
];
|
||||
TRACE_6("",_text,_textSize,_requiredItem,_textColor,_backgroundColor,_autoMultiline);
|
||||
|
||||
if (_text == "") exitWith { ERROR_1("bad text %1",_text); false };
|
||||
// Check required item exists
|
||||
if (!isClass (configFile >> "CfgWeapons" >> _requiredItem)) exitWith { ERROR_1("bad item %1",_requiredItem); false };
|
||||
// Get color from spray item used
|
||||
if (_textColor == "") then {
|
||||
_textColor = getText (configFile >> "CfgWeapons" >> _requiredItem >> QGVAR(textColor));
|
||||
if (_textColor == "") then { _textColor = "000000" };
|
||||
};
|
||||
|
||||
|
||||
private _identifier = format ["%1_%2_%3",_text,_textColor,_backgroundColor];
|
||||
private _interactionText = _text regexReplace ["\\n", " "];
|
||||
private _texture = [_text, _textSize, _textColor, _backgroundColor, _autoMultiline] call FUNC(generateStencilTexture);
|
||||
TRACE_2("",_identifier,_texture);
|
||||
if (_texture == "") exitWith { ERROR_1("bad texture params %1",_this); false };
|
||||
|
||||
[_identifier, _interactionText, _requiredItem, [_texture]] call FUNC(addCustomTag) // return
|
@ -32,6 +32,7 @@ if (_texture == "") exitWith {
|
||||
if (_isVehicleTag) exitWith {
|
||||
TRACE_3("tagging vehicle",_object,typeOf _object,_texture);
|
||||
_object setObjectTextureGlobal [getText (configOf _object >> "selectionClan"), _texture];
|
||||
_object setVariable [QGVAR(hasTag), true, true];
|
||||
// if (_material != "") then { _object setObjectMaterialGlobal ["clan", _material] }; // ??
|
||||
["ace_tagCreated", [objNull, _texture, _object, _unit]] call CBA_fnc_globalEvent;
|
||||
};
|
||||
|
55
addons/tagging/functions/fnc_generateStencilTexture.sqf
Normal file
55
addons/tagging/functions/fnc_generateStencilTexture.sqf
Normal file
@ -0,0 +1,55 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Generate a "Text to Texture"
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Display Text <STRING>
|
||||
* 1: Text Size <NUMBER> (default: 0.3)
|
||||
* 2: Text Color (in HEX 6 or 8) <STRING> (default: "000000" - black)
|
||||
* 3: Background Color (in HEX 6 or 8) <STRING> (default: "00000000" - transparent)
|
||||
* 4: Auto newlines <BOOL> (default: true)
|
||||
* 4: Texture Dimensions <BOOL> (default: 512)
|
||||
*
|
||||
* Return Value:
|
||||
* Texture <STRING>
|
||||
*
|
||||
* Example:
|
||||
* ["your text"] call ace_tagging_fnc_generateStencilTexture
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params [
|
||||
["_text", "", [""]],
|
||||
["_textSize", 0.3, [0]],
|
||||
["_textColor", "000000", [""]],
|
||||
["_backgroundColor", "00000000", [""]],
|
||||
["_autoMultiline", true, [false]],
|
||||
["_dimension", 512, [0]]
|
||||
];
|
||||
|
||||
if (_textColor select [0, 1] == "#") then { _textColor = _textColor select [1]; };
|
||||
if (_backgroundColor select [0, 1] == "#") then { _backgroundColor = _backgroundColor select [1]; };
|
||||
if (!((count _textColor) in [6,8])) exitWith { ERROR_1("bad Tcolor %1",_textColor); "" };
|
||||
if (!((count _backgroundColor) in [6,8])) exitWith { ERROR_1("bad Bcolor %1",_textColor); "" };
|
||||
|
||||
if (_autoMultiline) then {
|
||||
private _magicWidth = 0.75;
|
||||
private _words = _text splitString " ";
|
||||
private _lines = [];
|
||||
while {_words isNotEqualTo []} do {
|
||||
private _size = count _words;
|
||||
while {_size > 1} do {
|
||||
private _testLine = (_words select [0, _size]) joinString " ";
|
||||
if ((_testLine getTextWidth ["ACE_Stencil", _textSize]) < _magicWidth) exitWith {};
|
||||
_size = _size - 1;
|
||||
};
|
||||
_lines pushBack ((_words select [0, _size]) joinString " ");
|
||||
_words = _words select [_size, (count _words) - _size];
|
||||
};
|
||||
_text = _lines joinString "\n";
|
||||
};
|
||||
|
||||
// return
|
||||
format ['#(rgb,%1,%1,3)text(1,1,"ACE_Stencil",%2,"#%3","#%4","%5")', _dimension, _textSize, _backgroundColor, _textColor, _text]
|
37
addons/tagging/functions/fnc_stencilVehicle.sqf
Normal file
37
addons/tagging/functions/fnc_stencilVehicle.sqf
Normal file
@ -0,0 +1,37 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: PabstMirror
|
||||
* Handles 3den attribute for vehicle ID markings
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
* 1: Display Text <STRING>
|
||||
* 2: Text Size <NUMBER> (Optional)
|
||||
* 3: Text Color <STRING> (Optional)
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [truck, "BARVO-1 Bastards"] call ace_tagging_fnc_stencilVehicle
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
params [
|
||||
["_vehicle", objNull, [objNull]],
|
||||
["_text", "", [""]],
|
||||
["_textSize", 0.3, [0]], // Fits about 7-8 chars in width
|
||||
["_textcolor", "f7e9e1f8", [""]] // making text color slightly transparent (f8) fixes a "shimmering" problem (possibly related to HBAO)
|
||||
];
|
||||
TRACE_2("",_vehicle,_text);
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
if (_text == "") exitWith {};
|
||||
private _clanSel = getText (configOf _vehicle >> "selectionClan");
|
||||
if (!(_clanSel in selectionNames _vehicle)) exitWith { TRACE_1("no tag",_clanSel); };
|
||||
|
||||
private _texture = [_text, _textSize, _textColor, "00000000", true] call FUNC(generateStencilTexture);
|
||||
TRACE_1("",_texture);
|
||||
if (_texture == "") exitWith { ERROR_1("bad texture params %1",_this); };
|
||||
[[], [], _texture, _vehicle, objNull, "", "", true] call FUNC(createTag); // apply texture and send event
|
@ -350,5 +350,11 @@
|
||||
<Chinesesimp>喷漆可喷涂在墙壁上</Chinesesimp>
|
||||
<Chinese>噴漆可噴塗在牆壁上</Chinese>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Tagging_stencilVehicle">
|
||||
<English>Vehicle ID Marking</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Tagging_stencilVehicle_tooltip">
|
||||
<English>Replaces clan tag with stenciled text</English>
|
||||
</Key>
|
||||
</Package>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user