33 lines
664 B
GDScript3
33 lines
664 B
GDScript3
|
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())
|
||
|
unhandled_ping_count += 1
|
||
|
total_ping_count += 1
|
||
|
ping_sound.play()
|
||
|
OS.request_attention()
|
||
|
|
||
|
|
||
|
func _on_ping_handled():
|
||
|
unhandled_ping_count -= 1
|
||
|
current_ping_id += 1
|