From 0d474b2286c81665727b0e0a1efdc29e0672dd1e Mon Sep 17 00:00:00 2001 From: FlightControl Date: Sun, 5 Mar 2017 10:01:28 +0100 Subject: [PATCH] Updated Database --- Moose Development/Moose/Core/Database.lua | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua index ce3321062..2b511c62a 100644 --- a/Moose Development/Moose/Core/Database.lua +++ b/Moose Development/Moose/Core/Database.lua @@ -562,9 +562,16 @@ function DATABASE:_EventOnDeadOrCrash( Event ) self:F2( { Event } ) if Event.IniDCSUnit then - if self.UNITS[Event.IniDCSUnitName] then - self:DeleteUnit( Event.IniDCSUnitName ) - -- add logic to correctly remove a group once all units are destroyed... + if Event.IniObjectCategory == 3 then + if self.STATICS[Event.IniDCSUnitName] then + self:DeleteStatic( Event.IniDCSUnitName ) + end + else + if Event.IniObjectCategory == 1 then + if self.UNITS[Event.IniDCSUnitName] then + self:DeleteUnit( Event.IniDCSUnitName ) + end + end end end end @@ -577,8 +584,14 @@ function DATABASE:_EventOnPlayerEnterUnit( Event ) self:F2( { Event } ) if Event.IniUnit then - self:AddUnit( Event.IniDCSUnitName ) - self:AddGroup( Event.IniDCSGroupName ) + if Event.IniObjectCategory == 3 then + self:AddStatic( Event.IniDCSUnitName ) + else + if Event.IniObjectCategory == 1 then + self:AddUnit( Event.IniDCSUnitName ) + self:AddGroup( Event.IniDCSGroupName ) + end + end local PlayerName = Event.IniUnit:GetPlayerName() if not self.PLAYERS[PlayerName] then self:AddPlayer( Event.IniUnitName, PlayerName )