cosmic/scripts/Base/Menu/send_message.gd
2024-05-23 01:47:18 +03:00

21 lines
518 B
GDScript

extends MenuAction
class_name MessageSenderAction
var dialogue
## Message which will be send on click
var msg: Message
## Additional formatting which can be applied by menu
var format = {}
## Gets message and translates it on display.
## Shown message should end with _LOCAL
func _ready():
var item_id = get_parent().menu.item_ids[id]
msg = Message.create(item_id, tr(item_id + "_LOCAL").format(format))
text = msg.shown
super._ready()
func action():
dialogue.send_message(msg)
get_parent().transit_menu(id)