-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.gd
682 lines (618 loc) · 29.6 KB
/
main.gd
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
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
extends Node2D
var strtp
var CO2_val = 400 #ppm
var CO2_rate = 0
var temp_val = 14
var points_val = 50
var points_rate = 2
var year = 2016
var actions = 2
var energy = {
"solar" : [0,5,-1.2,-0.5],
"coal" : [3,5,7.08,0.5],
"gas" : [3,5,3.2,0.5],
"wind" : [0,5,-0.8,-0.5],
"nuclear" : [0,10,-2.5,-1]
}
var science = {
"solar" : [0,5,-0.5,0],
"wind" : [0,5,-.33,0],
"nuclear" : [0,5,-.3,0],
"fossil" : [0,0,5.6,5]
}
var law = {
"forest": [0,5,-1.14,0],
"ecars": [0,5,-2,0],
"dtax": [0,0,0.5,5],
"itax": [0,5,-0.5,0]
}
#func _process(delta):
func _ready():
set_process(true)
get_node("menu_popup/open_facilities/Facilities_popup/Gas3").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Coal3").set_opacity(0.2)
#Research
strtp = """Solar cells
First stage in solar research, you have the tecnology to manufacture solar cells which
are electrical devices that convert the energy of light directly into electricity."""
strtp += "\n cost="+ str(science['solar'][1])
strtp += "\n CO2 effect="+ str(science['solar'][2])
get_node("menu_popup/open_research/Research_popup/Solartech1").set_tooltip(strtp)
strtp = """Pointing array
Second stage in solar research: you are now able to use the solar cells at their
full capability following the sun trajectory"""
strtp += "\n cost="+ str(2*science['solar'][1])
strtp += "\n CO2 effect="+ str(2*science['solar'][2])
get_node("menu_popup/open_research/Research_popup/Solartech2").set_tooltip(strtp)
strtp = """Mass production
Last stage in solar research:you have the tecnology necessary for mass production of solar
arrays; this will increase your renewable energy source and decrease the CO2 level."""
strtp += "\n cost="+ str(3*science['solar'][1])
strtp += "\n CO2 effect="+ str(3*science['solar'][2])
get_node("menu_popup/open_research/Research_popup/Solartech3").set_tooltip(strtp)
strtp="""Materials
First stage in wind research: you have the tecnology necessary to build
wind turbines so you can convert kinetic energy from the wind into electrical power."""
strtp += "\n cost="+ str(science['wind'][1])
strtp += "\n CO2 effect="+ str(science['wind'][2])
get_node("menu_popup/open_research/Research_popup/Windtech1").set_tooltip(strtp)
strtp = """Aerodinamics
Second stage in wind research: your knowledge in wind turbine
aerodinamics is incresed, you can now increase the turbines efficiecy."""
strtp += "\n cost="+str(2*science['wind'][1])
strtp += "\n CO2 effect="+str(2*science['wind'][2])
get_node("menu_popup/open_research/Research_popup/Windtech2").set_tooltip(strtp)
strtp = """High efficiency bearing
Last stage in wind research: you reached maximum
eficiency in your wind turbines."""
strtp += "\n cost="+str(3*science['wind'][1])
strtp += "\n CO2 effect="+str(3*science['wind'][2])
get_node("menu_popup/open_research/Research_popup/Windtech3").set_tooltip(strtp)
strtp = """Thorium salt
First stage in neclear research: you reached the tecnology level necessay
to build a nuclear reactor which initiates and controls a sustained nuclear chain reaction."""
strtp += "\n cost="+ str(science['nuclear'][1])
strtp += "\n CO2 effect="+ str(science['nuclear'][2])
get_node("menu_popup/open_research/Research_popup/Nucleartech1").set_tooltip(strtp)
strtp = """Waste reciclyng
Second stage in nuclear research: you are decreasing
your waste production."""
strtp += "\n cost="+str(2*science['nuclear'][1])
strtp += "\n CO2 effect="+str(2*science['nuclear'][2])
get_node("menu_popup/open_research/Research_popup/Nucleartech2").set_tooltip(strtp)
strtp = """Fusion
Last stage in nuclear research: you are
finally free from waste."""
strtp += "\n cost="+str(3*science['nuclear'][1])
strtp += "\n CO2 effect="+str(3*science['nuclear'][2])
get_node("menu_popup/open_research/Research_popup/Nucleartech3").set_tooltip(strtp)
strtp = """Fracking
First stage in fossil fuel research:the process of drilling down into the earth before a
high-pressure water mixture is directed at the rock to release the gas inside. """
strtp += "\n cost="+ str(science['fossil'][1])
strtp += "\n CO2 effect="+ str(science['fossil'][2])
get_node("menu_popup/open_research/Research_popup/Fossiltech1").set_tooltip(strtp)
strtp = """Deep ocean drilling
Second stage in fossil fuel research:the process of oil and gas exploration in deep ocean;
tecnologically more challenging than drilling on ground or shallow water, it increases your oil production."""
strtp += "\n cost="+str(2*science['fossil'][1])
strtp += "\n CO2 effect="+str(2*science['fossil'][2])
get_node("menu_popup/open_research/Research_popup/Fossiltech2").set_tooltip(strtp)
strtp = """Super extraction
Last stage in fossil fuel research: yuo are exstracting oil at your full capability,
this produces many points but also has a major effect in CO2 levels."""
strtp += "\n cost="+str(3*science['fossil'][1])
strtp += "\n CO2 effect="+str(3*science['fossil'][2])
get_node("menu_popup/open_research/Research_popup/Fossiltech3").set_tooltip(strtp)
#politics
strtp = "Planting forest"
strtp += "\n cost="+ str(law['forest'][1])
strtp += "\n additional points="+ str(law['forest'][3])
strtp += "\n CO2 effect="+ str(law['forest'][2])
get_node("menu_popup/open_politics/Politics_popup/forestry").set_tooltip(strtp)
strtp = "Electric cars politcs"
strtp += "\n cost="+ str(law['ecars'][1])
strtp += "\n additional points="+ str(law['ecars'][3])
strtp += "\n CO2 effect="+ str(law['ecars'][2])
get_node("menu_popup/open_politics/Politics_popup/ecars").set_tooltip(strtp)
strtp = "Decrease oil taxes"
strtp += "\n cost="+ str(law['dtax'][1])
strtp += "\n additional points="+ str(law['dtax'][3])
strtp += "\n CO2 effect="+ str(law['dtax'][2])
get_node("menu_popup/open_politics/Politics_popup/dtax").set_tooltip(strtp)
strtp = "Increase oil taxes"
strtp += "\n cost="+ str(law['itax'][1])
strtp += "\n additional points="+ str(law['itax'][3])
strtp += "\n CO2 effect="+ str(law['itax'][2])
get_node("menu_popup/open_politics/Politics_popup/itax").set_tooltip(strtp)
#Facilities
strtp = "Coal"
strtp += "\n starting number of facilities="+ str(energy['coal'][0])
strtp += "\n stopping the facility cost="+ str(energy['coal'][1])
strtp += "\n additional points per level="+ str(energy['coal'][3])
strtp += "\n CO2 effect="+ str(energy['coal'][2])
get_node("menu_popup/open_facilities/Facilities_popup/Coal1").set_tooltip(strtp)
strtp = "Coal"
strtp += "\n starting number of facilities="+ str(energy['coal'][0])
strtp += "\n stopping the facility cost="+str(2*energy['coal'][1])
strtp += "\n additional points per level="+str(2*energy['coal'][3])
strtp += "\n CO2 effect="+str(2*energy['coal'][2])
get_node("menu_popup/open_facilities/Facilities_popup/Coal2").set_tooltip(strtp)
strtp = "Coal"
strtp += "\n starting number of facilities="+ str(energy['coal'][0])
strtp += "\n stopping the facility cost="+str(3*energy['coal'][1])
strtp += "\n additional points per level="+str(3*energy['coal'][3])
strtp += "\n CO2 effect="+str(3*energy['coal'][2])
get_node("menu_popup/open_facilities/Facilities_popup/Coal3").set_tooltip(strtp)
strtp = "Gas"
strtp += "\n starting number of facilities="+ str(energy['gas'][0])
strtp += "\n stopping the facility cost="+ str(energy['gas'][1])
strtp += "\n additional points per level="+ str(energy['gas'][3])
strtp += "\n CO2 effect="+ str(energy['gas'][2])
get_node("menu_popup/open_facilities/Facilities_popup/Gas1").set_tooltip(strtp)
strtp = "Gas"
strtp += "\n starting number of facilities="+ str(energy['gas'][0])
strtp += "\n stopping the facility cost="+str(2*energy['gas'][1])
strtp += "\n additional points per level="+str(2*energy['gas'][3])
strtp += "\n CO2 effect="+str(2*energy['gas'][2])
get_node("menu_popup/open_facilities/Facilities_popup/Gas2").set_tooltip(strtp)
strtp = "Gas"
strtp += "\n starting number of facilities="+ str(energy['gas'][0])
strtp += "\n stopping the facility cost="+str(3*energy['gas'][1])
strtp += "\n additional points per level="+str(3*energy['gas'][3])
strtp += "\n CO2 effect="+str(3*energy['gas'][2])
get_node("menu_popup/open_facilities/Facilities_popup/Gas3").set_tooltip(strtp)
strtp = "Solar"
strtp += "\n starting number of facilities="+ str(energy['solar'][0])
strtp += "\n building cost="+ str(energy['solar'][1])
strtp += "\n additional points per level="+ str(energy['solar'][2])
strtp += "\n CO2 effect="+ str(energy['solar'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Solar1").set_tooltip(strtp)
strtp = "Solar"
strtp += "\n starting number of facilities="+ str(energy['solar'][0])
strtp += "\n building cost="+str(2*energy['solar'][1])
strtp += "\n additional points per level="+str(2*energy['solar'][2])
strtp += "\n CO2 effect="+str(2*energy['solar'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Solar2").set_tooltip(strtp)
strtp = "Solar"
strtp += "\n starting number of facilities="+ str(energy['solar'][0])
strtp += "\n building cost="+str(3*energy['solar'][1])
strtp += "\n additional points per level="+str(3*energy['solar'][2])
strtp += "\n CO2 effect="+str(3*energy['solar'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Solar3").set_tooltip(strtp)
strtp = "Nuclear"
strtp += "\n starting number of facilities="+ str(energy['nuclear'][0])
strtp += "\n building cost="+ str(energy['nuclear'][1])
strtp += "\n additional points per level="+ str(energy['nuclear'][2])
strtp += "\n CO2 effect="+ str(energy['nuclear'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear1").set_tooltip(strtp)
strtp = "Nuclear"
strtp += "\n starting number of facilities="+ str(energy['nuclear'][0])
strtp += "\n building cost="+str(2*energy['nuclear'][1])
strtp += "\n additional points per level="+str(2*energy['nuclear'][2])
strtp += "\n CO2 effect="+str(2*energy['nuclear'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear2").set_tooltip(strtp)
strtp = "Nuclear"
strtp += "\n starting number of facilities="+ str(energy['nuclear'][0])
strtp += "\n building cost="+str(3*energy['nuclear'][1])
strtp += "\n additional points per level="+str(3*energy['nuclear'][2])
strtp += "\n CO2 effect="+str(3*energy['nuclear'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear3").set_tooltip(strtp)
strtp = "Wind"
strtp += "\n starting number of facilities="+ str(energy['wind'][0])
strtp += "\n building cost="+ str(energy['wind'][1])
strtp += "\n additional points per level="+ str(energy['wind'][2])
strtp += "\n CO2 effect="+ str(energy['wind'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Wind1").set_tooltip(strtp)
strtp = "Wind"
strtp += "\n starting number of facilities="+ str(energy['wind'][0])
strtp += "\n building cost="+str(2*energy['wind'][1])
strtp += "\n additional points per level="+str(2*energy['wind'][2])
strtp += "\n CO2 effect="+str(2*energy['wind'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Wind2").set_tooltip(strtp)
strtp = "Wind"
strtp += "\n starting number of facilities="+ str(energy['wind'][0])
strtp += "\n building cost="+str(3*energy['wind'][1])
strtp += "\n additional points per level="+str(3*energy['wind'][2])
strtp += "\n CO2 effect="+str(3*energy['wind'][3])
get_node("menu_popup/open_facilities/Facilities_popup/Wind3").set_tooltip(strtp)
func CO2_mod():
var inc_CO2 = energy['solar'][0]*energy['solar'][2] + energy['coal'][0]*energy['coal'][2] + energy['gas'][0]*energy['gas'][2] + energy['wind'][0]*energy['wind'][2] + energy['nuclear'][0]*energy['nuclear'][2] + science['solar'][0]*science['solar'][2] + science['wind'][0]*science['wind'][2] + science['nuclear'][0]*science['nuclear'][2] + science['fossil'][0]*science['fossil'][2] + law['forest'][0]*law['forest'][2] + law['ecars'][0]*law['ecars'][2] + law['dtax'][0]*law['dtax'][2] + law['itax'][0]*law['itax'][2]
print(inc_CO2)
return inc_CO2
func points_mod():
var inc_points = energy['solar'][0]*energy['solar'][3] + energy['coal'][0]*energy['coal'][3] + energy['gas'][0]*energy['gas'][3] + energy['wind'][0]*energy['wind'][3] + energy['nuclear'][0]*energy['nuclear'][3] + science['solar'][0]*science['solar'][3] + science['wind'][0]*science['wind'][3] + science['nuclear'][0]*science['nuclear'][3] + science['fossil'][0]*science['fossil'][3] + law['forest'][0]*law['forest'][3] + law['ecars'][0]*law['ecars'][3] + law['dtax'][0]*law['dtax'][3] + law['itax'][0]*law['itax'][3]
print(inc_points)
return inc_points
func compute_action():
if actions > 0:
actions -= 1
get_node("action_value").set_text(str(actions))
func compute_world():
var CO2_mod = CO2_mod()
var points_mod = points_mod()
CO2_val = CO2_val + CO2_rate + CO2_mod
temp_val = 0.008*CO2_val + 10.8
points_val += points_rate + points_mod
year += 1
get_node("C02_value").set_text(str(int(CO2_val))+"."+str(int(10*(CO2_val-int(CO2_val)))))
get_node("Temp_value").set_text(str(int(temp_val))+"."+str(int(100 *(temp_val-int(temp_val)))))
get_node("year_value").set_text(str(year))
get_node("action_value").set_text(str(actions))
get_node("points_value").set_text(str(int(points_val))+"."+str(int(10*(points_val-int(points_val)))))
get_node("AnimatedSprite").set_frame(int(0+(temp_val-14)*60/4.76))
if temp_val > 18.76:
get_tree().change_scene("res://lose.scn")
elif year > 2100:
get_tree().change_scene("res://win.scn")
func _acquireAssets(dict):
points_val -= dict[0] * dict[1]
get_node("points_value").set_text(str(points_val))
func _on_close_menu_pressed():
get_node("open_menu").show()
get_node("menu_popup").hide()
func _on_open_menu_pressed():
get_node("menu_popup").popup()
#get_node("menu_popup").set_exclusive(true)
func _on_next_turn_pressed():
compute_world()
actions = 2
get_node("action_value").set_text(str(actions))
# Research buttons
func _on_open_research_pressed():
_on_close_menu_pressed()
get_node("menu_popup/open_research/Research_popup").popup()
#get_node("menu_popup/open_research/Research_popup").set_exclusive(true)
func _on_close_research_pressed():
get_node("menu_popup/open_research/Research_popup").hide()
_on_open_menu_pressed()
func _on_Solartech1_pressed():
if (actions > 0) and (science['solar'][0] == 0) and (points_val >= science['solar'][1]):
science['solar'][0] = 1
_acquireAssets(science['solar'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Solartech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Solartech2").set_opacity(1)
get_node("menu_popup/open_research/Research_popup/Solartech3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(science['solar'][0])
func _on_Solartech2_pressed():
if (actions > 0) and (science['solar'][0] == 1) and (points_val >= 2 * science['solar'][1]):
science['solar'][0] = 2
_acquireAssets(science['solar'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Solartech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Solartech2").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Solartech3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(science['solar'][0])
func _on_Solartech3_pressed():
if (actions > 0) and (science['solar'][0] == 2) and (points_val >= 3 * science['solar'][1]):
science['solar'][0] = 3
_acquireAssets(science['solar'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Solartech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Solartech2").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Solartech3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(science['solar'][0])
func _on_Windtech1_pressed():
if (actions > 0) and (science['wind'][0] == 0) and (points_val >= science['wind'][1]):
science['wind'][0] = 1
_acquireAssets(science['wind'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Windtech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Windtech2").set_opacity(1)
get_node("menu_popup/open_research/Research_popup/Windtech3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(science['wind'][0])
func _on_Windtech2_pressed():
if (actions > 0) and (science['wind'][0] == 1) and (points_val >= 2 * science['wind'][1]):
science['wind'][0] = 2
_acquireAssets(science['wind'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Windtech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Windtech2").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Windtech3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(science['wind'][0])
func _on_Windtech3_pressed():
if (actions > 0) and (science['wind'][0] == 2) and (points_val >= 3 * science['wind'][1]):
science['wind'][0] = 3
_acquireAssets(science['wind'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Windtech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Windtech2").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Windtech3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(science['wind'][0])
func _on_Nucleartech1_pressed():
if (actions > 0) and (science['nuclear'][0] == 0) and (points_val >= science['nuclear'][1]):
science['nuclear'][0] = 1
_acquireAssets(science['nuclear'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Nucleartech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Nucleartech2").set_opacity(1)
get_node("menu_popup/open_research/Research_popup/Nucleartech3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(science['nuclear'][0])
func _on_Nucleartech2_pressed():
if (actions > 0) and (science['nuclear'][0] == 1) and (points_val >= 2 * science['nuclear'][1]):
science['nuclear'][0] = 2
_acquireAssets(science['nuclear'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Nucleartech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Nucleartech2").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Nucleartech3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(science['nuclear'][0])
func _on_Nucleartech3_pressed():
if (actions > 0) and (science['nuclear'][0] == 2) and (points_val >= 3 * science['nuclear'][1]):
science['nuclear'][0] = 3
_acquireAssets(science['nuclear'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Nucleartech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Nucleartech2").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Nucleartech3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(science['nuclear'][0])
func _on_Fossiltech1_pressed():
if (actions > 0) and (science['fossil'][0] == 0) and (points_val >= science['fossil'][1]):
science['fossil'][0] = 1
_acquireAssets(science['fossil'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Fossiltech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Fossiltech2").set_opacity(1)
get_node("menu_popup/open_research/Research_popup/Fossiltech3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(science['fossil'][0])
func _on_Fossiltech2_pressed():
if (actions > 0) and (science['fossil'][0] == 1) and (points_val >= 2 * science['fossil'][1]):
science['fossil'][0] = 2
_acquireAssets(science['fossil'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Fossiltech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Fossiltech2").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Fossiltech3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(science['fossil'][0])
func _on_Fossiltech3_pressed():
if (actions > 0) and (science['fossil'][0] == 2) and (points_val >= 3 * science['fossil'][1]):
science['fossil'][0] = 3
_acquireAssets(science['fossil'])
compute_action()
get_node("menu_popup/open_research/Research_popup/Fossiltech1").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Fossiltech2").set_opacity(0.2)
get_node("menu_popup/open_research/Research_popup/Fossiltech3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(science['fossil'][0])
# Law buttons
func _on_open_politics_pressed():
_on_close_menu_pressed()
get_node("menu_popup/open_politics/Politics_popup").popup()
#get_node("menu_popup/open_politics/Politics_popup").set_exclusive(true)
func _on_close_politics_pressed():
get_node("menu_popup/open_politics/Politics_popup").hide()
_on_open_menu_pressed()
func _on_forestry_pressed():
if (actions > 0) and (law['forest'][0] == 0) and (points_val >= law['forest'][1]):
law['forest'][0] = 1
_acquireAssets(law['forest'])
compute_action()
get_node("menu_popup/open_politics/Politics_popup/forestry").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(law['forest'][0])
func _on_ecars_pressed():
if (actions > 0) and (law['ecars'][0] == 0) and (points_val >= law['ecars'][1]):
law['ecars'][0] = 1
_acquireAssets(law['ecars'])
compute_action()
get_node("menu_popup/open_politics/Politics_popup/ecars").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(law['ecars'][0])
func _on_dtax_pressed():
if (actions > 0) and (law['dtax'][0] == 0) and (points_val >= law['dtax'][1]):
law['dtax'][0] = 1
_acquireAssets(law['dtax'])
compute_action()
get_node("menu_popup/open_politics/Politics_popup/dtax").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(law['dtax'][0])
func _on_itax_pressed():
if (actions > 0) and (law['itax'][0] == 0) and (points_val >= law['itax'][1]):
law['itax'][0] = 1
_acquireAssets(law['itax'])
compute_action()
get_node("menu_popup/open_politics/Politics_popup/itax").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(law['itax'][0])
# Energy buttons
func _on_open_facilities_pressed():
_on_close_menu_pressed()
get_node("menu_popup/open_facilities/Facilities_popup").popup()
#get_node("menu_popup/open_facilities/Facilities_popup").set_exclusive(true)
func _on_close_facilities_pressed():
get_node("menu_popup/open_facilities/Facilities_popup").hide()
_on_open_menu_pressed()
func _on_Coal1_pressed():
if (actions > 0) and (energy['coal'][0] == 0 or energy['coal'][0] == 2) and (points_val >= energy['coal'][1]):
energy['coal'][0] = 1
_acquireAssets(energy['coal'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Coal1").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Coal2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Coal3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['coal'][0])
func _on_Coal2_pressed():
if (actions > 0) and (energy['coal'][0] == 1 or energy['coal'][0] == 3) and (points_val >= 2 * energy['coal'][1]):
energy['coal'][0] = 2
_acquireAssets(energy['coal'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Coal1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Coal2").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Coal3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['coal'][0])
func _on_Coal3_pressed():
if (actions > 0) and (energy['coal'][0] == 2) and (points_val >= 3 * energy['coal'][1]):
energy['coal'][0] = 3
_acquireAssets(energy['coal'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Coal1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Coal2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Coal3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(energy['coal'][0])
func _on_Gas1_pressed():
if (actions > 0) and (energy['gas'][0] == 0 or energy['gas'][0] == 2) and (points_val >= energy['gas'][1]):
energy['gas'][0] = 1
_acquireAssets(energy['gas'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Gas1").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Gas2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Gas3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['gas'][0])
func _on_Gas2_pressed():
if (actions > 0) and (energy['gas'][1] == 0 or energy['gas'][0] == 3) and (points_val >= 2 * energy['gas'][1]):
energy['gas'][0] = 2
_acquireAssets(energy['gas'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Gas1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Gas2").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Gas3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['gas'][0])
func _on_Gas3_pressed():
if (actions > 0) and (energy['gas'][0] == 2) and (points_val >= 3 * energy['gas'][1]):
energy['gas'][0] = 3
_acquireAssets(energy['gas'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Gas1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Gas2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Gas3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(energy['gas'][0])
func _on_Solar1_pressed():
if (actions > 0) and (energy['solar'][0] == 0 or energy['solar'][0] == 2) and (points_val >= energy['solar'][1]):
energy['solar'][0] = 1
_acquireAssets(energy['solar'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Solar1").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Solar2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Solar3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['solar'][0])
func _on_Solar2_pressed():
if (actions > 0) and (energy['solar'][0] == 1 or energy['solar'][0] == 3) and (points_val >= 2 * energy['solar'][1]):
energy['solar'][0] = 2
_acquireAssets(energy['solar'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Solar1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Solar2").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Solar3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['solar'][0])
func _on_Solar3_pressed():
if (actions > 0) and (energy['solar'][0] == 2) and (points_val >= 3 * energy['solar'][1]):
energy['solar'][0] = 3
_acquireAssets(energy['solar'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Solar1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Solar2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Solar3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(energy['solar'][0])
func _on_Nuclear1_pressed():
if (actions > 0) and (energy['nuclear'][0] == 0 or energy['nuclear'][0] == 2) and (points_val >= energy['nuclear'][1]):
energy['nuclear'][0] = 1
_acquireAssets(energy['nuclear'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear1").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['nuclear'][0])
func _on_Nuclear2_pressed():
if (actions > 0) and (energy['nuclear'][0] == 1 or energy['nuclear'][0] == 3) and (points_val >= 2 * energy['nuclear'][1]):
energy['nuclear'][0] = 2
_acquireAssets(energy['nuclear'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear2").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['nuclear'][0])
func _on_Nuclear3_pressed():
if (actions > 0) and (energy['nuclear'][0] == 2) and (points_val >= 3 * energy['nuclear'][1]):
energy['nuclear'][0] = 3
_acquireAssets(energy['nuclear'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Nuclear3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(energy['nuclear'][0])
func _on_Wind1_pressed():
print("miu")
if (actions > 0) and (energy['wind'][0] == 0 or energy['wind'][0] == 2) and (points_val >= energy['wind'][1]):
energy['wind'][0] = 1
_acquireAssets(energy['wind'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Wind1").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Wind2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Wind3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['wind'][0])
func _on_Wind2_pressed():
if (actions > 0) and (energy['wind'][0] == 1 or energy['wind'][0] == 3) and (points_val >= 2 * energy['wind'][1]):
energy['wind'][0] = 2
_acquireAssets(energy['wind'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Wind1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Wind2").set_opacity(0.2)
get_node("menu_popup/open_facilities/Facilities_popup/Wind3").set_opacity(1)
else :
get_node("Error_popup").popup()
print(energy['wind'][0])
func _on_Wind3_pressed():
if (actions > 0) and (energy['wind'][0] == 2) and (points_val >= 3 * energy['wind'][1]):
energy['wind'][0] = 3
_acquireAssets(energy['wind'])
compute_action()
get_node("menu_popup/open_facilities/Facilities_popup/Wind1").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Wind2").set_opacity(1)
get_node("menu_popup/open_facilities/Facilities_popup/Wind3").set_opacity(0.2)
else :
get_node("Error_popup").popup()
print(energy['wind'][0])