-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathGUI.lua
618 lines (556 loc) · 26.2 KB
/
GUI.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
local lib = require "__FARL__/lib_control"
local saveVar = lib.saveVar
local debugDump = lib.debugDump
local startsWith = lib.startsWith
local mod_gui = require '__core__/lualib/mod-gui'
local isValidSlot = function(slot, state)
if not slot or not slot.valid_for_read then return false end
--if state then
if state == "empty" then
return not slot.is_blueprint_setup()
elseif state == "setup" then
return slot.is_blueprint_setup()
end
--end
return true
end
local getBlueprints = function(book, state)
local main = book.get_inventory(defines.inventory.item_main)
local count = 0
local bps = {}
for i=1, #main do
if isValidSlot(main[i], state) then
count = count + 1
table.insert(bps, main[i])
end
end
return bps, count
end
GUI = {
ccWires = {
{"stg-ccNetWire-red"},
{"stg-ccNetWire-green"},
{"stg-ccNetWire-both"}
},
styleprefix = "farl_",
defaultStyles = {
label = "label",
button = "button",
checkbox = "checkbox"
},
bindings = {},
new = function()
local new = {}
setmetatable(new, {__index=GUI})
return new
end,
init = function(player)
local settings = Settings.loadByPlayer(player)
GUI.bindings = {
signals = settings.signals,
poles = settings.poles,
medium = settings.medium,
ccNet = settings.ccNet,
bridge = settings.bridge,
collectWood = settings.collectWood,
dropWood = settings.dropWood,
fullCruise = settings.fullCruise,
}
end,
add = function(parent, e, bind)
local gtype = e.type
if not e.style and GUI.defaultStyles[gtype] then
e.style = GUI.styleprefix..gtype
end
if bind then
if e.type == "checkbox" then
if e.state == nil then
e.state = false
end
if type(bind) == "string" then
e.state = Settings.loadByPlayer(parent.gui.player)[e.name]
else
e.state = false
GUI.callbacks[e.name] = bind
end
end
end
if e.type == "checkbox" and not e.state then
e.state = false
end
local ret = parent.add(e)
if bind and e.type == "textfield" then
ret.text = tostring(bind)
end
if e.type == "checkbox" and e.state == nil then
e.state = false
end
return ret
end,
addButton = function(parent, e, bind)
e.type = e.type or "button"
if bind then
GUI.callbacks[e.name] = bind
end
return GUI.add(parent, e, bind)
end,
addLabel = function(parent, e, bind)
if type(e) == "string" or type(e) == "number" or (type(e) == "table" and e[1]) then
e = {caption=e}
end
e.type="label"
return GUI.add(parent,e,bind)
end,
addTextfield = function(parent, e, bind)
e.type="textfield"
return GUI.add(parent, e, bind)
end,
addPlaceHolder = function(parent, count)
local c = count or 1
for _=1,c do
GUI.add(parent, {type="label", caption=""})
end
end,
createGui = function(player)
if mod_gui.get_frame_flow(player).farl ~= nil then return end
local psettings = Settings.loadByPlayer(player)
--GUI.init(player)
local farl = GUI.add(mod_gui.get_frame_flow(player), {type="frame", direction="vertical", name="farl"})
local rows = GUI.add(farl, {type="table", name="rows", column_count=1})
local span = 3
local buttons = GUI.add(rows, {type="table", name="buttons", column_count=span})
GUI.addButton(buttons, {name="start"}, GUI.toggleStart)
GUI.addButton(buttons, {name="cc"}, GUI.toggleCC)
GUI.create_settings_button(player, true)
local progressBar = GUI.add(rows,{type = "progressbar", name = "pathProgress", size = 200, value = 0.5, style = "production_progressbar"})
progressBar.style.maximal_width = 150
progressBar.visible = false
local progressLabel = GUI.addLabel(rows,{caption="", name = "pathLabel"})
progressLabel.visible = false
GUI.add(rows, {type = "flow", direction="vertical", name = "farlConfirm"})
GUI.add(rows, {type="checkbox", name="signals", caption={"tgl-signal"}}, "signals")
GUI.add(rows, {type="checkbox", name="poles", caption={"tgl-poles"}}, "poles")
GUI.add(rows, {type="checkbox", name="concrete", caption={"tgl-concrete"}}, "concrete")
GUI.add(rows,{type="checkbox", name="bulldozer", caption={"tgl-bulldozer"}, state=psettings.bulldozer, tooltip={"farl_tooltip_bulldozer"}})
GUI.add(rows,{type="checkbox", name="maintenance", caption={"tgl-maintenance"}, state=psettings.maintenance, tooltip={"farl_tooltip_maintenance"}})
GUI.add(rows, {type="checkbox", name="bridge", caption={"tgl-bridge"}, tooltip={"farl_tooltip_bridge"}}, "bridge")
end,
-- createAutopilotGui = function(entity, player)
--
-- end,
--
-- destroyAutopilotGui = function(entity, player)
--
-- end,
createPopup = function(player)
if mod_gui.get_frame_flow(player).farl then
local gui = GUI.add(mod_gui.get_frame_flow(player).farl.rows.farlConfirm, {type = "frame", direction="vertical", name = "farlConfirmFlow"})
GUI.addLabel(gui, {caption="Ghost rails detected, start Autopilot?"})
GUI.add(gui, {type = "checkbox", name = "autoPilot", caption="Drive without me", state = false})
local flow = GUI.add(gui, {type="flow", direction="horizontal", name="buttonFlow"})
GUI.addButton(flow, {name="confirmYes", caption="Yes"}, GUI.confirmYes)
GUI.addButton(flow, {name="confirmNo", caption="No"}, GUI.confirmNo)
end
end,
destroyGui = function(player)
if player.valid then
if mod_gui.get_frame_flow(player).farl == nil then return end
mod_gui.get_frame_flow(player).farl.destroy()
end
end,
onGuiClick = function(event, farl, player)
local name = event.element.name
if GUI.callbacks[name] then
return GUI.callbacks[name](event, farl, player)
end
if name == "debug" then
saveVar(global,"debug")
farl:debugInfo()
elseif startsWith(name,"load_bp_") then
local i = name:match("load_bp_(%w*)")
GUI.load_bp(event,farl, player,tonumber(i))
elseif startsWith(name,"save_bp_") then
local i = name:match("save_bp_(%w*)")
GUI.save_bp(event,farl, player,tonumber(i))
end
end,
on_gui_checked_state_changed = function(event, farl, player)
local name = event.element.name
if name == "bulldozer" then
return GUI.toggleBulldozer(event, farl, player)
end
if name == "maintenance" then
return GUI.toggleMaintenance(event, farl, player)
end
local psettings = Settings.loadByPlayer(player)
if name == "signals" or name == "poles" or name == "ccNet" or name == "flipPoles" or name == "collectWood" or name == "dropWood"
or name == "poleEntities" or name == "parallelTracks" or name == "concrete" or name == "railEntities" or name == "mirrorConcrete"
or name == "signalEveryPole" or name == "place_ghosts" or name == "remove_cliffs" or name == "fullCruise" then
psettings[name] = not psettings[name]
if name == "poles" then
if psettings[name] and farl.active then
farl:findLastPole()
end
end
if name == "fullCruise" then
psettings.cruiseSpeed = psettings.fullCruise and farl.train.max_forward_speed or 0.4
end
elseif name == "bridge" then
psettings.bridge = not psettings.bridge
end
end,
toggleStart = function(_, farl, _)
farl:toggleActive(true)
end,
debugInfo = function(_, farl, _)
farl:debugInfo()
end,
confirmYes = function(event, farl, player)
farl.confirmed = true
--kick player out and insert farl_player
if event.element.parent.parent.autoPilot.state then
local loco = player.vehicle
local farlLoco = farl.locomotive
-- if not loco or not isFARLLocomotive(loco) then
-- farl:deactivate()
-- GUI.destroyGui(player)
-- return
-- end
if player.vehicle and farlLoco == player.vehicle then
player.driving = false
end
GUI.destroyGui(player)
local ghostPlayer = player.surface.create_entity({name="farl_player", position=player.position, force=player.force})
loco.set_driver(ghostPlayer)
farl.driver = ghostPlayer
farl.settings = util.table.deepcopy(Settings.loadByPlayer(player))
farl.startedBy = player
farl.cheat_mode = player.cheat_mode
global.activeFarls[FARL.getIdFromTrain(farl.train)] = farl
farl.direction = farl:calcTrainDir()
farl.lastrail = farl:findLastRail()
farl.ghostPath = farl:getGhostPath()
end
farl:activate()
if farl.active then
farl:toggleCruiseControl()
end
farl.confirmed = nil
if mod_gui.get_frame_flow(player).farl then
mod_gui.get_frame_flow(player).farl.rows.farlConfirm.farlConfirmFlow.destroy()
end
end,
confirmNo = function(_, farl, player)
farl.confirmed = false
farl:activate()
farl.ghostPath = nil
farl.confirmed = nil
mod_gui.get_frame_flow(player).farl.rows.farlConfirm.farlConfirmFlow.destroy()
end,
toggleBulldozer = function(_, farl, _)
farl:toggleBulldozer()
GUI.updateGui(farl)
end,
toggleMaintenance = function(_, farl, _)
farl:toggleMaintenance()
GUI.updateGui(farl)
end,
load_bp = function(event, farl, player, i)
local index = player.index
if global.savedBlueprints[index][i] then
local bps = global.savedBlueprints[index][i]
local psettings = Settings.loadByPlayer(player)
local lanes = #bps.straight.lanes + 1
local pole = game.entity_prototypes[bps.straight.pole.name].localised_name
psettings.activeBP = table.deepcopy(global.savedBlueprints[index][i])
if farl.active then
farl:deactivate()
farl:activate()
end
player.print({"", {"text-blueprint-loaded"}, " ",{"text-blueprint-description", lanes, pole}})
GUI.toggleSettingsWindow(event,farl,player)
end
end,
save_bp = function(event, farl, player, i)
local index = player.index
local psettings = Settings.loadByPlayer(player)
global.savedBlueprints[index][i] = table.deepcopy(psettings.activeBP)
player.print({"text-blueprint-saved"})
GUI.toggleSettingsWindow(event,farl,player)
GUI.toggleSettingsWindow(event,farl,player)
end,
toggleSide = function(event, _, player)
local psettings = Settings.loadByPlayer(player)
if psettings.poleSide == 1 then
psettings.poleSide = -1
event.element.caption = {"stg-side-left"}
return
else
psettings.poleSide = 1
event.element.caption = {"stg-side-right"}
return
end
end,
toggleCC = function(_, farl, _)
farl:toggleCruiseControl()
end,
create_settings_button = function(player, sprite)
local buttons = mod_gui.get_frame_flow(player).farl.rows.buttons
if buttons.settings and buttons.settings.valid then buttons.settings.destroy() end
if sprite then
return GUI.addButton(buttons, {type = "sprite-button", name = "settings", sprite = "farl_settings", style = "farl_button" }, GUI.toggleSettingsWindow)
else
return GUI.addButton(buttons, {name = "settings", caption = {"text-save"}}, GUI.toggleSettingsWindow)
end
end,
toggleSettingsWindow = function(_, farl, player)
local row = mod_gui.get_frame_flow(player).farl.rows
local psettings = Settings.loadByPlayer(player)
if row.settings ~= nil then
local s = row.settings
local sDistance = tonumber(s.signalDistance.text) or psettings.signalDistance
local railType = tonumber(s.railType.selected_index) or 1
local wire = tonumber(s.row3.ccNetWires.selected_index)
sDistance = sDistance < 0 and 0 or sDistance
GUI.create_settings_button(player, true)
GUI.saveSettings({ signalDistance = sDistance, railType = railType, ccWires = wire }, player, farl)
row.settings.destroy()
else
local settings = row.add({type="table", name="settings", column_count=2})
GUI.create_settings_button(player)
GUI.add(settings,{type="checkbox", name="dropWood", caption={"stg-dropWood"}}, "dropWood")
GUI.add(settings,{type="checkbox", name="collectWood", caption={"stg-collectWood"}}, "collectWood")
GUI.add(settings,{type="checkbox", name="fullCruise", caption={"stg-fullCruise"}}, "fullCruise")
GUI.addPlaceHolder(settings)
GUI.add(settings, {type="label", caption={"stg-signalDistance"}})
GUI.add(settings, {type="textfield", name="signalDistance", style="farl_textfield_small"}, psettings.signalDistance)
--GUI.add(settings, {type="checkbox", name="signalEveryPole", caption={"stg-signalEveryPole"}, tooltip={"farl_tooltip_signalEveryPole"}}, "signalEveryPole")
--GUI.add(settings, {type="label", caption=""})
GUI.add(settings, {type="label", caption={"stg-railType"}})
if not psettings.railType or not global.rails_localised[psettings.railType] then
psettings.railType = 1
psettings.rail = global.rails_by_index[1]
end
GUI.add(settings,{type="drop-down", name="railType", items=global.rails_localised, selected_index=psettings.railType})
-- GUI.add(settings, {type="label", caption={"stg-poleSide"}})
-- GUI.add(settings, {type="checkbox", name="flipPoles", caption={"stg-flipPoles"}, state=psettings.flipPoles})
GUI.add(settings,{type="checkbox", name="poleEntities", caption={"stg-poleEntities"}, tooltip={"farl_tooltip_place_pole_entities"}},"poleEntities")
GUI.add(settings, {type="checkbox", name="remove_cliffs", caption={"stg-remove-cliffs"}, tooltip={ "farl_tooltip_remove_cliffs", {"item-name.cliff-explosives"}}}, "remove_cliffs")
GUI.add(settings,{type="checkbox", name="railEntities", caption={"stg-rail-entities"}, tooltip={"farl_tooltip_place_walls"}}, "railEntities")
GUI.add(settings, { type = "checkbox", name="place_ghosts", caption = {"stg-place-ghosts"}, tooltip={"farl_tooltip_place_ghosts"}}, "place_ghosts")
GUI.add(settings, {type="checkbox", name="mirrorConcrete", caption= {"stg-mirror-concrete"}, "mirrorConcrete"})
GUI.addPlaceHolder(settings)
GUI.add(settings, {type="checkbox", name="ccNet", caption={"stg-ccNet"}, state=psettings.ccNet})
local row2 = GUI.add(settings, {type="table", name="row3", column_count=2})
GUI.add(row2, {type="label", caption={"stg-ccNetWire"}})
GUI.add(row2, { type = "drop-down", name = "ccNetWires", items = GUI.ccWires, selected_index = psettings.ccWires } )
GUI.addLabel(settings, {caption={"stg-stored-blueprints"}})
local stored_bp = GUI.add(settings,{type="table", column_count=3})
local bps = global.savedBlueprints[player.index]
for i=1,3 do
if bps and bps[i] then
local lanes = #bps[i].straight.lanes + 1
local pole = game.entity_prototypes[bps[i].straight.pole.name].localised_name
GUI.addButton(stored_bp,{name="load_bp_"..i, caption="L"})
GUI.addButton(stored_bp,{name="save_bp_"..i, caption="S", tooltip = {"farl_tooltip_s_button"}})
GUI.addLabel(stored_bp, {caption={"text-blueprint-description", lanes, pole}})
else
GUI.addLabel(stored_bp,{caption="L"})
GUI.addButton(stored_bp,{name="save_bp_"..i, caption="S", tooltip = {"farl_tooltip_s_button"}})
GUI.addLabel(stored_bp, {caption="--"})
end
end
GUI.add(settings, {type="label", caption={"stg-blueprint"}})
local row3 = GUI.add(settings, {type="table", name="row4", column_count=2})
GUI.addButton(row3, {name="blueprint", caption={"stg-blueprint-read"}, tooltip = {"farl_tooltip_read"}}, GUI.readBlueprint)
GUI.addButton(row3, {name="bpClear", caption={"stg-blueprint-clear"}}, GUI.clearBlueprints)
GUI.add(settings, {type="label", caption={"stg-blueprint-write"}})
local row4 = GUI.add(settings, {type="flow", name="row5", direction="horizontal"})
GUI.addButton(row4, {name="blueprint_concrete_vertical", caption={"stg-blueprint-vertical"}}, GUI.create_concrete_vertical)
GUI.addButton(row4,{name="blueprint_concrete_diagonal", caption={"stg-blueprint-diagonal"}},GUI.create_concrete_diagonal)
local row6 = GUI.add(settings, {type="flow", name="row6", direction="horizontal"})
GUI.addButton(row6,{name="print_statistics", caption={"stg-statistics"}}, GUI.print_statistics)
end
end,
findBlueprintsInHotbar = function(player)
player.print("Cant read from the quickbar currently. Click the Read button with a blueprint or a blueprint book.")
player.print("(Reading from the quickbar will be reenabled as soon as the API allows it")
local blueprints = {}
return blueprints
-- if player ~= nil then
-- local hotbar = player.get_main_inventory())
-- if hotbar ~= nil then
-- for i=1,#hotbar do
-- local itemStack = hotbar[i]
-- if itemStack and itemStack.valid_for_read and itemStack.type == "blueprint" then
-- if ( type and type == 'empty' and not itemStack.is_blueprint_setup() )
-- or ( type and type == 'setup' and itemStack.is_blueprint_setup() )
-- or not type then
-- table.insert(blueprints, itemStack)
-- end
-- end
-- end
-- end
-- end
-- return blueprints
end,
readBlueprint = function(_, farl, player)
local status, err = pcall(function()
local bp = {}
local cursor = player.cursor_stack.valid_for_read and player.cursor_stack
local read_from_cursor, count
local read_blueprints = farl.read_blueprints
if cursor and cursor.is_blueprint and cursor.is_blueprint_setup() then
table.insert(bp, cursor)
read_from_cursor = true
read_blueprints = read_blueprints + 1
elseif cursor and cursor.is_blueprint_book then
bp, count = getBlueprints(cursor, 'setup')
read_from_cursor = true
read_blueprints = read_blueprints + count
else
farl:print("Cant read from the quickbar currently. Click the Read button with a blueprint or a blueprint book.")
farl:print("(Reading from the quickbar will be reenabled as soon as the API allows it")
return
--bp = GUI.findBlueprintsInHotbar(player, 'setup')
end
if #bp > 2 then
farl:print({"msg-error-too-many-bps"})
return
end
if #bp == 0 then
farl:print({ "msg-error-no-blueprint" })
return
end
local was_active = farl.active
farl:deactivate()
farl:parseBlueprints(bp)
if not read_from_cursor or read_blueprints == 2 then
read_blueprints = 0
GUI.destroyGui(player)
GUI.createGui(player)
end
if was_active then
farl:activate()
end
farl.read_blueprints = read_blueprints
return
end)
if not status then
debugDump("Error: "..err,true)
end
end,
clearBlueprints = function(_, farl, player)
local psettings = Settings.loadByPlayer(player)
psettings.bp = {diagonal=defaultsDiagonal, straight=defaultsStraight}
psettings.activeBP = psettings.bp
farl:print({"msg-bp-cleared"})
GUI.destroyGui(player)
GUI.createGui(player)
end,
create_concrete_vertical = function(_, farl, player)
GUI.createBlueprint(defaults_concrete_vert,farl,player)
end,
create_concrete_diagonal = function(_, farl, player)
GUI.createBlueprint(defaults_concrete_diag,farl,player)
end,
print_statistics = function(event, farl, player)
if player.valid then
local stats = global.statistics[player.force.name]
player.print({"stg-statistics"})
player.print({"text-created-entities"})
for n,c in pairs(stats.created) do
local proto = game.entity_prototypes[n] or game.item_prototypes[n] or false
if proto then
player.print({"",proto.localised_name, ": "..c})
else
player.print(n..": "..c)
end
end
player.print({"text-removed-entities"})
for n,c in pairs(stats.removed) do
local proto = game.entity_prototypes[n] or game.item_prototypes[n] or false
if proto then
player.print({"",proto.localised_name, ": "..c})
else
player.print(n..": "..c)
end
end
GUI.toggleSettingsWindow(event, farl, player)
end
end,
createBlueprint = function(bp_table, farl, player)
local cursor = player.cursor_stack.valid_for_read and player.cursor_stack
local blueprints = {}
if cursor and cursor.type == "blueprint" then
table.insert(blueprints, cursor)
else
farl:print("Click this button with an empty blueprint")
--blueprints = GUI.findBlueprintsInHotbar(player, 'empty')
return
end
if #blueprints > 0 then
local bp = blueprints[1]
bp.set_blueprint_entities(bp_table.entities)
bp.set_blueprint_tiles(bp_table.tiles)
local icons = {[1]={index = 1, signal={name = "rail", type="item"}},[2]={index = 2, signal={name = "farl", type="item"}}}
bp.blueprint_icons = icons
else
farl:print({"msg-no-empty-blueprint"})
end
end,
saveSettings = function(s, player, farl)
local psettings = Settings.loadByPlayer(player)
for i,p in pairs(s) do
if psettings[i] ~= nil then
if i == "railType" then
if p ~= psettings[i] then
farl:deactivate()
end
psettings[i] = p
psettings.rail = global.rails_by_index[p]
else
psettings[i] = p
end
end
end
end,
updateGui = function(farl)
local guiPlayer = (farl.driver and farl.driver.name ~= "farl_player") and farl.driver or false
if guiPlayer and mod_gui.get_frame_flow(guiPlayer).farl then
--GUI.init(farl.driver)
local farlGui = mod_gui.get_frame_flow(guiPlayer).farl.rows
farlGui.buttons.start.caption = farl.active and {"text-stop"} or {"text-start"}
farlGui.buttons.cc.caption = farl.cruise and {"text-stopCC"} or {"text-startCC"}
if farl.ghostProgress then
farlGui.pathProgress.visible = true
farlGui.pathProgress.value = farl.ghostProgress / farl.ghostProgressStart
farlGui.pathLabel.visible = true
farlGui.pathLabel.caption = farl.ghostProgress .. "/" .. farl.ghostProgressStart
else
farlGui.pathProgress.visible = false
farlGui.pathLabel.visible = false
farlGui.pathProgress.value = 0
farlGui.pathLabel.caption = "-/-"
end
if not farl.settings then
farl.settings = Settings.loadByPlayer(guiPlayer)
end
farlGui.bulldozer.state = farl.settings.bulldozer
farlGui.maintenance.state = farl.settings.maintenance
end
end,
}
GUI.callbacks = {
start = GUI.toggleStart,
cc = GUI.toggleCC,
settings = GUI.toggleSettingsWindow,
debug = GUI.debugInfo,
blueprint = GUI.readBlueprint,
bpClear = GUI.clearBlueprints,
blueprint_concrete_vertical = GUI.create_concrete_vertical,
blueprint_concrete_diagonal = GUI.create_concrete_diagonal,
print_statistics = GUI.print_statistics,
confirmYes = GUI.confirmYes,
confirmNo = GUI.confirmNo
}