21 lines
518 B
GDScript
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)
|