From ffeea0ee8b153a5ef000eb7dd6b71abab060dc5b Mon Sep 17 00:00:00 2001 From: FlightControl Date: Tue, 21 Mar 2017 10:12:58 +0100 Subject: [PATCH] MP test --- Moose Development/Moose/Core/Event.lua | 10 +++++----- Moose Development/Moose/Wrapper/Client.lua | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 9b2472ef0..9e304ffcd 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -785,11 +785,11 @@ function EVENT:onEvent( Event ) if Event.weapon then Event.Weapon = Event.weapon Event.WeaponName = Event.Weapon:getTypeName() - Event.WeaponPlayerName = Event.Weapon:getPlayerName() - Event.WeaponUNIT = Event.WeaponPlayerName and CLIENT:FindByName( Event.WeaponName, '', true ) -- Sometimes, the weapon is a player unit! - Event.WeaponCoalition = Event.WeaponPlayerName and Event.Weapon:getCoalition() - Event.WeaponCategory = Event.WeaponPlayerName and Event.Weapon:getDesc().category - Event.WeaponTypeName = Event.WeaponPlayerName and Event.Weapon:getTypeName() + Event.WeaponUNIT = CLIENT:Find( Event.Weapon, '', true ) -- Sometimes, the weapon is a player unit! + Event.WeaponPlayerName = Event.WeaponUNIT and Event.Weapon:getPlayerName() + Event.WeaponCoalition = Event.WeaponUNIT and Event.Weapon:getCoalition() + Event.WeaponCategory = Event.WeaponUNIT and Event.Weapon:getDesc().category + Event.WeaponTypeName = Event.WeaponUNIT and Event.Weapon:getTypeName() --Event.WeaponTgtDCSUnit = Event.Weapon:getTarget() end diff --git a/Moose Development/Moose/Wrapper/Client.lua b/Moose Development/Moose/Wrapper/Client.lua index 4d08b3fea..afab71f1d 100644 --- a/Moose Development/Moose/Wrapper/Client.lua +++ b/Moose Development/Moose/Wrapper/Client.lua @@ -73,7 +73,7 @@ CLIENT = { -- Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*RAMP-Deploy Troops 3' ):Transport() ) -- Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*HOT-Deploy Troops 2' ):Transport() ) -- Mission:AddClient( CLIENT:FindByName( 'RU MI-8MTV2*RAMP-Deploy Troops 4' ):Transport() ) -function CLIENT:Find( DCSUnit ) +function CLIENT:Find( DCSUnit, Error ) local ClientName = DCSUnit:getName() local ClientFound = _DATABASE:FindClient( ClientName ) @@ -82,7 +82,9 @@ function CLIENT:Find( DCSUnit ) return ClientFound end - error( "CLIENT not found for: " .. ClientName ) + if not Error then + error( "CLIENT not found for: " .. ClientName ) + end end