From 1ba3772b7125c8a8d85902bf33cc9f0ed672cdab Mon Sep 17 00:00:00 2001 From: Spencer Killen Date: Sat, 26 Sep 2026 10:54:26 -0600 Subject: [PATCH 1/2] work work --- currency/abstract/plague.tres | 1 + currency/abstract/time.tres | 1 + currency/inanimate/beer.tres | 1 + currency/inanimate/blood.tres | 2 ++ currency/inanimate/bread.tres | 1 + currency/inanimate/corpse.tres | 1 + currency/inanimate/gold.tres | 2 ++ currency/inanimate/stone.tres | 2 ++ currency/inanimate/water.tres | 2 ++ currency/inanimate/wood.tres | 2 ++ currency/production.gd | 6 ------ currency/sentient/archer.tres | 2 ++ currency/sentient/calvary.tres | 2 ++ currency/sentient/chicken.tres | 2 ++ currency/sentient/cow.tres | 2 ++ currency/sentient/dinosaur.tres | 2 ++ currency/sentient/doctor.tres | 2 ++ currency/sentient/drunk.tres | 1 + currency/sentient/farmer.tres | 2 ++ currency/sentient/kings_guard.tres | 1 + currency/sentient/lover.tres | 2 ++ currency/sentient/mercenary.tres | 2 ++ currency/sentient/messenger.tres | 2 ++ currency/sentient/miner.tres | 2 ++ currency/sentient/pig.tres | 2 ++ currency/sentient/royalty.tres | 2 ++ currency/sentient/spy.tres | 2 ++ currency/sentient/town_crier.tres | 2 ++ currency/sentient/wizard.tres | 2 ++ economy.gd | 32 +++++++++++++++++++++++++++++- economy.tscn | 23 +++++++++++++++++++++ project.godot | 2 ++ 32 files changed, 105 insertions(+), 7 deletions(-) diff --git a/currency/abstract/plague.tres b/currency/abstract/plague.tres index 8779a29..6ea297f 100644 --- a/currency/abstract/plague.tres +++ b/currency/abstract/plague.tres @@ -5,4 +5,5 @@ [resource] script = ExtResource("2_qihur") +name = "Plague" metadata/_custom_type_script = "uid://ucjmg8grkta8" diff --git a/currency/abstract/time.tres b/currency/abstract/time.tres index fd09b45..bcf850a 100644 --- a/currency/abstract/time.tres +++ b/currency/abstract/time.tres @@ -5,4 +5,5 @@ [resource] script = ExtResource("2_tg12d") +name = "Time" metadata/_custom_type_script = "uid://ucjmg8grkta8" diff --git a/currency/inanimate/beer.tres b/currency/inanimate/beer.tres index 51e024d..560cf86 100644 --- a/currency/inanimate/beer.tres +++ b/currency/inanimate/beer.tres @@ -5,4 +5,5 @@ [resource] script = ExtResource("2_h7qij") +name = "Beer" metadata/_custom_type_script = "uid://b3tqa2kc2bu0p" diff --git a/currency/inanimate/blood.tres b/currency/inanimate/blood.tres index 3af372b..68be1dc 100644 --- a/currency/inanimate/blood.tres +++ b/currency/inanimate/blood.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="InanimateCurrency" format=3 uid="uid://by3dayfdpobpt"] [ext_resource type="Script" uid="uid://cthcf4w1il4h8" path="res://currency/inanimate_currency.gd" id="1_6u8vm"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_vpm3o"] [resource] script = ExtResource("1_6u8vm") +name = "Blood" metadata/_custom_type_script = "uid://b3tqa2kc2bu0p" diff --git a/currency/inanimate/bread.tres b/currency/inanimate/bread.tres index 5418dcb..f37a280 100644 --- a/currency/inanimate/bread.tres +++ b/currency/inanimate/bread.tres @@ -5,4 +5,5 @@ [resource] script = ExtResource("2_nt5od") +name = "Bread" metadata/_custom_type_script = "uid://b3tqa2kc2bu0p" diff --git a/currency/inanimate/corpse.tres b/currency/inanimate/corpse.tres index 92f4381..8b8da40 100644 --- a/currency/inanimate/corpse.tres +++ b/currency/inanimate/corpse.tres @@ -5,4 +5,5 @@ [resource] script = ExtResource("2_aao11") +name = "Corpse" metadata/_custom_type_script = "uid://b3tqa2kc2bu0p" diff --git a/currency/inanimate/gold.tres b/currency/inanimate/gold.tres index 28aa943..977a38c 100644 --- a/currency/inanimate/gold.tres +++ b/currency/inanimate/gold.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="InanimateCurrency" format=3 uid="uid://bnlnq4ucsgfxe"] [ext_resource type="Script" uid="uid://cthcf4w1il4h8" path="res://currency/inanimate_currency.gd" id="1_i8ogj"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_u4rls"] [resource] script = ExtResource("1_i8ogj") +name = "Gold" metadata/_custom_type_script = "uid://b3tqa2kc2bu0p" diff --git a/currency/inanimate/stone.tres b/currency/inanimate/stone.tres index 8891d52..2dea5fe 100644 --- a/currency/inanimate/stone.tres +++ b/currency/inanimate/stone.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="InanimateCurrency" format=3 uid="uid://ytteqojj7k1o"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_oss13"] [ext_resource type="Script" uid="uid://cthcf4w1il4h8" path="res://currency/inanimate_currency.gd" id="1_r1hhf"] [resource] script = ExtResource("1_r1hhf") +name = "Stone" metadata/_custom_type_script = "uid://b3tqa2kc2bu0p" diff --git a/currency/inanimate/water.tres b/currency/inanimate/water.tres index b68bdb2..e2949c0 100644 --- a/currency/inanimate/water.tres +++ b/currency/inanimate/water.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="InanimateCurrency" format=3 uid="uid://b8b6yr444ecdk"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_6tuon"] [ext_resource type="Script" uid="uid://cthcf4w1il4h8" path="res://currency/inanimate_currency.gd" id="1_s2pc4"] [resource] script = ExtResource("1_s2pc4") +name = "Water" metadata/_custom_type_script = "uid://b3tqa2kc2bu0p" diff --git a/currency/inanimate/wood.tres b/currency/inanimate/wood.tres index bb812d8..0938edd 100644 --- a/currency/inanimate/wood.tres +++ b/currency/inanimate/wood.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="InanimateCurrency" format=3 uid="uid://b7vjuqkog7cxd"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_g2gb5"] [ext_resource type="Script" uid="uid://cthcf4w1il4h8" path="res://currency/inanimate_currency.gd" id="1_ilt41"] [resource] script = ExtResource("1_ilt41") +name = "Wood" metadata/_custom_type_script = "uid://b3tqa2kc2bu0p" diff --git a/currency/production.gd b/currency/production.gd index 0dead2c..16001a4 100644 --- a/currency/production.gd +++ b/currency/production.gd @@ -1,11 +1,5 @@ extends Resource class_name Production -enum Type { - Produce, - Consume, -} - -@export var type = Type.Produce @export var currency: Currency @export var amount: int diff --git a/currency/sentient/archer.tres b/currency/sentient/archer.tres index b15a390..d4d2f5d 100644 --- a/currency/sentient/archer.tres +++ b/currency/sentient/archer.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://l8osuuxl7exe"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_e7gnr"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_m37xt"] [resource] script = ExtResource("1_e7gnr") +name = "Archer" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/calvary.tres b/currency/sentient/calvary.tres index 5f26a7a..5a5928b 100644 --- a/currency/sentient/calvary.tres +++ b/currency/sentient/calvary.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dlxnbyiurne1s"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_cnnt2"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_o1w50"] [resource] script = ExtResource("1_o1w50") +name = "Calvary" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/chicken.tres b/currency/sentient/chicken.tres index 3b3eb5e..5785ad5 100644 --- a/currency/sentient/chicken.tres +++ b/currency/sentient/chicken.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dsohovjbf3s2p"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_10o5k"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_cup2e"] [resource] script = ExtResource("1_10o5k") +name = "Chicken" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/cow.tres b/currency/sentient/cow.tres index c23c60a..5d1271b 100644 --- a/currency/sentient/cow.tres +++ b/currency/sentient/cow.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://b5qok0rcalr"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_0c5xt"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_607lg"] [resource] script = ExtResource("1_0c5xt") +name = "Cow" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/dinosaur.tres b/currency/sentient/dinosaur.tres index 0c13174..1afcc31 100644 --- a/currency/sentient/dinosaur.tres +++ b/currency/sentient/dinosaur.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://clx8tbrad4m7c"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_0dcki"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_qayfp"] [resource] script = ExtResource("1_0dcki") +name = "Dinosaur" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/doctor.tres b/currency/sentient/doctor.tres index 1a5dcce..d9814ad 100644 --- a/currency/sentient/doctor.tres +++ b/currency/sentient/doctor.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://b1tgtujqs5lnr"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_8u0th"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_ohece"] [resource] script = ExtResource("1_8u0th") +name = "Doctor" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/drunk.tres b/currency/sentient/drunk.tres index 8a73f21..adfa44f 100644 --- a/currency/sentient/drunk.tres +++ b/currency/sentient/drunk.tres @@ -5,4 +5,5 @@ [resource] script = ExtResource("2_j265y") +name = "Drunk" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/farmer.tres b/currency/sentient/farmer.tres index 385ba5c..041d176 100644 --- a/currency/sentient/farmer.tres +++ b/currency/sentient/farmer.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dn0c1pfq04obw"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_35xhy"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_kipvp"] [resource] script = ExtResource("1_kipvp") +name = "Farmer" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/kings_guard.tres b/currency/sentient/kings_guard.tres index af3462a..a317fad 100644 --- a/currency/sentient/kings_guard.tres +++ b/currency/sentient/kings_guard.tres @@ -5,4 +5,5 @@ [resource] script = ExtResource("1_y7sat") +name = "King Guard" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/lover.tres b/currency/sentient/lover.tres index 35688b0..716ea77 100644 --- a/currency/sentient/lover.tres +++ b/currency/sentient/lover.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://8uo3q8rn6qqr"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_8hvx0"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_qvvhd"] [resource] script = ExtResource("1_qvvhd") +name = "Lover" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/mercenary.tres b/currency/sentient/mercenary.tres index f6596a5..7c96784 100644 --- a/currency/sentient/mercenary.tres +++ b/currency/sentient/mercenary.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://sq2lrgnfjugj"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_81xhi"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_m8i4c"] [resource] script = ExtResource("1_m8i4c") +name = "Mercenary" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/messenger.tres b/currency/sentient/messenger.tres index a8ace7e..7bc1462 100644 --- a/currency/sentient/messenger.tres +++ b/currency/sentient/messenger.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dq70tpr5osjkk"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_egwdx"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_iy37t"] [resource] script = ExtResource("1_egwdx") +name = "Messenger" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/miner.tres b/currency/sentient/miner.tres index 830a65a..c106653 100644 --- a/currency/sentient/miner.tres +++ b/currency/sentient/miner.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dpaj2dk3qm7ow"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_phc4h"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_yn73g"] [resource] script = ExtResource("1_phc4h") +name = "Miner" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/pig.tres b/currency/sentient/pig.tres index b1aa497..345a13e 100644 --- a/currency/sentient/pig.tres +++ b/currency/sentient/pig.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://rdrcyvuvrp2m"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_c1r5q"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_g345f"] [resource] script = ExtResource("1_g345f") +name = "Pig" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/royalty.tres b/currency/sentient/royalty.tres index d8b0153..c57f4cc 100644 --- a/currency/sentient/royalty.tres +++ b/currency/sentient/royalty.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dk3wsnr3ku7ka"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_acsld"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_jo5ux"] [resource] script = ExtResource("1_jo5ux") +name = "Royalty" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/spy.tres b/currency/sentient/spy.tres index fdbad75..9ab32e6 100644 --- a/currency/sentient/spy.tres +++ b/currency/sentient/spy.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dfj4jwdmff6bu"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_ou6ev"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_wync1"] [resource] script = ExtResource("1_ou6ev") +name = "Spy" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/town_crier.tres b/currency/sentient/town_crier.tres index 38e1e73..ef2ee3c 100644 --- a/currency/sentient/town_crier.tres +++ b/currency/sentient/town_crier.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://chsv8oeajty8j"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_0qymk"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_an3bl"] [resource] script = ExtResource("1_an3bl") +name = "Town Crier" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/currency/sentient/wizard.tres b/currency/sentient/wizard.tres index a0cdbb1..c175f26 100644 --- a/currency/sentient/wizard.tres +++ b/currency/sentient/wizard.tres @@ -1,7 +1,9 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://6xylw7p78fvf"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_05kyk"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_tds6s"] [resource] script = ExtResource("1_tds6s") +name = "Wizard" metadata/_custom_type_script = "uid://hcvynq5fjypj" diff --git a/economy.gd b/economy.gd index 6b3851a..1f79d8d 100644 --- a/economy.gd +++ b/economy.gd @@ -1,6 +1,36 @@ extends Node +signal productions_update(p: Array[Production]) +signal production_log(producer: Currency, p: Production) @export var currencies: Array[Production] +@export var members: Array + +func get_currency(c: Currency) -> Production: + for p in currencies: + if c == p.currency: + return p + var p := Production.new() + p.currency = c + p.amount = 0 + currencies.append(p) + productions_update.emit.call_deferred(currencies) + return p + +func sync_currency(): + #for p in currencies: + #if p.amount == 0: + #currencies.remove_at() + productions_update.emit.call_deferred(currencies) + + +func produce(producer: Currency, production: Production): + production_log.emit.call_deferred(producer, production) func simulate(): - pass + productions_update.emit.call_deferred(currencies) + +func _ready() -> void: + simulate() + for i in range(100): + produce(preload("res://currency/sentient/chicken.tres"), currencies[0]) + produce(preload("res://currency/sentient/chicken.tres"), currencies[2]) diff --git a/economy.tscn b/economy.tscn index f59ef0a..06760a1 100644 --- a/economy.tscn +++ b/economy.tscn @@ -1,6 +1,29 @@ [gd_scene format=3 uid="uid://dnpioqaes87yb"] [ext_resource type="Script" uid="uid://i14prh1jocdd" path="res://economy.gd" id="1_csm0v"] +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="2_tljx8"] +[ext_resource type="Resource" uid="uid://dmctedq3pav0t" path="res://currency/inanimate/corpse.tres" id="3_4ctyq"] +[ext_resource type="Resource" uid="uid://rdrcyvuvrp2m" path="res://currency/sentient/pig.tres" id="4_d7dul"] +[ext_resource type="Resource" uid="uid://dfj4jwdmff6bu" path="res://currency/sentient/spy.tres" id="5_4ctyq"] + +[sub_resource type="Resource" id="Resource_jd86c"] +script = ExtResource("2_tljx8") +currency = ExtResource("3_4ctyq") +amount = 10 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_jd7cj"] +script = ExtResource("2_tljx8") +currency = ExtResource("4_d7dul") +amount = 3 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_ei3g1"] +script = ExtResource("2_tljx8") +currency = ExtResource("5_4ctyq") +amount = -4 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" [node name="Economy" type="Node" unique_id=1950923383] script = ExtResource("1_csm0v") +currencies = Array[ExtResource("2_tljx8")]([SubResource("Resource_jd86c"), SubResource("Resource_jd7cj"), SubResource("Resource_ei3g1")]) diff --git a/project.godot b/project.godot index 9f698a3..f98b4dc 100644 --- a/project.godot +++ b/project.godot @@ -10,11 +10,13 @@ config_version=5 [application] +run/main_scene="uid://d06w1wtct0mfs" config/features=PackedStringArray("4.7") [autoload] Dialogic="*uid://ds2q0uclmolvu" +Economy="*uid://dnpioqaes87yb" [dialogic] From 0b1e33a97c81f05cd41efa9382e42bafb7a8f082 Mon Sep 17 00:00:00 2001 From: Spencer Killen Date: Sat, 26 Sep 2026 10:54:36 -0600 Subject: [PATCH 2/2] work work --- gui/production_chart.gd | 12 ++++++++++++ gui/production_chart.gd.uid | 1 + gui/production_chart.tscn | 6 ++++++ gui/production_display.gd | 7 +++++++ gui/production_display.gd.uid | 1 + gui/production_display.tscn | 18 +++++++++++++++++ gui/production_ledger.gd | 10 ++++++++++ gui/production_ledger.gd.uid | 1 + gui/production_ledger.tscn | 6 ++++++ gui/production_log.gd | 14 +++++++++++++ gui/production_log.gd.uid | 1 + gui/production_log.tscn | 37 +++++++++++++++++++++++++++++++++++ test/test_economy.gd | 1 + test/test_economy.gd.uid | 1 + test/test_economy.tscn | 24 +++++++++++++++++++++++ 15 files changed, 140 insertions(+) create mode 100644 gui/production_chart.gd create mode 100644 gui/production_chart.gd.uid create mode 100644 gui/production_chart.tscn create mode 100644 gui/production_display.gd create mode 100644 gui/production_display.gd.uid create mode 100644 gui/production_display.tscn create mode 100644 gui/production_ledger.gd create mode 100644 gui/production_ledger.gd.uid create mode 100644 gui/production_ledger.tscn create mode 100644 gui/production_log.gd create mode 100644 gui/production_log.gd.uid create mode 100644 gui/production_log.tscn create mode 100644 test/test_economy.gd create mode 100644 test/test_economy.gd.uid create mode 100644 test/test_economy.tscn diff --git a/gui/production_chart.gd b/gui/production_chart.gd new file mode 100644 index 0000000..41ae7f2 --- /dev/null +++ b/gui/production_chart.gd @@ -0,0 +1,12 @@ +extends VBoxContainer + +func _ready() -> void: + Economy.productions_update.connect(sync) + +func sync(productions: Array[Production]): + for child in get_children(): + child.queue_free() + for p in productions: + var display := preload("res://gui/production_display.tscn").instantiate() + display.production = p + add_child(display) diff --git a/gui/production_chart.gd.uid b/gui/production_chart.gd.uid new file mode 100644 index 0000000..8b618d4 --- /dev/null +++ b/gui/production_chart.gd.uid @@ -0,0 +1 @@ +uid://6u0icldaifvd diff --git a/gui/production_chart.tscn b/gui/production_chart.tscn new file mode 100644 index 0000000..08a490b --- /dev/null +++ b/gui/production_chart.tscn @@ -0,0 +1,6 @@ +[gd_scene format=3 uid="uid://desvyn6e28oar"] + +[ext_resource type="Script" uid="uid://6u0icldaifvd" path="res://gui/production_chart.gd" id="1_esxju"] + +[node name="ProductionChart" type="VBoxContainer" unique_id=1301678172] +script = ExtResource("1_esxju") diff --git a/gui/production_display.gd b/gui/production_display.gd new file mode 100644 index 0000000..b618ed0 --- /dev/null +++ b/gui/production_display.gd @@ -0,0 +1,7 @@ +extends Control + +@export var production: Production + +func _ready() -> void: + %Name.text = production.currency.name + %Amount.text = str(production.amount) diff --git a/gui/production_display.gd.uid b/gui/production_display.gd.uid new file mode 100644 index 0000000..b835f41 --- /dev/null +++ b/gui/production_display.gd.uid @@ -0,0 +1 @@ +uid://ck17fbo6svid8 diff --git a/gui/production_display.tscn b/gui/production_display.tscn new file mode 100644 index 0000000..0255058 --- /dev/null +++ b/gui/production_display.tscn @@ -0,0 +1,18 @@ +[gd_scene format=3 uid="uid://dmka51sldrutn"] + +[ext_resource type="Script" uid="uid://ck17fbo6svid8" path="res://gui/production_display.gd" id="1_dfe88"] + +[node name="ProductionDisplay" type="MarginContainer" unique_id=253822540] +custom_minimum_size = Vector2(400, 0) +script = ExtResource("1_dfe88") + +[node name="Name" type="Label" parent="." unique_id=1739229616] +unique_name_in_owner = true +layout_mode = 2 +text = "" + +[node name="Amount" type="Label" parent="." unique_id=660284845] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 8 +text = "0" diff --git a/gui/production_ledger.gd b/gui/production_ledger.gd new file mode 100644 index 0000000..8307090 --- /dev/null +++ b/gui/production_ledger.gd @@ -0,0 +1,10 @@ +extends VBoxContainer + +func _ready() -> void: + Economy.production_log.connect(append) + +func append(producer: Currency, production: Production): + var display := preload("res://gui/production_log.tscn").instantiate() + display.producer = producer + display.production = production + add_child(display) diff --git a/gui/production_ledger.gd.uid b/gui/production_ledger.gd.uid new file mode 100644 index 0000000..7a8243f --- /dev/null +++ b/gui/production_ledger.gd.uid @@ -0,0 +1 @@ +uid://5u2qeh5gvhhl diff --git a/gui/production_ledger.tscn b/gui/production_ledger.tscn new file mode 100644 index 0000000..6e3d4e5 --- /dev/null +++ b/gui/production_ledger.tscn @@ -0,0 +1,6 @@ +[gd_scene format=3 uid="uid://cxv743rjsolk5"] + +[ext_resource type="Script" uid="uid://5u2qeh5gvhhl" path="res://gui/production_ledger.gd" id="1_8f0gq"] + +[node name="ProductionChart" type="VBoxContainer" unique_id=1301678172] +script = ExtResource("1_8f0gq") diff --git a/gui/production_log.gd b/gui/production_log.gd new file mode 100644 index 0000000..182ada2 --- /dev/null +++ b/gui/production_log.gd @@ -0,0 +1,14 @@ +extends Control + +@export var producer: Currency +@export var production: Production + +func _ready() -> void: + %producer.text = producer.name + %amount.text = str(abs(production.amount)) + if production.amount > 0: + %type.text = "produced" + else: + %type.text = "consumed" + + %production.text = production.currency.name diff --git a/gui/production_log.gd.uid b/gui/production_log.gd.uid new file mode 100644 index 0000000..32571ef --- /dev/null +++ b/gui/production_log.gd.uid @@ -0,0 +1 @@ +uid://cm5y8byaoeda5 diff --git a/gui/production_log.tscn b/gui/production_log.tscn new file mode 100644 index 0000000..ee56be1 --- /dev/null +++ b/gui/production_log.tscn @@ -0,0 +1,37 @@ +[gd_scene format=3 uid="uid://dth0nxini731n"] + +[ext_resource type="Script" uid="uid://cm5y8byaoeda5" path="res://gui/production_log.gd" id="1_ei3g1"] + +[node name="ProductionLog" type="MarginContainer" unique_id=253822540] +script = ExtResource("1_ei3g1") + +[node name="HBoxContainer" type="HBoxContainer" parent="." unique_id=1073672077] +layout_mode = 2 + +[node name="producer" type="Label" parent="HBoxContainer" unique_id=1739229616] +unique_name_in_owner = true +layout_mode = 2 +text = "" + +[node name="type" type="Label" parent="HBoxContainer" unique_id=660284845] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 8 +text = "produced" + +[node name="amount" type="Label" parent="HBoxContainer" unique_id=146404186] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 8 +text = "0" + +[node name="text_produced2" type="Label" parent="HBoxContainer" unique_id=1784666448] +layout_mode = 2 +size_flags_horizontal = 8 +text = "of" + +[node name="production" type="Label" parent="HBoxContainer" unique_id=1547964707] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 8 +text = "" diff --git a/test/test_economy.gd b/test/test_economy.gd new file mode 100644 index 0000000..e07a0bf --- /dev/null +++ b/test/test_economy.gd @@ -0,0 +1 @@ +extends Control diff --git a/test/test_economy.gd.uid b/test/test_economy.gd.uid new file mode 100644 index 0000000..51db366 --- /dev/null +++ b/test/test_economy.gd.uid @@ -0,0 +1 @@ +uid://6438cbkn3fhm diff --git a/test/test_economy.tscn b/test/test_economy.tscn new file mode 100644 index 0000000..ba5af42 --- /dev/null +++ b/test/test_economy.tscn @@ -0,0 +1,24 @@ +[gd_scene format=3 uid="uid://d06w1wtct0mfs"] + +[ext_resource type="Script" uid="uid://6438cbkn3fhm" path="res://test/test_economy.gd" id="1_s48qe"] +[ext_resource type="PackedScene" uid="uid://desvyn6e28oar" path="res://gui/production_chart.tscn" id="2_jd86c"] +[ext_resource type="PackedScene" uid="uid://cxv743rjsolk5" path="res://gui/production_ledger.tscn" id="3_jd7cj"] + +[node name="TestEconomy" type="Control" unique_id=629898212] +layout_mode = 3 +anchors_preset = 0 +script = ExtResource("1_s48qe") + +[node name="ProductionChart" parent="." unique_id=1301678172 instance=ExtResource("2_jd86c")] +layout_mode = 0 + +[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=1023925432] +custom_minimum_size = Vector2(600, 100) +layout_mode = 0 +offset_left = 153.0 +offset_top = 346.0 +offset_right = 161.0 +offset_bottom = 346.0 + +[node name="ProductionChart2" parent="ScrollContainer" unique_id=1698529519 instance=ExtResource("3_jd7cj")] +layout_mode = 2