From 739405d716064846a2ea2face356fb6b8c3d7a48 Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 14 Jul 2024 01:01:44 +0200 Subject: [PATCH] Add work-around for SplashDamage errors --- .../plugins/splashdamage2/Splash_Damage_2_0.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/plugins/splashdamage2/Splash_Damage_2_0.lua b/resources/plugins/splashdamage2/Splash_Damage_2_0.lua index bba9aea5..1aac52c1 100644 --- a/resources/plugins/splashdamage2/Splash_Damage_2_0.lua +++ b/resources/plugins/splashdamage2/Splash_Damage_2_0.lua @@ -541,6 +541,20 @@ function track_wpns() end function onWpnEvent(event) + --[[ + What follows is a work-around for what is presumed to be a DCS-bug: + https://forum.dcs.world/topic/353679-possible-bug-in-objectgettypename-during-s_event_kill/ + ]]-- + if event.weapon then + local status, retval = pcall(event.weapon.getTypeName, event.weapon) + if not status then + -- gameMsg(tostring(event.id)..' WTF?\n'..tostring(retval)) + -- gameMsg(mist.utils.tableShow(event)) + -- gameMsg(tostring(event.weapon.getTypeName)) + return + end + end + -- end of work-around if event.weapon and ignoredWeaps[event.weapon:getTypeName()] then return end