Unit creation in F_createManagedUnit in unscheduled

This commit is contained in:
Filip Maciejewski 2019-10-11 00:08:13 +02:00
parent 5a7d47e23a
commit 05a4d38e33
No known key found for this signature in database
GPG Key ID: 53D1504CC3DBCD46
1 changed files with 14 additions and 11 deletions

View File

@ -30,19 +30,22 @@ params [
["_placement", 0, [0]]
];
// 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";
isNil {
// 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;
_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;
// Joint to target group to preserve Side
[_unit] joinSilent _group;
deleteGroup _groupTemp;
// Process KP object init
[_unit] call F_addObjectInit;
// Process KP object init
[_unit] call F_addObjectInit;
};
_unit // return