From 40eee3e533c5880872f7ddcb98172e0bbb0a58f3 Mon Sep 17 00:00:00 2001 From: Spencer Killen Date: Sat, 26 Sep 2026 23:54:33 -0600 Subject: [PATCH 1/3] . --- command.gd | 5 ++++ command.gd.uid | 1 + commands/command_button.gd | 14 ++++++++++ commands/command_button.gd.uid | 1 + commands/command_button.tscn | 8 ++++++ commands/move.gd | 2 ++ commands/move.gd.uid | 1 + commands/move_command.tres | 9 ++++++ currency/currency.gd | 1 + currency/members/MemberSprite.tscn | 1 + currency/sentient/farmer.tres | 2 ++ economy.gd | 4 ++- event.gd | 10 ++++++- game.tscn | 11 ++++++++ gui/bribe_button.tscn | 1 + gui/currency_inspector_panel.gd | 4 +++ gui/inbox_event_only.tscn | 8 ++++++ gui/inbox_message_subject.gd | 5 ++-- gui/inbox_panel.gd | 7 +++-- gui/production_chart.gd | 4 +++ letters/event_letter.gd | 10 +++++++ letters/event_letter.gd.uid | 1 + member_inspector_panel.gd | 19 +++++++++++++ member_inspector_panel.tscn | 9 ++++++ test/command_modal.gd | 12 ++++++++ test/command_modal.gd.uid | 1 + test/test_economy.gd | 2 -- test/test_economy.tscn | 44 ++++++++++++++++++++++++------ user_context.gd | 16 +++++++++++ 29 files changed, 197 insertions(+), 16 deletions(-) create mode 100644 command.gd create mode 100644 command.gd.uid create mode 100644 commands/command_button.gd create mode 100644 commands/command_button.gd.uid create mode 100644 commands/command_button.tscn create mode 100644 commands/move.gd create mode 100644 commands/move.gd.uid create mode 100644 commands/move_command.tres create mode 100644 gui/inbox_event_only.tscn create mode 100644 letters/event_letter.gd create mode 100644 letters/event_letter.gd.uid create mode 100644 test/command_modal.gd create mode 100644 test/command_modal.gd.uid diff --git a/command.gd b/command.gd new file mode 100644 index 0000000..5e11c6e --- /dev/null +++ b/command.gd @@ -0,0 +1,5 @@ +extends Resource +class_name Command + +@export var name: String +@export var modal_name: String diff --git a/command.gd.uid b/command.gd.uid new file mode 100644 index 0000000..11e6962 --- /dev/null +++ b/command.gd.uid @@ -0,0 +1 @@ +uid://cn8rc6jyllrf0 diff --git a/commands/command_button.gd b/commands/command_button.gd new file mode 100644 index 0000000..a237022 --- /dev/null +++ b/commands/command_button.gd @@ -0,0 +1,14 @@ +extends Button + +signal command_succcess(c: Command) + +@export var command: Command + +func _ready() -> void: + sync() + +func sync(): + text = command.name + +func _on_pressed() -> void: + command_succcess.emit(command) diff --git a/commands/command_button.gd.uid b/commands/command_button.gd.uid new file mode 100644 index 0000000..1fcfe02 --- /dev/null +++ b/commands/command_button.gd.uid @@ -0,0 +1 @@ +uid://m5qf37ordikh diff --git a/commands/command_button.tscn b/commands/command_button.tscn new file mode 100644 index 0000000..420a110 --- /dev/null +++ b/commands/command_button.tscn @@ -0,0 +1,8 @@ +[gd_scene format=3 uid="uid://cno33rgilttxt"] + +[ext_resource type="PackedScene" uid="uid://dqb4a1igddv71" path="res://gui/bribe_button.tscn" id="1_j6j61"] +[ext_resource type="Script" uid="uid://m5qf37ordikh" path="res://commands/command_button.gd" id="2_0fnf4"] + +[node name="CommandButton" unique_id=1084248382 instance=ExtResource("1_j6j61")] +script = ExtResource("2_0fnf4") +command = null diff --git a/commands/move.gd b/commands/move.gd new file mode 100644 index 0000000..056fd8b --- /dev/null +++ b/commands/move.gd @@ -0,0 +1,2 @@ +extends Command +class_name MoveCommand diff --git a/commands/move.gd.uid b/commands/move.gd.uid new file mode 100644 index 0000000..82486ed --- /dev/null +++ b/commands/move.gd.uid @@ -0,0 +1 @@ +uid://jxfw3ptlwg8d diff --git a/commands/move_command.tres b/commands/move_command.tres new file mode 100644 index 0000000..025b639 --- /dev/null +++ b/commands/move_command.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="MoveCommand" format=3 uid="uid://u6lls6n0xw3n"] + +[ext_resource type="Script" uid="uid://jxfw3ptlwg8d" path="res://commands/move.gd" id="1_cox6k"] + +[resource] +script = ExtResource("1_cox6k") +name = "Move" +modal_name = "Moving!" +metadata/_custom_type_script = "uid://jxfw3ptlwg8d" diff --git a/currency/currency.gd b/currency/currency.gd index 1f0a1d5..aa3d55e 100644 --- a/currency/currency.gd +++ b/currency/currency.gd @@ -7,3 +7,4 @@ class_name Currency @export var thumbnail: Texture2D @export var color: Color = Color.PINK @export var wants: Array[Production] +@export var commands: Array[Command] = [preload("res://commands/move_command.tres")] diff --git a/currency/members/MemberSprite.tscn b/currency/members/MemberSprite.tscn index 059c0b9..5d85577 100644 --- a/currency/members/MemberSprite.tscn +++ b/currency/members/MemberSprite.tscn @@ -9,6 +9,7 @@ shader = ExtResource("1_tm326") [sub_resource type="CanvasTexture" id="CanvasTexture_wgite"] [node name="MemberSprite" type="TextureRect" unique_id=283117283] +z_index = 100 material = SubResource("ShaderMaterial_tm326") mouse_default_cursor_shape = 2 texture = SubResource("CanvasTexture_wgite") diff --git a/currency/sentient/farmer.tres b/currency/sentient/farmer.tres index 4f3ce37..1f7d75d 100644 --- a/currency/sentient/farmer.tres +++ b/currency/sentient/farmer.tres @@ -2,6 +2,8 @@ [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://cn8rc6jyllrf0" path="res://command.gd" id="1_uh6l7"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_7lva1"] [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"] [ext_resource type="Resource" uid="uid://b5qok0rcalr" path="res://currency/sentient/cow.tres" id="5_uddvy"] diff --git a/economy.gd b/economy.gd index eda8b96..f94f198 100644 --- a/economy.gd +++ b/economy.gd @@ -83,7 +83,9 @@ func simulate(): produce(o) production_log.emit(null, o) if e.timeline != null: - Dialogic.start(e.timeline) + GameState.add_letter.emit(e.into_letter()) + if randf() < 0.01: + LetterGeneration.try_generate_offer() func get_all_currencies_in(dir: StringName): diff --git a/event.gd b/event.gd index 240772b..04f7bda 100644 --- a/event.gd +++ b/event.gd @@ -9,8 +9,10 @@ enum EventNature { Random, Certain, } -@export var probability: float = 0.005 +@export var probability: float = 0.01 @export var nature: EventNature = EventNature.Random +@export var email_source: Currency = preload("res://currency/sentient/town_crier.tres") +@export var email_subject: String = "Something is amok!" func requirements_satisfied() -> bool: for requirement in requirements: @@ -28,3 +30,9 @@ func outcome() -> Array[Production]: stuff.append_array(extra_mods) return stuff +func into_letter() -> EventLetter: + var el := EventLetter.new() + el.source = email_source + el.subject_field = email_subject + el.timeline = timeline + return el diff --git a/game.tscn b/game.tscn index 5fb05fb..d056222 100644 --- a/game.tscn +++ b/game.tscn @@ -2,6 +2,9 @@ [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"] +[ext_resource type="PackedScene" uid="uid://coebykrbnhlif" path="res://currency/members/MemberSprite.tscn" id="3_7jktm"] +[ext_resource type="Resource" uid="uid://dn0c1pfq04obw" path="res://currency/sentient/farmer.tres" id="4_ryrav"] +[ext_resource type="Resource" uid="uid://b7lxfjhx4qhts" path="res://allegiance/good.tres" id="5_eow3j"] [node name="Game" type="Node2D" unique_id=1791439508] @@ -10,3 +13,11 @@ [node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1213874033] [node name="TestEconomy" parent="CanvasLayer" unique_id=629898212 instance=ExtResource("2_feb5d")] + +[node name="MemberSprite" parent="." unique_id=283117283 instance=ExtResource("3_7jktm")] +offset_left = 294.0 +offset_top = 1177.0 +offset_right = 345.0 +offset_bottom = 1219.0 +currency = ExtResource("4_ryrav") +allegiance = ExtResource("5_eow3j") diff --git a/gui/bribe_button.tscn b/gui/bribe_button.tscn index 6ca6c6b..099841a 100644 --- a/gui/bribe_button.tscn +++ b/gui/bribe_button.tscn @@ -3,6 +3,7 @@ [ext_resource type="Script" uid="uid://olr6663hny8n" path="res://bribe_button.gd" id="1_2abdb"] [node name="BribeButton" type="Button" unique_id=1084248382] +custom_minimum_size = Vector2(0, 50) text = "< num > of < currency >" script = ExtResource("1_2abdb") diff --git a/gui/currency_inspector_panel.gd b/gui/currency_inspector_panel.gd index 0b554a7..4ffd8ad 100644 --- a/gui/currency_inspector_panel.gd +++ b/gui/currency_inspector_panel.gd @@ -5,7 +5,11 @@ var currency: Currency = null func _ready() -> void: UserContext.currency_inspect.connect(currency_inspect) UserContext.member_inspect.connect(member_inspect) + UserContext.modal_command_change.connect(modal_command_change) update() + +func modal_command_change(_c: Command): + visible = false func member_inspect(_m: CurrencyMemberSprite): visible = false diff --git a/gui/inbox_event_only.tscn b/gui/inbox_event_only.tscn new file mode 100644 index 0000000..c7117fa --- /dev/null +++ b/gui/inbox_event_only.tscn @@ -0,0 +1,8 @@ +[gd_scene format=3 uid="uid://choixlqgx0jo7"] + +[ext_resource type="PackedScene" uid="uid://da2ldx7una0a2" path="res://gui/inbox_message_subject.tscn" id="1_nc3yv"] + +[node name="InboxEvent" unique_id=1590519653 instance=ExtResource("1_nc3yv")] + +[node name="ReplyButton" parent="MarginContainer/HBoxContainer" parent_id_path=PackedInt32Array(1418860833) index="2" unique_id=803741826] +visible = false diff --git a/gui/inbox_message_subject.gd b/gui/inbox_message_subject.gd index 6dd5f7e..fc4d930 100644 --- a/gui/inbox_message_subject.gd +++ b/gui/inbox_message_subject.gd @@ -7,8 +7,9 @@ func _ready() -> void: %Source.text = letter.source.name %Subject.text = letter.subject_field -func on_remove_letter(_l: Letter): - queue_free() +func on_remove_letter(l: Letter): + if letter == l: + queue_free() func _on_pressed() -> void: letter.start() diff --git a/gui/inbox_panel.gd b/gui/inbox_panel.gd index 59fe72a..fff1837 100644 --- a/gui/inbox_panel.gd +++ b/gui/inbox_panel.gd @@ -6,11 +6,14 @@ func _ready() -> void: visible = false func add_letter(l: Letter): - var ldis := preload("res://gui/inbox_message_subject.tscn").instantiate() + var ldis: Button + if l is EventLetter: + ldis = preload("res://gui/inbox_event_only.tscn").instantiate() + else: + ldis = preload("res://gui/inbox_message_subject.tscn").instantiate() ldis.letter = l %Letters.add_child(ldis) - func open(): visible = true diff --git a/gui/production_chart.gd b/gui/production_chart.gd index 41ae7f2..e07f5b4 100644 --- a/gui/production_chart.gd +++ b/gui/production_chart.gd @@ -2,6 +2,10 @@ extends VBoxContainer func _ready() -> void: Economy.productions_update.connect(sync) + UserContext.modal_command_change.connect(modal_command_change) + +func modal_command_change(c: Command): + visible = c == null func sync(productions: Array[Production]): for child in get_children(): diff --git a/letters/event_letter.gd b/letters/event_letter.gd new file mode 100644 index 0000000..4581a6c --- /dev/null +++ b/letters/event_letter.gd @@ -0,0 +1,10 @@ +extends Letter +class_name EventLetter + +func start(): + Dialogic.start(timeline) + await Dialogic.timeline_ended + GameState.remove_letter.emit(self) + +func reply(): + push_error("reply Not implemented!") diff --git a/letters/event_letter.gd.uid b/letters/event_letter.gd.uid new file mode 100644 index 0000000..7d3cde2 --- /dev/null +++ b/letters/event_letter.gd.uid @@ -0,0 +1 @@ +uid://d30k84i53crwu diff --git a/member_inspector_panel.gd b/member_inspector_panel.gd index e0dd381..e1b1e67 100644 --- a/member_inspector_panel.gd +++ b/member_inspector_panel.gd @@ -5,8 +5,12 @@ extends "res://gui/currency_inspector_panel.gd" func _ready() -> void: UserContext.currency_inspect.connect(currency_inspect) UserContext.member_inspect.connect(member_inspect) + UserContext.modal_command_change.connect(modal_command_change) update() +func modal_command_change(_c: Command): + visible = false + func member_inspect(m: CurrencyMemberSprite): if member != null: member.tree_exiting.disconnect(member_left) @@ -22,6 +26,9 @@ func member_left(): func clear_bribes(): for child in %BribesList.get_children(): child.queue_free() +func clear_commands(): + for child in %CommandsList.get_children(): + child.queue_free() func bribe_success(): member.allegiance = preload("res://allegiance/good.tres") @@ -35,6 +42,13 @@ func load_bribes(): btn.bribe_succees.connect(bribe_success) %BribesList.add_child(btn) +func load_commands(): + for p in member.currency.commands: + var btn := preload("res://commands/command_button.tscn").instantiate() + btn.command = p + btn.command_succcess.connect(UserContext.modal) + %CommandsList.add_child(btn) + func currency_inspect(_c: Currency): visible = false @@ -47,8 +61,13 @@ func update(): %CurrencyMemberSprite.allegiance = member.allegiance %CurrencyMemberSprite.sync() clear_bribes() + clear_commands() %Bribes.visible = false + %Commands.visible = true if member.allegiance != preload("res://allegiance/good.tres"): load_bribes() %Bribes.visible = true + %Commands.visible = false + else: + load_commands() diff --git a/member_inspector_panel.tscn b/member_inspector_panel.tscn index 0722179..00ed234 100644 --- a/member_inspector_panel.tscn +++ b/member_inspector_panel.tscn @@ -39,3 +39,12 @@ text = "Bribe with" [node name="BribesList" type="VBoxContainer" parent="VBoxContainer" parent_id_path=PackedInt32Array(362599487) index="10" unique_id=476203914] unique_name_in_owner = true layout_mode = 2 + +[node name="Commands" type="Label" parent="VBoxContainer" parent_id_path=PackedInt32Array(362599487) index="11" unique_id=87746800] +unique_name_in_owner = true +layout_mode = 2 +text = "Command" + +[node name="CommandsList" type="VBoxContainer" parent="VBoxContainer" parent_id_path=PackedInt32Array(362599487) index="12" unique_id=73835062] +unique_name_in_owner = true +layout_mode = 2 diff --git a/test/command_modal.gd b/test/command_modal.gd new file mode 100644 index 0000000..fee0bb0 --- /dev/null +++ b/test/command_modal.gd @@ -0,0 +1,12 @@ +extends Label + +func _ready() -> void: + UserContext.modal_command_change.connect(modal_command_change) + modal_command_change(null) + +func modal_command_change(c: Command): + if c == null: + visible = false + return + visible = true + text = c.modal_name + " " + UserContext.selected_member.currency.name diff --git a/test/command_modal.gd.uid b/test/command_modal.gd.uid new file mode 100644 index 0000000..8b516ae --- /dev/null +++ b/test/command_modal.gd.uid @@ -0,0 +1 @@ +uid://cvwxv4hfw4u0o diff --git a/test/test_economy.gd b/test/test_economy.gd index 8d4e62f..8f55f62 100644 --- a/test/test_economy.gd +++ b/test/test_economy.gd @@ -6,11 +6,9 @@ func _on_get_cow_pressed() -> void: p.amount += 1 - func _on_run_simulate_pressed() -> void: Economy.simulate() func _on_open_inbox_pressed() -> void: UserContext.open_inbox.emit() - LetterGeneration.try_generate_offer() diff --git a/test/test_economy.tscn b/test/test_economy.tscn index ecc5fe5..3f3efb8 100644 --- a/test/test_economy.tscn +++ b/test/test_economy.tscn @@ -9,6 +9,7 @@ [ext_resource type="PackedScene" uid="uid://coebykrbnhlif" path="res://currency/members/MemberSprite.tscn" id="6_vua3v"] [ext_resource type="Resource" uid="uid://ihsvxienxbeu" path="res://currency/sentient/knight.tres" id="7_s0mui"] [ext_resource type="Resource" uid="uid://dfbgxc6nlcjct" path="res://allegiance/bad.tres" id="8_i7808"] +[ext_resource type="Script" uid="uid://cvwxv4hfw4u0o" path="res://test/command_modal.gd" id="10_ccsa3"] [node name="TestEconomy" type="Control" unique_id=629898212] layout_mode = 3 @@ -17,6 +18,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +mouse_filter = 2 script = ExtResource("1_s48qe") [node name="ScrollContainer2" type="ScrollContainer" parent="." unique_id=872959271] @@ -69,18 +71,15 @@ text = "Get cow" layout_mode = 2 text = "Run simulate" -[node name="OpenInbox" type="Button" parent="Control/VBoxContainer" unique_id=1148713984] -layout_mode = 2 -text = "OpenInbox" - [node name="CurrencyInspectorPanel" parent="." unique_id=169191981 instance=ExtResource("4_7ya5o")] layout_mode = 1 +offset_left = -467.0 +offset_right = 33.0 [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 +offset_left = -468.0 +offset_right = 32.0 [node name="InboxPanel" parent="." unique_id=534578339 instance=ExtResource("5_n4oyp")] layout_mode = 1 @@ -99,8 +98,37 @@ offset_bottom = 406.0 currency = ExtResource("7_s0mui") allegiance = ExtResource("8_i7808") +[node name="CommandModal" type="Label" parent="." unique_id=562980582] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -63.0 +offset_top = 19.0 +offset_right = 64.0 +offset_bottom = 42.0 +grow_horizontal = 2 +theme_override_font_sizes/font_size = 52 +text = "" +script = ExtResource("10_ccsa3") + +[node name="OpenInbox" type="Button" parent="." unique_id=1148713984] +layout_mode = 1 +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -114.0 +offset_top = -64.0 +offset_right = -20.0 +offset_bottom = -33.0 +grow_horizontal = 0 +grow_vertical = 0 +text = "OpenInbox" + [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"] -[connection signal="pressed" from="Control/VBoxContainer/OpenInbox" to="." method="_on_open_inbox_pressed"] +[connection signal="pressed" from="OpenInbox" to="." method="_on_open_inbox_pressed"] [editable path="MemberSprite"] diff --git a/user_context.gd b/user_context.gd index 7947a6e..d9989ea 100644 --- a/user_context.gd +++ b/user_context.gd @@ -13,14 +13,30 @@ var selected_member: CurrencyMemberSprite = null var focused_members: Array[CurrencyMemberSprite] = [] signal selected_member_change(current: CurrencyMemberSprite) +var modal_command: Command +signal modal_command_change(c: Command) + +func modal(c: Command): + modal_command = c + modal_command_change.emit(c) + func select_focused_member(): var candidate := focused_member() if candidate == null: return + if selected_member != null: + unselect_member() selected_member = candidate + selected_member.tree_exiting.connect(unselect_member) selected_member_change.emit(selected_member) UserContext.member_inspect.emit(selected_member) +func unselect_member(): + if selected_member == null: + return + selected_member.tree_exiting.disconnect(unselect_member) + selected_member = null + func focused_member() -> CurrencyMemberSprite: if focused_members.size() == 0: return null From 8c628ddf602f911750c57d260d7881cafdf2ec6f Mon Sep 17 00:00:00 2001 From: Spencer Killen Date: Sun, 27 Sep 2026 00:06:11 -0600 Subject: [PATCH 2/3] . --- Troup.tscn | 1 + currency/sentient/archer.tres | 2 ++ currency/sentient/calvary.tres | 2 ++ currency/sentient/dinosaur.tres | 2 ++ currency/sentient/doctor.tres | 2 ++ currency/sentient/kings_guard.tres | 2 ++ currency/sentient/knight.tres | 2 ++ currency/sentient/mercenary.tres | 2 ++ currency/sentient/messenger.tres | 2 ++ currency/sentient/miner.tres | 2 ++ currency/sentient/spy.tres | 2 ++ currency/sentient/town_crier.tres | 2 ++ currency/sentient/wizard.tres | 2 ++ troup.gd | 17 ++++++++++++----- user_context.gd | 9 +++++++++ 15 files changed, 46 insertions(+), 5 deletions(-) diff --git a/Troup.tscn b/Troup.tscn index 38caa23..0792db2 100644 --- a/Troup.tscn +++ b/Troup.tscn @@ -16,6 +16,7 @@ position = Vector2(50, 49) shape = SubResource("RectangleShape2D_riqys") [node name="MemberSprite" parent="." unique_id=283117283 instance=ExtResource("2_v0at3")] +unique_name_in_owner = true 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) diff --git a/currency/sentient/archer.tres b/currency/sentient/archer.tres index a6c843e..6ff9ae0 100644 --- a/currency/sentient/archer.tres +++ b/currency/sentient/archer.tres @@ -1,8 +1,10 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://l8osuuxl7exe"] +[ext_resource type="Script" uid="uid://cn8rc6jyllrf0" path="res://command.gd" id="1_227pm"] [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="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_b0duy"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_k5pub"] [ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_k672a"] [ext_resource type="Resource" uid="uid://b8b6yr444ecdk" path="res://currency/inanimate/water.tres" id="5_2kil6"] [ext_resource type="Resource" uid="uid://ervsee7ku1i2" path="res://currency/inanimate/bread.tres" id="6_qqxwu"] diff --git a/currency/sentient/calvary.tres b/currency/sentient/calvary.tres index 7b804f0..ee61a95 100644 --- a/currency/sentient/calvary.tres +++ b/currency/sentient/calvary.tres @@ -1,8 +1,10 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://dlxnbyiurne1s"] +[ext_resource type="Script" uid="uid://cn8rc6jyllrf0" path="res://command.gd" id="1_2uxum"] [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="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_hqcau"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_npspm"] [ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_lyu7q"] [ext_resource type="Resource" uid="uid://b8b6yr444ecdk" path="res://currency/inanimate/water.tres" id="5_fxi61"] [ext_resource type="Resource" uid="uid://ervsee7ku1i2" path="res://currency/inanimate/bread.tres" id="6_vf3g1"] diff --git a/currency/sentient/dinosaur.tres b/currency/sentient/dinosaur.tres index c3b5d8b..aba434f 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://cn8rc6jyllrf0" path="res://command.gd" id="1_eu6eo"] [ext_resource type="Script" uid="uid://dddyxbkq0ienn" path="res://currency/production.gd" id="1_qayfp"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_3kirj"] [ext_resource type="Resource" uid="uid://6xylw7p78fvf" path="res://currency/sentient/wizard.tres" id="3_2x36w"] [ext_resource type="Texture2D" uid="uid://c4snl0k8eu4n5" path="res://thumbnails/dino.jpg" id="3_bufop"] [ext_resource type="Resource" uid="uid://dfj4jwdmff6bu" path="res://currency/sentient/spy.tres" id="4_bufop"] diff --git a/currency/sentient/doctor.tres b/currency/sentient/doctor.tres index 45d75de..b1db9f8 100644 --- a/currency/sentient/doctor.tres +++ b/currency/sentient/doctor.tres @@ -1,8 +1,10 @@ [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://cn8rc6jyllrf0" path="res://command.gd" id="1_hu81m"] [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://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_w0d8m"] [ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_yv5d2"] [ext_resource type="Texture2D" uid="uid://bbcjo350ne8pv" path="res://thumbnails/doctor.jpg" id="5_e68kt"] [ext_resource type="Resource" uid="uid://crnhu4w6lfopb" path="res://currency/inanimate/beer.tres" id="6_r8lqy"] diff --git a/currency/sentient/kings_guard.tres b/currency/sentient/kings_guard.tres index 2894fc9..8a3e456 100644 --- a/currency/sentient/kings_guard.tres +++ b/currency/sentient/kings_guard.tres @@ -1,8 +1,10 @@ [gd_resource type="Resource" script_class="SentientCurrency" format=3 uid="uid://cwpk5e2exbgcr"] +[ext_resource type="Script" uid="uid://cn8rc6jyllrf0" path="res://command.gd" id="1_1ptox"] [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="Resource" uid="uid://boshkhnywnk27" path="res://currency/production/human_production_shared_1.tres" id="2_s3h3i"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_t2htw"] [ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_3jtdd"] [ext_resource type="Resource" uid="uid://bnlnq4ucsgfxe" path="res://currency/inanimate/gold.tres" id="5_bom44"] [ext_resource type="Resource" uid="uid://ervsee7ku1i2" path="res://currency/inanimate/bread.tres" id="6_y0tsi"] diff --git a/currency/sentient/knight.tres b/currency/sentient/knight.tres index 40f8523..cfd145e 100644 --- a/currency/sentient/knight.tres +++ b/currency/sentient/knight.tres @@ -1,6 +1,8 @@ [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="Script" uid="uid://cn8rc6jyllrf0" path="res://command.gd" id="1_ds1y1"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_gpemk"] [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"] diff --git a/currency/sentient/mercenary.tres b/currency/sentient/mercenary.tres index 255accb..d8678b6 100644 --- a/currency/sentient/mercenary.tres +++ b/currency/sentient/mercenary.tres @@ -2,6 +2,8 @@ [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://cn8rc6jyllrf0" path="res://command.gd" id="1_vs85s"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_ul3xr"] [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"] [ext_resource type="Resource" uid="uid://bnlnq4ucsgfxe" path="res://currency/inanimate/gold.tres" id="5_p4ceb"] diff --git a/currency/sentient/messenger.tres b/currency/sentient/messenger.tres index 6942b1a..994dacb 100644 --- a/currency/sentient/messenger.tres +++ b/currency/sentient/messenger.tres @@ -2,6 +2,8 @@ [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://cn8rc6jyllrf0" path="res://command.gd" id="1_mf0hi"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_0uhpw"] [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"] [ext_resource type="Resource" uid="uid://bnlnq4ucsgfxe" path="res://currency/inanimate/gold.tres" id="5_rq11v"] diff --git a/currency/sentient/miner.tres b/currency/sentient/miner.tres index 8053b70..c363384 100644 --- a/currency/sentient/miner.tres +++ b/currency/sentient/miner.tres @@ -1,8 +1,10 @@ [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://cn8rc6jyllrf0" path="res://command.gd" id="1_tbpph"] [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://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_t4qyg"] [ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_2kvuq"] [ext_resource type="Resource" uid="uid://b8b6yr444ecdk" path="res://currency/inanimate/water.tres" id="5_eaivi"] [ext_resource type="Resource" uid="uid://ervsee7ku1i2" path="res://currency/inanimate/bread.tres" id="6_4664q"] diff --git a/currency/sentient/spy.tres b/currency/sentient/spy.tres index 6dfa9d0..ce9eac4 100644 --- a/currency/sentient/spy.tres +++ b/currency/sentient/spy.tres @@ -1,8 +1,10 @@ [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://cn8rc6jyllrf0" path="res://command.gd" id="1_wnwuo"] [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://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_jpoxk"] [ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_pvkom"] [ext_resource type="Resource" uid="uid://bnlnq4ucsgfxe" path="res://currency/inanimate/gold.tres" id="5_ssejx"] [ext_resource type="Resource" uid="uid://ervsee7ku1i2" path="res://currency/inanimate/bread.tres" id="6_dmqey"] diff --git a/currency/sentient/town_crier.tres b/currency/sentient/town_crier.tres index ab683bb..2b485ea 100644 --- a/currency/sentient/town_crier.tres +++ b/currency/sentient/town_crier.tres @@ -2,7 +2,9 @@ [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://cn8rc6jyllrf0" path="res://command.gd" id="1_urykh"] [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://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_lqdse"] [ext_resource type="Resource" uid="uid://mgb7y1r3eapq" path="res://currency/production/human_production_shared_2.tres" id="3_xknsl"] [ext_resource type="Resource" uid="uid://ervsee7ku1i2" path="res://currency/inanimate/bread.tres" id="5_hkj46"] [ext_resource type="Resource" uid="uid://b7vjuqkog7cxd" path="res://currency/inanimate/wood.tres" id="6_s7hyh"] diff --git a/currency/sentient/wizard.tres b/currency/sentient/wizard.tres index a509853..9cd964f 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://cn8rc6jyllrf0" path="res://command.gd" id="1_fu5ce"] [ext_resource type="Script" uid="uid://hcvynq5fjypj" path="res://currency/sentient_currency.gd" id="1_tds6s"] +[ext_resource type="Resource" uid="uid://u6lls6n0xw3n" path="res://commands/move_command.tres" id="2_rx02f"] [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"] [ext_resource type="Resource" uid="uid://crnhu4w6lfopb" path="res://currency/inanimate/beer.tres" id="5_g2km3"] diff --git a/troup.gd b/troup.gd index c0b416e..9cf6c83 100644 --- a/troup.gd +++ b/troup.gd @@ -5,12 +5,19 @@ const SPEED = 100.0 const JUMP_VELOCITY = -400.0 @export var target : Node2D +func _ready() -> void: + UserContext. set_target_for . connect(set_target_for) + +func set_target_for(who: CurrencyMemberSprite, t: Node2D): + if %MemberSprite == who: + if target != null: + target.tree_exiting.disconnect(removed_target) + t.tree_exiting.connect(removed_target) + target = t + +func removed_target(): + target = null -func _get_target(event) -> void: - if target != null: - return - if UserContext.selected_member == self: - pass #func _Direction() -> Vector2: #self.position = self.position.move_toward(target.transform.position, speed * delta) diff --git a/user_context.gd b/user_context.gd index d9989ea..2c771e7 100644 --- a/user_context.gd +++ b/user_context.gd @@ -8,6 +8,7 @@ signal member_inspect(c: CurrencyMemberSprite) @warning_ignore("unused_signal") signal open_inbox +signal set_target_for(who: CurrencyMemberSprite, target: Node2D) var selected_member: CurrencyMemberSprite = null var focused_members: Array[CurrencyMemberSprite] = [] @@ -20,7 +21,15 @@ func modal(c: Command): modal_command = c modal_command_change.emit(c) + + func select_focused_member(): + if modal_command is MoveCommand: + if focused_member() == selected_member: + modal(null) + return + set_target_for.emit(selected_member, focused_member()) + return var candidate := focused_member() if candidate == null: return From 2adb900957c1812b600b24b4c742e025b90f4d7e Mon Sep 17 00:00:00 2001 From: Spencer Killen Date: Sun, 27 Sep 2026 00:14:37 -0600 Subject: [PATCH 3/3] . --- economy.gd | 2 ++ troup.gd | 1 + user_context.gd | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/economy.gd b/economy.gd index f94f198..5232656 100644 --- a/economy.gd +++ b/economy.gd @@ -80,6 +80,8 @@ func simulate(): if e.requirements_satisfied() and e.will_happen(): var outcome := e.outcome() for o in outcome: + if o == null: + continue produce(o) production_log.emit(null, o) if e.timeline != null: diff --git a/troup.gd b/troup.gd index 9cf6c83..99fb3db 100644 --- a/troup.gd +++ b/troup.gd @@ -14,6 +14,7 @@ func set_target_for(who: CurrencyMemberSprite, t: Node2D): target.tree_exiting.disconnect(removed_target) t.tree_exiting.connect(removed_target) target = t + UserContext.modal(null) func removed_target(): target = null diff --git a/user_context.gd b/user_context.gd index 2c771e7..03c74d8 100644 --- a/user_context.gd +++ b/user_context.gd @@ -28,7 +28,7 @@ func select_focused_member(): if focused_member() == selected_member: modal(null) return - set_target_for.emit(selected_member, focused_member()) + set_target_for.emit(selected_member, focused_member().get_parent()) return var candidate := focused_member() if candidate == null: