Actors - Beta Components Module
anvil.beta.actors.components
EntityReflectProjectiles
Bases: JsonComponent
[EXPERIMENTAL] Allows an entity to reflect projectiles. Needs the experimental flag in anvilconfig.json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
azimuth_angle
|
Molang | str | float
|
Angle in degrees added to the projectile's y axis rotation. Game default 0. |
required |
elevation_angle
|
Molang | str | float
|
Angle in degrees added to the projectile's x axis rotation. Game default 0. |
required |
reflected_projectiles
|
list[str | Entity]
|
Projectiles that are reflected when they hit the entity. |
required |
reflection_scale
|
Molang | str | float
|
Velocity scale of the reflected projectile. Below 1 slows it, above 1 speeds it up. Game default 1. |
required |
reflection_sound
|
str
|
Sound event played when a projectile is reflected. Game default reflect. |
required |
Documentation reference
__required__ = ()
class-attribute
JSON keys the schema marks required although their field is optional, because
__validate__ requires them.
__from_json__(data)
classmethod
Builds the object from its parsed JSON, the inverse of __json__(). Each key goes
to the field written under it, read through the field's annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The parsed JSON object. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
The data is not an object, or a value does not match its field. |
ValueError
|
The data has a key the class does not write, or a constant field holds another value. |
__json__()
The component as {identifier: payload}.
__json_fields__()
classmethod
The compiled fields of this class, compiled on first use.
__payload_schema__(definitions)
classmethod
The schema of the payload under the identifier.
__post_init__()
Side effects after construction.
__prepare_export__(owner, *, root=True)
Finishes the object for export, where its owner calls it. Components with a
localized name override it. root is False for a permutation's components.
__schema__()
classmethod
The JSON Schema (draft 2020-12) of this object's JSON, its parts under $defs.
__schema_body__(definitions)
classmethod
The schema of {identifier: payload}.