documentation - messagebus, base, knowledgebase
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user