mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix pre-spectator position saving
When staging a spectator (physically applying the spectator state) the unit position is saved for potential later restoration. This shouldn't be done multiple times since the function can be called again to reset staged units.
This commit is contained in:
parent
b87b4ea16a
commit
98b088f26f
@ -15,4 +15,6 @@
|
|||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
params ["_unit","_oldUnit"];
|
||||||
|
|
||||||
[_unit,false] call FUNC(setSpectator);
|
[_unit,false] call FUNC(setSpectator);
|
||||||
|
@ -40,13 +40,16 @@ _unit enableSimulation !_set;
|
|||||||
[_unit, _set, QGVAR(isStaged), side group _unit] call EFUNC(common,switchToGroupSide);
|
[_unit, _set, QGVAR(isStaged), side group _unit] call EFUNC(common,switchToGroupSide);
|
||||||
|
|
||||||
if (_set) then {
|
if (_set) then {
|
||||||
// Move and hide the player ASAP to avoid being seen
|
// Position should only be saved on first entry
|
||||||
GVAR(oldPos) = getPosATL _unit;
|
if !(GETVAR(_unit,GVAR(isStaged),false)) then {
|
||||||
_unit setPos (getMarkerPos QGVAR(respawn));
|
GVAR(oldPos) = getPosATL _unit;
|
||||||
|
};
|
||||||
|
|
||||||
// Ghosts can't talk
|
// Ghosts can't talk
|
||||||
[_unit, QGVAR(isStaged)] call EFUNC(common,hideUnit);
|
[_unit, QGVAR(isStaged)] call EFUNC(common,hideUnit);
|
||||||
[_unit, QGVAR(isStaged)] call EFUNC(common,muteUnit);
|
[_unit, QGVAR(isStaged)] call EFUNC(common,muteUnit);
|
||||||
|
|
||||||
|
_unit setPos (getMarkerPos QGVAR(respawn));
|
||||||
} else {
|
} else {
|
||||||
// Physical beings can talk
|
// Physical beings can talk
|
||||||
[_unit, QGVAR(isStaged)] call EFUNC(common,unhideUnit);
|
[_unit, QGVAR(isStaged)] call EFUNC(common,unhideUnit);
|
||||||
|
Loading…
Reference in New Issue
Block a user