dofile_once("data/scripts/lib/utilities.lua")

local player_x, player_y = EntityGetTransform(EntityGetWithTag("player_unit")[1])

local entity_id = EntityGetParent(GetUpdatedEntityID())
local puller_x, puller_y = EntityGetTransform(entity_id)

if math.abs(puller_x - player_x) < 20 and math.abs(puller_y - player_y) < 150 and EntityGetWithName("sex_cooldown") == 0 then

	local angle = get_direction(puller_x, puller_y-5, player_x, player_y)
	local length = 3000

	local vel_x = 0 - math.cos(angle) * length
	local vel_y =  math.sin(angle) * length

	shoot_projectile(entity_id, "mods/lewd_noita/files/enemies/pulling_tentacle.xml", puller_x, puller_y, vel_x, vel_y)
end