diff --git a/quant.ew/data/entities/animals/boss_pit/wand_rotate.lua b/quant.ew/data/entities/animals/boss_pit/wand_rotate.lua new file mode 100644 index 00000000..c2510f1b --- /dev/null +++ b/quant.ew/data/entities/animals/boss_pit/wand_rotate.lua @@ -0,0 +1,19 @@ +dofile_once("data/scripts/lib/utilities.lua") + +local entity_id = GetUpdatedEntityID() +local x, y = EntityGetTransform(GetUpdatedEntityID()) + +local players = EntityGetWithTag("ew_peer") + +local closest +local dir = 0 +for _, player in ipairs(players) do + local px, py = EntityGetTransform(player) + local r = px * px + py * py + if closest == nil or r < closest then + closest = r + dir = math.atan2(py - y, px - x) + end +end + +EntitySetTransform(entity_id, x, y, dir) \ No newline at end of file