6 type = "frame", |
6 type = "frame", |
7 name = "set-goal", |
7 name = "set-goal", |
8 caption = {"set-goal-gui.title"}, |
8 caption = {"set-goal-gui.title"}, |
9 direction = "vertical" |
9 direction = "vertical" |
10 } |
10 } |
|
11 local goal_description_text = player.get_goal_description() |
|
12 if type(goal_description_text) == "table" |
|
13 then |
|
14 local translation_request_id = player.request_translation(goal_description_text) |
|
15 goal_description_text = "" |
|
16 if not storage.translation_requests |
|
17 then |
|
18 storage.translation_requests = {} |
|
19 end |
|
20 storage.translation_requests[translation_request_id] = {player_index=event.player_index, type = "goal-description"} |
|
21 end |
11 frame.add{ |
22 frame.add{ |
12 type = "text-box", |
23 type = "text-box", |
13 text = player.get_goal_description(), |
24 text = goal_description_text, |
14 name = "goal-description", |
25 name = "goal-description", |
15 style = "set-goal-gui-textbox", |
26 style = "set-goal-gui-textbox", |
16 icon_selector = true, |
27 icon_selector = true, |
17 } |
28 } |
18 local buttons_flow = frame.add{ |
29 local buttons_flow = frame.add{ |
48 and event.element.tags |
59 and event.element.tags |
49 and event.element.tags["owner-mod"] == "set-goal" |
60 and event.element.tags["owner-mod"] == "set-goal" |
50 then |
61 then |
51 if event.element.tags.action == "confirm" |
62 if event.element.tags.action == "confirm" |
52 then |
63 then |
53 player.set_goal_description(player.gui.goal["set-goal"]["goal-description"].text) |
64 player.set_goal_description(player.gui.goal["set-goal"]["goal-description"].text, player.get_goal_description() ~= "") |
54 player.gui.goal["set-goal"].destroy() |
65 player.gui.goal["set-goal"].destroy() |
55 elseif event.element.tags.action == "close" |
66 elseif event.element.tags.action == "close" |
56 then |
67 then |
57 player.gui.goal["set-goal"].destroy() |
68 player.gui.goal["set-goal"].destroy() |
58 end |
69 end |