This commit is contained in:
Spencer Killen 2026-09-27 15:00:53 -06:00
parent 6fae54b78d
commit ee88919e71
Signed by: sjkillen
GPG key ID: 1DAA9D8D7C6ADD05
4 changed files with 36 additions and 0 deletions

View file

@ -3,6 +3,7 @@ extends Node
signal productions_update(p: Array[Production])
@warning_ignore("unused_signal")
signal production_log(producer: Currency, p: Production)
@warning_ignore("unused_signal")
signal log(s: String)
@export var currencies: Array[Production]
@export var members: Array
@ -79,6 +80,10 @@ func simulate():
update_currencies()
for e in events:
if e.requirements_satisfied() and e.will_happen():
if e.game_over_timeline != null:
get_tree().change_scene_to_file("res://game_over.tscn")
Dialogic.start(e.game_over_timeline)
return
if e.log_message != "" and not e.skip_log:
Economy.log.emit(e.log_message)
var outcome := e.outcome()
@ -113,6 +118,9 @@ func _ready() -> void:
update_currencies()
func _on_timer_timeout() -> void:
if get_tree().current_scene.scene_file_path != "res://game.tscn":
%SimulateTickTimer.start()
return
if Dialogic.current_timeline != null:
%SimulateTickTimer.start()
return

6
game_over.gd Normal file
View file

@ -0,0 +1,6 @@
extends Control
func _ready() -> void:
await Dialogic.timeline_ended
get_tree().quit()

1
game_over.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://newnma6kkptj

21
game_over.tscn Normal file
View file

@ -0,0 +1,21 @@
[gd_scene format=3 uid="uid://cqfexy3yy3tbr"]
[ext_resource type="Script" uid="uid://newnma6kkptj" path="res://game_over.gd" id="1_y26ei"]
[node name="GameOver" type="Control" unique_id=880250183]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_y26ei")
[node name="ColorRect" type="ColorRect" parent="." unique_id=619694373]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 1)