IsAlive: check if the given listener is an actual entity

This commit is contained in:
smallmodel committed 2023-11-26 20:38:14 +01:00
1 parent 5418d84c7e
commit 433305617c
1 file changed
+12 -5
+12 -5
View File
@@ -3576,13 +3576,20 @@ void ScriptThread::Angles_PointAt(Event *ev)
void ScriptThread::EventIsAlive(Event *ev)
{
Entity *ent = ev->GetEntity(1);
Entity* ent;
if (ent) {
ev->AddInteger(!ent->IsDead());
} else {
ev->AddInteger(0);
if (!ev->IsEntityAt(1)) {
ev->AddInteger(false);
return;
}
ent = ev->GetEntity(1);
if (!ent) {
ev->AddInteger(false);
return;
}
ev->AddInteger(ent->health > 0);
}
void ScriptThread::EventPopmenu(Event *ev)