-
Notifications
You must be signed in to change notification settings - Fork 18
Actors Manager
qqtnn edited this page Jun 1, 2024
·
1 revision
The Actors Manager component, is an easy way to get list of objects already pre-filtered in the core.
actors_manager.get_all_actors()
local actors = actors_manager.get_all_actors()
-- sorting actors by distance to the local player
local player_position = get_player_position()
table.sort(actors, function(a, b)
return a:get_position():squared_dist_to_ignore_z(player_position) <
b:get_position():squared_dist_to_ignore_z(player_position)
end);
-- now interact with the actors in order of proximity
for _, actor in ipairs(actors) do
if actor:is_enemy() and actor:is_alive() then
-- Process only living enemies
-- Add your logic here
end
end
actors_manager.get_enemy_actors()
actors_manager.get_ally_actors()
actors_manager.get_all_particles()
actors_manager.get_ally_particles()
actors_manager.get_enemy_particles()
actors_manager.get_all_players()
actors_manager.get_ally_players()
actors_manager.get_enemy_players()
actors_manager.get_all_npcs()
actors_manager.get_ally_npcs()
actors_manager.get_enemy_npcs()
actors_manager.get_all_items()