Component:ValueUserOverride: Difference between revisions

From Resonite Wiki
add sections
Minor rewording, punctuation, added related components.
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<languages></languages>
<languages></languages>
<translate>
<translate>
The '''ValueUserOverride''' Component allows for the driving of a value for each user listed in <code>_overrides</code>
The '''ValueUserOverride''' Component allows storing "override" values for each user listed under <code>_overrides</code> and [[Drive|driving]] the <code>Target</code> field with them.
{{Infobox Component
{{Infobox Component
|Image=ValueUserOverride`1Component.png
|Image=ValueUserOverride`1Component.png
Line 11: Line 11:
{{Table ComponentFields
{{Table ComponentFields
|Target|{{RootFieldType|FieldDrive`1|T}}|TypeAdv0=true| Target field of the specified type, that gets driven to the override value.
|Target|{{RootFieldType|FieldDrive`1|T}}|TypeAdv0=true| Target field of the specified type, that gets driven to the override value.
|Default|'''T'''|TypeAdv1=true| The default value given to <code>Target</code> if no suitable override exists in <code>_overrides</code>
|Default|'''T'''|TypeAdv1=true| The default value given to <code>Target</code> if no suitable override exists in <code>_overrides</code>.
|CreateOverrideOnWrite|Bool| Creates an entry in <code>_overrides</code> when <code>Target</code> is written back.
|CreateOverrideOnWrite|Bool| Creates an entry in <code>_overrides</code> when <code>Target</code> is written back.
|PersistentOverrides|Bool| Values in <code>_overrides</code> are stored with the object when it is saved
|PersistentOverrides|Bool| Values in <code>_overrides</code> are stored with the object when it is saved.
|_overrides|{{RootFieldType|SyncBag`1|[[#Override|Override]]&lt;T&gt;}}|TypeAdv4=true| A list of Overrides and the corresponding users they apply to.
|_overrides|{{RootFieldType|SyncBag`1|[[#Override|Override]]&lt;T&gt;}}|TypeAdv4=true| A list of Overrides and the corresponding users they apply to.
}}
}}
Line 20: Line 20:
== Override ==
== Override ==
{{Table TypeFields
{{Table TypeFields
|User|[[#UserRef|UserRef]]|TypeAdv0=true| The [[Type:User|User]] that should see <code>Value</code>'s content inside of <code>Target</code> locally instead of <code>Default</code>'s content
|User|[[Type:UserRef|UserRef]]|TypeAdv0=true| The [[Type:User|User]] that should see <code>Value</code>'s content inside of <code>Target</code> locally instead of <code>Default</code>'s content
|Value|'''T'''|TypeAdv1=true| The value that <code>User</code> should see target driven to locally.  
|Value|'''T'''|TypeAdv1=true| The value that <code>User</code> should see target driven to locally.  
}}
== UserRef ==
{{Table TypeFields
|User|User| The user that matches the <code>_machineId</code> and <code>_userId</code>.
|_machineId|String| The machine id last known for a [[Type:User|User]]. Is used to try to identify the user and fill <code>User</code> user ref field the next time they're in a world with this component.
|_userId|String| The user's account ID last known for a [[Type:User|User]]. Is used to try to identify the user and fill <code>User</code> user ref field the next time they're in a world with this component.
}}
}}


Line 34: Line 27:


== Behavior ==
== Behavior ==
The <code>_overrides</code> bag contains a list of users and their associated values - whenever the local user matches a user entry in the bag, the associated value is driven to <code>Target</code>. Otherwise, <code>Target</code> is driven to the value in <code>Default</code>
The <code>_overrides</code> bag contains a list of users and their associated values - whenever the local user matches a user entry in the bag, the associated value is driven to <code>Target</code>. Otherwise, <code>Target</code> is driven to the value in <code>Default</code>.


<code>CreateOverrideOnWrite</code> allows for new users and values to be added to the bag when the driven value in <code>Target</code> is directly or indirectly changed by that user. If it is not enabled, the value in <code>Target</code> is not changeable.
<code>CreateOverrideOnWrite</code> allows for new users and values to be added to the bag when the driven value in <code>Target</code> is directly or indirectly changed by that user. If it is not enabled, the value in <code>Target</code> is not changeable unless the override is added or changed manually from the inspector panel.


Attempting to write to or otherwise cause a discrete entry to a driven field is known as Hooking it. Any Hook to the <code>Target</code> value is intercepted by the '''ValueUserOverride''' Component and will change the modifying user's entry in the <code>_overrides</code> bag. If there is no entry for the user and if <code>CreateOverrideOnWrite</code> is enabled, it will create an entry using the set value.
Attempting to write to or otherwise cause a discrete entry to a driven field is known as Hooking it. Any Hook to the <code>Target</code> value is intercepted by the '''ValueUserOverride''' Component and will change the modifying user's entry in the <code>_overrides</code> bag. If there is no entry for the user and if <code>CreateOverrideOnWrite</code> is enabled, it will create an entry using the set value.
Line 44: Line 37:


== Related Components ==
== Related Components ==
* [[Component:BooleanUserOverrideGather|BooleanUserOverrideGather]]
* [[Component:NumericUserOverrideGather|NumericUserOverrideGather]]
</translate>
</translate>
[[Category:Generics{{#translation:}}]]
[[Category:Generics{{#translation:}}]]

Latest revision as of 10:40, 28 June 2024

The ValueUserOverride Component allows storing "override" values for each user listed under _overrides and driving the Target field with them.

Component image 
ValueUserOverride component as seen in the Scene Inspector


Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
Target field drive of T Target field of the specified type, that gets driven to the override value.
Default T The default value given to Target if no suitable override exists in _overrides.
CreateOverrideOnWrite Bool Creates an entry in _overrides when Target is written back.
PersistentOverrides Bool Values in _overrides are stored with the object when it is saved.
_overrides direct SyncBag`1<Override<T>> A list of Overrides and the corresponding users they apply to.


Override

Fields
Name Type Description
User UserRef The User that should see Value's content inside of Target locally instead of Default's content
Value T The value that User should see target driven to locally.


Usage

Behavior

The _overrides bag contains a list of users and their associated values - whenever the local user matches a user entry in the bag, the associated value is driven to Target. Otherwise, Target is driven to the value in Default.

CreateOverrideOnWrite allows for new users and values to be added to the bag when the driven value in Target is directly or indirectly changed by that user. If it is not enabled, the value in Target is not changeable unless the override is added or changed manually from the inspector panel.

Attempting to write to or otherwise cause a discrete entry to a driven field is known as Hooking it. Any Hook to the Target value is intercepted by the ValueUserOverride Component and will change the modifying user's entry in the _overrides bag. If there is no entry for the user and if CreateOverrideOnWrite is enabled, it will create an entry using the set value.

Examples

Related Components