Update terminate()

This commit is contained in:
JeremyStar™ 2024-03-28 14:05:44 +01:00
parent ef5c6f4535
commit 9fc1fb00bb

View file

@ -144,17 +144,17 @@ func lwarn(message: String, origin: String = "Bessere Tests") -> void: print_ric
func lerror(message: String, origin: String = "Bessere Tests") -> void: print_rich("[color=red]ERR! " + origin + ": " + message + "[/color]")
func lcrash(message: String, origin: String = "Bessere Tests") -> void:
print_rich("[color=red][b]CRSH " + origin + ": " + message + "[/b][/color]")
await terminate()
await terminate(69)
# Log message sanitization
func lsanitize(message: String) -> String:
return message.replace("[", "[lb]").replace("]", "[rb]").replace("[lb[rb]", "[lb]").replace("\n", "\\n")
# Terminates the engine
func terminate() -> void:
func terminate(exit_code: int = 0) -> void:
linfo("Shutting down...")
await get_tree().create_timer(0.25).timeout
get_tree().quit(69)
get_tree().quit(exit_code)
await get_tree().create_timer(5).timeout
printerr("Godot hasn't shutdown yet (bug?)")
await get_tree().create_timer(99999999).timeout