Created the page for the Is Destroyed node. |
Removed "the". |
||
Line 28: | Line 28: | ||
== Examples == | == Examples == | ||
There is a certain setup required to detect when a slot gets destroyed, here is what you need and why: | There is a certain setup required to detect when a slot gets destroyed, here is what you need and why: | ||
* A [[Slot]] that holds 2 components, a [[Component:DynamicVariableSpace|Dynamic Variable Space]] component and a [[Component:DynamicReferenceVariable|Dynamic Reference Variable]] component (we will use the [[Reference Type]] of an IDestroyable). This will listen for | * A [[Slot]] that holds 2 components, a [[Component:DynamicVariableSpace|Dynamic Variable Space]] component and a [[Component:DynamicReferenceVariable|Dynamic Reference Variable]] component (we will use the [[Reference Type]] of an IDestroyable). This will listen for any changes that happen. | ||
* A [[ProtoFlux:Dynamic_Variable_Input|Dynamic Variable Input]] node. Must be parented under the slot that is listening using the Dynamic Variable Space. | * A [[ProtoFlux:Dynamic_Variable_Input|Dynamic Variable Input]] node. Must be parented under the slot that is listening using the Dynamic Variable Space. | ||
* This '''IsDestroyed''' node, used to check if some element was destroyed. | * This '''IsDestroyed''' node, used to check if some element was destroyed. |
Latest revision as of 04:43, 23 May 2024
The Is Destroyed
node takes in a destroyable world element and returns if that element was destroyed from the world. Destruction of the slot prevents the result from changing, as by the time the slot is gone, it is too late. There is however a method to check if something did get destroyed, see the examples below.
Inputs
Element (IDestroyable)
The destroyable world element in question.
Outputs
* (bool)
Returns if this element was destroyed in this world.
Examples
There is a certain setup required to detect when a slot gets destroyed, here is what you need and why:
- A Slot that holds 2 components, a Dynamic Variable Space component and a Dynamic Reference Variable component (we will use the Reference Type of an IDestroyable). This will listen for any changes that happen.
- A Dynamic Variable Input node. Must be parented under the slot that is listening using the Dynamic Variable Space.
- This IsDestroyed node, used to check if some element was destroyed.
- A Continuously Changing Relay node, used to make sure it updates our value.
- A Fire On True node. We want to know when the element gets destroyed at this exact moment.
- A Host User or Local User node, used for the Fire On True node.
With this setup, and when the target slot is destroyed (and there is no longer any references to it), the DynamicReferenceVariable component will still have it stored on its field, showing the old ID along with it. This in turn makes the IsDestroyed set to true
.
-
IsDestroyed Node Example 01