documentation - messagebus, base, knowledgebase
parent
5b8b01678e
commit
e5386e633b
@ -0,0 +1,34 @@
|
||||
<p>The MessageBus is a node singleton that delivers messages and data between objects. It rests at res://Singleton/MessageBus.gd. <br></p>
|
||||
<br>
|
||||
<h3>flow </h3>
|
||||
<p>A handler first subscribes to a topic. When a particular topic comes up, it is published and passed to the subscribed handlers. When a topic is no longer relevant to a handler or the handler exited the tree, it unsubscribes.<br></p>
|
||||
<br>
|
||||
<p>Also, all objects that inherit from the <a href="/blessfrey-gdd/docs/base">base</a> request a ref_id at ready. <br></p>
|
||||
<br>
|
||||
<h3>signals </h3>
|
||||
<p><ul>
|
||||
<li>• <b>-</b>: - </li>
|
||||
</ul><br>
|
||||
<br>
|
||||
<h3>variables </h3><br>
|
||||
<p><ul>
|
||||
<li>• <b>current_ref_id</b>: int. ref ids are handed out sequentially by incrementing this value. Its initial value is -1. </li>
|
||||
<li>• <b>topics</b>: Dictionary. Holds a list of handlers for each topic. </li>
|
||||
</ul><br></p>
|
||||
<br>
|
||||
<h3>methods </h3><br>
|
||||
<p>int designate_ref_id() <br></p>
|
||||
<p>increments current_ref_id by one then returns it. <br></p>
|
||||
<br>
|
||||
<p>void publish(String topic, ??? data) <br></p>
|
||||
<p>If the topic has any active subscriptions, its handlers are prompted to handle the data. <br></p>
|
||||
<br>
|
||||
<p>void subscribe(String topic, Object handler) <br></p>
|
||||
<p>An entry in topics is made for the topic if needed, then the handler is added to the topic's list. <br></p>
|
||||
<br>
|
||||
<p>void unsubscribe(String topic, Object handler) <br></p>
|
||||
<p>if the topic has an active subscription, the given handler is erased from the topic's list. <br></p>
|
||||
<br>
|
||||
<p>void _on_handler_tree_exited(String topic, Object handler) <br></p>
|
||||
<p>During subscribe, the handler is connected to execute this if it exits the tree. It unsubscribes the handler from the topic. <br></p>
|
||||
<br>
|
@ -0,0 +1,58 @@
|
||||
<p>The Base is a node with IDs, a name, and a description. It rests at res://Entity/Base.gd. <br></p>
|
||||
<br>
|
||||
<h3>flow </h3>
|
||||
<p>At ready, it gains a ref_id from the MessageBus. <br></p>
|
||||
<br>
|
||||
<h3>signals </h3>
|
||||
<p><ul>
|
||||
<li>• <b>-</b>: - </li>
|
||||
</ul><br>
|
||||
<br>
|
||||
<h3>variables </h3><br>
|
||||
<p><ul>
|
||||
<li>• <b>base_id</b>: Color. The id shared by all instances of this type of object. For example, all instances of Melon Soda have the same base id but different ref ids. </li>
|
||||
<li>• <b>desc_key</b>: String. The key used by the TranslationServer to retrieve the object's description. </li>
|
||||
<li>• <b>is_player</b>: bool. Only true when this object is the player. </li>
|
||||
<li>• <b>name_key</b>: String. The key used by the TranslationServer to retrieve the object's display name. </li>
|
||||
<li>• <b>player_base_id</b>: Color. The base id of the player. </li>
|
||||
<li>• <b>ref_id</b>: int. The id that identifies a particular instance of an object. </li>
|
||||
</ul><br></p>
|
||||
<br>
|
||||
<h3>setters + getters </h3>
|
||||
<p>Color get_base_id () <br></p>
|
||||
<p>base_id getter <br></p>
|
||||
<br>
|
||||
<p>??? get_base_id_in_hex()<br></p>
|
||||
<p>returns base_id in hex <br></p>
|
||||
<br>
|
||||
<p>String get_desc()<br></p>
|
||||
<p>returns description in current language <br></p>
|
||||
<br>
|
||||
<p>String get_desc_key()<br></p>
|
||||
<p>desc_key getter <br></p>
|
||||
<br>
|
||||
<p>String get_display_name()<br></p>
|
||||
<p>returns display name in current language <br></p>
|
||||
<br>
|
||||
<p>bool get_is_player()<br></p>
|
||||
<p>returns whether this object is the player <br></p>
|
||||
<br>
|
||||
<p>void set_ref_id(new_ref_id)<br></p>
|
||||
<p>ref_id setter <br></p>
|
||||
<br>
|
||||
<p>int get_ref_id()<br></p>
|
||||
<p>ref_id getter <br></p>
|
||||
<br><br>
|
||||
<h3>methods </h3><br>
|
||||
<p>bool compare_base_id(second_object) <br></p>
|
||||
<p>returns whether this object and the given object are the same kind of object. <br></p>
|
||||
<br>
|
||||
<p>bool compare_base_id_to_hex(hex) <br></p>
|
||||
<p>returns whether this object has the given hex as a base id. <br></p>
|
||||
<br>
|
||||
<p>bool compare_ref_id(second_object) <br></p>
|
||||
<p>returns whether this object and the given object are the exact same object. <br></p>
|
||||
<br>
|
||||
<p>??? make_instance(path) <br></p>
|
||||
<p>returns an instance of the scene at the given path. <br></p>
|
||||
<br>
|
@ -0,0 +1,36 @@
|
||||
<p>The KnowledgeBase is a node singleton that stores and manages all the knowledge in the game. It rests at res://Singleton/KnowledgeBase.gd. <br></p>
|
||||
<br>
|
||||
<h3>flow </h3>
|
||||
<p>On ready, the encountered, forgot, and learned topics and handlers are set up. <br></p>
|
||||
<br>
|
||||
<p>Knowledge is learned by setting
|
||||
<br>
|
||||
<p>Also, all objects that inherit from the <a href="/blessfrey-gdd/docs/base">base</a> request a ref_id at ready. <br></p>
|
||||
<br>
|
||||
<h3>signals </h3>
|
||||
<p><ul>
|
||||
<li>• <b>-</b>: - </li>
|
||||
</ul><br>
|
||||
<br>
|
||||
<h3>variables </h3><br>
|
||||
<p><ul>
|
||||
<li>• <b>current_ref_id</b>: int. ref ids are handed out sequentially by incrementing this value. Its initial value is -1. </li>
|
||||
<li>• <b>topics</b>: Dictionary. Holds a list of handlers for each topic. </li>
|
||||
</ul><br></p>
|
||||
<br>
|
||||
<h3>methods </h3><br>
|
||||
<p>int designate_ref_id() <br></p>
|
||||
<p>increments current_ref_id by one then returns it. <br></p>
|
||||
<br>
|
||||
<p>void publish(String topic, ??? data) <br></p>
|
||||
<p>If the topic has any active subscriptions, its handlers are prompted to handle the data. <br></p>
|
||||
<br>
|
||||
<p>void subscribe(String topic, Object handler) <br></p>
|
||||
<p>An entry in topics is made for the topic if needed, then the handler is added to the topic's list. <br></p>
|
||||
<br>
|
||||
<p>void unsubscribe(String topic, Object handler) <br></p>
|
||||
<p>if the topic has an active subscription, the given handler is erased from the topic's list. <br></p>
|
||||
<br>
|
||||
<p>void _on_handler_tree_exited(String topic, Object handler) <br></p>
|
||||
<p>During subscribe, the handler is connected to execute this if it exits the tree. It unsubscribes the handler from the topic. <br></p>
|
||||
<br>
|
@ -0,0 +1,34 @@
|
||||
<p>The MessageBus is a node singleton that delivers messages and data between objects. It rests at res://Singleton/MessageBus.gd. <br></p>
|
||||
<br>
|
||||
<h3>flow </h3>
|
||||
<p>A handler first subscribes to a topic. When a particular topic comes up, it is published and passed to the subscribed handlers. When a topic is no longer relevant to a handler or the handler exited the tree, it unsubscribes.<br></p>
|
||||
<br>
|
||||
<p>Also, all objects that inherit from the <a href="/blessfrey-gdd/docs/base">base</a> request a ref_id at ready. <br></p>
|
||||
<br>
|
||||
<h3>signals </h3>
|
||||
<p><ul>
|
||||
<li>• <b>-</b>: - </li>
|
||||
</ul><br>
|
||||
<br>
|
||||
<h3>variables </h3><br>
|
||||
<p><ul>
|
||||
<li>• <b>current_ref_id</b>: int. ref ids are handed out sequentially by incrementing this value. Its initial value is -1. </li>
|
||||
<li>• <b>topics</b>: Dictionary. Holds a list of handlers for each topic. </li>
|
||||
</ul><br></p>
|
||||
<br>
|
||||
<h3>methods </h3><br>
|
||||
<p>int designate_ref_id() <br></p>
|
||||
<p>increments current_ref_id by one then returns it. <br></p>
|
||||
<br>
|
||||
<p>void publish(String topic, ??? data) <br></p>
|
||||
<p>If the topic has any active subscriptions, its handlers are prompted to handle the data. <br></p>
|
||||
<br>
|
||||
<p>void subscribe(String topic, Object handler) <br></p>
|
||||
<p>An entry in topics is made for the topic if needed, then the handler is added to the topic's list. <br></p>
|
||||
<br>
|
||||
<p>void unsubscribe(String topic, Object handler) <br></p>
|
||||
<p>if the topic has an active subscription, the given handler is erased from the topic's list. <br></p>
|
||||
<br>
|
||||
<p>void _on_handler_tree_exited(String topic, Object handler) <br></p>
|
||||
<p>During subscribe, the handler is connected to execute this if it exits the tree. It unsubscribes the handler from the topic. <br></p>
|
||||
<br>
|
Loading…
Reference in New Issue