tweak carry stance req., timeout certain PFH, exit PFH, debug

This commit is contained in:
commy2 2015-03-25 20:18:23 +01:00
parent 569a77d41b
commit 3634eaf568
8 changed files with 52 additions and 10 deletions

View File

@ -71,7 +71,7 @@ _actionID = _unit addAction [
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
// check everything
[FUNC(carryObjectPFH), 0, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
[FUNC(carryObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
// reset current dragging height.
GVAR(currentHeightChange) = 0;

View File

@ -1,11 +1,19 @@
// by commy2
#include "script_component.hpp"
#ifdef DEBUG_ENABLED_DRAGGING
systemChat format ["%1 carryObjectPFH running", time];
#endif
private ["_unit", "_target"];
_unit = _this select 0 select 0;
_target = _this select 0 select 1;
if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
// drop if the crate is destroyed
if !([_target] call EFUNC(common,isAlive)) then {
[_unit, _target] call FUNC(dropObject_carry);

View File

@ -62,7 +62,7 @@ _actionID = _unit addAction [
_unit setVariable [QGVAR(ReleaseActionID), _actionID];
// check everything
[FUNC(dragObjectPFH), 0, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
[FUNC(dragObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler;
// reset current dragging height.
GVAR(currentHeightChange) = 0;

View File

@ -1,11 +1,19 @@
// by commy2
#include "script_component.hpp"
#ifdef DEBUG_ENABLED_DRAGGING
systemChat format ["%1 dragObjectPFH running", time];
#endif
private ["_unit", "_target"];
_unit = _this select 0 select 0;
_target = _this select 0 select 1;
if !(_unit getVariable [QGVAR(isDragging), false]) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
// drop if the crate is destroyed
if !([_target] call EFUNC(common,isAlive)) then {
[_unit, _target] call FUNC(dropObject);

View File

@ -26,7 +26,7 @@ if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith {
};
private "_timer";
_timer = time + 2;
_timer = time + 5;
// handle objects vs persons
if (_target isKindOf "CAManBase") then {

View File

@ -1,6 +1,10 @@
// by commy2
#include "script_component.hpp"
#ifdef DEBUG_ENABLED_DRAGGING
systemChat format ["%1 startCarryPFH running", time];
#endif
private ["_unit", "_target", "_timeOut"];
_unit = _this select 0 select 0;
@ -18,11 +22,28 @@ if !([_target] call EFUNC(common,isAlive)) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
// timeout. Done with lifting object. Start carrying process.
if (time > _timeOut) exitWith {
[_unit, _target] call FUNC(carryObject);
// handle persons vs objects
if (_target isKindOf "CAManBase") then {
if (time > _timeOut) exitWith {
[_unit, _target] call FUNC(carryObject);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
} else {
if (time > _timeOut) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
// drop if in timeout
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};
// wait for the unit to stand up
if (stance _unit == "STAND") exitWith {
[_unit, _target] call FUNC(carryObject);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
// @todo, wait for stance _unit == "STAND"

View File

@ -1,6 +1,10 @@
// by commy2
#include "script_component.hpp"
#ifdef DEBUG_ENABLED_DRAGGING
systemChat format ["%1 startDragPFH running", time];
#endif
private ["_unit", "_target", "_timeOut"];
_unit = _this select 0 select 0;
@ -25,7 +29,6 @@ if (time > _timeOut) exitWith {
// drop if in timeout
private "_draggedObject";
_draggedObject = _unit getVariable [QGVAR(draggedObject), objNull];
[_unit, _draggedObject] call FUNC(dropObject);
};

View File

@ -1,6 +1,8 @@
#define COMPONENT dragging
#include "\z\ace\addons\main\script_mod.hpp"
//#define DEBUG_ENABLED_DRAGGING
#ifdef DEBUG_ENABLED_DRAGGING
#define DEBUG_MODE_FULL
#endif