mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
start carrying phase
This commit is contained in:
parent
12062c0e25
commit
655f23b53c
@ -24,6 +24,8 @@ PREP(initPerson);
|
||||
PREP(isObjectOnObject);
|
||||
PREP(setCarryable);
|
||||
PREP(setDraggable);
|
||||
PREP(startCarry);
|
||||
PREP(startCarryPFH);
|
||||
PREP(startDrag);
|
||||
PREP(startDragPFH);
|
||||
|
||||
|
@ -27,7 +27,7 @@ _inBuilding = [_unit] call FUNC(isObjectOnObject);
|
||||
_unit playAction "released";
|
||||
|
||||
// prevent collision damage
|
||||
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
|
||||
["fixCollision", _unit] call EFUNC(common,localEvent);
|
||||
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
|
||||
|
||||
// release object
|
||||
@ -37,7 +37,7 @@ if (_target isKindOf "CAManBase") then {
|
||||
if (_target getVariable ["ACE_isUnconscious", false]) then {
|
||||
[_target, "unconscious", 2, true] call EFUNC(common,doAnimation);
|
||||
} else {
|
||||
[_target, "", 2, true] call EFUNC(common,doAnimation); //@todo "AinjPpneMrunSnonWnonDb_release" seems to fall back to unconsciousness anim. retest after config fix
|
||||
[_target, "", 2, true] call EFUNC(common,doAnimation); //@todo "AinjPpneMrunSnonWnonDb_release" seems to fall back to unconsciousness anim.
|
||||
};
|
||||
};
|
||||
|
||||
@ -54,5 +54,7 @@ _unit setVariable [QGVAR(draggedObject), objNull, true];
|
||||
// make object accesable for other units
|
||||
[objNull, _target, true] call EFUNC(common,claim);
|
||||
|
||||
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
|
||||
["fixFloating", _target, _target] call EFUNC(common,targetEvent);
|
||||
if !(_target isKindOf "CAManBase") then {
|
||||
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
|
||||
["fixFloating", _target, _target] call EFUNC(common,targetEvent);
|
||||
};
|
||||
|
@ -24,12 +24,22 @@ private "_inBuilding";
|
||||
_inBuilding = [_unit] call FUNC(isObjectOnObject);
|
||||
|
||||
// prevent collision damage
|
||||
["fixCollision", _unit, _unit] call EFUNC(common,targetEvent);
|
||||
["fixCollision", _unit] call EFUNC(common,localEvent);
|
||||
["fixCollision", _target, _target] call EFUNC(common,targetEvent);
|
||||
|
||||
// release object
|
||||
detach _target;
|
||||
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
[_unit, "", 2, true] call EFUNC(common,doAnimation);
|
||||
|
||||
if (_target getVariable ["ACE_isUnconscious", false]) then {
|
||||
[_target, "unconscious", 2, true] call EFUNC(common,doAnimation);
|
||||
} else {
|
||||
[_target, "", 2, true] call EFUNC(common,doAnimation); //@todo
|
||||
};
|
||||
};
|
||||
|
||||
// reselect weapon and re-enable sprint
|
||||
_unit selectWeapon primaryWeapon _unit;
|
||||
|
||||
@ -46,5 +56,7 @@ _unit setVariable [QGVAR(carriedObject), objNull, true];
|
||||
// make object accesable for other units
|
||||
[objNull, _target, true] call EFUNC(common,claim);
|
||||
|
||||
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
|
||||
["fixFloating", _target, _target] call EFUNC(common,targetEvent);
|
||||
if !(_target isKindOf "CAManBase") then {
|
||||
["fixPosition", _target, _target] call EFUNC(common,targetEvent);
|
||||
["fixFloating", _target, _target] call EFUNC(common,targetEvent);
|
||||
};
|
||||
|
57
addons/dragging/functions/fnc_startCarry.sqf
Normal file
57
addons/dragging/functions/fnc_startCarry.sqf
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Start the carrying process.
|
||||
*
|
||||
* Argument:
|
||||
* 0: Unit that should do the carrying (Object)
|
||||
* 1: Object to carry (Object)
|
||||
*
|
||||
* Return value:
|
||||
* NONE.
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
// check weight
|
||||
private "_weight";
|
||||
_weight = [_target] call FUNC(getWeight);
|
||||
|
||||
if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
|
||||
[localize "STR_ACE_Dragging_UnableToDrag"] call EFUNC(common,displayTextStructured);
|
||||
};
|
||||
|
||||
// select no weapon and stop sprinting
|
||||
_unit action ["SwitchWeapon", _unit, _unit, 99];
|
||||
|
||||
[_unit, "isDragging", true] call EFUNC(common,setforceWalkStatus);
|
||||
|
||||
// prevent multiple players from accessing the same object
|
||||
[_unit, _target, true] call EFUNC(common,claim);
|
||||
|
||||
private "_timer";
|
||||
_timer = 2;
|
||||
|
||||
// can't play action that depends on weapon if it was added the same frame
|
||||
/*[{_this playActionNow "grabDrag";}, _unit] call EFUNC(common,execNextFrame);*/ //@todo
|
||||
|
||||
// move a bit closer and adjust direction when trying to pick up a person
|
||||
if (_target isKindOf "CAManBase") then {
|
||||
/*[_target, "AinjPpneMrunSnonWnonDb_grab", 2, true] call EFUNC(common,doAnimation);
|
||||
_target setDir (getDir _unit + 180);
|
||||
_target setPos (getPos _unit vectorAdd (vectorDir _unit vectorMultiply 1.5));*/
|
||||
|
||||
_timer = 15;
|
||||
|
||||
|
||||
//@todo
|
||||
};
|
||||
|
||||
// prevents draging and carrying at the same time
|
||||
_unit setVariable [QGVAR(isCarrying), true, true];
|
||||
|
||||
[FUNC(startCarryPFH), 0.2, [_unit, _target], _timer] call CBA_fnc_addPerFrameHandler;
|
23
addons/dragging/functions/fnc_startCarryPFH.sqf
Normal file
23
addons/dragging/functions/fnc_startCarryPFH.sqf
Normal file
@ -0,0 +1,23 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_target", "_timeOut"];
|
||||
|
||||
_unit = _this select 0 select 0;
|
||||
_target = _this select 0 select 1;
|
||||
_timeOut = _this select 0 select 2;
|
||||
|
||||
// timeout. Done with lifting object. Start carrying process.
|
||||
if (time > _timeOut) exitWith {
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
// drop if in timeout
|
||||
private "_carriedObject";
|
||||
_carriedObject = _unit getVariable [QGVAR(carriedObject), objNull];
|
||||
|
||||
if (!isNull _carriedObject) exitWith {
|
||||
[_unit, _carriedObject] call FUNC(dropObject);
|
||||
};
|
||||
|
||||
[_unit, _target] call FUNC(carryObject);
|
||||
};
|
Loading…
Reference in New Issue
Block a user