Looked At¶
文档版本:1.21.50.25
Defines the behavior when another entity looks at this entity.
架构¶
looked_at:
{
number "field_of_view" : opt
filters "filters"
boolean "find_players_only" : opt
string "line_of_sight_obstruction_type" : opt
array "look_at_locations" : opt
{
string "<any array element>" : opt
}
range_number_type "looked_at_cooldown"
event_object "looked_at_event"
event_object "not_looked_at_event"
boolean "scale_fov_by_distance" : opt
number "search_radius" : opt
string "set_target" : opt
}
field_of_view
:number- [Beta] Defines, in degrees, the width of the field of view for entities looking at the owner entity. If 'scale_fov_by_distance' is set to true, this value corresponds to the field of view at a distance of one block between the entities.
filters
:filters- 一个过滤器组。Defines the entities that can trigger this component.
find_players_only
:boolean- [Beta] Limits the search to only the nearest Player that meets the specified "filters" rather than all nearby entities.
line_of_sight_obstruction_type
:string- [Beta] Defines the type of block shape used to check for line of sight obstructions.
look_at_locations
:array- [Beta] A list of locations on the owner entity towards which line of sight checks are performed. At least one location must be unobstructed for the entity to be considered as looked at.
look_at_locations
<any array element>
:string
looked_at_cooldown
:range_number_type- The range for the random amount of time during which the entity is
cooling down
and won't get angered or look for a target.
0..0
:number- The first value of the range.
1..1
:number- The second value of the range.
range_min
:number- The minimum value of the range.
range_max
:number- The maximum value of the range.
looked_at_event
:event_object- The event identifier to run when the entities specified in filters look at this entity.
not_looked_at_event
:event_object- [Beta] Defines the event to trigger when no entity is found looking at the owner entity.
scale_fov_by_distance
:boolean- [Beta] When true, the field of view narrows as the distance between the owner entity and the entity looking at it increases. This ensures that the width of the view cone remains somewhat constant towards the owner entity position, regardless of distance.
search_radius
:number- Maximum distance this entity will look for another entity looking at it.
set_target
:string- Defines if and how the owner entity will set entities that are looking at it as its combat targets. Valid values:
- "never", looking entities are never set as targets, but events are emitted.
- "once_and_stop_scanning", the first detected looking entity is set as target. Scanning and event emission is suspended if and until the owner entity has a target.
- [Beta] "once_and_keep_scanning", the first detected looking entity is set as target. Scanning and event emission continues.