addOrSetTrait
Call Signature
Section titled “Call Signature”addOrSetTrait<
S>(writer,target,trait, …record):boolean
Adds trait to target where it lacks it, and sets it to record
where it holds it: an entity’s, or the world’s for a world trait, such
as a poison a second hit starts again. Answers true where this call
added the trait, and false where it set one the target held, or
where a deployed world refused the write and logged it, writing
nothing. The writer is as setTrait’s. record is the whole record,
every field of a trait of fields, so the result never depends on what
the target held; a write of some fields that keeps the rest asks
entity.has(Trait) first. A tag, or a trait of an empty schema, takes
none, and a factory trait’s record is never null or undefined. An add tells the add’s watchers with the
record in place, as addTrait, and is refused "world-full" where
addTrait is; a set tells the change watchers, as setTrait. In a
predicted system the answer may differ between the page’s run, a re-run
and the room’s, so a one-shot reaction to the add, such as a sound,
goes through an event. As Unity’s EntityManager.AddComponentData.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
S extends Schema |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
EntityAuthority | PredictedStep |
target |
PredictedEntity |
trait |
PredictedTrait<S> |
…record |
WholeSchemaArgument<S> |
Returns
Section titled “Returns”boolean
Call Signature
Section titled “Call Signature”addOrSetTrait<
T>(writer,target,trait, …record):boolean
Adds trait to target where it lacks it, and sets it to record
where it holds it: an entity’s, or the world’s for a world trait, such
as a poison a second hit starts again. Answers true where this call
added the trait, and false where it set one the target held, or
where a deployed world refused the write and logged it, writing
nothing. The writer is as setTrait’s. record is the whole record,
every field of a trait of fields, so the result never depends on what
the target held; a write of some fields that keeps the rest asks
entity.has(Trait) first. A tag, or a trait of an empty schema, takes
none, and a factory trait’s record is never null or undefined. An add tells the add’s watchers with the
record in place, as addTrait, and is refused "world-full" where
addTrait is; a set tells the change watchers, as setTrait. In a
predicted system the answer may differ between the page’s run, a re-run
and the room’s, so a one-shot reaction to the add, such as a sound,
goes through an event. As Unity’s EntityManager.AddComponentData.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends UnstreamedTrait |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
EntityAuthority | SystemStep |
target |
Target |
trait |
T |
…record |
WholeRecordArgument<T> |
Returns
Section titled “Returns”boolean
Call Signature
Section titled “Call Signature”addOrSetTrait<
T>(writer,target,trait, …record):boolean
Adds trait to target where it lacks it, and sets it to record
where it holds it: an entity’s, or the world’s for a world trait, such
as a poison a second hit starts again. Answers true where this call
added the trait, and false where it set one the target held, or
where a deployed world refused the write and logged it, writing
nothing. The writer is as setTrait’s. record is the whole record,
every field of a trait of fields, so the result never depends on what
the target held; a write of some fields that keeps the rest asks
entity.has(Trait) first. A tag, or a trait of an empty schema, takes
none, and a factory trait’s record is never null or undefined. An add tells the add’s watchers with the
record in place, as addTrait, and is refused "world-full" where
addTrait is; a set tells the change watchers, as setTrait. In a
predicted system the answer may differ between the page’s run, a re-run
and the room’s, so a one-shot reaction to the add, such as a sound,
goes through an event. As Unity’s EntityManager.AddComponentData.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends AnyEntityPredictedTrait |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
PredictedStep |
target |
PredictedEntity |
trait |
T |
…record |
WholeRecordArgument<T> |
Returns
Section titled “Returns”boolean
Call Signature
Section titled “Call Signature”addOrSetTrait<
T>(writer,target,trait, …record):boolean
Adds trait to target where it lacks it, and sets it to record
where it holds it: an entity’s, or the world’s for a world trait, such
as a poison a second hit starts again. Answers true where this call
added the trait, and false where it set one the target held, or
where a deployed world refused the write and logged it, writing
nothing. The writer is as setTrait’s. record is the whole record,
every field of a trait of fields, so the result never depends on what
the target held; a write of some fields that keeps the rest asks
entity.has(Trait) first. A tag, or a trait of an empty schema, takes
none, and a factory trait’s record is never null or undefined. An add tells the add’s watchers with the
record in place, as addTrait, and is refused "world-full" where
addTrait is; a set tells the change watchers, as setTrait. In a
predicted system the answer may differ between the page’s run, a re-run
and the room’s, so a one-shot reaction to the add, such as a sound,
goes through an event. As Unity’s EntityManager.AddComponentData.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends Trait |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
EntityAuthority |
target |
Entity |
trait |
T |
…record |
WholeRecordArgument<T> |
Returns
Section titled “Returns”boolean
Call Signature
Section titled “Call Signature”addOrSetTrait<
T>(writer,target,trait, …record):boolean
Adds trait to target where it lacks it, and sets it to record
where it holds it: an entity’s, or the world’s for a world trait, such
as a poison a second hit starts again. Answers true where this call
added the trait, and false where it set one the target held, or
where a deployed world refused the write and logged it, writing
nothing. The writer is as setTrait’s. record is the whole record,
every field of a trait of fields, so the result never depends on what
the target held; a write of some fields that keeps the rest asks
entity.has(Trait) first. A tag, or a trait of an empty schema, takes
none, and a factory trait’s record is never null or undefined. An add tells the add’s watchers with the
record in place, as addTrait, and is refused "world-full" where
addTrait is; a set tells the change watchers, as setTrait. In a
predicted system the answer may differ between the page’s run, a re-run
and the room’s, so a one-shot reaction to the add, such as a sound,
goes through an event. As Unity’s EntityManager.AddComponentData.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends Trait |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
Authority |
target |
World |
trait |
T |
…record |
WholeRecordArgument<T> |
Returns
Section titled “Returns”boolean
Call Signature
Section titled “Call Signature”addOrSetTrait<
T>(writer,target,trait, …record):boolean
Adds trait to target where it lacks it, and sets it to record
where it holds it: an entity’s, or the world’s for a world trait, such
as a poison a second hit starts again. Answers true where this call
added the trait, and false where it set one the target held, or
where a deployed world refused the write and logged it, writing
nothing. The writer is as setTrait’s. record is the whole record,
every field of a trait of fields, so the result never depends on what
the target held; a write of some fields that keeps the rest asks
entity.has(Trait) first. A tag, or a trait of an empty schema, takes
none, and a factory trait’s record is never null or undefined. An add tells the add’s watchers with the
record in place, as addTrait, and is refused "world-full" where
addTrait is; a set tells the change watchers, as setTrait. In a
predicted system the answer may differ between the page’s run, a re-run
and the room’s, so a one-shot reaction to the add, such as a sound,
goes through an event. As Unity’s EntityManager.AddComponentData.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends Trait |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
SetupWriter |
target |
Target |
trait |
T |
…record |
WholeRecordArgument<T> |
Returns
Section titled “Returns”boolean
Call Signature
Section titled “Call Signature”addOrSetTrait<
T>(writer,target,trait, …record):boolean
Adds trait to target where it lacks it, and sets it to record
where it holds it: an entity’s, or the world’s for a world trait, such
as a poison a second hit starts again. Answers true where this call
added the trait, and false where it set one the target held, or
where a deployed world refused the write and logged it, writing
nothing. The writer is as setTrait’s. record is the whole record,
every field of a trait of fields, so the result never depends on what
the target held; a write of some fields that keeps the rest asks
entity.has(Trait) first. A tag, or a trait of an empty schema, takes
none, and a factory trait’s record is never null or undefined. An add tells the add’s watchers with the
record in place, as addTrait, and is refused "world-full" where
addTrait is; a set tells the change watchers, as setTrait. In a
predicted system the answer may differ between the page’s run, a re-run
and the room’s, so a one-shot reaction to the add, such as a sound,
goes through an event. As Unity’s EntityManager.AddComponentData.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T extends LocalTrait |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
writer |
ViewWriter | EntityAuthority | SystemStep |
target |
Target |
trait |
T |
…record |
WholeRecordArgument<T> |
Returns
Section titled “Returns”boolean