From 0de500309005a59112b744a57377851e4dda12b5 Mon Sep 17 00:00:00 2001 From: Spencer Killen Date: Sat, 26 Sep 2026 20:40:39 -0600 Subject: [PATCH 1/5] . --- economy.gd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/economy.gd b/economy.gd index 947a287..9c6822a 100644 --- a/economy.gd +++ b/economy.gd @@ -18,6 +18,8 @@ func get_currency(c: Currency) -> Production: return p func do_bribing(p: Production) -> bool: + if get_currency_amount(p.currency) < p.amount: + return false produce(negate_production(p)) return true From 575ae4f49dd48c8ac0bf1bfde9748196dfa81db8 Mon Sep 17 00:00:00 2001 From: Tandy Date: Sat, 26 Sep 2026 20:55:28 -0600 Subject: [PATCH 2/5] sdfsdfdsf --- event.gd | 1 + project.godot | 2 + random events/a_pig_flew.tres | 33 +++++++++++++++ random events/from_farmer_to_table.tres | 54 +++++++++++++++++++++++++ test/a_pig_flew.dtl | 7 ++++ test/a_pig_flew.dtl.uid | 1 + test/from_farmer_to_table.dtl | 3 ++ test/from_farmer_to_table.dtl.uid | 1 + 8 files changed, 102 insertions(+) create mode 100644 random events/a_pig_flew.tres create mode 100644 random events/from_farmer_to_table.tres create mode 100644 test/a_pig_flew.dtl create mode 100644 test/a_pig_flew.dtl.uid create mode 100644 test/from_farmer_to_table.dtl create mode 100644 test/from_farmer_to_table.dtl.uid diff --git a/event.gd b/event.gd index 90a5c90..9497d20 100644 --- a/event.gd +++ b/event.gd @@ -1,5 +1,6 @@ extends Resource class_name Event @export var modified_resource: Production +@export var extra_mods: Array[Production] @export var timeline: DialogicTimeline @export var requirements: Array[Production] diff --git a/project.godot b/project.godot index 2fc66c8..e137856 100644 --- a/project.godot +++ b/project.godot @@ -26,6 +26,7 @@ LetterGeneration="*uid://d156m2y8b38qs" directories/dch_directory={} directories/dtl_directory={ +"a_pig_flew": "res://test/a_pig_flew.dtl", "asking for currency solo": "res://test/asking for currency solo.dtl", "bar_crawl": "res://test/bar_crawl.dtl", "blood_rain": "res://test/blood_rain.dtl", @@ -35,6 +36,7 @@ directories/dtl_directory={ "dino": "res://test/dino.dtl", "double_agent": "res://test/double_agent.dtl", "drought": "res://test/drought.dtl", +"from_farmer_to_table": "res://test/from_farmer_to_table.dtl", "goldrush": "res://test/goldrush.dtl", "new intel": "res://test/new intel.dtl", "outbreak": "res://test/outbreak.dtl", diff --git a/random events/a_pig_flew.tres b/random events/a_pig_flew.tres new file mode 100644 index 0000000..564f117 --- /dev/null +++ b/random events/a_pig_flew.tres @@ -0,0 +1,33 @@ +[gd_resource type="Resource" script_class="Event" format=3 uid="uid://ddjairvlvswck"] + +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_puqnt"] +[ext_resource type="Resource" uid="uid://b5qok0rcalr" path="res://currency/sentient/cow.tres" id="2_tqpw4"] +[ext_resource type="Resource" uid="uid://dsohovjbf3s2p" path="res://currency/sentient/chicken.tres" id="3_unbcn"] +[ext_resource type="Resource" uid="uid://rdrcyvuvrp2m" path="res://currency/sentient/pig.tres" id="4_k6ytv"] +[ext_resource type="Script" uid="uid://diwdxofo6exg3" path="res://event.gd" id="5_ks6hr"] +[ext_resource type="Resource" uid="uid://dnfywi4qk5tj" path="res://test/a_pig_flew.dtl" id="6_tqpw4"] + +[sub_resource type="Resource" id="Resource_stddx"] +script = ExtResource("1_puqnt") +currency = ExtResource("2_tqpw4") +amount = 15 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_3520l"] +script = ExtResource("1_puqnt") +currency = ExtResource("3_unbcn") +amount = 15 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_wblg4"] +script = ExtResource("1_puqnt") +currency = ExtResource("4_k6ytv") +amount = 15 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[resource] +script = ExtResource("5_ks6hr") +modified_resource = SubResource("Resource_wblg4") +extra_mods = Array[ExtResource("1_puqnt")]([SubResource("Resource_stddx"), SubResource("Resource_3520l")]) +timeline = ExtResource("6_tqpw4") +metadata/_custom_type_script = "uid://diwdxofo6exg3" diff --git a/random events/from_farmer_to_table.tres b/random events/from_farmer_to_table.tres new file mode 100644 index 0000000..e2480d7 --- /dev/null +++ b/random events/from_farmer_to_table.tres @@ -0,0 +1,54 @@ +[gd_resource type="Resource" script_class="Event" format=3 uid="uid://f7qw65154l20"] + +[ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_piiqm"] +[ext_resource type="Resource" uid="uid://dmctedq3pav0t" path="res://currency/inanimate/corpse.tres" id="2_khbdk"] +[ext_resource type="Resource" uid="uid://dn0c1pfq04obw" path="res://currency/sentient/farmer.tres" id="3_4gw5s"] +[ext_resource type="Resource" uid="uid://b5qok0rcalr" path="res://currency/sentient/cow.tres" id="4_rfq60"] +[ext_resource type="Resource" uid="uid://rdrcyvuvrp2m" path="res://currency/sentient/pig.tres" id="5_x0khx"] +[ext_resource type="Resource" uid="uid://dsohovjbf3s2p" path="res://currency/sentient/chicken.tres" id="6_6f6jr"] +[ext_resource type="Script" uid="uid://diwdxofo6exg3" path="res://event.gd" id="7_q4b6l"] +[ext_resource type="Resource" uid="uid://dctqq013bc6rx" path="res://test/from_farmer_to_table.dtl" id="8_khbdk"] + +[sub_resource type="Resource" id="Resource_korph"] +script = ExtResource("1_piiqm") +currency = ExtResource("2_khbdk") +amount = 15 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_7vjbg"] +script = ExtResource("1_piiqm") +currency = ExtResource("3_4gw5s") +amount = -15 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_u1m57"] +script = ExtResource("1_piiqm") +currency = ExtResource("3_4gw5s") +amount = 20 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_biffg"] +script = ExtResource("1_piiqm") +currency = ExtResource("4_rfq60") +amount = 20 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_i756o"] +script = ExtResource("1_piiqm") +currency = ExtResource("5_x0khx") +amount = 20 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[sub_resource type="Resource" id="Resource_uhb4h"] +script = ExtResource("1_piiqm") +currency = ExtResource("6_6f6jr") +amount = 20 +metadata/_custom_type_script = "uid://dddyxbkq0ienn" + +[resource] +script = ExtResource("7_q4b6l") +modified_resource = SubResource("Resource_7vjbg") +extra_mods = Array[ExtResource("1_piiqm")]([SubResource("Resource_korph")]) +timeline = ExtResource("8_khbdk") +requirements = Array[ExtResource("1_piiqm")]([SubResource("Resource_u1m57"), SubResource("Resource_biffg"), SubResource("Resource_i756o"), SubResource("Resource_uhb4h")]) +metadata/_custom_type_script = "uid://diwdxofo6exg3" diff --git a/test/a_pig_flew.dtl b/test/a_pig_flew.dtl new file mode 100644 index 0000000..151ef24 --- /dev/null +++ b/test/a_pig_flew.dtl @@ -0,0 +1,7 @@ +Well the day has finally come {player_name}... + +Pigs are flying!\ +Cows are jumping over the moon!\ +Chickens are.. well they're just doing normal chicken things. But there sure are a lot of them! + +The moral of the story is we have a lot more farm animals now for some reason. \ No newline at end of file diff --git a/test/a_pig_flew.dtl.uid b/test/a_pig_flew.dtl.uid new file mode 100644 index 0000000..3a11e16 --- /dev/null +++ b/test/a_pig_flew.dtl.uid @@ -0,0 +1 @@ +uid://dnfywi4qk5tj diff --git a/test/from_farmer_to_table.dtl b/test/from_farmer_to_table.dtl new file mode 100644 index 0000000..341f6a0 --- /dev/null +++ b/test/from_farmer_to_table.dtl @@ -0,0 +1,3 @@ +Sire! There's been a massacre!\ +The animals have risen up against our farmers! +Oh well, dangers of the job I s'pose. \ No newline at end of file diff --git a/test/from_farmer_to_table.dtl.uid b/test/from_farmer_to_table.dtl.uid new file mode 100644 index 0000000..e5df368 --- /dev/null +++ b/test/from_farmer_to_table.dtl.uid @@ -0,0 +1 @@ +uid://dctqq013bc6rx From 9469c63d819d5b6e0e36672e6474d0b5b1acc7a2 Mon Sep 17 00:00:00 2001 From: Spencer Killen Date: Sat, 26 Sep 2026 21:13:20 -0600 Subject: [PATCH 3/5] . --- CameraMove.gd | 14 +++++++++----- game.tscn | 12 ++++++++++++ gui/currency_inspector_panel.tscn | 19 ++++++------------- project.godot | 3 ++- test/test_economy.tscn | 10 +++++++++- 5 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 game.tscn diff --git a/CameraMove.gd b/CameraMove.gd index 501c2ab..808bc43 100644 --- a/CameraMove.gd +++ b/CameraMove.gd @@ -8,7 +8,7 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: +func _process(_delta: float) -> void: var mouse: = get_viewport().get_mouse_position() var size: = get_viewport().get_visible_rect().size if (mouse.x < (0.10*size.x)): @@ -24,14 +24,18 @@ func _process(delta: float) -> void: func _input(event): if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_WHEEL_UP and event.pressed: - zoom.x +=1 zoom.y +=1 elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN and event.pressed: - - zoom.x -=1 - zoom.y -=1 + if zoom.x - 1 < 1: + zoom.x = 1 + else: + zoom.x -= 1 + if zoom.y - 1 < 1: + zoom.y = 1 + else: + zoom.y -= 1 diff --git a/game.tscn b/game.tscn new file mode 100644 index 0000000..5fb05fb --- /dev/null +++ b/game.tscn @@ -0,0 +1,12 @@ +[gd_scene format=3 uid="uid://dkui3dlb4vu1c"] + +[ext_resource type="PackedScene" uid="uid://bdk1r2u8clllr" path="res://map.tscn" id="1_e2o6t"] +[ext_resource type="PackedScene" uid="uid://d06w1wtct0mfs" path="res://test/test_economy.tscn" id="2_feb5d"] + +[node name="Game" type="Node2D" unique_id=1791439508] + +[node name="map" parent="." unique_id=575553336 instance=ExtResource("1_e2o6t")] + +[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1213874033] + +[node name="TestEconomy" parent="CanvasLayer" unique_id=629898212 instance=ExtResource("2_feb5d")] diff --git a/gui/currency_inspector_panel.tscn b/gui/currency_inspector_panel.tscn index d437f63..d0f05e3 100644 --- a/gui/currency_inspector_panel.tscn +++ b/gui/currency_inspector_panel.tscn @@ -3,15 +3,12 @@ [ext_resource type="Script" uid="uid://bkptc7j6c1r7p" path="res://gui/currency_inspector_panel.gd" id="1_tj5vo"] [ext_resource type="Texture2D" uid="uid://bplvus0ytk2f8" path="res://thumbnails/beer.png" id="2_p4bd1"] -[node name="CurrencyInspectorPanel" type="Control" unique_id=169191981] -custom_minimum_size = Vector2(0, 100) -layout_mode = 3 +[node name="CurrencyInspectorPanel" type="Panel" unique_id=1489159816] +custom_minimum_size = Vector2(500, 100) 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") @@ -19,14 +16,10 @@ 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 +layout_mode = 0 +offset_left = 50.0 +offset_right = 450.0 +offset_bottom = 503.0 [node name="InspectedCurrency" type="Label" parent="VBoxContainer" unique_id=1206438498] unique_name_in_owner = true diff --git a/project.godot b/project.godot index 2fc66c8..ab6cd35 100644 --- a/project.godot +++ b/project.godot @@ -10,7 +10,7 @@ config_version=5 [application] -run/main_scene="uid://d06w1wtct0mfs" +run/main_scene="uid://dkui3dlb4vu1c" config/features=PackedStringArray("4.7") [autoload] @@ -133,5 +133,6 @@ dialogic_default_action={ [rendering] +textures/canvas_textures/default_texture_filter=0 rendering_device/driver.windows="d3d12" renderer/rendering_method="gl_compatibility" diff --git a/test/test_economy.tscn b/test/test_economy.tscn index 505b07b..ecc5fe5 100644 --- a/test/test_economy.tscn +++ b/test/test_economy.tscn @@ -19,8 +19,13 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_s48qe") -[node name="ProductionChart" parent="." unique_id=1301678172 instance=ExtResource("2_jd86c")] +[node name="ScrollContainer2" type="ScrollContainer" parent="." unique_id=872959271] layout_mode = 0 +offset_right = 432.0 +offset_bottom = 297.0 + +[node name="ProductionChart" parent="ScrollContainer2" unique_id=1301678172 instance=ExtResource("2_jd86c")] +layout_mode = 2 [node name="ScrollContainer" parent="." unique_id=587807919 instance=ExtResource("3_n4oyp")] layout_mode = 1 @@ -51,6 +56,7 @@ grow_horizontal = 0 grow_vertical = 2 [node name="VBoxContainer" type="VBoxContainer" parent="Control" unique_id=74649172] +visible = false layout_mode = 0 offset_right = 40.0 offset_bottom = 40.0 @@ -71,6 +77,7 @@ text = "OpenInbox" layout_mode = 1 [node name="MemberInspectorPanel" parent="." unique_id=1641024074 instance=ExtResource("5_i7808")] +custom_minimum_size = Vector2(0, 100) layout_mode = 1 offset_left = -189.0 offset_right = -189.0 @@ -79,6 +86,7 @@ offset_right = -189.0 layout_mode = 1 [node name="MemberSprite" parent="." unique_id=283117283 instance=ExtResource("6_vua3v")] +visible = false instance_shader_parameters/border_color = Color(1, 0, 0, 1) instance_shader_parameters/border_width = 0.16 instance_shader_parameters/fill_color = Color(1, 0.7529412, 0.79607844, 1) From 0591c91ac002f9884b2ec19c7e7272369863bc05 Mon Sep 17 00:00:00 2001 From: Spencer Killen Date: Sat, 26 Sep 2026 22:00:53 -0600 Subject: [PATCH 4/5] . --- economy.gd | 35 +++++++++++++++++++++++++++++++++-- economy.tscn | 5 +++++ event.gd | 24 ++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/economy.gd b/economy.gd index 9c6822a..eda8b96 100644 --- a/economy.gd +++ b/economy.gd @@ -6,6 +6,19 @@ signal production_log(producer: Currency, p: Production) @export var currencies: Array[Production] @export var members: Array + +@onready var events: Array[Event] = load_events() + + +func load_events() -> Array[Event]: + var dir := "res://random events" + var es: Array[Event] = [] + for event_name in ResourceLoader.list_directory(dir): + var event: Event = load(dir + "/" + event_name) + es.push_back(event) + return es + + func get_currency(c: Currency) -> Production: sync_currency.call_deferred() for p in currencies: @@ -52,7 +65,7 @@ func produce(production: Production): var c := get_currency(production.currency) c.amount += production.amount -func simulate(): +func update_currencies(): productions_update.emit.call_deferred(currencies) for c in currencies: for p in c.currency.production: @@ -60,7 +73,18 @@ func simulate(): pp.currency = p.currency pp.amount = c.amount * p.amount produce(pp) - + +func simulate(): + update_currencies() + for e in events: + if e.requirements_satisfied() and e.will_happen(): + var outcome := e.outcome() + for o in outcome: + produce(o) + production_log.emit(null, o) + if e.timeline != null: + Dialogic.start(e.timeline) + func get_all_currencies_in(dir: StringName): var reses := ResourceLoader.list_directory(dir) @@ -77,4 +101,11 @@ func get_all_inanimate_currencies() -> Array: return get_all_currencies_in("res://currency/inanimate") func _ready() -> void: + %SimulateTickTimer.start() + update_currencies() + +func _on_timer_timeout() -> void: + if Dialogic.current_timeline != null: + %SimulateTickTimer.start() + return simulate() diff --git a/economy.tscn b/economy.tscn index af02a24..4e1b247 100644 --- a/economy.tscn +++ b/economy.tscn @@ -62,3 +62,8 @@ 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_g3220"), SubResource("Resource_bb1uu"), SubResource("Resource_vw3jp"), SubResource("Resource_xg8li"), SubResource("Resource_f6kxb"), SubResource("Resource_6u4g3"), SubResource("Resource_aqv3t"), SubResource("Resource_g2km3")]) + +[node name="SimulateTickTimer" type="Timer" parent="." unique_id=1726107261] +unique_name_in_owner = true + +[connection signal="timeout" from="SimulateTickTimer" to="." method="_on_timer_timeout"] diff --git a/event.gd b/event.gd index 9497d20..240772b 100644 --- a/event.gd +++ b/event.gd @@ -4,3 +4,27 @@ class_name Event @export var extra_mods: Array[Production] @export var timeline: DialogicTimeline @export var requirements: Array[Production] + +enum EventNature { + Random, + Certain, +} +@export var probability: float = 0.005 +@export var nature: EventNature = EventNature.Random + +func requirements_satisfied() -> bool: + for requirement in requirements: + if Economy.get_currency_amount(requirement.currency) < requirement.amount: + return false + return true + +func will_happen() -> bool: + if nature == EventNature.Certain: + return true + return randf() <= probability + +func outcome() -> Array[Production]: + var stuff: Array[Production] = [modified_resource] + stuff.append_array(extra_mods) + return stuff + From 2cce4fe6b7947d4d1e90db351185b2992e53896c Mon Sep 17 00:00:00 2001 From: Tandy Date: Sat, 26 Sep 2026 22:01:31 -0600 Subject: [PATCH 5/5] sdsdf --- project.godot | 1 + test/dino ending.dtl | 5 +++++ test/dino ending.dtl.uid | 1 + 3 files changed, 7 insertions(+) create mode 100644 test/dino ending.dtl create mode 100644 test/dino ending.dtl.uid diff --git a/project.godot b/project.godot index e137856..764c3f6 100644 --- a/project.godot +++ b/project.godot @@ -34,6 +34,7 @@ directories/dtl_directory={ "counteroffer request": "res://test/counteroffer request.dtl", "counteroffer_response": "res://counteroffer_response.dtl", "dino": "res://test/dino.dtl", +"dino ending": "res://test/dino ending.dtl", "double_agent": "res://test/double_agent.dtl", "drought": "res://test/drought.dtl", "from_farmer_to_table": "res://test/from_farmer_to_table.dtl", diff --git a/test/dino ending.dtl b/test/dino ending.dtl new file mode 100644 index 0000000..8d205bf --- /dev/null +++ b/test/dino ending.dtl @@ -0,0 +1,5 @@ +Wha- +[wait time="2.0"] +[b]I WALKED AWAY FOR LIKE 2 MINUTES[/b] +[i][b]HOW THE HELL DID YOU GET EATEN BY A DINOSAUR?!!?[/b][/i] +congarjulations,, yourr did it and unlooked the secrt dino ending 🦖🦖🦖🦖🦖 \ No newline at end of file diff --git a/test/dino ending.dtl.uid b/test/dino ending.dtl.uid new file mode 100644 index 0000000..ed6ff7e --- /dev/null +++ b/test/dino ending.dtl.uid @@ -0,0 +1 @@ +uid://dxjgtv26imfaf