ProtoFlux:Is Removed: Difference between revisions

From Resonite Wiki
Created a page for the Is Removed node.
 
Removed "the".
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
|}}
|}}


The <code>Is Removed</code> node takes in a [[Type:IWorldElement|world element]] and returns if that element was removed 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 removed, see the examples below.
The <code>Is Removed</code> node takes in a [[Type:IWorldElement|world element]] and returns if that element was removed 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 removed, see the examples below.


== Inputs ==
== Inputs ==
Line 28: Line 28:
== Examples ==
== Examples ==
There is a certain setup required to detect when a slot gets removed, here is what you need and why:
There is a certain setup required to detect when a slot gets removed, 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 a slot). This will listen for the any changes that happen.
* 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 a slot). 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 '''IsRemoved''' node, used to check if some element was removed.
* This '''IsRemoved''' node, used to check if some element was removed.

Latest revision as of 04:42, 23 May 2024

Is Removed
Element
*
Elements

The Is Removed node takes in a world element and returns if that element was removed 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 removed, see the examples below.

Inputs

Element (IWorldElement)

The world element in question.

Outputs

* (bool)

Returns if this element was removed in this world.

Examples

There is a certain setup required to detect when a slot gets removed, here is what you need and why:

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 IsRemoved set to true.