From 3db0bf799667f371d98abff1942917ded81e8731 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 24 Oct 2021 21:03:55 +0100 Subject: [PATCH] mantis 7952: kill npc if health gone (original patch by Mandarinka Tasty with small change) --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 57a371865c..bef6737123 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3852,6 +3852,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api presence.setHealthWithUpdate(health); if (health <= 0) { + // check to see if it is an NPC and just remove it + if (presence.IsNPC) + { + INPCModule NPCmodule = World.RequestModuleInterface(); + if (NPCmodule != null) + NPCmodule.DeleteNPC(presence.UUID, World); + return; + } + float healthliveagain = 100; presence.ControllingClient.SendAgentAlertMessage("You died!", true); presence.setHealthWithUpdate(healthliveagain);