From 7b0f7b58c4f7469db9b0b004fd9094ba7b0a2a9a Mon Sep 17 00:00:00 2001
From: chimchooree The inspect menu ("res://UI/InspectMenu/InspectMenu.tscn") is instanced at declaration and added as a child at ready in the UI singleton. When tangible entity is right-clicked (@ $Body/Sprite/Clickable), the UI enters InspectMenu with its subject set. The "id_pressed" signal is reset for each subject. InspectMenu connects "about_to_show" the first time it's needed and keeps it forever. Before popup(), it resets, adds a label at an offset with the subject's display name, then adds a UI option for each inspect option. When tangible entity is right-clicked (@ $Body/Sprite/Clickable), the UI enters InspectMenu with its subject set. (The subject setter also sets the player's target.) The "id_pressed" signal is reset for each subject. InspectMenu connects "about_to_show" the first time it's needed and keeps it forever. Before popup(), it resets, adds a label at an offset with the subject's display name, then adds a UI option for each inspect option. When a selection is made, the "id_pressed" signal calls "id_pressed" on the subject, which calls the method at its inspect_options[pressed_id][1]. So 'examine' calls 'examine,' which is in tangible.gd. Most related methods are on tangible.gd, though they may be at a more specific script. Tangibles and inventory items both have inspect menus, but their code has to be separate. They are too different from each other. I intend for the player to be able to pick up an item through the inspect menu without changing his current target. For now, InspectMenu.gd/set_subject(subject) sets the player target. MoveToDestination.gd/handle_moved_result tracks the user's current target using character/find_distance_to_target(). Instead, it would need to receive the relevant subject from the inspect menu or skill or attack target from the character and pass it through character/find_distance_to(target). It doesn't close the inspect menu if pickup is chosen while item out of range, even after item is picked up. Items - drops, drop table, floor items, base items, inventory items, move to pick up item, shift-move-to-pick-up-item, item spawner, item in container, item inspect, item use, dropping from inv Items are objects that may be picked up, purchased, used, equipped, dropped, or sold. They include currency, quest items, equipment, consumables, readables, upgrades, keys, and trinkets. An item changes its form depending on its context. If the item is within the player's intimate distance, the character will be prompted to pick up the item.
Otherwise, pathfinding begins. Otherwise, pathfinding begins towards the floor item. Upon arrival, it calls item.pick_up().pick_up(). I intend for the player to be able to pick up an item through the inspect menu without changing his current target. For now, InspectMenu.gd/set_subject(subject) sets the player target. MoveToDestination.gd/handle_moved_result tracks the user's current target using character/find_distance_to_target(). Instead, it would need to receive the relevant subject from the inspect menu or skill or attack target from the character and pass it through character/find_distance_to(target). Pathfinding programmatically moves an entity towards a point. If an entity decides to pick up a floor item, UserControl.gd/pickup(floor_item) checks the range. If too far away, it will trigger MoveToDestination.gd/pickup_setup(floor_item). Signals are disconnected, track is made true, 'item_arrived' signal is connected to UserControl/Move, and the goal target is set. MoveToDestination.gd's Execute method constantly loops between path_to_point() and choose_velocity(). path_to_point calls cancel on the player and path_to_object(goal_target). Mobile.gd/path_to_object(goal_target) sets the floor item as the next then reassesses the path with each call. If there is no current_dot, dots are set between the user and the goal_target and the method ends. Otherwise, the last_dot is either the last dot or the current_dot. If the goal hasn't moved, the method ends. If the goal is further, the path is wholly or partially recalculated. If the goal is nearer, the path is recalculated between the last_dot and the goal. choose_velocity() sets the entity's body's internal velocity to current_dot - current_pos. mobileBody.gd/_process(delta) sets its physics_body_node's move_and_collide to velocity (judged from internal velocity) * speed * delta * KnowledgeBase.logic_time, publishing "moved" and the entity to the MessageBus. The MessageBus's Moved.gd handler will judge progress and emit a signal. Since "reached", "arrived", etc are connected during MoveToDestination's Enter phase, handle_moved_result handles the package. If it is "arrived" and track is true, 'item_arrived' signal is emitted, the first waypoint is popped off, and the entity calls clear_movement. MoveToDestination.gd/_on_item_arrived(floor_item) calls arrived to disconnect signals, set track to false, and clear the entity's movement. Then it calls item.pick_up().pick_up(). Navigation2D and get_simple_path will be removed in a future version of Godot. I intend for the player to be able to pick up an item through the inspect menu without changing his current target. For now, InspectMenu.gd/set_subject(subject) sets the player target. MoveToDestination.gd/handle_moved_result tracks the user's current target using character/find_distance_to_target(). Instead, it would need to receive the relevant subject from the inspect menu or skill or attack target from the character and pass it through character/find_distance_to(target).
logic
-
@@ -20,6 +20,10 @@
+
+
works for...
four representations
-
+ challenges/known issues
+
+ works for...
+
+
+
diff --git a/src/blessfrey-gdd/pathfinding b/src/blessfrey-gdd/pathfinding
new file mode 100644
index 0000000..b1ca572
--- /dev/null
+++ b/src/blessfrey-gdd/pathfinding
@@ -0,0 +1,30 @@
+
+ move to pick up an item
+
+
+
+
+
+
+
+ challenges/known issues
+
+
+ works for...
+
+
+
diff --git a/src/blessfrey-gdd/terms b/src/blessfrey-gdd/terms
index 3911d0c..794f651 100644
--- a/src/blessfrey-gdd/terms
+++ b/src/blessfrey-gdd/terms
@@ -1,13 +1,22 @@
The vision for Blessfrey