Commit 2de482165862fe94791c77a01d1e0f3b8b6d1e4c
1 parent
ae0df041
Version 0.18.4 published
Showing
6 changed files
with
161 additions
and
112 deletions
CHANGELOG.md
... | ... | @@ -8,14 +8,22 @@ and this project adheres to the versioning of Factorio, so 0.18.x will be at lea |
8 | 8 | |
9 | 9 | ## [0.18.4] - 2020-06-07 |
10 | 10 | ### General |
11 | -Based onyuser feedback updated the mod | |
11 | +Based on user feedback updated the mod | |
12 | + | |
13 | +### Added | |
14 | +- Added the possibility to copy the results (from recent and also the current) to the display | |
12 | 15 | |
13 | 16 | ### Changed |
14 | 17 | - Window now remember last location when opened |
18 | +- Updated the BS button (it's backspace people...) so it now has a nice icon instead of the letters | |
19 | +- Recent results now add to the top, instead of the bottom | |
20 | +- When calculator is opened it focues on the display for entering the equation | |
21 | +- You can click pretty much anywhere now and it focues on the display for entering the equation | |
15 | 22 | |
16 | 23 | ### Fixed |
17 | 24 | - On multiplayer session the window would lag behind while dragging, because the location would be saved on server. This isn't going to happen anymore, hopefully (not tested yet). |
18 | 25 | - When window is moved out of boundaries, when reopened, it will correct itself to be fully in sight again. |
26 | +- Settings had weird default values (were set 2 times) | |
19 | 27 | |
20 | 28 | ## [0.18.3] - 2020-06-07 |
21 | 29 | ### General | ... | ... |
calcui-styles.lua
... | ... | @@ -53,6 +53,13 @@ data:extend({ |
53 | 53 | }, |
54 | 54 | { |
55 | 55 | type = "sprite", |
56 | + name = "sprite_calcui_backspace", | |
57 | + filename = "__calculator-ui__/graphics/backspace.png", | |
58 | + width = 50, | |
59 | + height = 50 | |
60 | + }, | |
61 | + { | |
62 | + type = "sprite", | |
56 | 63 | name = "sprite_calcui_red", |
57 | 64 | filename = "__calculator-ui__/graphics/red.png", |
58 | 65 | width = 50, | ... | ... |
calculator.lua
... | ... | @@ -6,9 +6,9 @@ local function get_gui_root(player) |
6 | 6 | end |
7 | 7 | |
8 | 8 | -- ---------------------------------------------------------------- |
9 | -function show_think(player, enabled) | |
9 | +local function show_think(player, enabled) | |
10 | 10 | local root = get_gui_root(player) |
11 | - | |
11 | + | |
12 | 12 | if enabled then |
13 | 13 | root.calcui.calcui_table.calcui_table_col2.calcui_rant.sprite = "sprite_calcui_think" |
14 | 14 | root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.style.height = 196 |
... | ... | @@ -19,9 +19,9 @@ function show_think(player, enabled) |
19 | 19 | end |
20 | 20 | |
21 | 21 | -- ---------------------------------------------------------------- |
22 | -function show_rant(player, enabled) | |
22 | +local function show_rant(player, enabled) | |
23 | 23 | local root = get_gui_root(player) |
24 | - | |
24 | + | |
25 | 25 | if enabled then |
26 | 26 | root.calcui.calcui_table.calcui_table_col2.calcui_rant.sprite = "sprite_calcui_rant" |
27 | 27 | root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.style.height = 196 |
... | ... | @@ -40,7 +40,7 @@ local function destroy_calculator(player) |
40 | 40 | end |
41 | 41 | |
42 | 42 | -- ---------------------------------------------------------------- |
43 | -function fix_oob_ui(player) | |
43 | +local function fix_oob_ui(player) | |
44 | 44 | if global.gui_position[player.index].x < 0 then |
45 | 45 | global.gui_position[player.index].x = 0 |
46 | 46 | end |
... | ... | @@ -58,33 +58,40 @@ function fix_oob_ui(player) |
58 | 58 | if global.gui_position[player.index].y + height > player.display_resolution.height then |
59 | 59 | global.gui_position[player.index].y = player.display_resolution.height - height |
60 | 60 | end |
61 | - --global.gui_position[player.index] | |
62 | 61 | end |
63 | 62 | |
64 | 63 | -- ---------------------------------------------------------------- |
65 | 64 | function show_calculator(player) |
66 | 65 | local root = get_gui_root(player) |
67 | 66 | |
67 | + if not global.recent_results then | |
68 | + global.recent_results = {} | |
69 | + if not global.recent_results[player.index] then | |
70 | + global.recent_results[player.index] = {} | |
71 | + end | |
72 | + end | |
73 | + | |
68 | 74 | if not root.calcui then |
69 | 75 | local calcui = root.add({ |
70 | - type = "frame", | |
71 | - name = "calcui", | |
76 | + type = "frame", | |
77 | + name = "calcui", | |
72 | 78 | style = "dialog_frame", |
73 | 79 | direction = "vertical" |
74 | 80 | }) |
75 | - | |
81 | + | |
76 | 82 | local flow = calcui.add({ |
77 | - type = "flow", | |
83 | + type = "flow", | |
78 | 84 | name = "calcui_flow" |
79 | 85 | }) |
80 | 86 | flow.style.horizontally_stretchable = "on" |
81 | - | |
87 | + | |
82 | 88 | flow.add({ |
83 | - type = "label", | |
84 | - caption = {"calculator-ui.title"}, | |
89 | + type = "label", | |
90 | + name = "calcui_title", | |
91 | + caption = {"calculator-ui.title"}, | |
85 | 92 | style = "frame_title" |
86 | 93 | }).drag_target = calcui |
87 | - | |
94 | + | |
88 | 95 | local widget = flow.add({ |
89 | 96 | type = "empty-widget", |
90 | 97 | style = "draggable_space_header", |
... | ... | @@ -94,30 +101,30 @@ function show_calculator(player) |
94 | 101 | widget.style.horizontally_stretchable = "on" |
95 | 102 | widget.style.minimal_width = 24 |
96 | 103 | widget.style.natural_height = 24 |
97 | - | |
104 | + | |
98 | 105 | flow.add({ |
99 | - type = "sprite-button", | |
100 | - sprite = "utility/close_white", | |
101 | - style = "frame_action_button", | |
106 | + type = "sprite-button", | |
107 | + sprite = "utility/close_white", | |
108 | + style = "frame_action_button", | |
102 | 109 | name = "calcui_close" |
103 | 110 | }) |
104 | - | |
111 | + | |
105 | 112 | local table = calcui.add({ |
106 | - type = "table", | |
107 | - name = "calcui_table", | |
108 | - column_count = "2", | |
113 | + type = "table", | |
114 | + name = "calcui_table", | |
115 | + column_count = "2", | |
109 | 116 | vertical_centering = "false" |
110 | 117 | }) |
111 | - | |
118 | + | |
112 | 119 | local col1 = table.add({ |
113 | - type = "flow", | |
114 | - name = "calcui_table_col1", | |
120 | + type = "flow", | |
121 | + name = "calcui_table_col1", | |
115 | 122 | direction = "vertical" |
116 | 123 | }) |
117 | - | |
124 | + | |
118 | 125 | local display = col1.add({ |
119 | - type = "textfield", | |
120 | - caption = "", | |
126 | + type = "textfield", | |
127 | + caption = "", | |
121 | 128 | name = "calcui_display" |
122 | 129 | }) |
123 | 130 | display.style.width = 212 |
... | ... | @@ -125,7 +132,7 @@ function show_calculator(player) |
125 | 132 | local row1 = col1.add({type="flow", name="calcui_col1_row1", direction="horizontal"}) |
126 | 133 | row1.add({type="sprite-button", style="calcui_button_style_light", caption="CE", name="calcui_button_CE"}).sprite = "sprite_calcui_light" -- CE = Clear Entry (just this line) |
127 | 134 | row1.add({type="sprite-button", style="calcui_button_style_light", caption="C", name="calcui_button_C"}).sprite = "sprite_calcui_light" -- C = Clear (all, past results as well) |
128 | - row1.add({type="sprite-button", style="calcui_button_style_light", caption="BS", name="calcui_button_BS"}).sprite = "sprite_calcui_light" | |
135 | + row1.add({type="sprite-button", style="calcui_button_style_light", caption="", name="calcui_button_BS"}).sprite = "sprite_calcui_backspace" | |
129 | 136 | row1.add({type="sprite-button", style="calcui_button_style_light", caption="/", name="calcui_button_DIV"}).sprite = "sprite_calcui_light" |
130 | 137 | |
131 | 138 | local row2 = col1.add({type="flow", name="calcui_col1_row2", direction="horizontal"}) |
... | ... | @@ -153,43 +160,54 @@ function show_calculator(player) |
153 | 160 | row5.add({type="sprite-button", style="calcui_button_style_red", caption="=", name="calcui_button_EQU"}).sprite = "sprite_calcui_red" |
154 | 161 | |
155 | 162 | local col2 = table.add({ |
156 | - type = "flow", | |
157 | - name = "calcui_table_col2", | |
163 | + type = "flow", | |
164 | + name = "calcui_table_col2", | |
158 | 165 | direction = "vertical" |
159 | 166 | }) |
160 | 167 | |
161 | 168 | local result = col2.add({ |
162 | - type = "label", | |
163 | - caption = "= ", | |
164 | - name = "calcui_display_result" | |
169 | + type = "flow", | |
170 | + name = "calcui_result", | |
171 | + direction = "horizontal" | |
165 | 172 | }) |
166 | - result.style.font = "default-large" | |
167 | - | |
168 | - local rant = col2.add({ | |
173 | + | |
174 | + result.add({ | |
175 | + type = "label", | |
176 | + caption = "=", | |
177 | + name = "calcui_display_sign" | |
178 | + }).style.font = "default-large" | |
179 | + | |
180 | + result.add({ | |
181 | + type = "label", | |
182 | + caption = "", | |
183 | + name = "calcui_copy_display_result" | |
184 | + }).style.font = "default-large" | |
185 | + | |
186 | + col2.add({ | |
169 | 187 | type = "sprite", |
170 | 188 | name = "calcui_rant" |
171 | 189 | }) |
172 | - | |
190 | + | |
173 | 191 | col2.add({ |
174 | - type = "line", | |
192 | + type = "line", | |
193 | + name = "calcui_line", | |
175 | 194 | direction = "horizontal" |
176 | 195 | }) |
177 | - | |
196 | + | |
178 | 197 | local scroll = col2.add({ |
179 | 198 | type = "scroll-pane", |
180 | 199 | name = "calcui_scroll_pane" |
181 | 200 | }) |
182 | 201 | scroll.style.height = 252 |
183 | - | |
184 | - local recents = scroll.add({ | |
185 | - type = "table", | |
186 | - caption = "", | |
187 | - name = "calcui_result_table", | |
188 | - column_count = "2" | |
189 | - }) | |
190 | - recents.style.column_alignments[1] = "right" | |
191 | - | |
192 | - | |
202 | + | |
203 | + scroll.add({ | |
204 | + type = "table", | |
205 | + caption = "", | |
206 | + name = "calcui_result_table", | |
207 | + column_count = "3" | |
208 | + }).style.column_alignments[1] = "right" | |
209 | + | |
210 | + | |
193 | 211 | -- use last saved location or center the gui |
194 | 212 | if not global.gui_position then |
195 | 213 | global.gui_position = {} |
... | ... | @@ -197,16 +215,19 @@ function show_calculator(player) |
197 | 215 | if global.gui_position[player.index] then |
198 | 216 | -- fix weird saved positions (out of reach) |
199 | 217 | fix_oob_ui(player) |
200 | - | |
218 | + | |
201 | 219 | calcui.location = global.gui_position[player.index] |
202 | 220 | else |
203 | 221 | calcui.force_auto_center() |
204 | 222 | end |
223 | + | |
224 | + -- focus on display | |
225 | + display.focus() | |
205 | 226 | end |
206 | 227 | end |
207 | 228 | |
208 | 229 | -- ---------------------------------------------------------------- |
209 | -function hide_calculator(player) | |
230 | +local function hide_calculator(player) | |
210 | 231 | destroy_calculator(player) |
211 | 232 | end |
212 | 233 | |
... | ... | @@ -227,36 +248,65 @@ function focus_on_input(player) |
227 | 248 | end |
228 | 249 | |
229 | 250 | -- ---------------------------------------------------------------- |
230 | -function clear_equation(player) | |
251 | +local function clear_equation(player) | |
231 | 252 | local root = get_gui_root(player) |
232 | 253 | root.calcui.calcui_table.calcui_table_col1.calcui_display.text = "" |
233 | 254 | end |
234 | 255 | |
235 | 256 | -- ---------------------------------------------------------------- |
236 | -function process_ce_key(player, button) | |
257 | +local function process_ce_key(player, button) | |
237 | 258 | local root = get_gui_root(player) |
238 | 259 | clear_equation(player) |
239 | - root.calcui.calcui_table.calcui_table_col2.calcui_display_result.caption = "=" | |
240 | - root.calcui.calcui_table.calcui_table_col2.calcui_display_result.tooltip = "" | |
260 | + root.calcui.calcui_table.calcui_table_col2.calcui_result.calcui_copy_display_result.caption = "" | |
261 | + root.calcui.calcui_table.calcui_table_col2.calcui_result.calcui_copy_display_result.tooltip = "" | |
241 | 262 | end |
242 | 263 | |
243 | 264 | -- ---------------------------------------------------------------- |
244 | -function process_c_key(player, button) | |
265 | +local function process_c_key(player, button) | |
245 | 266 | local root = get_gui_root(player) |
246 | 267 | process_ce_key(player, button) |
247 | 268 | root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.clear() |
269 | + global.recent_results[player.index] = {} | |
248 | 270 | end |
249 | 271 | |
250 | 272 | -- ---------------------------------------------------------------- |
251 | -function process_backspace_key(player, button) | |
273 | +local function process_backspace_key(player, button) | |
252 | 274 | local root = get_gui_root(player) |
253 | 275 | root.calcui.calcui_table.calcui_table_col1.calcui_display.text = string.sub(root.calcui.calcui_table.calcui_table_col1.calcui_display.text, 1, -2) |
254 | 276 | end |
255 | 277 | |
256 | 278 | -- ---------------------------------------------------------------- |
257 | -function fix_equation(equation, root) | |
279 | +local function draw_recent_table(player) | |
280 | + local root = get_gui_root(player) | |
281 | + | |
282 | + -- drop old table | |
283 | + root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.clear() | |
284 | + | |
285 | + for i, result in ipairs(global.recent_results[player.index]) do | |
286 | + root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.add({ | |
287 | + type = "label", | |
288 | + name = "calcui_copy_equation_" .. i, | |
289 | + caption = result["equation"], | |
290 | + tooltip = {"calculator-ui.recent_tooltip"} | |
291 | + }) | |
292 | + root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.add({ | |
293 | + type = "label", | |
294 | + name = "calcui_sign_" .. i, | |
295 | + caption = "=" | |
296 | + }) | |
297 | + root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.add({ | |
298 | + type = "label", | |
299 | + name = "calcui_copy_result_" .. i, | |
300 | + caption = result["result"] | |
301 | + }) | |
302 | + end | |
303 | + root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.scroll_to_top() | |
304 | +end | |
305 | + | |
306 | +-- ---------------------------------------------------------------- | |
307 | +local function fix_equation(equation, root) | |
258 | 308 | local result = equation |
259 | - local prev_result = root.calcui.calcui_table.calcui_table_col2.calcui_display_result.tooltip | |
309 | + local prev_result = root.calcui.calcui_table.calcui_table_col2.calcui_result.calcui_copy_display_result.tooltip | |
260 | 310 | |
261 | 311 | |
262 | 312 | -- 1. visible part |
... | ... | @@ -308,7 +358,7 @@ function fix_equation(equation, root) |
308 | 358 | |
309 | 359 | -- fix percentage |
310 | 360 | result = result:gsub("(%%)", "/100") |
311 | - | |
361 | + | |
312 | 362 | -- fix danish keyboard |
313 | 363 | result = result:gsub(",", ".") |
314 | 364 | result = result:gsub(";", ",") |
... | ... | @@ -321,17 +371,17 @@ end |
321 | 371 | function process_equal_key(player, button) |
322 | 372 | local root = get_gui_root(player) |
323 | 373 | local original_equation = root.calcui.calcui_table.calcui_table_col1.calcui_display.text; |
324 | - | |
374 | + | |
325 | 375 | equation, original_equation = fix_equation(original_equation, root) |
326 | - | |
376 | + | |
327 | 377 | -- just testing |
328 | 378 | --root.calcui.calcui_table.calcui_table_col1.calcui_display.text = equation |
329 | - | |
379 | + | |
330 | 380 | if not (equation == nil or equation == "") then |
331 | 381 | local status, retval = pcall(function() |
332 | 382 | return load("return " .. equation)() |
333 | 383 | end) |
334 | - root.calcui.calcui_table.calcui_table_col2.calcui_display_result.tooltip = retval | |
384 | + root.calcui.calcui_table.calcui_table_col2.calcui_result.calcui_copy_display_result.tooltip = retval | |
335 | 385 | if not (retval == math.huge or retval ~= retval) then |
336 | 386 | status, retval_show = pcall(function() |
337 | 387 | local result = string.format("%0." .. settings.get_player_settings(player)["calcui-decimal-places"].value .. "f", retval) |
... | ... | @@ -352,31 +402,22 @@ function process_equal_key(player, button) |
352 | 402 | else |
353 | 403 | if retval <= 0 then |
354 | 404 | show_think(player, true) |
355 | - else | |
405 | + else | |
356 | 406 | show_rant(player, false) |
357 | 407 | end |
358 | 408 | end |
359 | - root.calcui.calcui_table.calcui_table_col2.calcui_display_result.caption = "= " .. retval_show | |
360 | - | |
409 | + root.calcui.calcui_table.calcui_table_col2.calcui_result.calcui_copy_display_result.caption = retval_show | |
410 | + | |
361 | 411 | -- only write in recent table if actually a result |
362 | 412 | if status then |
363 | - -- check last equation and only insert if not the same | |
364 | - local item_size = #root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.children | |
365 | - | |
366 | - if item_size == 0 or root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.children[item_size-1].caption ~= original_equation then | |
367 | - local recent_equation = root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.add({ | |
368 | - type = "label", | |
369 | - name = "calcui_recent_equation_" .. item_size, | |
370 | - caption = original_equation, | |
371 | - tooltip = {"calculator-ui.recent_tooltip"} | |
372 | - }) | |
373 | - local recent_result = root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table.add({ | |
374 | - type = "label", | |
375 | - name = "calcui_recent_result_" .. item_size, | |
376 | - caption = root.calcui.calcui_table.calcui_table_col2.calcui_display_result.caption | |
413 | + -- check first equation and only insert if not the same | |
414 | + if #global.recent_results[player.index] == 0 or global.recent_results[player.index][1]["equation"] ~= original_equation then | |
415 | + table.insert(global.recent_results[player.index], 1, { | |
416 | + equation = original_equation, | |
417 | + result = retval_show | |
377 | 418 | }) |
378 | - root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.scroll_to_bottom() | |
379 | 419 | end |
420 | + draw_recent_table(player) | |
380 | 421 | end |
381 | 422 | end |
382 | 423 | |
... | ... | @@ -386,7 +427,7 @@ function process_equal_key(player, button) |
386 | 427 | end |
387 | 428 | |
388 | 429 | -- ---------------------------------------------------------------- |
389 | -function display_addchar(player, char) | |
430 | +local function display_addchar(player, char) | |
390 | 431 | local root = get_gui_root(player) |
391 | 432 | root.calcui.calcui_table.calcui_table_col1.calcui_display.text = root.calcui.calcui_table.calcui_table_col1.calcui_display.text .. char |
392 | 433 | show_rant(player, false) |
... | ... | @@ -428,10 +469,10 @@ function handle_calcui_click(event, player) |
428 | 469 | local event_name = event.element.name |
429 | 470 | local button_prefix = "calcui_button_" |
430 | 471 | local button_prefix_len = string.len(button_prefix) |
431 | - | |
432 | - local recent_prefix = "calcui_recent_" | |
433 | - local recent_prefix_len = string.len(recent_prefix); | |
434 | - | |
472 | + | |
473 | + local copy_prefix = "calcui_copy_" | |
474 | + local copy_prefix_len = string.len(copy_prefix); | |
475 | + | |
435 | 476 | -- calculator buttons |
436 | 477 | if string.sub(event_name, 1, button_prefix_len) == button_prefix then |
437 | 478 | show_rant(player, false) |
... | ... | @@ -442,7 +483,7 @@ function handle_calcui_click(event, player) |
442 | 483 | if dispatch_func then |
443 | 484 | dispatch_func(player, button) |
444 | 485 | end |
445 | - | |
486 | + | |
446 | 487 | local addchar = button_addchar[button] |
447 | 488 | if addchar then |
448 | 489 | display_addchar(player, addchar) |
... | ... | @@ -450,15 +491,22 @@ function handle_calcui_click(event, player) |
450 | 491 | -- close button |
451 | 492 | elseif event_name == "calcui_close" then |
452 | 493 | hide_calculator(player) |
453 | - -- recent results | |
454 | - elseif string.sub(event_name, 1, recent_prefix_len) == recent_prefix then | |
455 | - if event.button == defines.mouse_button_type.left and | |
494 | + -- copy results | |
495 | + elseif string.sub(event_name, 1, copy_prefix_len) == copy_prefix then | |
496 | + if event.button == defines.mouse_button_type.left and | |
456 | 497 | event.shift == true then |
457 | - -- copy equation to display | |
498 | + -- copy equation or result to display | |
458 | 499 | local root = get_gui_root(player) |
459 | - root.calcui.calcui_table.calcui_table_col1.calcui_display.text = root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table[event_name].caption | |
500 | + if event_name == "calcui_copy_display_result" then | |
501 | + root.calcui.calcui_table.calcui_table_col1.calcui_display.text = root.calcui.calcui_table.calcui_table_col2.calcui_result.calcui_copy_display_result.caption | |
502 | + else | |
503 | + root.calcui.calcui_table.calcui_table_col1.calcui_display.text = root.calcui.calcui_table.calcui_table_col2.calcui_scroll_pane.calcui_result_table[event_name].caption | |
504 | + end | |
460 | 505 | focus_on_input(player) |
461 | 506 | end |
507 | + -- if else focus on focus on display | |
508 | + else | |
509 | + focus_on_input(player) | |
462 | 510 | end |
463 | 511 | end |
464 | 512 | |
... | ... | @@ -477,7 +525,6 @@ end |
477 | 525 | -- ---------------------------------------------------------------- |
478 | 526 | function calcui_on_gui_location_changed(event) |
479 | 527 | if event.element.name == "calcui" then |
480 | - local root = get_gui_root(game.players[event.player_index]) | |
481 | 528 | if not global.gui_position then |
482 | 529 | global.gui_position = {} |
483 | 530 | end | ... | ... |
control.lua
... | ... | @@ -27,17 +27,6 @@ function debug_log(f, str) |
27 | 27 | end |
28 | 28 | |
29 | 29 | -- ---------------------------------------------------------------- |
30 | -local function get_gui_root(player) | |
31 | - return player.gui.screen | |
32 | -end | |
33 | - | |
34 | --- ---------------------------------------------------------------- | |
35 | -function destroy_calcui_gui(player) | |
36 | - local root = get_gui_root(player) | |
37 | - root.calcui_gui_top.destroy() | |
38 | -end | |
39 | - | |
40 | --- ---------------------------------------------------------------- | |
41 | 30 | local function shortcut(event) |
42 | 31 | if event.prototype_name == "calcui_4func" then |
43 | 32 | local player = game.players[event.player_index] |
... | ... | @@ -52,8 +41,8 @@ local function on_gui_click(event) |
52 | 41 | local event_name = event.element.name |
53 | 42 | debug_print("event_name " .. event_name) |
54 | 43 | local player = game.players[event.player_index] |
55 | - | |
56 | - local calcui_prefix = "calcui_" | |
44 | + | |
45 | + local calcui_prefix = "calcui" | |
57 | 46 | local possible_marcalc_prefix = string.sub( event_name, 1, string.len(calcui_prefix)) |
58 | 47 | if possible_marcalc_prefix == calcui_prefix then |
59 | 48 | handle_calcui_click(event, player) | ... | ... |
graphics/backspace.png
0 → 100644
653 Bytes
settings.lua
... | ... | @@ -6,13 +6,11 @@ data:extend({ |
6 | 6 | maximum_value = 10, |
7 | 7 | name = "calcui-decimal-places", |
8 | 8 | setting_type = "runtime-per-user", |
9 | - default_value = true | |
10 | 9 | }, |
11 | 10 | { |
12 | 11 | type = "bool-setting", |
13 | - default_value = 0, | |
12 | + default_value = false, | |
14 | 13 | name = "calcui-clear-on-calc", |
15 | 14 | setting_type = "runtime-per-user", |
16 | - default_value = false | |
17 | 15 | } |
18 | 16 | }) |
19 | 17 | \ No newline at end of file | ... | ... |