File tree Expand file tree Collapse file tree 14 files changed +100
-41
lines changed Expand file tree Collapse file tree 14 files changed +100
-41
lines changed Original file line number Diff line number Diff line change 1+ extends Node
2+
3+ @onready var view_model = TemperatureViewModel .new ()
4+
5+ @export var time_component : TimeComponent
6+
7+ # TODO: Currently sourced from https://climate.nasa.gov/vital-signs/global-temperature/?intent=121.
8+ # This should be based on the actual start date of the game.
9+ var temperature_anomaly_celsius = 1.28
10+
11+ func _ready () -> void :
12+ ViewModelRegistry .register (ViewModelRegistry .Keys .TEMPERATURE , view_model )
13+ time_component .on_new_day .connect (_handle_new_day )
14+
15+ func _handle_new_day (new_temperature_anomaly : int ) -> void :
16+ # TODO: this is a large increase for testing. it should be based on the state of the world.
17+ temperature_anomaly_celsius += .01
18+ view_model .set_temperature_anomaly (temperature_anomaly_celsius )
Original file line number Diff line number Diff line change 1+ [gd_scene load_steps =2 format =3 uid ="uid://cxdm1p8x2yt7d" ]
2+
3+ [ext_resource type ="Script" path ="res://entities/components/temperature_component.gd" id ="1_gnlrf" ]
4+
5+ [node name ="TemperatureComponent" type ="Node" ]
6+ script = ExtResource ("1_gnlrf" )
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ class_name TimeComponent
77@export var default_speed : float = 1
88@export var fast_speed : float = 3
99
10+ signal on_new_day (new_timestamp : int )
11+
1012var time_since_last_update : float = 0
1113var time : float = Time .get_unix_time_from_system ()
1214var is_paused : bool = false
@@ -24,6 +26,7 @@ func _process(delta: float):
2426 if time_since_last_update > (day_update_interval_seconds / speed ):
2527 time_since_last_update = 0
2628 time += 86400 # seconds in a day
29+ on_new_day .emit (time )
2730 view_model .set_time (time )
2831
2932func toggle_paused ():
Original file line number Diff line number Diff line change 11# LANGUAGE translation for project-evergreen for the following files:
22# res://entities/countries/usa.gd
3+ # res://ui/widgets/top_app_bar.tscn
34#
45# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
56#
@@ -20,3 +21,7 @@ msgstr ""
2021#: entities/countries/usa.gd
2122msgid "COUNTRY_USA_NAME"
2223msgstr "United States of America"
24+
25+ #: ui/widgets/top_app_bar.tscn
26+ msgid "TEMPERATURE_ANOMALY_DESCRIPTION"
27+ msgstr "Temperature Anomaly"
Original file line number Diff line number Diff line change 11# LANGUAGE translation for project-evergreen for the following files:
22# res://entities/countries/usa.gd
3+ # res://ui/widgets/top_app_bar.tscn
34#
45# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
56#
@@ -14,3 +15,7 @@ msgstr ""
1415#: entities/countries/usa.gd
1516msgid "COUNTRY_USA_NAME"
1617msgstr ""
18+
19+ #: ui/widgets/top_app_bar.tscn
20+ msgid "TEMPERATURE_ANOMALY_DESCRIPTION"
21+ msgstr ""
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -66,4 +66,4 @@ select={
6666[internationalization ]
6767
6868locale/translations =PackedStringArray ("res://locale/en.mo" , "res://locale/zh_TW.mo" )
69- locale/translations_pot_files =PackedStringArray ("res://entities/countries/usa.gd" )
69+ locale/translations_pot_files =PackedStringArray ("res://entities/countries/usa.gd" , "res://ui/widgets/top_app_bar.tscn" )
Original file line number Diff line number Diff line change 1- [gd_scene load_steps =8 format =3 uid ="uid://d3nj6rt0cm53e" ]
1+ [gd_scene load_steps =9 format =3 uid ="uid://d3nj6rt0cm53e" ]
22
33[ext_resource type ="PackedScene" uid ="uid://xlfbl7fowoic" path ="res://scenes/worldmap/world_map.tscn" id ="1_cjno1" ]
44[ext_resource type ="PackedScene" uid ="uid://qjjw8mvvjabt" path ="res://ui/viewmodels/vm_countries.tscn" id ="1_grghp" ]
77[ext_resource type ="PackedScene" uid ="uid://dap6c80qsg2ip" path ="res://entities/music_player_component.tscn" id ="3_l6axm" ]
88[ext_resource type ="PackedScene" uid ="uid://dcnty7qxod06" path ="res://scenes/components/camera_component.tscn" id ="4_xha1d" ]
99[ext_resource type ="PackedScene" uid ="uid://b1x0140gst6wf" path ="res://entities/time_component.tscn" id ="5_6js18" ]
10+ [ext_resource type ="PackedScene" uid ="uid://cxdm1p8x2yt7d" path ="res://entities/components/temperature_component.tscn" id ="5_p0y26" ]
1011
1112[node name ="World" type ="Node2D" ]
1213
2223
2324[node name ="MusicPlayerComponent" parent ="Components" instance =ExtResource ("3_l6axm" )]
2425
26+ [node name ="TemperatureComponent" parent ="Components" node_paths =PackedStringArray ("time_component" ) instance =ExtResource ("5_p0y26" )]
27+ time_component = NodePath ("../TimeComponent" )
28+
2529[node name ="WorldMap" parent ="." instance =ExtResource ("1_cjno1" )]
2630position = Vector2 (0 , 1 )
2731
You can’t perform that action at this time.
0 commit comments