Fix F_createManagedUnit changing side of target group

This commit is contained in:
Filip Maciejewski 2019-10-09 20:04:49 +02:00
parent 979105a05e
commit 5a7d47e23a
No known key found for this signature in database
GPG Key ID: 53D1504CC3DBCD46
1 changed files with 9 additions and 1 deletions

View File

@ -30,10 +30,18 @@ params [
["_placement", 0, [0]]
];
private _unit = _group createUnit [_type, _spawnPos, [], _placement, "FORM"];
// Create temp group, as we need to let the unit join the "correct side group".
// If we use the "correct side group" for the createUnit, the group would switch to the side of the unit written in the config.
private _groupTemp = createGroup [CIVILIAN, true];
private _unit = _groupTemp createUnit [_type, _spawnPos, [], _placement, "FORM"];
_unit addMPEventHandler ["MPKilled", {_this spawn kill_manager}];
_unit setRank _rank;
// Joint to target group to preserve Side
[_unit] joinSilent _group;
deleteGroup _groupTemp;
// Process KP object init
[_unit] call F_addObjectInit;