Death check (universal)

Simple example of death check

function CheckDeath(Obj: TL2Live = nil): boolean;   // death check for the specified object     
begin                                                        
  if (Obj = nil) then Obj:= User;                         // if the object is not specified, then by default we use the user
  result:= false;                                         // specify result by default
  if (Obj.Dead) then begin                                // if we are dead, then
    result:= true;                                        // set the result of the function - true
    Engine.Msg('', 'Died, rising...', 128);               // print info to logs
    Engine.FaceControl(0, false);                         // turn off the interface
    while (User.Dead) and delay(999) do Engine.GoHome;    // while we are dead, every 1 second we try to rise
    delay(5555);                                          // waiting for additional time to boot (on low-end PCs, increase it)
  end; 
end;

begin
  if CheckDeath() then ...
end.