From 7a5aa3a4f94102519c02bc63b8a37d80f0183494 Mon Sep 17 00:00:00 2001 From: funkyfranky Date: Wed, 15 Aug 2018 00:13:33 +0200 Subject: [PATCH] bla --- .../Moose/Functional/Warehouse.lua | 29 ++++++++++++------- Moose Development/Moose/Wrapper/Group.lua | 27 +++++++++++------ 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/Moose Development/Moose/Functional/Warehouse.lua b/Moose Development/Moose/Functional/Warehouse.lua index 34e90698e..b9b5ac0cb 100644 --- a/Moose Development/Moose/Functional/Warehouse.lua +++ b/Moose Development/Moose/Functional/Warehouse.lua @@ -2053,19 +2053,26 @@ function WAREHOUSE:_GetIDsFromGroup(group) return _wid,_aid,_rid end - -- Group name - local name=group:GetName() - - -- Get ids - local wid,aid,rid=analyse(name) + if group then - -- Debug info - self:E(self.wid..string.format("Group Name = %s", tostring(name))) - self:E(self.wid..string.format("Warehouse ID = %s", tostring(wid))) - self:E(self.wid..string.format("Asset ID = %s", tostring(aid))) - self:E(self.wid..string.format("Request ID = %s", tostring(rid))) + -- Group name + local name=group:GetName() + + -- Get ids + local wid,aid,rid=analyse(name) - return wid,aid,rid + -- Debug info + self:E(self.wid..string.format("Group Name = %s", tostring(name))) + self:E(self.wid..string.format("Warehouse ID = %s", tostring(wid))) + self:E(self.wid..string.format("Asset ID = %s", tostring(aid))) + self:E(self.wid..string.format("Request ID = %s", tostring(rid))) + + return wid,aid,rid + else + self:E("WARNING: Group not found in GetIDsFromGroup() function!") + end + + end --- Filter stock assets by table entry. diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index f78f9ef04..96b44357d 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -1460,9 +1460,11 @@ function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) -- -- Get the units of the group. local units=self:GetUnits() - for UnitID,_unit in pairs(units) do + local x + local y + for UnitID=1,#units do - local unit=_unit --Wrapper.Unit#UNIT + local unit=units[UnitID] --Wrapper.Unit#UNIT -- Get closest parking spot of current unit. Note that we look for occupied spots since the unit is currently sitting on it! local Parkingspot, TermialID, Distance=unit:GetCoordinate():GetClosestParkingSpot(airbase) @@ -1472,20 +1474,27 @@ function GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) -- -- Get unit coordinates for respawning position. local uc=unit:GetCoordinate() - SpawnTemplate.units[UnitID].x = Parkingspot.x - SpawnTemplate.units[UnitID].y = Parkingspot.z - SpawnTemplate.units[UnitID].alt = Parkingspot.y + + + SpawnTemplate.units[UnitID].x = uc.x --Parkingspot.x + SpawnTemplate.units[UnitID].y = uc.z --Parkingspot.z + SpawnTemplate.units[UnitID].alt = uc.y --Parkingspot.y SpawnTemplate.units[UnitID].parking = TermialID SpawnTemplate.units[UnitID].parking_id = nil + + if UnitID==1 then + x=uc.x + y=uc.z + end end - SpawnPoint.x = AirbaseCoord.x - SpawnPoint.y = AirbaseCoord.z + SpawnPoint.x = x --AirbaseCoord.x + SpawnPoint.y = y --AirbaseCoord.z - SpawnTemplate.x = AirbaseCoord.x - SpawnTemplate.y = AirbaseCoord.z + SpawnTemplate.x = x --AirbaseCoord.x + SpawnTemplate.y = y --AirbaseCoord.z -- Set uncontrolled state. SpawnTemplate.uncontrolled=Uncontrolled