diary/system/ping_system/ping_system.gd
2022-06-04 13:33:00 +02:00

31 lines
612 B
GDScript

extends Node
# warning-ignore:unused_signal
signal ping_handled
onready var ping_sound = get_node("PingSound")
var unhandled_ping_count = 0
var total_ping_count = 0
var current_ping_id = 0
func _input(event):
if event is InputEventKey:
if event.scancode == KEY_P and event.control and event.alt:
if event.pressed and !event.is_echo():
send_ping()
func send_ping():
if unhandled_ping_count < 15:
Data.messages.add_message("", Time.get_current_time(), Users.get_helper())
ping_sound.play()
OS.request_attention()
func _on_ping_handled():
unhandled_ping_count -= 1
current_ping_id += 1