mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
setPosATL
globally
This commit is contained in:
parent
fdbaeabc47
commit
04564b4e4f
@ -67,9 +67,30 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||
_clone setMimic "unconscious";
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(syncCorpse),{
|
||||
params ["_corpse"];
|
||||
[QGVAR(moveCorpse), {
|
||||
params ["_corpse", "_dir", "_pos"];
|
||||
_pos params ["_xPos", "_yPos", "_zPos"];
|
||||
|
||||
private _currentPos = getPosATL _corpse;
|
||||
|
||||
// Check if the corpse is already close to the target
|
||||
// If so, don't teleport
|
||||
if !(
|
||||
(_currentPos select 0 <= _xPos + 0.25) &&
|
||||
{_currentPos select 0 >= _xPos - 0.25} &&
|
||||
{_currentPos select 1 <= _yPos + 0.25} &&
|
||||
{_currentPos select 1 >= _yPos - 0.25} &&
|
||||
{_currentPos select 2 <= _zPos + 0.25} &&
|
||||
{_currentPos select 2 >= _zPos - 0.25}
|
||||
) then {
|
||||
// Set direction before position
|
||||
_corpse setDir _dir;
|
||||
|
||||
// Bring corpse back to clone's position
|
||||
_corpse setPosATL _pos;
|
||||
};
|
||||
|
||||
// Sync the corpse with its position
|
||||
[{
|
||||
_this awake true;
|
||||
|
||||
@ -79,19 +100,6 @@ if (isNil QGVAR(maxWeightCarryRun)) then {
|
||||
}, _corpse] call CBA_fnc_execNextFrame;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
[QGVAR(moveCorpse), {
|
||||
params ["_corpse", "_dir", "_pos"];
|
||||
|
||||
// Set direction before position
|
||||
_corpse setDir _dir;
|
||||
|
||||
// Bring corpse back to clone's position
|
||||
_corpse setPosATL _pos;
|
||||
|
||||
// Sync the corpse with its position
|
||||
[QGVAR(syncCorpse), _corpse] call CBA_fnc_globalEvent;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
||||
// Display event handler
|
||||
["MouseZChanged", {(_this select 1) call FUNC(handleScrollWheel)}] call CBA_fnc_addDisplayHandler;
|
||||
|
||||
|
@ -39,8 +39,8 @@ if (!isNull _target) then {
|
||||
_pos set [2, 0.05];
|
||||
};
|
||||
|
||||
// Move the unit where it is local
|
||||
[QGVAR(moveCorpse), [_target, getDir _unit + 180, _pos], _target] call CBA_fnc_targetEvent;
|
||||
// Move the unit globally (important, as it doesn't work otherwise)
|
||||
[QGVAR(moveCorpse), [_target, getDir _unit + 180, _pos]] call CBA_fnc_globalEvent;
|
||||
|
||||
// Unhide unit
|
||||
if (!_isObjectHidden) then {
|
||||
|
Loading…
Reference in New Issue
Block a user