For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /server/classes/EntityAttributeComponent.md.

Class: EntityAttributeComponent

entity component

Beta

这是任何以数字为中心、可以定义最小值、最大值和默认值的实体组件的基类抽象类。

This is a base abstract class for any entity component that centers around a number and can have a minimum, maximum, and default defined value.

Extends

Extended by

Properties

currentValue

readonly currentValue: number

Beta

Remarks

此实例当前属性的值。

Current value of this attribute for this instance.

Throws

This property can throw when used.


defaultValue

readonly defaultValue: number

Beta

Remarks

返回此属性的默认定义值。

Returns the default defined value for this attribute.

Throws

This property can throw when used.


effectiveMax

readonly effectiveMax: number

Beta

Remarks

返回给定任何其他环境组件或因素后此属性的有效最大值。

Returns the effective max of this attribute given any other ambient components or factors.

Throws

This property can throw when used.


effectiveMin

readonly effectiveMin: number

Beta

Remarks

返回给定任何其他环境组件或因素后此属性的有效最小值。

Returns the effective min of this attribute given any other ambient components or factors.

Throws

This property can throw when used.


entity

readonly entity: Entity

Beta

Remarks

拥有此组件的实体。如果实体已被移除,则实体将为 undefined

The entity that owns this component. The entity will be undefined if it has been removed.

Throws

This property can throw when used.

InvalidEntityError

Inherited from

EntityComponent.entity


isValid

readonly isValid: boolean

Beta

Remarks

返回该组件是否有效。如果组件的拥有者有效,并且满足组件所需的任何额外验证,则该组件被视为有效。

Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.

Inherited from

EntityComponent.isValid


typeId

readonly typeId: string

Beta

Remarks

组件的标识符。

Identifier of the component.

Inherited from

EntityComponent.typeId

Methods

resetToDefaultValue()

resetToDefaultValue(): void

World Mutation Beta

Returns

void

Remarks

将此属性的当前值重置为定义的默认值。

Resets the current value of this attribute to the defined default value.

Throws

This function can throw errors.


resetToMaxValue()

resetToMaxValue(): void

World Mutation Beta

Returns

void

Remarks

将此属性的当前值重置为定义的最大值。

Resets the current value of this attribute to the maximum defined value.

Throws

This function can throw errors.


resetToMinValue()

resetToMinValue(): void

World Mutation Beta

Returns

void

Remarks

将此属性的当前值重置为定义的最小值。

Resets the current value of this attribute to the minimum defined value.

Throws

This function can throw errors.


setCurrentValue()

setCurrentValue(value): boolean

World Mutation Beta

Parameters

value

number

Returns

boolean

Remarks

设置此属性的当前值。

Sets the current value of this attribute.

Throws

如果值超出范围,将抛出 ArgumentOutOfBounds Error。

If the value is out of bounds, an ArgumentOutOfBounds Error is thrown.

ArgumentOutOfBoundsError

InvalidEntityError

同领域相关