local function attractor(distance, entity) if get_player(entity) == get_player() then if get_type(entity) == BASE or get_type(entity) == PLANET then if distance < 500 then return -1 else return 2 * math.exp((0-distance) / 2000) end else --if distance < 500 then return math.max(-10, ((0-700)/distance)) --else -- return 0 --end end elseif get_player(entity) ~= 0 then if get_type(entity) == SHIP then return math.max(-10, math.min(1, math.pow((distance - 300) / 300, 3))) else return math.max(-10, math.min(10, math.pow((distance - 300) / 300, 3))) end else if get_type(entity) == PLANET then return math.max(-10, math.min(1, math.pow((distance - 100) / 100, 3))) else return math.max(-1, math.min(0, math.pow((distance - 300) / 300, 3))) end end end