This commit is contained in:
Spencer Killen 2026-09-26 12:37:45 -06:00
parent ff357a7131
commit 6f3e2e4b95
Signed by: sjkillen
GPG key ID: 1DAA9D8D7C6ADD05
32 changed files with 329 additions and 23 deletions

6
UserContext.tscn Normal file
View file

@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://0a08ucta58lp"]
[ext_resource type="Script" uid="uid://cl24d6o0rj78f" path="res://user_context.gd" id="1_1x84n"]
[node name="UserContext" type="Node" unique_id=1649918931]
script = ExtResource("1_1x84n")

View file

@ -3,3 +3,4 @@ class_name Currency
@export var name: String @export var name: String
@export var production: Array[Production] @export var production: Array[Production]
@export_multiline var description = "no description of currency"

View file

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="InanimateCurrency" format=3 uid="uid://y4ssn47oa8tm"]
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_2mm5k"]
[ext_resource type="Script" uid="uid://cthcf4w1il4h8" path="res://currency/inanimate_currency.gd" id="2_e2hgv"]
[resource]
script = ExtResource("2_e2hgv")
name = "Fertilizer"
metadata/_custom_type_script = "uid://b3tqa2kc2bu0p"

View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="Production" format=3 uid="uid://boshkhnywnk27"]
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_mn5kr"]
[ext_resource type="Resource" uid="uid://ervsee7ku1i2" path="res://currency/inanimate/bread.tres" id="1_q30nv"]
[resource]
script = ExtResource("1_mn5kr")
currency = ExtResource("1_q30nv")
amount = -1
metadata/_custom_type_script = "uid://dddyxbkq0ienn"

View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="Production" format=3 uid="uid://mgb7y1r3eapq"]
[ext_resource type="Resource" uid="uid://y4ssn47oa8tm" path="res://currency/inanimate/fertilizer.tres" id="1_yms1a"]
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="2_ww73s"]
[resource]
script = ExtResource("2_ww73s")
currency = ExtResource("1_yms1a")
amount = 1
metadata/_custom_type_script = "uid://dddyxbkq0ienn"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_e7gnr"] [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"] [ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_m37xt"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_b0duy"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_k672a"]
[resource] [resource]
script = ExtResource("1_e7gnr") script = ExtResource("1_e7gnr")
name = "Archer" name = "Archer"
production = Array[ExtResource("1_m37xt")]([ExtResource("2_b0duy"), ExtResource("3_k672a")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_cnnt2"] [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"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_o1w50"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_hqcau"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_lyu7q"]
[resource] [resource]
script = ExtResource("1_o1w50") script = ExtResource("1_o1w50")
name = "Calvary" name = "Calvary"
production = Array[ExtResource("1_cnnt2")]([ExtResource("2_hqcau"), ExtResource("3_lyu7q")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_8u0th"] [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"] [ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_ohece"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_u3n2t"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_yv5d2"]
[resource] [resource]
script = ExtResource("1_8u0th") script = ExtResource("1_8u0th")
name = "Doctor" name = "Doctor"
production = Array[ExtResource("1_ohece")]([ExtResource("2_u3n2t"), ExtResource("3_yv5d2")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -1,9 +1,12 @@
[gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dv834343s36af"] [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dv834343s36af"]
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_b07i1"] [ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_b07i1"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_0dvy8"]
[ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="2_j265y"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="2_j265y"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_0dvy8"]
[resource] [resource]
script = ExtResource("2_j265y") script = ExtResource("2_j265y")
name = "Drunk" name = "Drunk"
production = Array[ExtResource("1_b07i1")]([ExtResource("2_0dvy8"), ExtResource("3_0dvy8")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_35xhy"] [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"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_kipvp"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_jkjll"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_kfqfp"]
[resource] [resource]
script = ExtResource("1_kipvp") script = ExtResource("1_kipvp")
name = "Farmer" name = "Farmer"
production = Array[ExtResource("1_35xhy")]([ExtResource("2_jkjll"), ExtResource("3_kfqfp")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_f1fuf"] [ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_f1fuf"]
[ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_y7sat"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_y7sat"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_s3h3i"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_3jtdd"]
[resource] [resource]
script = ExtResource("1_y7sat") script = ExtResource("1_y7sat")
name = "King Guard" name = "King Guard"
production = Array[ExtResource("1_f1fuf")]([ExtResource("2_s3h3i"), ExtResource("3_3jtdd")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -0,0 +1,12 @@
[gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://ihsvxienxbeu"]
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_626vc"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_sa77c"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_xhy5h"]
[ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="4_7d8n3"]
[resource]
script = ExtResource("4_7d8n3")
name = "Knight"
production = Array[ExtResource("1_626vc")]([ExtResource("2_sa77c"), ExtResource("3_xhy5h")])
metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_8hvx0"] [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"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_qvvhd"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_xggvw"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_8a0mj"]
[resource] [resource]
script = ExtResource("1_qvvhd") script = ExtResource("1_qvvhd")
name = "Lover" name = "Lover"
production = Array[ExtResource("1_8hvx0")]([ExtResource("2_xggvw"), ExtResource("3_8a0mj")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_81xhi"] [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"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_m8i4c"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_x1puw"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_yveov"]
[resource] [resource]
script = ExtResource("1_m8i4c") script = ExtResource("1_m8i4c")
name = "Mercenary" name = "Mercenary"
production = Array[ExtResource("1_81xhi")]([ExtResource("2_x1puw"), ExtResource("3_yveov")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_egwdx"] [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"] [ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_iy37t"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_demtt"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_mxgt6"]
[resource] [resource]
script = ExtResource("1_egwdx") script = ExtResource("1_egwdx")
name = "Messenger" name = "Messenger"
production = Array[ExtResource("1_iy37t")]([ExtResource("2_demtt"), ExtResource("3_mxgt6")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_phc4h"] [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"] [ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_yn73g"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_8h62s"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_2kvuq"]
[resource] [resource]
script = ExtResource("1_phc4h") script = ExtResource("1_phc4h")
name = "Miner" name = "Miner"
production = Array[ExtResource("1_yn73g")]([ExtResource("2_8h62s"), ExtResource("3_2kvuq")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_acsld"] [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"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_jo5ux"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_40pnt"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_xy04b"]
[resource] [resource]
script = ExtResource("1_jo5ux") script = ExtResource("1_jo5ux")
name = "Royalty" name = "Royalty"
production = Array[ExtResource("1_acsld")]([ExtResource("2_40pnt"), ExtResource("3_xy04b")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_ou6ev"] [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"] [ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_wync1"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_30yvg"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_pvkom"]
[resource] [resource]
script = ExtResource("1_ou6ev") script = ExtResource("1_ou6ev")
name = "Spy" name = "Spy"
production = Array[ExtResource("1_wync1")]([ExtResource("2_30yvg"), ExtResource("3_pvkom")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_0qymk"] [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"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_an3bl"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_0o8mq"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_xknsl"]
[resource] [resource]
script = ExtResource("1_an3bl") script = ExtResource("1_an3bl")
name = "Town Crier" name = "Town Crier"
production = Array[ExtResource("1_0qymk")]([ExtResource("2_0o8mq"), ExtResource("3_xknsl")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -2,8 +2,11 @@
[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_05kyk"] [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"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_tds6s"]
[ext_resource type="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_ud150"]
[ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_mp872"]
[resource] [resource]
script = ExtResource("1_tds6s") script = ExtResource("1_tds6s")
name = "Wizard" name = "Wizard"
production = Array[ExtResource("1_05kyk")]([ExtResource("2_ud150"), ExtResource("3_mp872")])
metadata/_custom_type_script = "uid://hcvynq5fjypj" metadata/_custom_type_script = "uid://hcvynq5fjypj"

View file

@ -6,6 +6,7 @@ signal production_log(producer: Currency, p: Production)
@export var members: Array @export var members: Array
func get_currency(c: Currency) -> Production: func get_currency(c: Currency) -> Production:
sync_currency.call_deferred()
for p in currencies: for p in currencies:
if c == p.currency: if c == p.currency:
return p return p
@ -13,24 +14,36 @@ func get_currency(c: Currency) -> Production:
p.currency = c p.currency = c
p.amount = 0 p.amount = 0
currencies.append(p) currencies.append(p)
productions_update.emit.call_deferred(currencies)
return p return p
func sync_currency(): func sync_currency():
#for p in currencies: var did_remove := true
#if p.amount == 0: while did_remove:
#currencies.remove_at() did_remove = false
productions_update.emit.call_deferred(currencies) for i in range(len(currencies)):
var p: Production = currencies[i]
if p.amount == 0:
currencies.remove_at(i)
did_remove = true
break
productions_update.emit(currencies)
func produce(producer: Currency, production: Production): func produce(producer: Currency, production: Production):
production_log.emit.call_deferred(producer, production) sync_currency.call_deferred()
var c := get_currency(production.currency)
c.amount += production.amount
func simulate(): func simulate():
productions_update.emit.call_deferred(currencies) productions_update.emit.call_deferred(currencies)
for c in currencies:
for p in c.currency.production:
var pp := Production.new()
pp.currency = p.currency
pp.amount = c.amount * p.amount
produce(c.currency, pp)
# TODO remove this
production_log.emit.call_deferred(c.currency, pp)
func _ready() -> void: func _ready() -> void:
simulate() simulate()
for i in range(100):
produce(preload("res://currency/sentient/chicken.tres"), currencies[0])
produce(preload("res://currency/sentient/chicken.tres"), currencies[2])

View file

@ -2,28 +2,63 @@
[ext_resource type="Script" uid="uid://i14prh1jocdd" path="res://economy.gd" id="1_csm0v"] [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="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://dk3wsnr3ku7ka" path="res://currency/sentient/royalty.tres" id="3_ms0h4"]
[ext_resource type="Resource" uid="uid://rdrcyvuvrp2m" path="res://currency/sentient/pig.tres" id="4_d7dul"] [ext_resource type="Resource" uid="uid://cwpk5e2exbgcr" path="res://currency/sentient/kings_guard.tres" id="4_17ik3"]
[ext_resource type="Resource" uid="uid://dfj4jwdmff6bu" path="res://currency/sentient/spy.tres" id="5_4ctyq"] [ext_resource type="Resource" uid="uid://ervsee7ku1i2" path="res://currency/inanimate/bread.tres" id="4_yg0ra"]
[ext_resource type="Resource" uid="uid://b8b6yr444ecdk" path="res://currency/inanimate/water.tres" id="5_17ik3"]
[ext_resource type="Resource" uid="uid://chsv8oeajty8j" path="res://currency/sentient/town_crier.tres" id="6_2k4vk"]
[ext_resource type="Resource" uid="uid://dn0c1pfq04obw" path="res://currency/sentient/farmer.tres" id="7_isn2b"]
[ext_resource type="Resource" uid="uid://ihsvxienxbeu" path="res://currency/sentient/knight.tres" id="8_qb8iw"]
[ext_resource type="Resource" uid="uid://l8osuuxl7exe" path="res://currency/sentient/archer.tres" id="9_4ywr4"]
[sub_resource type="Resource" id="Resource_jd86c"] [sub_resource type="Resource" id="Resource_g3220"]
script = ExtResource("2_tljx8") script = ExtResource("2_tljx8")
currency = ExtResource("3_4ctyq") currency = ExtResource("3_ms0h4")
amount = 10 amount = 1
metadata/_custom_type_script = "uid://dddyxbkq0ienn" metadata/_custom_type_script = "uid://dddyxbkq0ienn"
[sub_resource type="Resource" id="Resource_jd7cj"] [sub_resource type="Resource" id="Resource_bb1uu"]
script = ExtResource("2_tljx8") script = ExtResource("2_tljx8")
currency = ExtResource("4_d7dul") currency = ExtResource("4_17ik3")
amount = 3 amount = 4
metadata/_custom_type_script = "uid://dddyxbkq0ienn" metadata/_custom_type_script = "uid://dddyxbkq0ienn"
[sub_resource type="Resource" id="Resource_ei3g1"] [sub_resource type="Resource" id="Resource_vw3jp"]
script = ExtResource("2_tljx8") script = ExtResource("2_tljx8")
currency = ExtResource("5_4ctyq") currency = ExtResource("4_yg0ra")
amount = -4 amount = 1000
metadata/_custom_type_script = "uid://dddyxbkq0ienn"
[sub_resource type="Resource" id="Resource_xg8li"]
script = ExtResource("2_tljx8")
currency = ExtResource("5_17ik3")
amount = 5000
metadata/_custom_type_script = "uid://dddyxbkq0ienn"
[sub_resource type="Resource" id="Resource_f6kxb"]
script = ExtResource("2_tljx8")
currency = ExtResource("6_2k4vk")
amount = 1
metadata/_custom_type_script = "uid://dddyxbkq0ienn"
[sub_resource type="Resource" id="Resource_6u4g3"]
script = ExtResource("2_tljx8")
currency = ExtResource("7_isn2b")
amount = 50
metadata/_custom_type_script = "uid://dddyxbkq0ienn"
[sub_resource type="Resource" id="Resource_aqv3t"]
script = ExtResource("2_tljx8")
currency = ExtResource("8_qb8iw")
amount = 25
metadata/_custom_type_script = "uid://dddyxbkq0ienn"
[sub_resource type="Resource" id="Resource_g2km3"]
script = ExtResource("2_tljx8")
currency = ExtResource("9_4ywr4")
amount = 15
metadata/_custom_type_script = "uid://dddyxbkq0ienn" metadata/_custom_type_script = "uid://dddyxbkq0ienn"
[node name="Economy" type="Node" unique_id=1950923383] [node name="Economy" type="Node" unique_id=1950923383]
script = ExtResource("1_csm0v") script = ExtResource("1_csm0v")
currencies = Array[ExtResource("2_tljx8")]([SubResource("Resource_jd86c"), SubResource("Resource_jd7cj"), SubResource("Resource_ei3g1")]) currencies = Array[ExtResource("2_tljx8")]([SubResource("Resource_g3220"), SubResource("Resource_bb1uu"), SubResource("Resource_vw3jp"), SubResource("Resource_xg8li"), SubResource("Resource_f6kxb"), SubResource("Resource_6u4g3"), SubResource("Resource_aqv3t"), SubResource("Resource_g2km3")])

View file

@ -0,0 +1,28 @@
extends Control
var currency: Currency = null
func _ready() -> void:
UserContext.currency_inspect.connect(currency_inspect)
update()
func currency_inspect(c: Currency):
currency = c
update()
func update():
if currency == null:
visible = false
return
visible = true
%InspectedCurrency.text = currency.name
%CurrencyDescription.text = currency.description
for child in %ProductionsList.get_children():
child.queue_free()
for production in currency.production:
var display := preload("res://gui/production_display.tscn").instantiate()
display.production = production
%ProductionsList.add_child(display)
func _on_close_button_pressed() -> void:
visible = false

View file

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

View file

@ -0,0 +1,76 @@
[gd_scene format=3 uid="uid://75htlmk51oo"]
[ext_resource type="Script" uid="uid://bkptc7j6c1r7p" path="res://gui/currency_inspector_panel.gd" id="1_tj5vo"]
[sub_resource type="Gradient" id="Gradient_jd7cj"]
[sub_resource type="GradientTexture2D" id="GradientTexture2D_y6nab"]
gradient = SubResource("Gradient_jd7cj")
[sub_resource type="CanvasTexture" id="CanvasTexture_4sc8i"]
diffuse_texture = SubResource("GradientTexture2D_y6nab")
[node name="CurrencyInspectorPanel" type="Control" unique_id=169191981]
custom_minimum_size = Vector2(0, 100)
layout_mode = 3
anchors_preset = 11
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -188.0
offset_right = -188.0
grow_horizontal = 0
grow_vertical = 2
script = ExtResource("1_tj5vo")
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=362599487]
custom_minimum_size = Vector2(400, 0)
custom_maximum_size = Vector2(400, -1)
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -253.0
offset_right = 47.0
offset_bottom = 149.0
grow_horizontal = 2
[node name="InspectedCurrency" type="Label" parent="VBoxContainer" unique_id=1206438498]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 0
text = "< Selected Currency >"
[node name="CurrrencyImage" type="TextureRect" parent="VBoxContainer" unique_id=1066520786]
unique_name_in_owner = true
layout_mode = 2
texture = SubResource("CanvasTexture_4sc8i")
[node name="CurrencyDescription" type="Label" parent="VBoxContainer" unique_id=543173020]
unique_name_in_owner = true
layout_mode = 2
text = "< Description of currency >"
[node name="word" type="Label" parent="VBoxContainer" unique_id=835011658]
layout_mode = 2
text = "Production:"
[node name="ProductionsList" type="VBoxContainer" parent="VBoxContainer" unique_id=1042554009]
unique_name_in_owner = true
layout_mode = 2
[node name="CloseButton" type="Button" parent="." unique_id=404008755]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -44.5
offset_top = -31.0
offset_right = 44.5
grow_horizontal = 2
grow_vertical = 0
text = "close"
[connection signal="pressed" from="CloseButton" to="." method="_on_close_button_pressed"]

View file

@ -5,3 +5,7 @@ extends Control
func _ready() -> void: func _ready() -> void:
%Name.text = production.currency.name %Name.text = production.currency.name
%Amount.text = str(production.amount) %Amount.text = str(production.amount)
func _on_inspect_button_pressed() -> void:
UserContext.currency_inspect.emit(production.currency)

View file

@ -16,3 +16,8 @@ unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 8 size_flags_horizontal = 8
text = "0" text = "0"
[node name="InspectButton" type="Button" parent="." unique_id=54175511]
layout_mode = 2
[connection signal="pressed" from="InspectButton" to="." method="_on_inspect_button_pressed"]

View file

@ -18,6 +18,7 @@ config/features=PackedStringArray("4.7")
Dialogic="*uid://ds2q0uclmolvu" Dialogic="*uid://ds2q0uclmolvu"
Economy="*uid://dnpioqaes87yb" Economy="*uid://dnpioqaes87yb"
Random="*uid://cu3n7igqstbxi" Random="*uid://cu3n7igqstbxi"
UserContext="*uid://0a08ucta58lp"
[dialogic] [dialogic]

View file

@ -1 +1,11 @@
extends Control extends Control
func _on_get_cow_pressed() -> void:
var p := Economy.get_currency(preload("res://currency/sentient/cow.tres"))
p.amount += 1
func _on_run_simulate_pressed() -> void:
Economy.simulate()

View file

@ -3,10 +3,15 @@
[ext_resource type="Script" uid="uid://6438cbkn3fhm" path="res://test/test_economy.gd" id="1_s48qe"] [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://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"] [ext_resource type="PackedScene" uid="uid://cxv743rjsolk5" path="res://gui/production_ledger.tscn" id="3_jd7cj"]
[ext_resource type="PackedScene" uid="uid://75htlmk51oo" path="res://gui/currency_inspector_panel.tscn" id="4_7ya5o"]
[node name="TestEconomy" type="Control" unique_id=629898212] [node name="TestEconomy" type="Control" unique_id=629898212]
layout_mode = 3 layout_mode = 3
anchors_preset = 0 anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_s48qe") script = ExtResource("1_s48qe")
[node name="ProductionChart" parent="." unique_id=1301678172 instance=ExtResource("2_jd86c")] [node name="ProductionChart" parent="." unique_id=1301678172 instance=ExtResource("2_jd86c")]
@ -22,3 +27,36 @@ offset_bottom = 346.0
[node name="ProductionChart2" parent="ScrollContainer" unique_id=1698529519 instance=ExtResource("3_jd7cj")] [node name="ProductionChart2" parent="ScrollContainer" unique_id=1698529519 instance=ExtResource("3_jd7cj")]
layout_mode = 2 layout_mode = 2
[node name="Control" type="Control" parent="." unique_id=641955392]
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -145.0
offset_top = -17.0
offset_right = -105.0
offset_bottom = 23.0
grow_horizontal = 0
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="Control" unique_id=74649172]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="GetCow" type="Button" parent="Control/VBoxContainer" unique_id=1886603156]
layout_mode = 2
text = "Get cow"
[node name="RunSimulate" type="Button" parent="Control/VBoxContainer" unique_id=158790493]
layout_mode = 2
text = "Run simulate"
[node name="CurrencyInspectorPanel" parent="." unique_id=169191981 instance=ExtResource("4_7ya5o")]
layout_mode = 1
[connection signal="pressed" from="Control/VBoxContainer/GetCow" to="." method="_on_get_cow_pressed"]
[connection signal="pressed" from="Control/VBoxContainer/RunSimulate" to="." method="_on_run_simulate_pressed"]

4
user_context.gd Normal file
View file

@ -0,0 +1,4 @@
extends Node
@warning_ignore("unused_signal")
signal currency_inspect(c: Currency)

1
user_context.gd.uid Normal file
View file

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