GeradorMagicoUtil a then ok, r = pcall(HttpService.JSONDecode, HttpService, string.sub(texto, a, b)) if ok then return r end end return nil end function U.limitar(v, a, b) return math.max(a, math.min(b, tonumber(v) or a)) end -- ===================== imagem: PNG simples (sem compressão) e base64 ===================== local CRC = {} for i = 0, 255 do local c = i for _ = 1, 8 do if bit32.band(c, 1) == 1 then c = bit32.bxor(0xEDB88320, bit32.rshift(c, 1)) else c = bit32.rshift(c, 1) end end CRC[i] = c end local function crc32(b, de, ate) local c = 0xFFFFFFFF for i = de, ate do c = bit32.bxor(CRC[bit32.band(bit32.bxor(c, buffer.readu8(b, i)), 0xFF)], bit32.rshift(c, 8)) end return bit32.bxor(c, 0xFFFFFFFF) end local function escreverBE(b, pos, v) buffer.writeu8(b, pos, bit32.band(bit32.rshift(v, 24), 0xFF)) buffer.writeu8(b, pos + 1, bit32.band(bit32.rshift(v, 16), 0xFF)) buffer.writeu8(b, pos + 2, bit32.band(bit32.rshift(v, 8), 0xFF)) buffer.writeu8(b, pos + 3, bit32.band(v, 0xFF)) end -- rgb: buffer com 3 bytes por ponto (largura * altura * 3). Devolve um buffer com o arquivo PNG. function U.png(rgb, largura, altura) local linha = largura * 3 + 1 local cru = linha * altura local blocos = math.max(1, math.ceil(cru / 65535)) local zlib = 2 + blocos * 5 + cru + 4 local total = 8 + (12 + 13) + (12 + zlib) + 12 local b = buffer.create(total) local p = 0 for _, v in ipairs({ 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }) do buffer.writeu8(b, p, v) p += 1 end local function pedaco(tipo, tamanho, escrever) escreverBE(b, p, tamanho) local inicioTipo = p + 4 buffer.writestring(b, inicioTipo, tipo) p = inicioTipo + 4 escrever() escreverBE(b, p, crc32(b, inicioTipo, p - 1)) p += 4 end pedaco("IHDR", 13, function() escreverBE(b, p, largura) escreverBE(b, p + 4, altura) buffer.writeu8(b, p + 8, 8) -- 8 bits buffer.writeu8(b, p + 9, 2) -- RGB buffer.writeu8(b, p + 10, 0) buffer.writeu8(b, p + 11, 0) buffer.writeu8(b, p + 12, 0) p += 13 end) pedaco("IDAT", zlib, function() buffer.writeu8(b, p, 0x78) buffer.writeu8(b, p + 1, 0x01) p += 2 local a1, a2 = 1, 0 -- Adler-32 local feito = 0 for bloco = 1, blocos do local n = math.min(65535, cru - feito) buffer.writeu8(b, p, bloco == blocos and 1 or 0) buffer.writeu16(b, p + 1, n) buffer.writeu16(b, p + 3, bit32.band(bit32.bnot(n), 0xFFFF)) p += 5 for i = feito, feito + n - 1 do local y = i // linha local x = i % linha local v = 0 if x > 0 then v = buffer.readu8(rgb, y * largura * 3 + x - 1) end buffer.writeu8(b, p, v) p += 1 a1 = (a1 + v) % 65521 a2 = (a2 + a1) % 65521 end feito += n if bloco % 4 == 0 then task.wait() end end escreverBE(b, p, a2 * 65536 + a1) p += 4 end) pedaco("IEND", 0, function() end) return b end local ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" local LETRA = {} for i = 1, 64 do LETRA[i - 1] = string.byte(ALFA, i) end function U.base64(b) local n = buffer.len(b) local saida = buffer.create(((n + 2) // 3) * 4) local o = 0 for i = 0, n - 1, 3 do local a = buffer.readu8(b, i) local c2 = i + 1 < n and buffer.readu8(b, i + 1) or 0 local c3 = i + 2 < n and buffer.readu8(b, i + 2) or 0 local v = a * 65536 + c2 * 256 + c3 buffer.writeu8(saida, o, LETRA[bit32.band(bit32.rshift(v, 18), 63)]) buffer.writeu8(saida, o + 1, LETRA[bit32.band(bit32.rshift(v, 12), 63)]) buffer.writeu8(saida, o + 2, i + 1 < n and LETRA[bit32.band(bit32.rshift(v, 6), 63)] or 61) buffer.writeu8(saida, o + 3, i + 2 < n and LETRA[bit32.band(v, 63)] or 61) o += 4 if i % 90000 == 0 then task.wait() end end return buffer.tostring(saida) end -- ===================== foto da tela do Studio ===================== -- Tira uma foto olhando de `de` para `para` (Vector3). A câmera volta para onde estava (nunca fica travada). -- Devolve { png64 = texto base64 do PNG (para o Gemini), imagem = EditableImage pequena (para a prévia) } ou nil. function U.foto(de, para, largura, voltar) largura = largura or 640 local cam = workspace.CurrentCamera local antes = { cf = cam.CFrame, foco = cam.Focus, tipo = cam.CameraType } if de and para then cam.CFrame = CFrame.lookAt(de, para) cam.Focus = CFrame.new(para) end task.wait(1.2) -- dá tempo do terreno e das peças aparecerem local id local ok = pcall(function() CaptureService:CaptureScreenshot(function(conteudo) id = conteudo end) end) local t = 0 while ok and not id and t < 8 do task.wait(0.2) t += 0.2 end if voltar ~= false then cam.CFrame, cam.Focus = antes.cf, antes.foco end if cam.CameraType == Enum.CameraType.Scriptable then cam.CameraType = Enum.CameraType.Fixed end if not id then return nil end local okImg, grande = pcall(function() return AssetService:CreateEditableImageAsync(Content.fromUri(id)) end) if not okImg or not grande then return nil end local tam = grande.Size local escala = math.min(1, largura / tam.X) local w, h = math.max(1, math.floor(tam.X * escala)), math.max(1, math.floor(tam.Y * escala)) local rgba = grande:ReadPixelsBuffer(Vector2.zero, tam) local pequenoRGBA = buffer.create(w * h * 4) local rgb = buffer.create(w * h * 3) for y = 0, h - 1 do local sy = math.min(tam.Y - 1, math.floor(y / escala)) for x = 0, w - 1 do local sx = math.min(tam.X - 1, math.floor(x / escala)) local s = (sy * tam.X + sx) * 4 local d = y * w + x local r, g, bl = buffer.readu8(rgba, s), buffer.readu8(rgba, s + 1), buffer.readu8(rgba, s + 2) buffer.writeu8(rgb, d * 3, r) buffer.writeu8(rgb, d * 3 + 1, g) buffer.writeu8(rgb, d * 3 + 2, bl) buffer.writeu32(pequenoRGBA, d * 4, r + g * 256 + bl * 65536 + 255 * 16777216) end if y % 40 == 0 then task.wait() end end grande:Destroy() local previa pcall(function() previa = AssetService:CreateEditableImage({ Size = Vector2.new(w, h) }) previa:WritePixelsBuffer(Vector2.zero, Vector2.new(w, h), pequenoRGBA) end) return { png64 = U.base64(U.png(rgb, w, h)), imagem = previa, largura = w, altura = h } end -- Caixa (centro e tamanho) de tudo que está numa pasta/modelo do workspace, para enquadrar a câmera. function U.caixa(objeto) if not objeto then return nil end local mn, mx, n = Vector3.new(math.huge, math.huge, math.huge), Vector3.new(-math.huge, -math.huge, -math.huge), 0 for _, d in ipairs(objeto:GetDescendants()) do if d:IsA("BasePart") then n += 1 mn = mn:Min(d.Position) mx = mx:Max(d.Position) end end if objeto:IsA("BasePart") then n += 1 mn, mx = objeto.Position, objeto.Position end if n == 0 then return nil end return (mn + mx) / 2, (mx - mn).Magnitude end -- Ponto de vista bom para ver uma caixa (centro, tamanho). function U.vista(centro, tamanho) local d = math.max(tamanho, 20) * 0.9 return centro + Vector3.new(d, d * 0.5, d), centro end return U end ]]>Modelos 0 then wl = amp * (0.10 + 0.25 * aguaFrac) end local expo = 2.2 - 1.4 * relevo local function clamp(v, a, b) return math.max(a, math.min(b, v)) end local function hAt(x, z) local a = math.noise(x / 220, z / 220, seed) local b = math.noise(x / 90, z / 90, seed + 11) * 0.5 local c = math.noise(x / 35, z / 35, seed + 23) * 0.2 local t = clamp((a + b + c) * 1.25 + 0.5, 0, 1) local h = amp * (t ^ expo) if ilha then local d = math.sqrt((x / halfL) ^ 2 + (z / halfW) ^ 2) h = h * clamp(1 - (d / 1.0) ^ 3, 0, 1) end return h end local function escolher(lista, x, z) if #lista == 1 then return lista[1] end local n = math.noise(x / 30, z / 30, seed + 77) return lista[clamp(math.floor((n + 0.5) * #lista) + 1, 1, #lista)] end local function superficie(h, x, z) if wl > 0 and praia and h <= wl + 2.5 then return Enum.Material[praia] end local f = h / amp + math.noise(x / 45, z / 45, seed + 5) * 0.12 for _, c in ipairs(camadas) do if f <= c[1] then return Enum.Material[escolher(c[2], x, z)] end end return Enum.Material[escolher(camadas[#camadas][2], x, z)] end local function interior(depth) if depth > 10 then return Enum.Material[fundoMat] end return Enum.Material[interiorMat] end local cores = { Grass = Color3.fromRGB(88, 138, 58), LeafyGrass = Color3.fromRGB(70, 124, 50), Ground = Color3.fromRGB(104, 84, 60), Sand = Color3.fromRGB(226, 186, 120), Sandstone = Color3.fromRGB(196, 140, 88), Mud = Color3.fromRGB(86, 64, 46), Rock = Color3.fromRGB(110, 108, 104), Basalt = Color3.fromRGB(62, 62, 66), Slate = Color3.fromRGB(88, 92, 98), Limestone = Color3.fromRGB(200, 194, 178), Snow = Color3.fromRGB(238, 243, 248), Ice = Color3.fromRGB(168, 208, 230), Glacier = Color3.fromRGB(188, 220, 236), Salt = Color3.fromRGB(235, 230, 220), Asphalt = Color3.fromRGB(58, 58, 62), Pavement = Color3.fromRGB(150, 148, 144), Concrete = Color3.fromRGB(140, 140, 138), CrackedLava = Color3.fromRGB(240, 96, 24), Cobblestone = Color3.fromRGB(120, 116, 110), Brick = Color3.fromRGB(150, 82, 62), WoodPlanks = Color3.fromRGB(150, 110, 70), } Terrain:Clear() for nome, cor in pairs(cores) do pcall(function() Terrain:SetMaterialColor(Enum.Material[nome], cor) end) end for _, nome in ipairs({"Mapa_Arvores", "Mapa_Pedras", "Mapa_Decoracao"}) do local f = workspace:FindFirstChild(nome) if f then f:Destroy() end end local ox = -math.floor(halfL / RES) * RES local oz = -math.floor(halfW / RES) * RES local oy = -8 local nx = math.ceil((L + RES) / RES) local nz = math.ceil((W + RES) / RES) local ny = math.ceil((H + 12) / RES) + 2 local CH = 16 local contador = 0 for cx = 0, nx - 1, CH do for cz = 0, nz - 1, CH do local sx = math.min(CH, nx - cx) local sz = math.min(CH, nz - cz) local mats, occs = {}, {} local alturas = {} for ix = 1, sx do alturas[ix] = {} for iz = 1, sz do alturas[ix][iz] = hAt(ox + (cx + ix - 0.5) * RES, oz + (cz + iz - 0.5) * RES) end end for ix = 1, sx do mats[ix], occs[ix] = {}, {} local px = ox + (cx + ix - 0.5) * RES for iy = 1, ny do mats[ix][iy], occs[ix][iy] = {}, {} local baixo = oy + (iy - 1) * RES for iz = 1, sz do local h = alturas[ix][iz] local pz = oz + (cz + iz - 0.5) * RES local occ = clamp((h - baixo) / RES, 0, 1) if baixo < 0 then occ = 1 end if occ > 0.01 then local m if h - baixo < RES * 1.5 then m = superficie(h, px, pz) else m = interior(h - baixo) end mats[ix][iy][iz] = m occs[ix][iy][iz] = occ elseif wl > 0 and baixo < wl then mats[ix][iy][iz] = Enum.Material.Water occs[ix][iy][iz] = clamp((wl - baixo) / RES, 0, 1) else mats[ix][iy][iz] = Enum.Material.Air occs[ix][iy][iz] = 0 end end end end local p0 = Vector3.new(ox + cx * RES, oy, oz + cz * RES) local p1 = p0 + Vector3.new(sx * RES, ny * RES, sz * RES) Terrain:WriteVoxels(Region3.new(p0, p1), RES, mats, occs) contador += 1 if contador % 3 == 0 then task.wait() end end end local function peca(pasta, forma, tam, cf, cor, mat, colide) local p = Instance.new("Part") p.Shape = forma p.Size = tam p.CFrame = cf p.Color = cor p.Material = mat p.Anchored = true p.CanCollide = colide p.TopSurface = Enum.SurfaceType.Smooth p.BottomSurface = Enum.SurfaceType.Smooth p.Parent = pasta return p end local function posicao() local x = rnd:NextNumber(-halfL * 0.96, halfL * 0.96) local z = rnd:NextNumber(-halfW * 0.96, halfW * 0.96) return x, z, hAt(x, z) end local CIL, BOL, BLO = Enum.PartType.Cylinder, Enum.PartType.Ball, Enum.PartType.Block local CAT = game:GetService("ServerStorage"):FindFirstChild("Catalogo_Gerador") local function lista(nomes) local t = {} for _, n in ipairs(nomes) do local m = CAT and CAT:FindFirstChild(n) if m then table.insert(t, m) end end return t end local TPL_ARV, TPL_PED = lista(@TPLARV@), lista(@TPLPED@) local function colocarModelo(pasta, tpls, x, h, z, altura) local m = tpls[rnd:NextInteger(1, #tpls)]:Clone() local _, sz = m:GetBoundingBox() if sz.Y > 0.1 then pcall(function() m:ScaleTo(m:GetScale() * altura / sz.Y) end) end m:PivotTo(CFrame.new(x, h, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0)) local cf, s2 = m:GetBoundingBox() m:PivotTo(m:GetPivot() + Vector3.new(x - cf.X, h - (cf.Y - s2.Y / 2) - 0.4, z - cf.Z)) m.Parent = pasta end local mediaPartes = 1 if #TPL_ARV > 0 then local soma = 0 for _, m in ipairs(TPL_ARV) do soma += (m:GetAttribute("Partes") or 50) end mediaPartes = soma / #TPL_ARV end local function tronco(pasta, x, h, z, alt, esp, cor) return peca(pasta, CIL, Vector3.new(alt, esp, esp), CFrame.new(x, h + alt / 2 - 0.5, z) * CFrame.Angles(0, 0, math.pi / 2), cor, Enum.Material.Wood, true) end local function galho(pasta, x, y, z, ang, comp, esp, cor) local dir = CFrame.Angles(0, ang, 0) * Vector3.new(math.cos(math.rad(55)), math.sin(math.rad(55)), 0) return peca(pasta, CIL, Vector3.new(comp, esp, esp), CFrame.new(Vector3.new(x, y, z) + dir * comp / 2) * CFrame.Angles(0, ang, math.rad(55)), cor, Enum.Material.Wood, false) end local qtdArv = math.min(2000, math.floor(L * W / 600 * arvoresD)) if arvTipo == "nenhuma" then qtdArv = 0 end if #TPL_ARV > 0 then qtdArv = math.min(qtdArv, math.floor(6000 / math.max(1, mediaPartes))) end if qtdArv > 0 then local ARV = Instance.new("Folder") ARV.Name = "Mapa_Arvores" ARV.Parent = workspace local feitas, tentativas = 0, 0 while feitas < qtdArv and tentativas < qtdArv * 6 do tentativas += 1 local x, z, h = posicao() if h > wl + 3.5 and h < amp * 0.72 and h > 1 then feitas += 1 local esc = rnd:NextNumber(0.8, 1.35) local alt = 10 * esc local madeira = Color3.fromRGB(84, 62, 44) if #TPL_ARV > 0 then colocarModelo(ARV, TPL_ARV, x, h, z, alt * 1.6) elseif arvTipo == "cacto" then local cor = Color3.fromRGB(70, 110, 60) local ca = alt * 0.8 peca(ARV, CIL, Vector3.new(ca, 1.6, 1.6), CFrame.new(x, h + ca / 2 - 0.5, z) * CFrame.Angles(0, 0, math.pi / 2), cor, Enum.Material.Grass, true) peca(ARV, CIL, Vector3.new(ca * 0.4, 1.1, 1.1), CFrame.new(x + 1.3, h + ca * 0.55, z) * CFrame.Angles(0, 0, math.pi / 2), cor, Enum.Material.Grass, false) peca(ARV, CIL, Vector3.new(ca * 0.35, 1.1, 1.1), CFrame.new(x - 1.3, h + ca * 0.7, z) * CFrame.Angles(0, 0, math.pi / 2), cor, Enum.Material.Grass, false) elseif arvTipo == "palmeira" then local a2 = alt * 1.35 tronco(ARV, x, h, z, a2, 1.1 * esc, Color3.fromRGB(120, 92, 62)) local topo = Vector3.new(x, h + a2 - 0.3, z) for k = 0, 5 do local ang = k * math.pi / 3 + rnd:NextNumber(-0.2, 0.2) peca(ARV, BLO, Vector3.new(7 * esc, 0.3, 1.9), CFrame.new(topo) * CFrame.Angles(0, ang, 0) * CFrame.new(3.1 * esc, -0.9, 0) * CFrame.Angles(0, 0, -0.38), Color3.fromRGB(56, 118, 52), Enum.Material.Grass, false) end elseif arvTipo == "morta" then local cor = Color3.fromRGB(70, 60, 52) tronco(ARV, x, h, z, alt * 0.9, 1.3 * esc, cor) galho(ARV, x, h + alt * 0.55, z, rnd:NextNumber(0, 6.28), 5 * esc, 0.7, cor) galho(ARV, x, h + alt * 0.75, z, rnd:NextNumber(0, 6.28), 4 * esc, 0.6, cor) elseif arvTipo == "pinheiro" then tronco(ARV, x, h, z, alt, 1.4 * esc, madeira) local verde = Color3.fromRGB(38, 82, 56) for k = 1, 3 do local r = (7.5 - k * 1.8) * esc peca(ARV, BOL, Vector3.new(r, r * 0.8, r), CFrame.new(x, h + alt * (0.45 + k * 0.2), z), verde, Enum.Material.Grass, false) end else tronco(ARV, x, h, z, alt, 1.4 * esc, madeira) local verde = Color3.fromRGB(rnd:NextInteger(52, 78), rnd:NextInteger(104, 138), rnd:NextInteger(48, 66)) local r = 9 * esc peca(ARV, BOL, Vector3.new(r, r * 0.85, r), CFrame.new(x, h + alt + 1, z), verde, Enum.Material.Grass, false) peca(ARV, BOL, Vector3.new(r * 0.7, r * 0.6, r * 0.7), CFrame.new(x + 2, h + alt + 3.2, z - 1), verde, Enum.Material.Grass, false) end if feitas % 150 == 0 then task.wait() end end end end local qtdPed = math.min(1500, math.floor(L * W / 900 * pedrasD)) if qtdPed > 0 then local PED = Instance.new("Folder") PED.Name = "Mapa_Pedras" PED.Parent = workspace local cor0 = interiorMat == "Sandstone" and Color3.fromRGB(150, 120, 86) or Color3.fromRGB(112, 112, 108) local feitas, tentativas = 0, 0 while feitas < qtdPed and tentativas < qtdPed * 5 do tentativas += 1 local x, z, h = posicao() if h > wl + 1.5 and h > 1 then feitas += 1 local t = rnd:NextNumber(2, 7) if #TPL_PED > 0 then colocarModelo(PED, TPL_PED, x, h, z, t * 0.9) else peca(PED, BOL, Vector3.new(t * rnd:NextNumber(0.9, 1.5), t * 0.7, t * rnd:NextNumber(0.9, 1.5)), CFrame.new(x, h + t * 0.1, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0), cor0, Enum.Material.Slate, true) end if feitas % 150 == 0 then task.wait() end end end end -- ===== cenário: objetos feitos de peças ===== local DEC = Instance.new("Folder") DEC.Name = "Mapa_Decoracao" DEC.Parent = workspace local function cor(r, g, b) return Color3.fromRGB(r, g, b) end local function ponto(modo) for _ = 1, 14 do local x, z, h = posicao() if modo == "agua" then if wl > 0 and h < wl - 1.5 then return x, z, h end elseif modo == "margem" then if wl > 0 and h > wl - 0.5 and h < wl + 4 then return x, z, h end elseif h > wl + 2 and h > 1 and h < amp * 0.8 then return x, z, h end end return nil end local function invisivel(pos, tam) local p = Instance.new("Part") p.Anchored, p.CanCollide, p.CanQuery, p.CanTouch, p.CastShadow = true, false, false, false, false p.Transparency = 1 p.Size = tam p.Position = pos p.Parent = DEC return p end local fogCor = cor(120, 130, 125) local BUILD = {} BUILD.juncos = function(x, z, h) for _ = 1, rnd:NextInteger(4, 8) do local alt = rnd:NextNumber(4, 8) peca(DEC, CIL, Vector3.new(alt, 0.28, 0.28), CFrame.new(x + rnd:NextNumber(-1.8, 1.8), h + alt / 2 - 0.3, z + rnd:NextNumber(-1.8, 1.8)) * CFrame.Angles(0, 0, math.pi / 2), cor(rnd:NextInteger(92, 120), rnd:NextInteger(110, 130), 58), Enum.Material.Grass, false) end end BUILD.nenufares = function(x, z, h) local d = rnd:NextNumber(2.5, 4.5) peca(DEC, CIL, Vector3.new(0.2, d, d), CFrame.new(x, wl + 0.15, z) * CFrame.Angles(0, 0, math.pi / 2), cor(54, 108, 56), Enum.Material.Grass, false) if rnd:NextNumber() < 0.25 then peca(DEC, BOL, Vector3.new(0.9, 0.7, 0.9), CFrame.new(x, wl + 0.5, z), cor(236, 200, 220), Enum.Material.SmoothPlastic, false) end end BUILD.cogumelos = function(x, z, h) local paleta = {cor(150, 60, 50), cor(170, 130, 80), cor(210, 200, 180), cor(110, 70, 120)} for _ = 1, rnd:NextInteger(1, 3) do local dx, dz, t = rnd:NextNumber(-1.2, 1.2), rnd:NextNumber(-1.2, 1.2), rnd:NextNumber(0.8, 1.6) peca(DEC, CIL, Vector3.new(1.6 * t, 0.55 * t, 0.55 * t), CFrame.new(x + dx, h + 0.8 * t - 0.2, z + dz) * CFrame.Angles(0, 0, math.pi / 2), cor(222, 212, 190), Enum.Material.SmoothPlastic, false) peca(DEC, BOL, Vector3.new(2.3 * t, 1.2 * t, 2.3 * t), CFrame.new(x + dx, h + 1.7 * t - 0.2, z + dz), paleta[rnd:NextInteger(1, #paleta)], Enum.Material.SmoothPlastic, false) end end BUILD.troncos = function(x, z, h) local comp, esp = rnd:NextNumber(8, 14), rnd:NextNumber(1.4, 2.6) peca(DEC, CIL, Vector3.new(comp, esp, esp), CFrame.new(x, h + esp / 2 - 0.2, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0), cor(78, 58, 42), Enum.Material.Wood, true) end BUILD.arbustos = function(x, z, h) local verde = cor(rnd:NextInteger(40, 70), rnd:NextInteger(90, 120), rnd:NextInteger(40, 60)) for _ = 1, 3 do local t = rnd:NextNumber(2.4, 4.4) peca(DEC, BOL, Vector3.new(t, t * 0.75, t), CFrame.new(x + rnd:NextNumber(-1.5, 1.5), h + t * 0.3, z + rnd:NextNumber(-1.5, 1.5)), verde, Enum.Material.Grass, false) end end BUILD.flores = function(x, z, h) local paleta = {cor(200, 70, 90), cor(230, 200, 70), cor(240, 240, 240), cor(150, 100, 200)} local c = paleta[rnd:NextInteger(1, #paleta)] for _ = 1, 4 do local dx, dz = rnd:NextNumber(-1.5, 1.5), rnd:NextNumber(-1.5, 1.5) peca(DEC, CIL, Vector3.new(1.4, 0.15, 0.15), CFrame.new(x + dx, h + 0.5, z + dz) * CFrame.Angles(0, 0, math.pi / 2), cor(60, 110, 50), Enum.Material.Grass, false) peca(DEC, BOL, Vector3.new(0.8, 0.6, 0.8), CFrame.new(x + dx, h + 1.3, z + dz), c, Enum.Material.SmoothPlastic, false) end end BUILD.ruinas = function(x, z, h) for _ = 1, rnd:NextInteger(3, 5) do local alt = rnd:NextNumber(3, 9) peca(DEC, BLO, Vector3.new(3, alt, 3), CFrame.new(x + rnd:NextNumber(-6, 6), h + alt / 2 - 0.5, z + rnd:NextNumber(-6, 6)) * CFrame.Angles(rnd:NextNumber(-0.12, 0.12), rnd:NextNumber(0, 6.28), rnd:NextNumber(-0.12, 0.12)), cor(130, 126, 118), Enum.Material.Cobblestone, true) end peca(DEC, BLO, Vector3.new(7, 1.5, 3), CFrame.new(x, h + 0.5, z + 5) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0.1), cor(120, 116, 108), Enum.Material.Cobblestone, true) end BUILD.tochas = function(x, z, h) peca(DEC, CIL, Vector3.new(6, 0.5, 0.5), CFrame.new(x, h + 2.5, z) * CFrame.Angles(0, 0, math.pi / 2), cor(70, 50, 36), Enum.Material.Wood, true) local chama = peca(DEC, BOL, Vector3.new(1.1, 1.5, 1.1), CFrame.new(x, h + 6.2, z), cor(255, 160, 60), Enum.Material.Neon, false) local luz = Instance.new("PointLight") luz.Brightness, luz.Range, luz.Color, luz.Shadows = 1.4, 22, cor(255, 170, 90), false luz.Parent = chama end BUILD.vagalumes = function(x, z, h) local p = invisivel(Vector3.new(x, h + 4, z), Vector3.new(16, 5, 16)) local pe = Instance.new("ParticleEmitter") pe.Rate = 2 pe.Lifetime = NumberRange.new(5, 9) pe.Speed = NumberRange.new(0.4, 1.2) pe.SpreadAngle = Vector2.new(180, 180) pe.Size = NumberSequence.new(0.35) pe.LightEmission = 1 pe.Color = ColorSequence.new(cor(190, 230, 110)) pe.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.2, 0.2), NumberSequenceKeypoint.new(0.8, 0.2), NumberSequenceKeypoint.new(1, 1)}) pe.Parent = p end BUILD.neblina = function(x, z, h) local p = invisivel(Vector3.new(x, math.max(h, wl) + 2, z), Vector3.new(24, 3, 24)) local pe = Instance.new("ParticleEmitter") pe.Texture = "rbxasset://textures/particles/smoke_main.dds" pe.Rate = 3 pe.Lifetime = NumberRange.new(10, 14) pe.Speed = NumberRange.new(0.4, 1.2) pe.SpreadAngle = Vector2.new(180, 20) pe.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, 14), NumberSequenceKeypoint.new(1, 24)}) pe.Color = ColorSequence.new(fogCor) pe.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.3, 0.86), NumberSequenceKeypoint.new(1, 1)}) pe.Parent = p end BUILD.cristais = function(x, z, h) local c = rnd:NextInteger(1, 3) == 1 and cor(150, 90, 220) or cor(70, 200, 210) for _ = 1, 3 do local alt = rnd:NextNumber(3, 7) local p = peca(DEC, BLO, Vector3.new(1.2, alt, 1.2), CFrame.new(x + rnd:NextNumber(-2, 2), h + alt / 2 - 0.4, z + rnd:NextNumber(-2, 2)) * CFrame.Angles(rnd:NextNumber(-0.35, 0.35), rnd:NextNumber(0, 6.28), rnd:NextNumber(-0.35, 0.35)), c, Enum.Material.Glass, false) p.Transparency = 0.3 end end BUILD.rocha_grande = function(x, z, h) local t = rnd:NextNumber(8, 18) peca(DEC, BOL, Vector3.new(t, t * 0.7, t * rnd:NextNumber(0.8, 1.2)), CFrame.new(x, h + t * 0.2, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0), interiorMat == "Sandstone" and cor(160, 120, 84) or cor(104, 104, 100), Enum.Material.Slate, true) end BUILD.capim = function(x, z, h) for _ = 1, 4 do local a = rnd:NextNumber(1.8, 3.2) peca(DEC, BLO, Vector3.new(0.25, a, 0.9), CFrame.new(x + rnd:NextNumber(-0.8, 0.8), h + a / 2 - 0.2, z + rnd:NextNumber(-0.8, 0.8)) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), rnd:NextNumber(-0.25, 0.25)), cor(rnd:NextInteger(70, 100), rnd:NextInteger(110, 140), 56), Enum.Material.Grass, false) end end local REGRAS = { juncos = {"margem", 500, 500}, nenufares = {"agua", 700, 300}, cogumelos = {"terra", 900, 400}, troncos = {"terra", 1400, 200}, arbustos = {"terra", 700, 500}, flores = {"terra", 500, 500}, ruinas = {"terra", 9000, 25}, tochas = {"terra", 6000, 40}, vagalumes = {"terra", 1800, 120}, neblina = {"terra", 2500, 80}, cristais = {"terra", 5000, 40}, rocha_grande = {"terra", 3500, 60}, capim = {"terra", 400, 600}, } for _, d in ipairs(decos) do local nome, dens = d[1], d[2] local regra, build = REGRAS[nome], BUILD[nome] if regra and build and dens > 0 then local n = math.min(regra[3], math.max(1, math.floor(L * W / regra[2] * dens))) for k = 1, n do local x, z, h = ponto(regra[1]) if x then build(x, z, h) end if k % 120 == 0 then task.wait() end end end end local spawn = workspace:FindFirstChildOfClass("SpawnLocation") if spawn then local filtro = OverlapParams.new() filtro.FilterType = Enum.RaycastFilterType.Include local grandes = {} for _, n in ipairs({"Mapa_Arvores", "Mapa_Pedras", "Objetos_Prontos"}) do local f = workspace:FindFirstChild(n) if f then table.insert(grandes, f) end end filtro.FilterDescendantsInstances = grandes local livre, seco = nil, nil for r = 0, math.floor(math.min(halfL, halfW) * 0.8), 15 do for a = 0, 7 do local x, z = r * math.cos(a * math.pi / 4), r * math.sin(a * math.pi / 4) local h = hAt(x, z) if h > wl + 3 then seco = seco or Vector3.new(x, h + 4, z) if not livre and #workspace:GetPartBoundsInRadius(Vector3.new(x, h + 3, z), 9, filtro) == 0 then livre = Vector3.new(x, h + 4, z) end end end if livre then break end end local alvo = livre or seco if alvo then spawn.Position = alvo for _, d in ipairs(workspace:GetPartBoundsInRadius(alvo, 6)) do if d:IsDescendantOf(DEC) then d:Destroy() end end end end local bp = workspace:FindFirstChild("Baseplate") if bp and bp:IsA("BasePart") and bp.Position.Y > -100 then bp.CFrame = bp.CFrame + Vector3.new(0, -300, 0) bp.Transparency = 1 end -- ===== atmosfera: luz, névoa, nuvens, cor e água ===== local MOODS = { dia = {clock = 14, bright = 2, amb = cor(70, 70, 75), out = cor(120, 125, 135), exp = 0, dens = 0.25, off = 0.15, acol = cor(199, 210, 225), adec = cor(150, 160, 175), haze = 1, sat = 0.05, con = 0.05, tint = cor(255, 255, 255), cover = 0.5, cdens = 0.5, ccol = cor(255, 255, 255), wcol = cor(40, 100, 125), wtr = 0.8, fog = cor(200, 210, 220)}, sombrio = {clock = 17.2, bright = 1.1, amb = cor(58, 66, 62), out = cor(86, 98, 92), exp = -0.1, dens = 0.36, off = 0.2, acol = cor(104, 122, 112), adec = cor(62, 76, 68), haze = 2, sat = -0.3, con = 0.12, tint = cor(205, 220, 210), cover = 0.9, cdens = 0.85, ccol = cor(84, 92, 88), wcol = cor(40, 58, 42), wtr = 0.35, fog = cor(110, 126, 116)}, noite = {clock = 0, bright = 0.6, amb = cor(28, 32, 52), out = cor(40, 48, 78), exp = 0, dens = 0.3, off = 0.1, acol = cor(30, 40, 70), adec = cor(20, 26, 46), haze = 1.5, sat = -0.1, con = 0.1, tint = cor(190, 205, 255), cover = 0.4, cdens = 0.5, ccol = cor(40, 48, 80), wcol = cor(20, 40, 70), wtr = 0.6, fog = cor(60, 70, 100)}, entardecer = {clock = 17.6, bright = 1.7, amb = cor(100, 82, 78), out = cor(150, 128, 112), exp = 0, dens = 0.3, off = 0.25, acol = cor(255, 192, 152), adec = cor(230, 160, 110), haze = 1.6, sat = 0.08, con = 0.06, tint = cor(255, 238, 220), cover = 0.55, cdens = 0.6, ccol = cor(255, 205, 170), wcol = cor(70, 100, 120), wtr = 0.6, fog = cor(225, 185, 155)}, neblina = {clock = 11, bright = 1.2, amb = cor(90, 95, 100), out = cor(140, 145, 150), exp = -0.1, dens = 0.55, off = 0.2, acol = cor(190, 195, 200), adec = cor(150, 155, 160), haze = 4, sat = -0.15, con = 0, tint = cor(235, 240, 240), cover = 0.9, cdens = 0.9, ccol = cor(170, 174, 178), wcol = cor(60, 80, 70), wtr = 0.55, fog = cor(190, 196, 196)}, nublado = {clock = 13, bright = 1.2, amb = cor(80, 82, 88), out = cor(120, 124, 132), exp = -0.1, dens = 0.35, off = 0.15, acol = cor(170, 176, 184), adec = cor(130, 136, 144), haze = 2, sat = -0.2, con = 0.05, tint = cor(240, 242, 248), cover = 0.9, cdens = 0.9, ccol = cor(120, 124, 130), wcol = cor(50, 80, 100), wtr = 0.7, fog = cor(170, 176, 184)}, magico = {clock = 19.6, bright = 1.4, amb = cor(90, 80, 130), out = cor(120, 110, 170), exp = 0, dens = 0.26, off = 0.2, acol = cor(170, 150, 215), adec = cor(120, 100, 170), haze = 1.5, sat = 0.2, con = 0.08, tint = cor(230, 215, 255), cover = 0.5, cdens = 0.6, ccol = cor(170, 140, 210), wcol = cor(60, 140, 170), wtr = 0.6, fog = cor(170, 150, 215)}, } local M = MOODS[humor] or MOODS.dia local Lighting = game:GetService("Lighting") for _, ef in ipairs(Lighting:GetChildren()) do if ef:IsA("PostEffect") and ef.Name ~= "MapaCor" then ef:Destroy() end end Lighting.ClockTime = M.clock Lighting.Brightness = M.bright Lighting.Ambient = M.amb Lighting.OutdoorAmbient = M.out Lighting.ExposureCompensation = M.exp local at = Lighting:FindFirstChildOfClass("Atmosphere") or Instance.new("Atmosphere") at.Density, at.Offset, at.Color, at.Decay, at.Glare, at.Haze = M.dens, M.off, M.acol, M.adec, 0, M.haze at.Parent = Lighting local cc = Lighting:FindFirstChild("MapaCor") or Instance.new("ColorCorrectionEffect") cc.Name = "MapaCor" cc.Saturation, cc.Contrast, cc.TintColor = M.sat, M.con, M.tint cc.Parent = Lighting local nuv = Terrain:FindFirstChildOfClass("Clouds") or Instance.new("Clouds") nuv.Cover, nuv.Density, nuv.Color = M.cover, M.cdens, M.ccol nuv.Parent = Terrain Terrain.WaterColor = M.wcol Terrain.WaterTransparency = M.wtr Terrain.WaterWaveSize = 0.15 Terrain.WaterWaveSpeed = 8 return "mapa pronto" ]======] M.MAPA_MATERIAIS = [======[ local T = workspace.Terrain local ok = {} for _, m in ipairs(Enum.Material:GetEnumItems()) do if m ~= Enum.Material.Air and m ~= Enum.Material.Water then local cf = CFrame.new(5000, 5000, 5000) local bom = pcall(function() T:FillBlock(cf, Vector3.new(4, 4, 4), m) local mats = T:ReadVoxels(Region3.new(Vector3.new(4998, 4998, 4998), Vector3.new(5002, 5002, 5002)), 4) if mats[1][1][1] ~= m then error("nao") end end) if bom then table.insert(ok, m.Name) end pcall(function() T:FillBlock(cf, Vector3.new(8, 8, 8), Enum.Material.Air) end) end end return table.concat(ok, ",") ]======] M.MAPA_CAMERA_CHAO = [======[ local sp = workspace:FindFirstChildOfClass("SpawnLocation") local p = sp.Position + Vector3.new(0, 4, 0) local melhor, livre = Vector3.new(0, 0, -1), -1 for a = 0, 7 do local d = Vector3.new(math.cos(a * math.pi / 4), 0, math.sin(a * math.pi / 4)) local atras = workspace:Raycast(p, -d * 14) local frente = workspace:Raycast(p, d * 40) local nota = (atras and 0 or 40) + (frente and (frente.Position - p).Magnitude or 40) if nota > livre then melhor, livre = d, nota end end local de = p - melhor * 12 + Vector3.new(0, 2, 0) local para = p + melhor * 30 return string.format("%.1f,%.1f,%.1f,%.1f,%.1f,%.1f", de.X, de.Y, de.Z, para.X, para.Y - 2, para.Z) ]======] M.OBJ_CABECALHO = [======[ local tipo = "@TIPO@" local TEXTO = [==[@TEXTO@]==] local TECLA = "@TECLA@" local N1 = @N1@ local DIR = "@DIR@" local cam = workspace.CurrentCamera local pasta = workspace:FindFirstChild("Objetos_Prontos") or Instance.new("Folder") pasta.Name = "Objetos_Prontos" pasta.Parent = workspace local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = {pasta} local origem = cam.CFrame.Position local r = workspace:Raycast(origem, cam.CFrame.LookVector * 1000, params) local pos = r and r.Position or (origem + cam.CFrame.LookVector * 30) if r and r.Normal.Y < 0.6 then local r2 = workspace:Raycast(pos - cam.CFrame.LookVector * 4 + Vector3.new(0, 60, 0), Vector3.new(0, -300, 0), params) if r2 then pos = r2.Position end end local para = Vector3.new(origem.X - pos.X, 0, origem.Z - pos.Z) if para.Magnitude < 0.1 then para = Vector3.new(0, 0, 1) end local BASE = CFrame.lookAt(pos, pos + para.Unit) local POS_FIXA = @POSFIXA@ if POS_FIXA then pos = Vector3.new(POS_FIXA[1], POS_FIXA[2], POS_FIXA[3]) local alvo = Vector3.new(POS_FIXA[4], pos.Y, POS_FIXA[5]) if (alvo - pos).Magnitude < 0.1 then alvo = pos + Vector3.new(0, 0, -1) end BASE = CFrame.lookAt(pos, alvo) r = nil end local m = Instance.new("Model") m.Name = "@NOME@" local function cor(r, g, b) return Color3.fromRGB(r, g, b) end local function peca(nome, tam, cf, c, mat, pai) local p = Instance.new("Part") p.Name, p.Size, p.CFrame, p.Color, p.Material, p.Anchored = nome, tam, cf, c, mat, true p.TopSurface, p.BottomSurface = Enum.SurfaceType.Smooth, Enum.SurfaceType.Smooth p.Parent = pai or m return p end local function invisivel(nome, cf) local p = peca(nome, Vector3.new(0.2, 0.2, 0.2), cf, cor(0, 0, 0), Enum.Material.SmoothPlastic) p.Transparency, p.CanCollide, p.CanQuery, p.CanTouch = 1, false, false, false return p end local function prompt(pai, acao, objeto) local pp = Instance.new("ProximityPrompt") pp.ActionText, pp.ObjectText = acao, objeto pp.KeyboardKeyCode = Enum.KeyCode[TECLA] pp.HoldDuration, pp.MaxActivationDistance, pp.RequiresLineOfSight = 0, 10, false pp.Parent = pai return pp end local function funcionamento(fonte) local s = Instance.new("Script") s.Name = "Funcionamento" s.Source = fonte s.Parent = m end ]======] M.OBJ_RODAPE = [======[ m.Parent = pasta local cf, tam = m:GetBoundingBox() local d = math.max(tam.X, tam.Y, tam.Z, 4) local frente = BASE.LookVector local c = cf.Position return string.format("%.2f,%.2f,%.2f|%.2f,%.2f,%.2f|%.2f", c.X, c.Y, c.Z, frente.X, frente.Y, frente.Z, d) ]======] M.OBJ_GIRAR = [======[ local m = script.Parent local TS = game:GetService("TweenService") local dob, folha = m:WaitForChild("Dobradica"), m:WaitForChild("Folha") task.wait(0.2) local pp = folha:FindFirstChildWhichIsA("ProximityPrompt", true) local fechaApos = @N1@ local ABRE = @ANG@ local base = dob.CFrame local offs = {} for _, p in ipairs(folha:GetChildren()) do if p:IsA("BasePart") then offs[p] = base:ToObjectSpace(p.CFrame) end end local ang = Instance.new("NumberValue") ang.Changed:Connect(function(v) local cf = base * CFrame.Angles(0, math.rad(v), 0) for p, o in pairs(offs) do p.CFrame = cf * o end end) local aberta, vez = false, 0 local function definir(abrir) aberta = abrir vez += 1 local minha = vez if pp then pp.ActionText = abrir and "Fechar" or "Abrir" end TS:Create(ang, TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Value = abrir and ABRE or 0}):Play() if abrir and fechaApos > 0 then task.delay(fechaApos, function() if aberta and vez == minha then definir(false) end end) end end if pp then pp.Triggered:Connect(function() definir(not aberta) end) end m:GetAttributeChangedSignal("Acionar"):Connect(function() definir(not aberta) end) ]======] M.OBJ_PONTO = [======[ local cam = workspace.CurrentCamera local r = workspace:Raycast(cam.CFrame.Position, cam.CFrame.LookVector * 1000) local p = r and r.Position or (cam.CFrame.Position + cam.CFrame.LookVector * 30) return string.format("%.1f,%.1f", p.X, p.Z) ]======] M.OBJ_JANELA = [======[ local naParede = r and r.Normal.Y < 0.6 local JB = naParede and CFrame.lookAt(r.Position + r.Normal * 0.25, r.Position + r.Normal * 2) or (POS_FIXA and BASE or (BASE * CFrame.new(0, 4.5, 0))) local W, H = @LARG@, @ALT@ local mold = cor(235, 232, 225) peca("MolduraE", Vector3.new(0.3, H + 0.6, 0.5), JB * CFrame.new(-W / 2 - 0.15, 0, 0), mold, Enum.Material.Wood) peca("MolduraD", Vector3.new(0.3, H + 0.6, 0.5), JB * CFrame.new(W / 2 + 0.15, 0, 0), mold, Enum.Material.Wood) peca("MolduraTopo", Vector3.new(W + 0.6, 0.3, 0.5), JB * CFrame.new(0, H / 2 + 0.15, 0), mold, Enum.Material.Wood) peca("Peitoril", Vector3.new(W + 0.9, 0.3, 0.8), JB * CFrame.new(0, -H / 2 - 0.15, -0.15), mold, Enum.Material.Wood) if not naParede and not POS_FIXA then local parede, cp = cor(205, 196, 182), Enum.Material.Concrete peca("ParedeBaixo", Vector3.new(10, 2.35, 0.6), BASE * CFrame.new(0, 1.175, 0.3), parede, cp) peca("ParedeCima", Vector3.new(10, 1.35, 0.6), BASE * CFrame.new(0, 7.325, 0.3), parede, cp) peca("ParedeE", Vector3.new(2.7, 4.3, 0.6), BASE * CFrame.new(-3.65, 4.5, 0.3), parede, cp) peca("ParedeD", Vector3.new(2.7, 4.3, 0.6), BASE * CFrame.new(3.65, 4.5, 0.3), parede, cp) end local folha = Instance.new("Model") folha.Name = "Folha" folha.Parent = m local dob = JB * CFrame.new(-W / 2, 0, 0) local vidro = peca("Vidro", Vector3.new(W, H, 0.12), dob * CFrame.new(W / 2, 0, 0), cor(170, 210, 230), Enum.Material.Glass, folha) vidro.Transparency = 0.45 peca("Travessa", Vector3.new(W, 0.15, 0.2), dob * CFrame.new(W / 2, 0, 0), mold, Enum.Material.Wood, folha) peca("Montante", Vector3.new(0.15, H, 0.2), dob * CFrame.new(W / 2, 0, 0), mold, Enum.Material.Wood, folha) invisivel("Dobradica", dob) prompt(vidro, "Abrir", TEXTO ~= "" and TEXTO or "Janela") m:SetAttribute("Ligavel", true) funcionamento([==[@GIRAR@]==]) ]======] M.OBJ_LAMPADA = [======[ local poste = peca("Poste", Vector3.new(0.5, 9, 0.5), BASE * CFrame.new(0, 4.5, 0), cor(45, 45, 50), Enum.Material.Metal) peca("Braco", Vector3.new(0.3, 0.3, 2), BASE * CFrame.new(0, 8.8, -0.9), cor(45, 45, 50), Enum.Material.Metal) local l = peca("Lampada", Vector3.new(1.2, 1.2, 1.2), BASE * CFrame.new(0, 8.3, -1.8), cor(255, 236, 190), Enum.Material.Neon) l.Shape = Enum.PartType.Ball local luz = Instance.new("PointLight") luz.Brightness, luz.Range, luz.Color, luz.Shadows = 1.4, 26, cor(255, 225, 170), true luz.Parent = l prompt(poste, "Apagar", TEXTO ~= "" and TEXTO or "Lâmpada") m:SetAttribute("Ligavel", true) funcionamento([==[ local m = script.Parent local l = m:WaitForChild("Lampada") local luz = l:WaitForChild("PointLight") local pp = m:WaitForChild("Poste"):WaitForChild("ProximityPrompt") local function trocar() luz.Enabled = not luz.Enabled l.Material = luz.Enabled and Enum.Material.Neon or Enum.Material.Glass pp.ActionText = luz.Enabled and "Apagar" or "Acender" end pp.Triggered:Connect(trocar) m:GetAttributeChangedSignal("Acionar"):Connect(trocar) ]==]) ]======] M.OBJ_PORTA = [======[ local W, H = @LARG@, @ALT@ local escuro = cor(90, 64, 40) peca("BatenteE", Vector3.new(0.6, H + 0.6, 0.8), BASE * CFrame.new(-W / 2 - 0.3, (H + 0.6) / 2, 0), escuro, Enum.Material.Wood) peca("BatenteD", Vector3.new(0.6, H + 0.6, 0.8), BASE * CFrame.new(W / 2 + 0.3, (H + 0.6) / 2, 0), escuro, Enum.Material.Wood) peca("BatenteTopo", Vector3.new(W + 1.2, 0.6, 0.8), BASE * CFrame.new(0, H + 0.3, 0), escuro, Enum.Material.Wood) local folha = Instance.new("Model") folha.Name = "Folha" folha.Parent = m local dob = BASE * CFrame.new(-W / 2, 0, 0) local porta = peca("Porta", Vector3.new(W, H, 0.35), dob * CFrame.new(W / 2, H / 2, 0), cor(130, 92, 58), Enum.Material.WoodPlanks, folha) peca("Macaneta", Vector3.new(0.3, 0.3, 0.7), dob * CFrame.new(W - 0.6, H * 0.45, 0), cor(200, 170, 60), Enum.Material.Metal, folha) invisivel("Dobradica", dob) prompt(porta, "Abrir", TEXTO ~= "" and TEXTO or "Porta") m:SetAttribute("Ligavel", true) funcionamento([==[@GIRAR@]==]) ]======] M.OBJ_BAU = [======[ local L, A, P = 4, 2.4, 2.6 local madeira = cor(120, 82, 50) local corpo = peca("Corpo", Vector3.new(L, A, P), BASE * CFrame.new(0, A / 2, 0), madeira, Enum.Material.WoodPlanks) for _, x in ipairs({-L / 2 + 0.25, L / 2 - 0.25}) do peca("Faixa", Vector3.new(0.3, A + 0.05, P + 0.05), BASE * CFrame.new(x, A / 2, 0), cor(70, 70, 75), Enum.Material.Metal) end local tampa = Instance.new("Model") tampa.Name = "Tampa" tampa.Parent = m local dob = BASE * CFrame.new(0, A, P / 2) peca("TampaMadeira", Vector3.new(L, 0.8, P), dob * CFrame.new(0, 0.4, -P / 2), madeira, Enum.Material.WoodPlanks, tampa) peca("Fecho", Vector3.new(0.6, 0.7, 0.2), dob * CFrame.new(0, 0.15, -P - 0.1), cor(200, 170, 60), Enum.Material.Metal, tampa) invisivel("Dobradica", dob) prompt(corpo, "Abrir", "Baú") funcionamento([==[ local m = script.Parent local TS = game:GetService("TweenService") local dob, tampa, corpo = m:WaitForChild("Dobradica"), m:WaitForChild("Tampa"), m:WaitForChild("Corpo") local pp = corpo:WaitForChild("ProximityPrompt") local reabre = @N1@ local ITEM = [=[@TEXTO@]=] if ITEM == "" then ITEM = "Tesouro" end local base = dob.CFrame local offs = {} for _, p in ipairs(tampa:GetChildren()) do if p:IsA("BasePart") then offs[p] = base:ToObjectSpace(p.CFrame) end end local ang = Instance.new("NumberValue") ang.Changed:Connect(function(v) local cf = base * CFrame.Angles(math.rad(v), 0, 0) for p, o in pairs(offs) do p.CFrame = cf * o end end) local brilho = Instance.new("ParticleEmitter") brilho.Rate = 0 brilho.Speed = NumberRange.new(4, 8) brilho.Lifetime = NumberRange.new(0.6, 1.2) brilho.Color = ColorSequence.new(Color3.fromRGB(255, 215, 90)) brilho.LightEmission = 0.6 brilho.Size = NumberSequence.new(0.3) brilho.Parent = corpo local pegou = {} local aberto = false local function abrir(jogador) if aberto then return end aberto = true pp.Enabled = false TS:Create(ang, TweenInfo.new(0.7, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Value = 105}):Play() brilho:Emit(25) if jogador and not pegou[jogador.UserId] then pegou[jogador.UserId] = true local tool = Instance.new("Tool") tool.Name, tool.ToolTip = ITEM, ITEM local h = Instance.new("Part") h.Name, h.Size, h.Color, h.Material = "Handle", Vector3.new(1, 1, 1), Color3.fromRGB(240, 200, 70), Enum.Material.Metal h.Parent = tool tool.Parent = jogador:FindFirstChildOfClass("Backpack") end if reabre > 0 then task.delay(reabre, function() TS:Create(ang, TweenInfo.new(0.6), {Value = 0}):Play() task.wait(0.6) aberto, pegou = false, {} pp.Enabled = true end) end end pp.Triggered:Connect(abrir) m:GetAttributeChangedSignal("Acionar"):Connect(function() abrir(nil) end) ]==]) ]======] M.OBJ_ALAVANCA = [======[ peca("Base", Vector3.new(1.6, 0.6, 1.6), BASE * CFrame.new(0, 0.3, 0), cor(80, 80, 84), Enum.Material.Metal) local piv = BASE * CFrame.new(0, 0.6, 0) local braco = Instance.new("Model") braco.Name = "Braco" braco.Parent = m local haste = peca("Haste", Vector3.new(0.25, 2.6, 0.25), piv * CFrame.new(0, 1.3, 0), cor(110, 110, 115), Enum.Material.Metal, braco) local pomo = peca("Pomo", Vector3.new(0.7, 0.7, 0.7), piv * CFrame.new(0, 2.6, 0), cor(200, 40, 40), Enum.Material.SmoothPlastic, braco) pomo.Shape = Enum.PartType.Ball invisivel("Dobradica", piv) prompt(haste, "Puxar", TEXTO ~= "" and TEXTO or "Alavanca") funcionamento([==[ local m = script.Parent local TS = game:GetService("TweenService") local dob, braco = m:WaitForChild("Dobradica"), m:WaitForChild("Braco") local pp = braco:WaitForChild("Haste"):WaitForChild("ProximityPrompt") local pomo = braco:WaitForChild("Pomo") local base = dob.CFrame local offs = {} for _, p in ipairs(braco:GetChildren()) do if p:IsA("BasePart") then offs[p] = base:ToObjectSpace(p.CFrame) end end local ang = Instance.new("NumberValue") ang.Value = -35 local function por(v) local cf = base * CFrame.Angles(math.rad(v), 0, 0) for p, o in pairs(offs) do p.CFrame = cf * o end end ang.Changed:Connect(por) por(-35) local ligada = false local function alvo() local melhor, dist = nil, 80 for _, o in ipairs(m.Parent:GetChildren()) do if o ~= m and o:IsA("Model") and o:GetAttribute("Ligavel") then local d = (o:GetPivot().Position - base.Position).Magnitude if d < dist then melhor, dist = o, d end end end return melhor end local function puxar() ligada = not ligada TS:Create(ang, TweenInfo.new(0.35), {Value = ligada and 35 or -35}):Play() pomo.Color = ligada and Color3.fromRGB(60, 190, 70) or Color3.fromRGB(200, 40, 40) local o = alvo() if o then o:SetAttribute("Acionar", not o:GetAttribute("Acionar")) end end pp.Triggered:Connect(puxar) m:GetAttributeChangedSignal("Acionar"):Connect(puxar) ]==]) ]======] M.OBJ_PLATAFORMA = [======[ local sobe = DIR == "sobe" local p = peca("Plataforma", Vector3.new(8, 1, 8), BASE * CFrame.new(0, sobe and 0.55 or 1.2, 0), cor(120, 120, 125), Enum.Material.DiamondPlate) p.Anchored = false local att = Instance.new("Attachment") att.Parent = p local ap = Instance.new("AlignPosition") ap.Mode = Enum.PositionAlignmentMode.OneAttachment ap.Attachment0 = att ap.MaxForce, ap.MaxVelocity, ap.Responsiveness = 1e8, 8, 30 ap.Position = p.Position ap.Parent = p local ao = Instance.new("AlignOrientation") ao.Mode = Enum.OrientationAlignmentMode.OneAttachment ao.Attachment0 = att ao.RigidityEnabled = true ao.CFrame = p.CFrame.Rotation ao.Parent = p local destino = sobe and (p.Position + Vector3.new(0, N1, 0)) or (BASE * CFrame.new(N1, 1.2, 0)).Position m:SetAttribute("A", p.Position) m:SetAttribute("B", destino) m:SetAttribute("Ligavel", true) funcionamento([==[ local m = script.Parent local p = m:WaitForChild("Plataforma") local ap = p:WaitForChild("AlignPosition") pcall(function() p:SetNetworkOwner(nil) end) local A, B = m:GetAttribute("A"), m:GetAttribute("B") local noB = false local function ir(b) noB = b ap.Position = b and B or A end m:GetAttributeChangedSignal("Acionar"):Connect(function() ir(not noB) end) while m.Parent do ir(not noB) task.wait((B - A).Magnitude / math.max(ap.MaxVelocity, 1) + 2.5) end ]==]) ]======] M.OBJ_CARTAZ = [======[ local madeira = cor(110, 78, 48) peca("PosteE", Vector3.new(0.4, 6, 0.4), BASE * CFrame.new(-2.6, 3, 0), madeira, Enum.Material.Wood) peca("PosteD", Vector3.new(0.4, 6, 0.4), BASE * CFrame.new(2.6, 3, 0), madeira, Enum.Material.Wood) local placa = peca("Placa", Vector3.new(6, 3, 0.3), BASE * CFrame.new(0, 4.4, -0.3), cor(150, 112, 70), Enum.Material.WoodPlanks) local sg = Instance.new("SurfaceGui") sg.Face = Enum.NormalId.Front sg.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud sg.PixelsPerStud = 50 sg.Parent = placa local t = Instance.new("TextLabel") t.Size = UDim2.fromScale(0.92, 0.85) t.Position = UDim2.fromScale(0.04, 0.075) t.BackgroundTransparency = 1 t.TextScaled = true t.Font = Enum.Font.GothamBold t.TextColor3 = cor(40, 28, 16) t.Text = TEXTO ~= "" and TEXTO or "Bem-vindo!" t.Parent = sg ]======] M.OBJ_TOCHA = [======[ peca("Poste", Vector3.new(0.5, 6, 0.5), BASE * CFrame.new(0, 3, 0), cor(70, 50, 36), Enum.Material.Wood) local cuia = peca("Cuia", Vector3.new(1.4, 0.6, 1.4), BASE * CFrame.new(0, 6.2, 0), cor(60, 60, 64), Enum.Material.Metal) local fogo = Instance.new("Fire") fogo.Size, fogo.Heat = 5, 9 fogo.Parent = cuia local luz = Instance.new("PointLight") luz.Brightness, luz.Range, luz.Color, luz.Shadows = 1.3, 20, cor(255, 170, 90), true luz.Parent = cuia ]======] M.FIGURANTES = [======[ local Players = game:GetService("Players") local N, CX, CZ, RAIO, VEL = @N@, @CX@, @CZ@, @RAIO@, @VEL@ local estilo = "@ESTILO@" local rnd = Random.new(@SEED@) local velha = workspace:FindFirstChild("Mapa_NPCs") if velha then velha:Destroy() end local pasta = Instance.new("Folder") pasta.Name = "Mapa_NPCs" pasta.Parent = workspace local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = {pasta} local function chao(x, z) local r = workspace:Raycast(Vector3.new(x, 600, z), Vector3.new(0, -1200, 0), params) if r and r.Material ~= Enum.Material.Water then return r.Position.Y end return nil end local function c(r, g, b) return Color3.fromRGB(r, g, b) end local PELES = {c(255, 224, 189), c(234, 184, 146), c(198, 134, 94), c(141, 85, 52), c(94, 56, 36), c(255, 205, 148)} local PALETAS = { moradores = {camisas = {c(200, 70, 70), c(70, 120, 200), c(230, 190, 70), c(90, 170, 110), c(240, 240, 240), c(170, 100, 190)}, calcas = {c(50, 60, 90), c(70, 70, 70), c(110, 90, 60), c(40, 40, 50)}}, guardas = {camisas = {c(40, 55, 95), c(50, 60, 70)}, calcas = {c(35, 40, 55), c(45, 45, 50)}}, medievais = {camisas = {c(130, 96, 64), c(160, 130, 90), c(110, 80, 70), c(90, 110, 80)}, calcas = {c(80, 62, 46), c(100, 80, 60), c(60, 54, 48)}}, turistas = {camisas = {c(255, 140, 60), c(60, 190, 200), c(240, 90, 150), c(250, 220, 80)}, calcas = {c(230, 220, 190), c(70, 110, 160), c(150, 150, 150)}}, } local pal = PALETAS[estilo] or PALETAS.moradores local AES = game:GetService("AvatarEditorService") local PALAVRA = ({moradores = "casual", guardas = "police", medievais = "medieval", turistas = "summer"})[estilo] or "casual" local function buscar(tipo, palavra) local ok, res = pcall(function() local p = CatalogSearchParams.new() p.AssetTypes = {tipo} p.SearchKeyword = palavra local ids = {} for _, it in ipairs(AES:SearchCatalog(p):GetCurrentPage()) do table.insert(ids, it.Id) end return ids end) return ok and res or {} end local CABELOS = buscar(Enum.AvatarAssetType.HairAccessory, "") local CAMISAS = buscar(Enum.AvatarAssetType.Shirt, PALAVRA) local CALCAS = buscar(Enum.AvatarAssetType.Pants, PALAVRA) local function sorteio(t) return #t > 0 and tostring(t[rnd:NextInteger(1, #t)]) or "" end local COMPORTAMENTO = [==[ local rig = script.Parent local hum = rig:WaitForChild("Humanoid") local raiz = rig:WaitForChild("HumanoidRootPart") local origem = rig:GetAttribute("Origem") local raio = rig:GetAttribute("Raio") local rnd = Random.new() local animador = hum:FindFirstChildOfClass("Animator") or Instance.new("Animator", hum) local function carregar(id) local a = Instance.new("Animation") a.AnimationId = "rbxassetid://" .. id local ok, faixa = pcall(function() return animador:LoadAnimation(a) end) if ok then faixa.Looped = true return faixa end return nil end local parado = carregar(507766666) local andando = carregar(507777826) if parado then parado:Play() end hum.Running:Connect(function(velocidade) if velocidade > 0.5 then if parado and parado.IsPlaying then parado:Stop(0.2) end if andando then if not andando.IsPlaying then andando:Play(0.2) end andando:AdjustSpeed(math.clamp(velocidade / 12, 0.4, 1.6)) end else if andando and andando.IsPlaying then andando:Stop(0.2) end if parado and not parado.IsPlaying then parado:Play(0.2) end end end) local PFS = game:GetService("PathfindingService") local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = {rig.Parent} local function destino() for _ = 1, 10 do local a, d = rnd:NextNumber(0, 6.2832), raio * math.sqrt(rnd:NextNumber()) local x, z = origem.X + d * math.cos(a), origem.Z + d * math.sin(a) local r = workspace:Raycast(Vector3.new(x, raiz.Position.Y + 80, z), Vector3.new(0, -200, 0), params) if r and r.Material ~= Enum.Material.Water then return r.Position end end return nil end local function andarAte(alvo) local caminho = PFS:CreatePath({AgentRadius = 2, AgentHeight = 5, AgentCanJump = true}) local ok = pcall(function() caminho:ComputeAsync(raiz.Position, alvo) end) if ok and caminho.Status == Enum.PathStatus.Success then for _, ponto in ipairs(caminho:GetWaypoints()) do if not rig.Parent then return end if ponto.Action == Enum.PathWaypointAction.Jump then hum.Jump = true end hum:MoveTo(ponto.Position) local chegou = hum.MoveToFinished:Wait() if not chegou then return end end else hum:MoveTo(alvo) hum.MoveToFinished:Wait() end end task.wait(rnd:NextNumber(0, 3)) while rig.Parent do local alvo = destino() if alvo then andarAte(alvo) end task.wait(rnd:NextNumber(1, 6)) end ]==] local criados = 0 for i = 1, N do local x, z, y for _ = 1, 30 do local a, d = rnd:NextNumber(0, 6.2832), RAIO * math.sqrt(rnd:NextNumber()) x, z = CX + d * math.cos(a), CZ + d * math.sin(a) y = chao(x, z) if y then break end end if y then local desc = Instance.new("HumanoidDescription") local pele = PELES[rnd:NextInteger(1, #PELES)] local camisa = pal.camisas[rnd:NextInteger(1, #pal.camisas)] local calca = pal.calcas[rnd:NextInteger(1, #pal.calcas)] desc.HeadColor = pele desc.TorsoColor, desc.LeftArmColor, desc.RightArmColor = camisa, camisa, camisa desc.LeftLegColor, desc.RightLegColor = calca, calca desc.HeightScale = rnd:NextNumber(0.92, 1.08) local vestido = desc:Clone() vestido.HairAccessory = sorteio(CABELOS) vestido.Shirt = tonumber(sorteio(CAMISAS)) or 0 vestido.Pants = tonumber(sorteio(CALCAS)) or 0 local ok, rig = pcall(function() return Players:CreateHumanoidModelFromDescription(vestido, Enum.HumanoidRigType.R15) end) if not ok or not rig then ok, rig = pcall(function() return Players:CreateHumanoidModelFromDescription(desc, Enum.HumanoidRigType.R15) end) end if ok and rig then rig.Name = "Figurante_" .. i rig.Parent = pasta rig:PivotTo(CFrame.new(x, y + 4, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0)) local topo = y for _, o in ipairs({{1.3, 1.3}, {-1.3, 1.3}, {1.3, -1.3}, {-1.3, -1.3}}) do local hy = chao(x + o[1], z + o[2]) if hy and hy > topo then topo = hy end end local cfb, szb = rig:GetBoundingBox() rig:PivotTo(rig:GetPivot() + Vector3.new(0, topo + 0.1 - (cfb.Y - szb.Y / 2), 0)) rig:SetAttribute("Origem", Vector3.new(CX, y, CZ)) rig:SetAttribute("Raio", RAIO) local hum = rig:FindFirstChildOfClass("Humanoid") hum.WalkSpeed = VEL * rnd:NextNumber(0.85, 1.15) hum.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None local sc = Instance.new("Script") sc.Name = "Comportamento" sc.Source = COMPORTAMENTO sc.Parent = rig criados += 1 end end if i % 4 == 0 then task.wait() end end return tostring(criados) ]======] M.CENA = [======[ local linhas = {} local function descrever(o, caminho) local d = o:GetAttribute("Descricao") local tam, pos = "", "" if o:IsA("Model") then local ok, cf, sz = pcall(function() return o:GetBoundingBox() end) if ok then tam = string.format(" size %.0fx%.0fx%.0f", sz.X, sz.Y, sz.Z) pos = string.format(" at %.0f,%.0f,%.0f", cf.X, cf.Y, cf.Z) end elseif o:IsA("BasePart") then tam = string.format(" size %.0fx%.0fx%.0f", o.Size.X, o.Size.Y, o.Size.Z) pos = string.format(" at %.0f,%.0f,%.0f", o.Position.X, o.Position.Y, o.Position.Z) end table.insert(linhas, "- " .. caminho .. " (" .. o.ClassName .. ")" .. (d and (" \"" .. d .. "\"") or "") .. tam .. pos) end local ignorar = {Mapa_Arvores = true, Mapa_Pedras = true, Mapa_Decoracao = true, Mapa_NPCs = true} for _, c in ipairs(workspace:GetChildren()) do if #linhas >= 45 then break end if not c:IsA("Terrain") and not c:IsA("Camera") then if ignorar[c.Name] then table.insert(linhas, "- workspace." .. c.Name .. " (generated map content, " .. #c:GetChildren() .. " items)") else descrever(c, "workspace." .. c.Name) end end end for _, servico in ipairs({"ServerStorage", "ReplicatedStorage"}) do local bib = game:GetService(servico):FindFirstChild("Biblioteca") if bib then for _, c in ipairs(bib:GetChildren()) do if #linhas >= 80 then break end descrever(c, servico .. ".Biblioteca." .. c.Name) end end end local L = game:GetService("Lighting") table.insert(linhas, string.format("Lighting ClockTime %.1f Brightness %.1f", L.ClockTime, L.Brightness)) return table.concat(linhas, "\n") ]======] M.SISTEMA_AGENTE = [======[ You are an expert Roblox Studio builder working for a game developer who does not read English. You receive a request (in Brazilian Portuguese) and answer ONLY with a JSON object. You write Luau code that is executed in the Studio command bar of a place open in EDIT mode (plugin security level), and you can use anything Studio allows from code. Capabilities you can use: - Terrain: WriteVoxels (use RES=4, arrays [x][y][z] of Enum.Material and occupancy 0..1), FillBlock/FillBall/FillCylinder/ FillWedge, ReadVoxels, Clear, SetMaterialColor, water properties (WaterColor, WaterTransparency, WaterWaveSize...). All Enum.Material terrain materials exist (Grass, Sand, Mud, Ground, Rock, Basalt, Slate, CrackedLava, Snow, Ice, Glacier, Salt, Asphalt, Cobblestone, Brick, Concrete, Limestone, Pavement, Sandstone, LeafyGrass, WoodPlanks, Water). - Lighting and atmosphere: Lighting.ClockTime/Brightness/Ambient/OutdoorAmbient/ExposureCompensation, Atmosphere, Sky, Clouds (child of Terrain), ColorCorrectionEffect, BloomEffect (weak only), DepthOfFieldEffect, SunRaysEffect (very weak). - Objects: Part (Block/Ball/Cylinder/Wedge), SpecialMesh, WedgePart, CornerWedgePart, TrussPart, unions via GeometryService/Part:UnionAsync, Model, Folder, Attachment, constraints, Motor6D rigs, Humanoid, SpawnLocation. - Interaction: ProximityPrompt (key prompt near a Part, event .Triggered), ClickDetector (event .MouseClick), Touched event on a Part. There is NO class named ProximitySensor, TouchSensor, Door, Switch, Button, Light, Sensor or Trigger: never use Instance.new with those names. - Effects: PointLight/SpotLight/SurfaceLight, ParticleEmitter (fog, fireflies, smoke, dust), Fire, Smoke, Sparkles, Beam, Trail. - Game logic: create Script/LocalScript/ModuleScript instances and set .Source; TweenService, CollectionService tags, Attributes, StarterGui ScreenGui with Frames/TextLabels, Teams, StarterPlayer settings, Workspace.Gravity. - Raycasting: use workspace:Raycast from above to put things exactly on the ground/terrain. ALWAYS pass RaycastParams (FilterType Exclude, FilterDescendantsInstances = {your own model}) when the ray starts above an object that moves or is being placed; otherwise the ray hits the object itself (an NPC "climbs itself" and rises forever). - NPCs/animals: build them as a Model with a PrimaryPart and Motor6D joints for limbs, then add a Script (Source) that wanders (pick a random point nearby, face it, walk at a calm speed, keep to the ground with an Exclude-filtered raycast, swing leg joints with math.sin while moving, rest between trips). Scripts only run in Play mode. RULES (important): 1. Put EVERYTHING you create inside ONE Folder in workspace named by the "pasta" field (start the code by destroying the old folder with that name so retries replace the previous attempt). Lighting/Terrain/Atmosphere changes are allowed when the request needs them. Never delete or modify objects you did not create, never call ClearAllChildren or Destroy on workspace/game/services. Terrain:Clear() is allowed ONLY when the request is to build a map or landscape. 2. FORBIDDEN: HttpService, loadstring, require(), DataStoreService, MessagingService, MarketplaceService, TeleportService. 3. Keep it performant: under 8000 parts, yield with task.wait() every ~150 iterations of heavy loops, use Anchored=true. 4. Visual quality rules from the developer: soft light (Lighting.Brightness at most 2, never a Glare in Atmosphere, no huge white or neon surfaces, Bloom weak with a high threshold), nothing floating (objects on water or terrain must reach the ground/sea floor), nothing buried in the ground, no overlapping messy objects, use natural varied colors and materials. 5. The code must be self-contained and end with `return "ok"`. Wrap risky parts with pcall when useful. 6. Write "plano" and "resumo" in Brazilian Portuguese, simple words, no technical terms (the user is not a programmer). LANDSCAPES: NEVER sculpt landscapes, dunes, hills, lakes or oases out of Parts/Balls (it looks terrible). The program has a proven terrain generator (real Terrain voxels with biomes, water, trees, rocks, fog, moods). For any request that needs a landscape/map/terrain/biome (desert, oasis, forest, swamp, island, snow, volcano, valley, lake...), answer the FIRST round with "base_mapa": {"descricao": "", "comprimento": N, "largura": N, "altura": N} and no "codigo". The program builds it, then asks you to add ONLY what is still missing (buildings, props, special objects) with code that does NOT clear or rebuild the terrain. If nothing is missing, answer pronto true. PEOPLE / NPCs ("figurantes", crowd, villagers, guards, tourists, pedestrians walking around): do NOT build humans from Parts. Use "npcs": {"quantidade": 1-40, "raio": studs, "centro": [x, z], "velocidade": 6-16, "estilo": "moradores" | "guardas" | "medievais" | "turistas"}. The program creates real R15 Humanoid people with idle and walking animations that wander inside the radius when the game runs (Play). Ask for "npcs" only AFTER the terrain exists (not in the same answer as "base_mapa"); you may combine "npcs" with "codigo". Animals are different: build them as Parts + Motor6D with a wandering Script. READY-MADE INTERACTIVE OBJECTS (tested, always work; prefer them over writing your own door/elevator scripts): use "objetos": a list of {"tipo", "posicao": [x, y, z], "virado_para": [x, z], ...} that the program builds for you. Types: "porta" (hinged door with its own frame; posicao = center of the door BOTTOM on the floor; optional "largura" 2-20 default 5, "altura" default 8; "n1" = seconds to close by itself, 0 = never). The door frame adds 0.6 stud on each side and on top, so leave a wall opening of (largura + 1.2) x (altura + 0.6). "janela" (window that opens; posicao = CENTER of the window inside your wall opening; "largura"/"altura" default 4; opening (largura + 0.6) x (altura + 0.6)). "bau" (chest that opens and gives a Tool named "texto"; "n1" = seconds to reset, 0 = once). "alavanca" (lever that toggles the nearest porta/janela/lampada/plataforma within 80 studs). "plataforma" (8x1x8 moving platform; posicao = its starting center; "dir": "sobe" goes up by "n1" studs, "lado" goes sideways by "n1" studs toward its local +X; loops by itself; great for parkour stairs: place several with increasing height). "lampada" (street lamp that turns on/off), "cartaz" (sign with "texto"), "tocha" (torch). "virado_para" is a point the FRONT of the object faces (for a door, a point outside the house). Optional "texto" and "tecla" ("E", "F", "G" or "R"). Up to 40 objects per answer. Send "objetos" together with or after the "codigo" that builds the walls/floors they sit on; the program builds your code first, then the objects. USER LIBRARY: "Cena atual" lists the user's existing assets with path, description, size and position, including ServerStorage.Biblioteca (the user's library). When the request mentions them or they clearly fit (e.g. "use my wooden house", a sword for a chest), CLONE them with code (o:Clone(), Model:ScaleTo if needed, PivotTo onto the ground with an Exclude-filtered Raycast) and parent the clones inside your folder. Never move, edit or delete the originals. COMMON MISTAKES TO AVOID (these caused real errors): - Enum values must really exist. There is NO Enum.MeshType.Cone. SpecialMesh.MeshType only has Head, Torso, Wedge, Prism, Pyramid, ParallelRamp, RightAngleRamp, CornerWedge, Brick, Sphere, Cylinder, FileMesh. For cones/pines stack Parts, use WedgePart or Pyramid-like SpecialMesh (Prism/Pyramid), or flattened Spheres. - Part.Shape accepts only Enum.PartType.Ball, Block, Cylinder (a Cylinder's axis is local X; rotate CFrame.Angles(0,0,math.pi/2) to stand it up). Wedge is the separate class WedgePart. - Only set properties that exist on that class. If unsure, skip the property instead of guessing. - When you receive an error, read it literally and fix THAT error; keep the rest of the working code. - Your answer is validated against the real Studio (Enum names, Instance.new class names) before it runs; invalid names will be sent back to you with the list of valid options. JSON fields: {"base_mapa": optional object described above, "npcs": optional object described above, "objetos": optional list described above, "plano": short plan in Portuguese, "pasta": "Agente_", "codigo": "", "camera": {"de": [x,y,z], "para": [x,y,z]} (where to photograph the result from, in studs), "pronto": false}. When you receive a photo and the result of a previous attempt: if the result already matches the request, answer {"pronto": true, "resumo": "what was done, in Portuguese"} WITHOUT codigo; otherwise fix problems and send the full new "codigo". ]======] M.NOMES_OBJ = {janela = "Janela", lampada = "Lampada", porta = "Porta", bau = "Bau", alavanca = "Alavanca", plataforma = "Plataforma", cartaz = "Cartaz", tocha = "Tocha"} return M end ]]>JogosFontes= 4 and 4 or 3) } end if rnd:NextNumber() < 0.6 then ruim = { op = "-", v = rnd:NextInteger(3, 6) + fase * 2 } else ruim = { op = "÷", v = 2 } end local esquerdaBoa = rnd:NextNumber() < 0.5 for _, p in ipairs(portoes) do if p:GetAttribute("Par") == par then local g = ((p:GetAttribute("Lado") == "E") == esquerdaBoa) and bom or ruim p:SetAttribute("Op", g.op) p:SetAttribute("Valor", g.v) p.Color = (g.op == "+" or g.op == "x") and Color3.fromRGB(40, 140, 255) or Color3.fromRGB(235, 60, 60) p.Transparency = 0.45 local t = p:FindFirstChild("Texto", true) if t then t.Text = g.op .. g.v end end end melhor = (bom.op == "+") and (melhor + bom.v) or (melhor * bom.v) if par == 1 then melhor += #mais1 -- a faixa +1 vem depois do 1º par end end -- o grupo vermelho é sempre vencível escolhendo bem inimigos = math.max(3, math.floor(melhor * (0.5 + math.min(0.35, fase * 0.05)))) for _, t in ipairs(mais1) do t.Transparency = 0 end end local function limparGrupo(lista) for _, b in ipairs(lista) do apagarBoneco(b, false) end table.clear(lista) end local function ajustarGrupo(lista, quantos, cor, centro) local alvo = math.min(quantos, MAX_BONECOS) local esp = espacamento(alvo) while #lista < alvo do table.insert(lista, novoBoneco(cor, centro + lugar(#lista + 1, esp))) end while #lista > alvo do apagarBoneco(table.remove(lista), true) end end local function textoFlutuante(t, cor, pos) local base = Instance.new("Part") base.Anchored, base.CanCollide, base.Transparency = true, false, 1 base.Size = Vector3.new(1, 1, 1) base.Position = pos base.Parent = pasta local bb = Instance.new("BillboardGui") bb.Size = UDim2.new(0, 140, 0, 50) bb.AlwaysOnTop = true bb.Parent = base local l = rotulo(bb, { Size = UDim2.fromScale(1, 1), Text = t, TextColor3 = cor }) TweenService:Create(base, TweenInfo.new(0.9), { Position = pos + Vector3.new(0, 8, 0) }):Play() TweenService:Create(l, TweenInfo.new(0.9), { TextTransparency = 1, TextStrokeTransparency = 1 }):Play() task.delay(1, function() base:Destroy() end) end local function prepararFase() sortearFase() limparGrupo(grupo) limparGrupo(grupoInimigo) table.clear(usados) for _, b in ipairs(barris) do b.entrada, b.mortos = nil, 0 end n, x, z, tempo = 1, 0, -6, 0 ajustarGrupo(grupo, n, AZUL, Vector3.new(x, Y + 1, z)) -- grupo vermelho parado na área dele local centroInimigo = Vector3.new(0, Y + 1, Z_INIMIGO - 8) local espI = espacamento(inimigos) for i = 1, math.min(inimigos, MAX_BONECOS) do table.insert(grupoInimigo, novoBoneco(VERMELHO, centroInimigo + lugar(i, espI))) end placarVermelho.Position = centroInimigo numVermelho.Text = tostring(inimigos) placarVermelho.BillboardGui.Enabled = true textoFase.Text = "FASE " .. fase end local function mostrarPainel(titulo, texto, botaoTexto) tituloPainel.Text = titulo textoPainel.Text = texto botao.Text = botaoTexto painel.Visible = true end local function fim(venceu) estado = "fim" if venceu then mostrarPainel("FASE " .. fase .. " CONCLUÍDA! 🎉", "Você chegou com " .. n .. " pessoas.\nA próxima fase tem mais inimigos e barris mais rápidos.", "▶ PRÓXIMA FASE") fase += 1 else mostrarPainel("O GRUPO VERMELHO VENCEU 😢", "Dica: escolha os portões azuis e pegue a faixa de +1 do lado esquerdo.", "↻ TENTAR DE NOVO") end end botao.Activated:Connect(function() painel.Visible = false prepararFase() estado = "correndo" end) -- ===== controles ===== UIS.InputBegan:Connect(function(i, gp) if i.KeyCode == Enum.KeyCode.A or i.KeyCode == Enum.KeyCode.Left then teclaE = true elseif i.KeyCode == Enum.KeyCode.D or i.KeyCode == Enum.KeyCode.Right then teclaD = true elseif (i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch) and not gp then arrastando, ultimoX = true, i.Position.X end end) UIS.InputEnded:Connect(function(i) if i.KeyCode == Enum.KeyCode.A or i.KeyCode == Enum.KeyCode.Left then teclaE = false elseif i.KeyCode == Enum.KeyCode.D or i.KeyCode == Enum.KeyCode.Right then teclaD = false elseif i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then arrastando = false end end) UIS.InputChanged:Connect(function(i) if arrastando and (i.UserInputType == Enum.UserInputType.MouseMovement or i.UserInputType == Enum.UserInputType.Touch) then if ultimoX then x += (i.Position.X - ultimoX) * 0.07 end ultimoX = i.Position.X end end) -- ===== jogo ===== local cam = workspace.CurrentCamera prepararFase() mostrarPainel("CROWD RUNNER", textoPainel.Text, "▶ JOGAR") -- modo demonstração: começa e passa de fase sozinho task.spawn(function() while true do task.wait(2) if P:GetAttribute("Demonstracao") and estado ~= "correndo" and estado ~= "batalha" then painel.Visible = false prepararFase() estado = "correndo" end end end) RunService.RenderStepped:Connect(function(dt) dt = math.min(dt, 0.05) tempo += dt cam.CameraType = Enum.CameraType.Scriptable local esp = espacamento(n) local raio = esp * math.sqrt(math.min(math.max(n, 1), MAX_BONECOS)) local limite = LARG / 2 - 1.5 - raio if estado == "correndo" then -- modo demonstração (atributo Demonstracao no CrowdRunner): o grupo vai sozinho para os portões bons if P:GetAttribute("Demonstracao") then -- próximo portão bom à frente local alvoX, alvoZ = 0, -math.huge for _, p in ipairs(portoes) do local pz, op = p:GetAttribute("Z"), p:GetAttribute("Op") if pz < z and pz > alvoZ and not usados["par" .. p:GetAttribute("Par")] and (op == "+" or op == "x") then alvoZ, alvoX = pz, p.Position.X end end -- a faixa +1 vem antes desse portão e ainda não passou: vai para ela if #mais1 > 0 then local inicioFaixa, fimFaixa = -math.huge, math.huge for _, m in ipairs(mais1) do inicioFaixa = math.max(inicioFaixa, m:GetAttribute("Z")) fimFaixa = math.min(fimFaixa, m:GetAttribute("Z")) end if z > fimFaixa and inicioFaixa > alvoZ then alvoX = mais1[1].Position.X end end -- barril chegando: vai para o lado oposto a ele for _, b in ipairs(barris) do if z - b.z > 0 and z - b.z < 30 then alvoX = b.parte.Position.X > 0 and -(LARG / 2 - 4) or (LARG / 2 - 4) end end x += math.clamp(alvoX - x, -22 * dt, 22 * dt) end local zAntes = z z -= VEL * (1 + fase * 0.03) * dt x += ((teclaD and 1 or 0) - (teclaE and 1 or 0)) * 22 * dt x = math.clamp(x, -limite, limite) -- portões for _, p in ipairs(portoes) do local pz = p:GetAttribute("Z") local par = p:GetAttribute("Par") if not usados["par" .. par] and zAntes > pz and z <= pz then local lado = x < 0 and "E" or "D" if p:GetAttribute("Lado") == lado then usados["par" .. par] = true local op, v = p:GetAttribute("Op"), p:GetAttribute("Valor") local antes = n if op == "+" then n += v elseif op == "x" then n *= v elseif op == "-" then n -= v else n = math.floor(n / v) end local bom = n >= antes textoFlutuante(op .. v, bom and Color3.fromRGB(120, 200, 255) or Color3.fromRGB(255, 110, 110), Vector3.new(x, Y + 8, z)) p.Transparency = 0.85 end end end -- faixa +1 for _, t in ipairs(mais1) do local tz = t:GetAttribute("Z") if not usados[t] and zAntes > tz and z <= tz and math.abs(x - t.Position.X) < 4 + raio * 0.6 then usados[t] = true n += 1 t.Transparency = 0.7 end end -- barris for _, b in ipairs(barris) do local bx = math.sin(tempo * (1.6 + fase * 0.12) + b.fase) * (LARG / 2 - 4) local cf = CFrame.new(bx, Y + 3, b.z) * CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(-bx / 3, 0, 0) b.parte.CFrame = cf for _, a in ipairs(b.aros) do a.parte.CFrame = cf * a.rel end if math.abs(z - b.z) < raio + 4 then -- cada barril derruba no máximo 20% do grupo que chegou nele (senão zera tudo e não dá para vencer) b.entrada = b.entrada or n local limite = math.max(3, math.floor(b.entrada * 0.2)) for k = #grupo, 1, -1 do local g = grupo[k] if (b.mortos or 0) < limite and math.abs(g.pos.X - bx) < 3.4 and math.abs(g.pos.Z - b.z) < 3.8 and n > 0 then b.mortos = (b.mortos or 0) + 1 table.remove(grupo, k) apagarBoneco(g, true) n -= 1 end end end end if n <= 0 then n = 0 fim(false) elseif z <= Z_INIMIGO + 4 and inimigos > 0 then estado = "batalha" elseif z <= Z_CHEGADA - 2 then fim(true) end elseif estado == "batalha" then -- os dois grupos vão se anulando local passo = math.max(1, math.floor(math.min(n, inimigos) / 20)) if tempo % 0.06 < dt then n -= passo inimigos -= passo numVermelho.Text = tostring(math.max(0, inimigos)) while #grupoInimigo > math.min(math.max(inimigos, 0), MAX_BONECOS) do apagarBoneco(table.remove(grupoInimigo), true) end end if n <= 0 then n = 0 fim(false) elseif inimigos <= 0 then placarVermelho.BillboardGui.Enabled = false estado = "correndo" end end -- grupo azul segue o líder local centro = Vector3.new(x, Y + 1, z) ajustarGrupo(grupo, n, AZUL, centro) for i, b in ipairs(grupo) do local alvo = centro + lugar(i, esp) b.pos = b.pos:Lerp(alvo, math.min(1, dt * 12)) local pulo = (estado == "correndo") and math.abs(math.sin(tempo * 12 + b.balanco)) * 0.35 or 0 b.corpo.CFrame = CFrame.new(b.pos + Vector3.new(0, pulo, 0)) b.cabeca.CFrame = CFrame.new(b.pos + Vector3.new(0, 1.6 + pulo, 0)) end -- grupo vermelho corre para o azul na batalha if estado == "batalha" then for _, b in ipairs(grupoInimigo) do b.pos = b.pos:Lerp(Vector3.new(x, Y + 1, z - 3), math.min(1, dt * 1.5)) b.corpo.CFrame = CFrame.new(b.pos) b.cabeca.CFrame = CFrame.new(b.pos + Vector3.new(0, 1.6, 0)) end end -- informações para teste (lidas pelo MCP) jogador:SetAttribute("CR_n", n) jogador:SetAttribute("CR_inimigos", inimigos) jogador:SetAttribute("CR_estado", estado) jogador:SetAttribute("CR_z", math.floor(z)) placarAzul.Position = centro numAzul.Text = tostring(math.max(n, 0)) barra.Size = UDim2.fromScale(math.clamp(z / Z_CHEGADA, 0, 1), 1) -- câmera atrás e em cima do grupo local olhar = Vector3.new(x * 0.5, Y, z - 22) cam.CFrame = CFrame.lookAt(Vector3.new(x * 0.5, Y + 24 + raio * 0.6, z + 26 + raio * 0.8), olhar) end) ]========] } return J end ]]>Gemini modelo que funcionou -- Chaves antigas começam com AIza (39 letras); as novas (desde maio/2026) começam com AQ. e são mais compridas. function G.formatoOk(chave) return string.match(chave, "^AIza[%w_%-]+$") ~= nil and #chave == 39 or string.match(chave, "^AQ%.[%w_%-%.]+$") ~= nil and #chave >= 23 and #chave <= 203 end local function versao(nome) local v = string.match(nome, "(%d+%.?%d*)") return tonumber(v) or 0 end function G.escolherModelo(chave, evitar) local ok, r = pcall(HttpService.RequestAsync, HttpService, { Url = URL .. "?pageSize=200", Method = "GET", Headers = { ["x-goog-api-key"] = chave }, }) if not ok or not r.Success then return nil end local dados = U.lerJson(r.Body) or {} local texto = {} for _, m in ipairs(dados.models or {}) do local nome = string.gsub(m.name or "", "^models/", "") local gera = false for _, metodo in ipairs(m.supportedGenerationMethods or {}) do if metodo == "generateContent" then gera = true end end local ruim = U.tem(nome, { "image", "tts", "audio", "live", "embed", "thinking", "exp", "vision", "robotics", "computer", "learnlm", "banana" }) if gera and string.sub(nome, 1, 6) == "gemini" and not ruim and nome ~= evitar then table.insert(texto, nome) end end for _, n in ipairs(texto) do if n == "gemini-flash-latest" then return n end end table.sort(texto, function(a, b) return versao(a) > versao(b) end) for _, n in ipairs(texto) do if string.find(n, "flash") and not string.find(n, "lite") then return n end end return texto[1] end local function erroLegivel(codigo, corpo) local baixo = string.lower(corpo or "") if codigo == 429 then return "A cota do Gemini acabou por agora (ou a chave está sem créditos). Espere um pouco ou veja a sua conta em aistudio.google.com." end if string.find(baixo, "api key not valid") or string.find(baixo, "api_key_invalid") or string.find(baixo, "expired") then return "O Google diz que essa chave não é válida. Copie a chave de novo, inteira, em aistudio.google.com/apikey." end if string.find(baixo, "location") and string.find(baixo, "not supported") then return "O Google não libera o Gemini para a sua região ou conta." end if string.find(baixo, "has not been used") or string.find(baixo, "service_disabled") or string.find(baixo, "disabled") then return "A chave foi criada num projeto em que o Gemini está desligado. Crie uma chave nova em aistudio.google.com/apikey." end if codigo == 400 or codigo == 401 or codigo == 403 then return "O Google recusou a chave (erro " .. codigo .. "). Crie uma chave nova em aistudio.google.com/apikey." end return "O Gemini deu erro (" .. tostring(codigo) .. ")." end -- op: { chave, modelo, sistema, imagem (base64 PNG), json (true = resposta em JSON) } -- Devolve (texto) ou lança erro com mensagem em português. function G.perguntar(texto, op) local chave = string.gsub(op.chave or "", "^%s+", "") chave = string.gsub(chave, "%s+$", "") if chave == "" then error("Falta a chave do Gemini. Cole a chave na aba Ajustes.", 0) end if string.find(chave, "[^%w_%-%.]") then error("A chave tem espaços ou letras estranhas (talvez veio texto junto). Copie só a chave.", 0) end local modelo = escolhido[chave] or op.modelo or G.MODELO_PADRAO local partes = { { text = texto } } if op.imagem then table.insert(partes, { inlineData = { mimeType = "image/png", data = op.imagem } }) end local pedido = { contents = { { parts = partes } } } if op.sistema then pedido.systemInstruction = { parts = { { text = op.sistema } } } end if op.json then pedido.generationConfig = { responseMimeType = "application/json", temperature = 0.6 } end local corpo = U.json(pedido) local trocouPor404 = false local tentativa = 0 local lentas = 0 while true do local ok, r = pcall(HttpService.RequestAsync, HttpService, { Url = URL .. modelo .. ":generateContent", Method = "POST", Headers = { ["Content-Type"] = "application/json", ["x-goog-api-key"] = chave }, Body = corpo, }) if not ok then local msg = string.lower(tostring(r)) local lento = string.find(msg, "timed?out") or string.find(msg, "timeout") if lento and lentas < 2 then lentas += 1 task.wait(ESPERAS[lentas]) elseif lento then error("O Gemini demorou demais para responder várias vezes seguidas (o Google está lento agora, não é a sua internet nem a sua chave). Espere um pouco e tente de novo.", 0) elseif string.find(msg, "permission") or string.find(msg, "denied") or string.find(msg, "not allowed") then error("O Studio bloqueou o plugin de usar a internet. Abra Plugins › Gerenciar plugins e permita o acesso a generativelanguage.googleapis.com.", 0) else error("Não consegui falar com o Gemini. Veja a internet. (detalhe: " .. string.sub(tostring(r), 1, 120) .. ")", 0) end elseif r.Success then local dados = U.lerJson(r.Body) local resposta = dados and dados.candidates and dados.candidates[1] and dados.candidates[1].content and dados.candidates[1].content.parts and dados.candidates[1].content.parts[1] and dados.candidates[1].content.parts[1].text if not resposta then error("O Gemini não devolveu resposta (talvez o pedido foi bloqueado pelo filtro do Google). Tente descrever de outro jeito.", 0) end escolhido[chave] = modelo return resposta elseif r.StatusCode >= 500 then tentativa += 1 if tentativa > #ESPERAS then error("O Google está com o Gemini sobrecarregado agora (o erro é deles, não é a sua chave). Tentei por uns 3 minutos. Espere um pouco e tente de novo.", 0) end if tentativa == 3 or tentativa == 5 then modelo = G.escolherModelo(chave, modelo) or modelo end task.wait(ESPERAS[tentativa]) elseif r.StatusCode == 404 and not trocouPor404 then trocouPor404 = true local novo = G.escolherModelo(chave, modelo) if not novo then error("Não consegui descobrir qual modelo do Gemini a sua chave pode usar.", 0) end modelo = novo else error(erroLegivel(r.StatusCode, r.Body), 0) end end end -- Igual a perguntar, mas devolve a resposta já lida como tabela (JSON). function G.perguntarJson(texto, op) op = table.clone(op) op.json = true local resposta = G.perguntar(texto, op) local t = U.lerJson(resposta) if type(t) ~= "table" then error("A inteligência artificial respondeu num formato que não consegui ler. Tente de novo.", 0) end return t end return G end ]]>Claude= 40 end local function erroLegivel(codigo, corpo) local baixo = string.lower(corpo or "") if string.find(baixo, "credit balance") then return "A sua conta da Anthropic está sem créditos. Coloque créditos em console.anthropic.com (Plans & Billing) ou use o Gemini / sem inteligência artificial." end if codigo == 401 then return "A Anthropic diz que essa chave do Claude não é válida. Crie outra em console.anthropic.com (API Keys) e cole de novo." end if codigo == 403 then return "Essa chave do Claude não tem permissão para esse modelo. Escolha outro modelo nos Ajustes." end if codigo == 404 then return "A Anthropic não achou esse modelo do Claude. Escolha outro modelo nos Ajustes." end if codigo == 429 then return "O limite de uso da sua conta do Claude foi atingido por agora. Espere um pouco e tente de novo." end if codigo == 413 then return "O pedido ficou grande demais para o Claude. Tente descrever com menos coisas de uma vez." end return "O Claude deu erro (" .. tostring(codigo) .. ")." end -- op: { chave, modelo, sistema, imagem (base64 PNG) }. Devolve o texto da resposta ou lança erro em português. function C.perguntar(texto, op) local chave = string.gsub(string.gsub(op.chave or "", "^%s+", ""), "%s+$", "") if chave == "" then error("Falta a chave do Claude. Cole a chave na aba Ajustes.", 0) end if string.find(chave, "[^%w_%-]") then error("A chave do Claude tem espaços ou letras estranhas (talvez veio texto junto). Copie só a chave, que começa com sk-ant-.", 0) end local conteudo = {} if op.imagem then table.insert(conteudo, { type = "image", source = { type = "base64", media_type = "image/png", data = op.imagem } }) end table.insert(conteudo, { type = "text", text = texto }) local pedido = { model = op.modelo or C.MODELO_PADRAO, max_tokens = 16000, messages = { { role = "user", content = conteudo } }, output_config = { effort = "medium" }, -- se o modelo recusar o pedido, a própria Anthropic tenta com outro modelo fallbacks = "default", } if op.sistema then pedido.system = op.sistema end local corpo = U.json(pedido) local tentativa, lentas = 0, 0 while true do local ok, r = pcall(HttpService.RequestAsync, HttpService, { Url = URL, Method = "POST", Headers = { ["Content-Type"] = "application/json", ["x-api-key"] = chave, ["anthropic-version"] = "2026-10-21", ["anthropic-beta"] = "server-side-fallback-2026-07-01", }, Body = corpo, }) if not ok then local msg = string.lower(tostring(r)) local lento = string.find(msg, "timed?out") or string.find(msg, "timeout") if lento and lentas < 2 then lentas += 1 task.wait(ESPERAS[lentas]) elseif lento then error("O Claude demorou demais para responder várias vezes seguidas. Espere um pouco e tente de novo (ou escolha um modelo mais rápido nos Ajustes).", 0) elseif string.find(msg, "permission") or string.find(msg, "denied") or string.find(msg, "not allowed") then error("O Studio bloqueou o plugin de usar a internet. Abra Plugins › Gerenciar plugins e permita o acesso a api.anthropic.com.", 0) else error("Não consegui falar com o Claude. Veja a internet. (detalhe: " .. string.sub(tostring(r), 1, 120) .. ")", 0) end elseif r.Success then local dados = U.lerJson(r.Body) or {} if dados.stop_reason == "refusal" then error("O Claude recusou esse pedido. Tente descrever de outro jeito.", 0) end local partes = {} for _, bloco in ipairs(dados.content or {}) do if bloco.type == "text" and bloco.text then table.insert(partes, bloco.text) end end if #partes == 0 then error("O Claude não devolveu resposta. Tente de novo.", 0) end return table.concat(partes, "\n") elseif r.StatusCode >= 500 or r.StatusCode == 529 then tentativa += 1 if tentativa > #ESPERAS then error("A Anthropic está com o Claude sobrecarregado agora (o erro é deles, não é a sua chave). Tentei por uns 3 minutos. Espere um pouco e tente de novo.", 0) end task.wait(ESPERAS[tentativa]) else error(erroLegivel(r.StatusCode, r.Body), 0) end end end return C end ]]>IACatalogo 1500 then m:Destroy() return nil end m:SetAttribute("Termo", termo) m:SetAttribute("Partes", partes) return m end -- Devolve até `quantos` nomes de modelos guardados para esse termo (busca na loja se faltar). function Catalogo.modelos(termo, avisar, quantos) quantos = quantos or 3 local f = pasta() local nomes = {} for _, m in ipairs(f:GetChildren()) do if m:GetAttribute("Termo") == termo then table.insert(nomes, m.Name) end end if #nomes >= quantos then return { table.unpack(nomes, 1, quantos) } end avisar("Buscando '" .. termo .. "' na loja grátis do Roblox...") local ok, paginas = pcall(InsertService.GetFreeModels, InsertService, termo, 0) if not ok or not paginas or not paginas[1] then return nomes end for _, r in ipairs(paginas[1].Results or {}) do if #nomes >= quantos then break end local nome = "C_" .. tostring(r.AssetId) if not f:FindFirstChild(nome) then local okObj, objetos = pcall(function() return game:GetObjects("rbxassetid://" .. tostring(r.AssetId)) end) if okObj and objetos and #objetos > 0 then local m = limpar(objetos, nome, termo) if m then m.Parent = f table.insert(nomes, nome) end end end end return nomes end return Catalogo end ]]>Adicionar 0.1 then pcall(function() m:ScaleTo(m:GetScale() * altura / sz.Y) end) end m:PivotTo(CFrame.new(x, h, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0)) local cf, s2 = m:GetBoundingBox() m:PivotTo(m:GetPivot() + Vector3.new(x - cf.X, h - (cf.Y - s2.Y / 2) - 0.4, z - cf.Z)) m.Parent = pasta end local B = {} function B.arvore(x, z, h, especie, tpls) local esc = rnd:NextNumber(0.8, 1.35) local alt = 10 * esc if tpls and #tpls > 0 then colocarModelo(tpls, x, h, z, alt * 1.6) elseif especie == "cacto" then local c, ca = cor(70, 110, 60), alt * 0.8 peca(CIL, Vector3.new(ca, 1.6, 1.6), CFrame.new(x, h + ca / 2 - 0.5, z) * CFrame.Angles(0, 0, math.pi / 2), c, Enum.Material.Grass, true) peca(CIL, Vector3.new(ca * 0.4, 1.1, 1.1), CFrame.new(x + 1.3, h + ca * 0.55, z) * CFrame.Angles(0, 0, math.pi / 2), c, Enum.Material.Grass, false) peca(CIL, Vector3.new(ca * 0.35, 1.1, 1.1), CFrame.new(x - 1.3, h + ca * 0.7, z) * CFrame.Angles(0, 0, math.pi / 2), c, Enum.Material.Grass, false) elseif especie == "palmeira" then local a2 = alt * 1.35 tronco(x, h, z, a2, 1.1 * esc, cor(120, 92, 62)) local topo = Vector3.new(x, h + a2 - 0.3, z) for k = 0, 5 do local ang = k * math.pi / 3 + rnd:NextNumber(-0.2, 0.2) peca(BLO, Vector3.new(7 * esc, 0.3, 1.9), CFrame.new(topo) * CFrame.Angles(0, ang, 0) * CFrame.new(3.1 * esc, -0.9, 0) * CFrame.Angles(0, 0, -0.38), cor(56, 118, 52), Enum.Material.Grass, false) end elseif especie == "morta" then local c = cor(70, 60, 52) tronco(x, h, z, alt * 0.9, 1.3 * esc, c) galho(x, h + alt * 0.55, z, rnd:NextNumber(0, 6.28), 5 * esc, 0.7, c) galho(x, h + alt * 0.75, z, rnd:NextNumber(0, 6.28), 4 * esc, 0.6, c) elseif especie == "pinheiro" then tronco(x, h, z, alt, 1.4 * esc, cor(84, 62, 44)) for k = 1, 3 do local r = (7.5 - k * 1.8) * esc peca(BOL, Vector3.new(r, r * 0.8, r), CFrame.new(x, h + alt * (0.45 + k * 0.2), z), cor(38, 82, 56), Enum.Material.Grass, false) end else tronco(x, h, z, alt, 1.4 * esc, cor(84, 62, 44)) local verde = cor(rnd:NextInteger(52, 78), rnd:NextInteger(104, 138), rnd:NextInteger(48, 66)) local r = 9 * esc peca(BOL, Vector3.new(r, r * 0.85, r), CFrame.new(x, h + alt + 1, z), verde, Enum.Material.Grass, false) peca(BOL, Vector3.new(r * 0.7, r * 0.6, r * 0.7), CFrame.new(x + 2, h + alt + 3.2, z - 1), verde, Enum.Material.Grass, false) end end function B.pedra(x, z, h, _, tpls) local t = rnd:NextNumber(2, 7) if tpls and #tpls > 0 then colocarModelo(tpls, x, h, z, t * 0.9) else peca(BOL, Vector3.new(t * rnd:NextNumber(0.9, 1.5), t * 0.7, t * rnd:NextNumber(0.9, 1.5)), CFrame.new(x, h + t * 0.1, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0), cor(112, 112, 108), Enum.Material.Slate, true) end end function B.rocha_grande(x, z, h) local t = rnd:NextNumber(8, 18) peca(BOL, Vector3.new(t, t * 0.7, t * rnd:NextNumber(0.8, 1.2)), CFrame.new(x, h + t * 0.2, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0), cor(104, 104, 100), Enum.Material.Slate, true) end function B.juncos(x, z, h) for _ = 1, rnd:NextInteger(4, 8) do local alt = rnd:NextNumber(4, 8) peca(CIL, Vector3.new(alt, 0.28, 0.28), CFrame.new(x + rnd:NextNumber(-1.8, 1.8), h + alt / 2 - 0.3, z + rnd:NextNumber(-1.8, 1.8)) * CFrame.Angles(0, 0, math.pi / 2), cor(rnd:NextInteger(92, 120), rnd:NextInteger(110, 130), 58), Enum.Material.Grass, false) end end function B.nenufares(x, z, h) local d = rnd:NextNumber(2.5, 4.5) peca(CIL, Vector3.new(0.2, d, d), CFrame.new(x, h + 0.15, z) * CFrame.Angles(0, 0, math.pi / 2), cor(54, 108, 56), Enum.Material.Grass, false) if rnd:NextNumber() < 0.25 then peca(BOL, Vector3.new(0.9, 0.7, 0.9), CFrame.new(x, h + 0.5, z), cor(236, 200, 220), Enum.Material.SmoothPlastic, false) end end function B.cogumelos(x, z, h) local paleta = { cor(150, 60, 50), cor(170, 130, 80), cor(210, 200, 180), cor(110, 70, 120) } for _ = 1, rnd:NextInteger(1, 3) do local dx, dz, t = rnd:NextNumber(-1.2, 1.2), rnd:NextNumber(-1.2, 1.2), rnd:NextNumber(0.8, 1.6) peca(CIL, Vector3.new(1.6 * t, 0.55 * t, 0.55 * t), CFrame.new(x + dx, h + 0.8 * t - 0.2, z + dz) * CFrame.Angles(0, 0, math.pi / 2), cor(222, 212, 190), Enum.Material.SmoothPlastic, false) peca(BOL, Vector3.new(2.3 * t, 1.2 * t, 2.3 * t), CFrame.new(x + dx, h + 1.7 * t - 0.2, z + dz), paleta[rnd:NextInteger(1, #paleta)], Enum.Material.SmoothPlastic, false) end end function B.troncos(x, z, h) local comp, esp = rnd:NextNumber(8, 14), rnd:NextNumber(1.4, 2.6) peca(CIL, Vector3.new(comp, esp, esp), CFrame.new(x, h + esp / 2 - 0.2, z) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0), cor(78, 58, 42), Enum.Material.Wood, true) end function B.arbustos(x, z, h) local verde = cor(rnd:NextInteger(40, 70), rnd:NextInteger(90, 120), rnd:NextInteger(40, 60)) for _ = 1, 3 do local t = rnd:NextNumber(2.4, 4.4) peca(BOL, Vector3.new(t, t * 0.75, t), CFrame.new(x + rnd:NextNumber(-1.5, 1.5), h + t * 0.3, z + rnd:NextNumber(-1.5, 1.5)), verde, Enum.Material.Grass, false) end end function B.flores(x, z, h) local paleta = { cor(200, 70, 90), cor(230, 200, 70), cor(240, 240, 240), cor(150, 100, 200) } local c = paleta[rnd:NextInteger(1, #paleta)] for _ = 1, 4 do local dx, dz = rnd:NextNumber(-1.5, 1.5), rnd:NextNumber(-1.5, 1.5) peca(CIL, Vector3.new(1.4, 0.15, 0.15), CFrame.new(x + dx, h + 0.5, z + dz) * CFrame.Angles(0, 0, math.pi / 2), cor(60, 110, 50), Enum.Material.Grass, false) peca(BOL, Vector3.new(0.8, 0.6, 0.8), CFrame.new(x + dx, h + 1.3, z + dz), c, Enum.Material.SmoothPlastic, false) end end function B.ruinas(x, z, h) for _ = 1, rnd:NextInteger(3, 5) do local alt = rnd:NextNumber(3, 9) peca(BLO, Vector3.new(3, alt, 3), CFrame.new(x + rnd:NextNumber(-6, 6), h + alt / 2 - 0.5, z + rnd:NextNumber(-6, 6)) * CFrame.Angles(rnd:NextNumber(-0.12, 0.12), rnd:NextNumber(0, 6.28), rnd:NextNumber(-0.12, 0.12)), cor(130, 126, 118), Enum.Material.Cobblestone, true) end peca(BLO, Vector3.new(7, 1.5, 3), CFrame.new(x, h + 0.5, z + 5) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), 0.1), cor(120, 116, 108), Enum.Material.Cobblestone, true) end function B.tochas(x, z, h) peca(CIL, Vector3.new(6, 0.5, 0.5), CFrame.new(x, h + 2.5, z) * CFrame.Angles(0, 0, math.pi / 2), cor(70, 50, 36), Enum.Material.Wood, true) local chama = peca(BOL, Vector3.new(1.1, 1.5, 1.1), CFrame.new(x, h + 6.2, z), cor(255, 160, 60), Enum.Material.Neon, false) local luz = Instance.new("PointLight") luz.Brightness, luz.Range, luz.Color, luz.Shadows = 1.4, 22, cor(255, 170, 90), false luz.Parent = chama end function B.vagalumes(x, z, h) local p = invisivel(Vector3.new(x, h + 4, z), Vector3.new(16, 5, 16)) local pe = Instance.new("ParticleEmitter") pe.Rate = 2 pe.Lifetime = NumberRange.new(5, 9) pe.Speed = NumberRange.new(0.4, 1.2) pe.SpreadAngle = Vector2.new(180, 180) pe.Size = NumberSequence.new(0.35) pe.LightEmission = 1 pe.Color = ColorSequence.new(cor(190, 230, 110)) pe.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.2, 0.2), NumberSequenceKeypoint.new(0.8, 0.2), NumberSequenceKeypoint.new(1, 1) }) pe.Parent = p end function B.neblina(x, z, h) local p = invisivel(Vector3.new(x, h + 2, z), Vector3.new(24, 3, 24)) local pe = Instance.new("ParticleEmitter") pe.Texture = "rbxasset://textures/particles/smoke_main.dds" pe.Rate = 3 pe.Lifetime = NumberRange.new(10, 14) pe.Speed = NumberRange.new(0.4, 1.2) pe.SpreadAngle = Vector2.new(180, 20) pe.Size = NumberSequence.new({ NumberSequenceKeypoint.new(0, 14), NumberSequenceKeypoint.new(1, 24) }) pe.Color = ColorSequence.new(cor(120, 130, 125)) pe.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.3, 0.86), NumberSequenceKeypoint.new(1, 1) }) pe.Parent = p end function B.cristais(x, z, h) local c = rnd:NextInteger(1, 3) == 1 and cor(150, 90, 220) or cor(70, 200, 210) for _ = 1, 3 do local alt = rnd:NextNumber(3, 7) local p = peca(BLO, Vector3.new(1.2, alt, 1.2), CFrame.new(x + rnd:NextNumber(-2, 2), h + alt / 2 - 0.4, z + rnd:NextNumber(-2, 2)) * CFrame.Angles(rnd:NextNumber(-0.35, 0.35), rnd:NextNumber(0, 6.28), rnd:NextNumber(-0.35, 0.35)), c, Enum.Material.Glass, false) p.Transparency = 0.3 end end function B.capim(x, z, h) for _ = 1, 4 do local a = rnd:NextNumber(1.8, 3.2) peca(BLO, Vector3.new(0.25, a, 0.9), CFrame.new(x + rnd:NextNumber(-0.8, 0.8), h + a / 2 - 0.2, z + rnd:NextNumber(-0.8, 0.8)) * CFrame.Angles(0, rnd:NextNumber(0, 6.28), rnd:NextNumber(-0.25, 0.25)), cor(rnd:NextInteger(70, 100), rnd:NextInteger(110, 140), 56), Enum.Material.Grass, false) end end return B end -- Distância mínima entre duas coisas iguais (para não nascerem uma dentro da outra). local AFASTAR = { arvore = 9, pedra = 4, rocha_grande = 14, ruinas = 16, tochas = 8, troncos = 8, vagalumes = 10, neblina = 18 } -- Há mapa no jogo aberto? (terreno ou um chão grande) function Adicionar.temMapa() return workspace.Terrain:CountCells() > 0 end -- pedido = resultado de Adicionar.entender. Devolve o resultado (apagar, vista) para a aba Feitos. function Adicionar.executar(pedido, cfg, avisar) if #pedido.itens == 0 then error("Não entendi o que adicionar. Sem IA eu sei colocar: " .. Adicionar.SABE .. ". Para outras coisas use 🚪 Objeto pronto, 📚 Biblioteca ou o 🤖 Pedido livre.", 0) end local rnd = Random.new() local cam = workspace.CurrentCamera -- não deixa as coisas caírem em cima das árvores, pedras, figurantes e objetos que já estão lá local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude local ignorar = {} for _, nome in ipairs({ "Mapa_Arvores", "Mapa_Pedras", "Mapa_Decoracao", "Mapa_NPCs", "Mapa_Adicionado", "Objetos_Prontos" }) do local f = workspace:FindFirstChild(nome) if f then table.insert(ignorar, f) end end for _, d in ipairs(workspace:GetDescendants()) do if d:IsA("Humanoid") and d.Parent then table.insert(ignorar, d.Parent) end end params.FilterDescendantsInstances = ignorar params.IgnoreWater = false -- centro e tamanho da área local centro, raio if pedido.espalhar then -- o gerador de mapas guarda o tamanho no terreno; mapa feito de outro jeito: 300 studs em volta do centro local tam = workspace.Terrain:GetAttribute("GeradorTamanho") centro = Vector3.zero raio = typeof(tam) == "Vector3" and math.min(tam.X, tam.Z) / 2 * 0.92 or 150 -- "flores pelo mapa todo" sem número: quantidade de acordo com o tamanho do mapa for _, it in ipairs(pedido.itens) do if it.semNumero then it.qtd = math.clamp(math.floor(raio * raio * 4 / 1600), 8, 200) end end else local r = workspace:Raycast(cam.CFrame.Position, cam.CFrame.LookVector * 2000, params) local alvo = r and r.Position or (cam.CFrame.Position + cam.CFrame.LookVector * 60) centro = Vector3.new(alvo.X, 0, alvo.Z) local total = 0 for _, it in ipairs(pedido.itens) do total += it.qtd end raio = total <= 1 and 0 or math.clamp(math.sqrt(total) * 9, 12, 150) end local mapaPasta = workspace:FindFirstChild("Mapa_Adicionado") if not mapaPasta then mapaPasta = Instance.new("Folder") mapaPasta.Name = "Mapa_Adicionado" mapaPasta.Parent = workspace end local pasta = Instance.new("Folder") pasta.Name = "Adicionado_" .. os.date("%H%M%S") .. "_" .. math.random(100, 999) pasta.Parent = mapaPasta local B = criador(pasta, rnd) local especiePadrao = workspace.Terrain:GetAttribute("GeradorArvore") local resumo, faltou = {}, 0 local postos = {} local function chao(x, z, querAgua) local r = workspace:Raycast(Vector3.new(x, 2000, z), Vector3.new(0, -4000, 0), params) if not r then return nil end local agua = r.Material == Enum.Material.Water if querAgua then return agua and r.Position.Y or nil end if agua then return nil end return r.Position.Y end for _, it in ipairs(pedido.itens) do local especie = it.especie or ((it.tipo == "arvore") and especiePadrao or nil) if it.tipo == "arvore" and especie == "nenhuma" then especie = nil end local tpls if cfg.catalogo ~= false then local termo = it.tipo == "arvore" and Catalogo.TERMOS_ARVORE[especie or "folhosa"] or (it.tipo == "pedra" and Catalogo.TERMO_PEDRA or nil) if termo then local nomes = Catalogo.modelos(termo, avisar) local cat = game:GetService("ServerStorage"):FindFirstChild("Catalogo_Gerador") tpls = {} for _, n in ipairs(nomes) do local m = cat and cat:FindFirstChild(n) if m then table.insert(tpls, m) end end end end local feitos = 0 local afastar = AFASTAR[it.tipo] or 3 for _ = 1, it.qtd * 12 do if feitos >= it.qtd then break end local ang, dist = rnd:NextNumber(0, math.pi * 2), raio * math.sqrt(rnd:NextNumber()) if it.qtd == 1 and feitos == 0 and not pedido.espalhar then dist = 0 end local x, z = centro.X + math.cos(ang) * dist, centro.Z + math.sin(ang) * dist local h = chao(x, z, it.tipo == "nenufares") local perto = false for _, p in ipairs(postos) do if p.tipo == it.tipo and (Vector2.new(p.x, p.z) - Vector2.new(x, z)).Magnitude < afastar then perto = true break end end if h and not perto then B[it.tipo](x, z, h, especie, tpls) table.insert(postos, { tipo = it.tipo, x = x, z = z }) feitos += 1 if feitos % 40 == 0 then task.wait() end end end faltou += it.qtd - feitos local nome = it.tipo == "arvore" and ((especie and especie ~= "folhosa") and (especie == "morta" and "árvore(s) seca(s)" or especie .. "(s)") or "árvore(s)") or it.tipo table.insert(resumo, feitos .. " " .. string.gsub(nome, "_", " ")) end if #pasta:GetChildren() == 0 then pasta:Destroy() error("Não achei chão para colocar (só água ou nada embaixo). Mire a câmera do Studio em terra firme e tente de novo.", 0) end avisar("Adicionei ao mapa: " .. table.concat(resumo, ", ") .. (pedido.espalhar and " (espalhado pelo mapa)." or " (onde a câmera está olhando).")) if faltou > 0 then avisar("Alguns não couberam (pouco chão seco ou espaço apertado). Mire numa área maior ou peça pelo mapa todo.") end local d = math.max(raio, 10) local chaoCentro = chao(centro.X, centro.Z, false) or 0 return { tipo = "adicionar", apagar = { "Mapa_Adicionado." .. pasta.Name }, vista = { Vector3.new(centro.X + d * 1.1, chaoCentro + d * 0.8 + 12, centro.Z + d * 1.1), Vector3.new(centro.X, chaoCentro + 3, centro.Z) }, } end return Adicionar end ]]>Mapa material do Studio. %f[%w] / %f[%W] = começo / fim de palavra. local DICIONARIO = { { { "%f[%w]lama%f[%W]", "%f[%w]barro%f[%W]", "lamac" }, "Mud" }, { { "%f[%w]terra%f[%W]", "%f[%w]solo%f[%W]" }, "Ground" }, { { "%f[%w]areia%f[%W]", "%f[%w]praia%f[%W]", "%f[%w]dunas?%f[%W]" }, "Sand" }, { { "arenito" }, "Sandstone" }, { { "folhagem", "%f[%w]mato%f[%W]", "grama com folhas", "capim alto" }, "LeafyGrass" }, { { "%f[%w]grama%f[%W]", "gramado", "%f[%w]capim%f[%W]" }, "Grass" }, { { "%f[%w]pedra%f[%W]", "%f[%w]rocha%f[%W]", "rochos", "pedreira" }, "Rock" }, { { "basalto", "vulcanic" }, "Basalt" }, { { "ardosia" }, "Slate" }, { { "calcario" }, "Limestone" }, { { "%f[%w]lava%f[%W]", "magma" }, "CrackedLava" }, { { "%f[%w]neve%f[%W]", "nevad" }, "Snow" }, { { "%f[%w]gelo%f[%W]", "congelad", "gelad" }, "Ice" }, { { "geleira", "glaciar" }, "Glacier" }, { { "%f[%w]sal%f[%W]", "salina", "salar" }, "Salt" }, { { "asfalto" }, "Asphalt" }, { { "pavimento", "calcada" }, "Pavement" }, { { "concreto", "cimento" }, "Concrete" }, { { "paralelepiped", "calcamento", "pedras de cal" }, "Cobblestone" }, { { "tijolo" }, "Brick" }, { { "tabuas?%f[%W]", "assoalho", "piso de madeira" }, "WoodPlanks" }, } -- altura típica: 0 praia/baixo, 1 chão, 2 rocha, 3 topo local NIVEL = { Sand = 0, Salt = 0, Mud = 1, Ground = 1, Grass = 1, LeafyGrass = 1, Asphalt = 1, Pavement = 1, Concrete = 1, Cobblestone = 1, Brick = 1, WoodPlanks = 1, Sandstone = 2, Rock = 2, Basalt = 2, Slate = 2, Limestone = 2, CrackedLava = 2, Snow = 3, Ice = 3, Glacier = 3 } local TIPOS_ARVORE = { folhosa = true, pinheiro = true, palmeira = true, morta = true, cacto = true, nenhuma = true } local HUMORES = { dia = true, sombrio = true, noite = true, entardecer = true, neblina = true, nublado = true, magico = true } local PALAVRAS_HUMOR = { { "sombrio", { "sombri", "escur[oa]", "assombrad", "sinistr", "tenebros", "misterios", "medonh", "macabr", "gotic", "lugubre", "soturn" } }, { "noite", { "%f[%w]noite%f[%W]", "noturn", "%f[%w]lua%f[%W]", "luar" } }, { "entardecer", { "entardecer", "por do sol", "crepusculo", "%f[%w]poente%f[%W]", "alaranjad" } }, { "neblina", { "neblina", "nevoeiro", "nevoa", "bruma", "enevoad" } }, { "nublado", { "nublad", "chuvos", "cinzent", "tempestade" } }, { "magico", { "magic", "encantad", "fada", "mistic" } }, { "dia", { "ensolarad", "dia claro", "%f[%w]sol%f[%W]", "claro e" } }, } local HUMOR_PADRAO = { grama = "dia", deserto = "dia", neve = "nublado", rochoso = "dia", pantano = "neblina", vulcao = "sombrio" } local DECORACOES = { juncos = true, nenufares = true, cogumelos = true, troncos = true, arbustos = true, flores = true, ruinas = true, tochas = true, vagalumes = true, neblina = true, cristais = true, rocha_grande = true, capim = true } local PALAVRAS_DECO = { { "juncos", { "junco", "canico", "taboa", "bambu" } }, { "nenufares", { "nenufar", "vitoria.regia" } }, { "cogumelos", { "cogumelo" } }, { "troncos", { "tronco", "%f[%w]toras?%f[%W]" } }, { "arbustos", { "arbusto", "moita" } }, { "flores", { "%f[%w]flor", "flores", "jardim" } }, { "ruinas", { "ruinas?", "%f[%w]colunas?%f[%W]", "templo antigo" } }, { "tochas", { "tocha", "lanterna", "ilumina" } }, { "vagalumes", { "vaga.?lume", "vagalume" } }, { "neblina", { "neblina", "nevoa", "nevoeiro", "bruma", "fumaca" } }, { "cristais", { "cristal", "cristais", "%f[%w]gemas?%f[%W]" } }, { "rocha_grande", { "rochedo", "pedras? grandes?", "rochas? grandes?" } }, { "capim", { "capim", "mato alto", "tufo" } }, } local DECO_PRESET = { grama = { { "arbustos", 0.3 }, { "flores", 0.25 }, { "capim", 0.3 } }, deserto = { { "rocha_grande", 0.3 } }, neve = { { "rocha_grande", 0.2 } }, rochoso = { { "rocha_grande", 0.5 } }, pantano = { { "juncos", 0.8 }, { "nenufares", 0.6 }, { "cogumelos", 0.5 }, { "troncos", 0.5 }, { "capim", 0.4 } }, vulcao = { { "rocha_grande", 0.5 } }, } local DECO_HUMOR = { sombrio = { { "vagalumes", 0.5 }, { "neblina", 0.6 } }, noite = { { "vagalumes", 0.4 }, { "tochas", 0.3 } }, neblina = { { "neblina", 0.6 } }, magico = { { "vagalumes", 0.8 }, { "cristais", 0.4 } }, } local PRESETS = { grama = { camadas = { { 0.8, { "Grass" } }, { 0.94, { "Rock" } }, { 1.01, { "Snow" } } }, praia = "Sand", interior = "Ground", arvore = "folhosa" }, deserto = { camadas = { { 0.8, { "Sand" } }, { 1.01, { "Sandstone" } } }, praia = nil, interior = "Sandstone", arvore = "cacto" }, neve = { camadas = { { 0.85, { "Snow" } }, { 1.01, { "Glacier" } } }, praia = "Snow", interior = "Rock", arvore = "pinheiro" }, rochoso = { camadas = { { 0.35, { "Ground" } }, { 0.88, { "Rock" } }, { 1.01, { "Snow" } } }, praia = "Ground", interior = "Rock", arvore = "pinheiro" }, pantano = { camadas = { { 0.55, { "Mud", "Grass" } }, { 0.85, { "LeafyGrass", "Ground" } }, { 1.01, { "Rock" } } }, praia = "Mud", interior = "Mud", arvore = "morta" }, vulcao = { camadas = { { 0.4, { "Basalt", "CrackedLava" } }, { 0.85, { "Basalt", "Rock" } }, { 1.01, { "Rock" } } }, praia = nil, interior = "Basalt", arvore = "nenhuma" }, } local cacheMateriais -- Quais materiais o terreno deste Studio aceita (testado uma vez). function Mapa.materiais() if cacheMateriais then return cacheMateriais end local ok, r = U.rodar(Modelos.MAPA_MATERIAIS) local lista = {} if ok and type(r) == "string" then for m in string.gmatch(r, "[^,]+") do table.insert(lista, m) end end cacheMateriais = #lista > 0 and lista or table.clone(MATERIAIS_PADRAO) return cacheMateriais end local function contem(lista, v) return table.find(lista, v) ~= nil end -- Lê a descrição em português e devolve a receita do mapa. function Mapa.receitaPorPalavras(texto, validos) local t = " " .. U.simples(texto) .. " " local tObj = string.gsub(t, "sem pedras?", " ") tObj = string.gsub(tObj, "sem arvores?", " ") tObj = string.gsub(tObj, "sem agua", " ") tObj = string.gsub(tObj, "sem lago", " ") tObj = string.gsub(tObj, "sem rio", " ") local r = { relevo = 0.5, agua = 0, arvores = 0.4, pedras = 0.3, ilha = false, preset = "grama" } if U.tem(t, { "deserto", "dunas?" }) then r.preset, r.arvores = "deserto", 0.3 elseif U.tem(t, { "pantano", "brejo", "mangue" }) then r.preset, r.agua, r.relevo = "pantano", 0.5, 0.2 elseif U.tem(t, { "vulcao", "vulcanic", "%f[%w]lava%f[%W]" }) then r.preset, r.relevo = "vulcao", 0.85 elseif U.tem(t, { "neve", "nevad", "%f[%w]gelo%f[%W]", "inverno", "artic" }) then r.preset = "neve" elseif U.tem(t, { "rochos", "canyon", "canion", "pedreira" }) then r.preset, r.pedras = "rochoso", 0.7 end if U.tem(t, { "plan[oa]%f[%W]", "planicie", "campo aberto" }) then r.relevo = 0.15 end if U.tem(t, { "montanh", "colin", "morro", "serra", "vulcao", "canyon", "canion" }) then r.relevo = 0.85 end if U.tem(t, { "%f[%w]ilha", "arquipelago" }) then r.ilha, r.agua = true, 0.6 end if U.tem(t, { "lago", "%f[%w]rio%f[%W]", "%f[%w]mar%f[%W]", "oceano", "agua", "praia", "lagoa" }) then r.agua = math.max(r.agua, 0.45) end if U.tem(t, { "oasis" }) then r.agua = math.max(r.agua, 0.3) end if U.tem(t, { "sem agua", "sem lago", "sem rio" }) then r.agua, r.ilha = 0, false end if U.tem(t, { "floresta", "bosque", "selva", "%f[%w]mata%f[%W]", "muitas arvores" }) then r.arvores = 0.95 end if U.tem(t, { "sem arvores?" }) then r.arvores = 0 end if U.tem(t, { "pedra", "rocha" }) then r.pedras = math.max(r.pedras, 0.7) end if U.tem(t, { "sem pedras?" }) then r.pedras = 0 end r.arvore = PRESETS[r.preset].arvore if U.tem(t, { "palmeir", "coqueir", "tropical" }) then r.arvore = "palmeira" elseif U.tem(t, { "pinheir", "conifer" }) then r.arvore = "pinheiro" elseif U.tem(t, { "arvores? mortas?", "sem folhas", "secas?%f[%W]" }) then r.arvore = "morta" elseif U.tem(t, { "cact" }) then r.arvore = "cacto" end local citados = {} for _, d in ipairs(DICIONARIO) do local mat = d[2] if contem(validos, mat) and U.tem(tObj, d[1]) and not contem(citados, mat) then table.insert(citados, mat) end end r.materiais = citados r.humor = HUMOR_PADRAO[r.preset] for _, h in ipairs(PALAVRAS_HUMOR) do if U.tem(t, h[2]) then r.humor = h[1] break end end local tDeco = string.gsub(t, "sem %w+ ?%w*", " ") local decos, ordem = {}, {} local function por(nome, dens) if decos[nome] == nil then table.insert(ordem, nome) end decos[nome] = math.max(decos[nome] or 0, dens) end for _, d in ipairs(DECO_PRESET[r.preset] or {}) do por(d[1], d[2]) end for _, d in ipairs(DECO_HUMOR[r.humor] or {}) do por(d[1], d[2]) end for _, d in ipairs(PALAVRAS_DECO) do if U.tem(tDeco, d[2]) then por(d[1], 0.7) end end for _, d in ipairs(PALAVRAS_DECO) do for _, p in ipairs(d[2]) do if string.find(t, "sem " .. p) or string.find(t, "sem muit[oa]s? " .. p) then decos[d[1]] = nil end end end r.decos = {} for _, nome in ipairs(ordem) do if decos[nome] then table.insert(r.decos, { nome, decos[nome] }) end end local explicita = U.tem(t, { "palmeir", "coqueir", "tropical", "pinheir", "conifer", "cact", "arvores? mortas?", "sem folhas", "secas?" }) if not explicita and (contem(citados, "Grass") or contem(citados, "LeafyGrass")) and (r.preset == "neve" or r.preset == "rochoso") then r.arvore = "folhosa" end return r end -- Palavras de paisagem que o modo Mapa entende sem inteligência artificial (além do dicionário de materiais, -- dos climas e do cenário). Se o pedido não tem nenhuma, o plugin avisa em vez de fazer um mapa qualquer. local PALAVRAS_PAISAGEM = { "deserto", "duna", "pantano", "brejo", "mangue", "vulcao", "vulcanic", "neve", "nevad", "inverno", "artic", "rochos", "canyon", "canion", "pedreira", "plan[oa]%f[%W]", "planicie", "campo", "montanh", "colin", "morro", "serra", "vale", "ilha", "arquipelago", "lago", "%f[%w]rio%f[%W]", "%f[%w]mar%f[%W]", "oceano", "agua", "praia", "lagoa", "oasis", "floresta", "bosque", "selva", "%f[%w]mata%f[%W]", "arvore", "palmeir", "coqueir", "tropical", "pinheir", "conifer", "cact", "paisagem", "natureza", "terreno", "prado", "savana", "tundra", "caverna" } function Mapa.entendeu(texto) local t = " " .. U.simples(texto) .. " " if U.tem(t, PALAVRAS_PAISAGEM) then return true end for _, d in ipairs(DICIONARIO) do if U.tem(t, d[1]) then return true end end for _, lista in ipairs({ PALAVRAS_HUMOR, PALAVRAS_DECO }) do for _, h in ipairs(lista) do if U.tem(t, h[2]) then return true end end end return false end -- Com os materiais citados, distribui do mais baixo (areia) ao mais alto (neve). function Mapa.montarCamadas(materiais, preset) local base = PRESETS[preset] if #materiais == 0 then return base.camadas, base.praia, base.interior end if #materiais == 1 and preset ~= "grama" then local camadas = {} for _, c in ipairs(base.camadas) do table.insert(camadas, { c[1], table.clone(c[2]) }) end if not contem(camadas[1][2], materiais[1]) then table.insert(camadas[1][2], 1, materiais[1]) end return camadas, base.praia, base.interior end local ordem = table.clone(materiais) table.sort(ordem, function(a, b) local na, nb = NIVEL[a] or 1, NIVEL[b] or 1 if na ~= nb then return na < nb end return table.find(materiais, a) < table.find(materiais, b) end) local praia for _, m in ipairs(ordem) do if NIVEL[m] == 0 then praia = m break end end local topo, meio = {}, {} for _, m in ipairs(ordem) do local n = NIVEL[m] or 1 if n == 3 then table.insert(topo, m) elseif n == 1 or n == 2 or (n == 0 and m ~= praia) then table.insert(meio, m) end end if #meio == 0 then meio = praia and { praia } or (#topo > 0 and table.clone(topo) or { "Ground" }) end local grupos, niveis = {}, {} for _, m in ipairs(meio) do local n = NIVEL[m] or 1 if not grupos[n] then grupos[n] = {} table.insert(niveis, n) end table.insert(grupos[n], m) end table.sort(niveis) local fimMeio = #topo > 0 and 0.86 or 1.01 local camadas = {} for i, n in ipairs(niveis) do local ate = i < #niveis and math.floor(fimMeio * (i / #niveis) ^ 0.7 * 100 + 0.5) / 100 or fimMeio table.insert(camadas, { ate, grupos[n] }) end if #topo > 0 then table.insert(camadas, { 1.01, topo }) end return camadas, praia, grupos[niveis[1]][1] end -- Receita final: palavras da descrição e, se a inteligência artificial estiver ligada, a receita dela por cima. function Mapa.parametros(texto, cfg, validos, avisar) local r = Mapa.receitaPorPalavras(texto, validos) local camadas, praia, interior = Mapa.montarCamadas(r.materiais, r.preset) if IA.ligada(cfg) then local ok, ia = pcall(function() local pedido = "Você monta mapas de jogo Roblox. Leia a descrição e devolva SÓ um JSON, sem explicação, com: " .. '"relevo" (0 a 1; 0 plano, 1 montanhoso), "agua" (0 a 1), "arvores" (0 a 1), "pedras" (0 a 1), ' .. '"ilha" (true ou false), "arvore_tipo" (um de: folhosa, pinheiro, palmeira, morta, cacto, nenhuma), ' .. '"praia" (material da beira da água, ou null), "interior" (material por baixo da superfície), ' .. '"humor" (clima, um de: dia, sombrio, noite, entardecer, neblina, nublado, magico), ' .. '"decoracoes" (lista de {"tipo", "densidade" 0 a 1}; tipo entre: juncos, nenufares, cogumelos, troncos, ' .. "arbustos, flores, ruinas, tochas, vagalumes, neblina, cristais, rocha_grande, capim) e " .. '"camadas": lista do chão de baixo para cima, cada item com "ate" (0 a 1, altura relativa onde a camada ' .. 'termina; o último é 1) e "materiais" (1 a 3 nomes). Use SOMENTE estes materiais: ' .. table.concat(validos, ", ") .. ". Neve, gelo e geleira só no topo. Areia só perto da água. Descrição: " .. texto return IA.perguntarJson(cfg, pedido) end) if ok then for _, k in ipairs({ "relevo", "agua", "arvores", "pedras" }) do if tonumber(ia[k]) then r[k] = tonumber(ia[k]) end end if type(ia.ilha) == "boolean" then r.ilha = ia.ilha end if TIPOS_ARVORE[ia.arvore_tipo] then r.arvore = ia.arvore_tipo end if HUMORES[ia.humor] then r.humor = ia.humor end if type(ia.decoracoes) == "table" then local novos = {} for _, d in ipairs(ia.decoracoes) do if type(d) == "table" and DECORACOES[d.tipo] then table.insert(novos, { d.tipo, U.limitar(d.densidade or 0.5, 0, 1) }) end end if #novos > 0 then r.decos = novos end end local novas = {} for _, c in ipairs(type(ia.camadas) == "table" and ia.camadas or {}) do local mats = {} for _, m in ipairs(type(c) == "table" and type(c.materiais) == "table" and c.materiais or {}) do if contem(validos, m) then table.insert(mats, m) end end if #mats > 0 then table.insert(novas, { U.limitar(c.ate or 1, 0.05, 1.01), mats }) end end if #novas > 0 then table.sort(novas, function(a, b) return a[1] < b[1] end) novas[#novas][1] = 1.01 camadas = novas praia = contem(validos, ia.praia) and ia.praia or nil interior = contem(validos, ia.interior) and ia.interior or camadas[1][2][1] avisar("O " .. IA.nome(cfg) .. " montou a receita do mapa.") end else avisar("O " .. IA.nome(cfg) .. " não ajudou com o mapa (" .. tostring(ia) .. "). Usando as palavras da descrição.") end end for _, k in ipairs({ "relevo", "agua", "arvores", "pedras" }) do r[k] = U.limitar(r[k], 0, 1) end if r.arvore == "cacto" then r.arvores = math.min(r.arvores, 0.3) elseif r.arvore == "morta" then r.arvores = math.min(r.arvores, 0.5) end r.camadas, r.praia, r.interior = camadas, praia, interior return r end local function luaLista(nomes) local t = {} for _, n in ipairs(nomes) do table.insert(t, '"' .. n .. '"') end return "{" .. table.concat(t, ",") .. "}" end -- dims: {comprimento, largura, altura}; op: {agua, arvores, pedras} (false = sem). Devolve o resultado do pedido. function Mapa.gerar(texto, cfg, dims, avisar, op) op = op or {} local comp = math.max(100, math.floor(tonumber(dims.comprimento) or 0) > 0 and math.floor(dims.comprimento) or 500) local larg = math.max(100, math.floor(tonumber(dims.largura) or 0) > 0 and math.floor(dims.largura) or 500) local alt = math.max(20, math.floor(tonumber(dims.altura) or 0) > 0 and math.floor(dims.altura) or 60) -- "adicione 5 palmeiras", "coloque cogumelos aqui": coloca no mapa que já existe, sem refazer o terreno local add = Adicionar.entender(texto) if add and (Adicionar.temMapa() or #add.itens == 0) then return Adicionar.executar(add, cfg, avisar) end if not Mapa.entendeu(texto) and not IA.ligada(cfg) then error("Não entendi esse pedido como paisagem. O modo Mapa (grátis) faz paisagens naturais: escreva com palavras como " .. "floresta, ilha, praia, lago, deserto, oásis, pântano, neve, vulcão, montanhas, cogumelos, ruínas, noite, neblina. " .. "Para mapas de jogo (pista de corrida, crowd runner, obby, cidade) use o Pedido livre com Gemini ou Claude.", 0) end avisar("Vendo quais materiais de terreno o Studio tem...") local validos = Mapa.materiais() local p = Mapa.parametros(texto, cfg, validos, avisar) if op.agua == false then p.agua, p.ilha = 0, false end if op.arvores == false then p.arvores = 0 end if op.pedras == false then p.pedras = 0 end -- mapa baixinho: neve, gelo e pedra de topo só se o usuário pediu (senão aparece neve num campo plano) if alt < 40 then local pediu = {} for _, m in ipairs(p.materiais) do pediu[m] = true end local topo = { Snow = true, Glacier = true, Ice = true, Rock = true } local novas = {} for _, c in ipairs(p.camadas) do local mats = {} for _, m in ipairs(c[2]) do if not topo[m] or pediu[m] then table.insert(mats, m) end end if #mats > 0 then table.insert(novas, { c[1], mats }) end end if #novas > 0 then novas[#novas][1] = 1.01 p.camadas = novas end end if p.preset == "deserto" and #p.materiais == 0 then p.agua = math.min(p.agua, string.find(U.simples(texto), "oasis") and 0.3 or 0.12) end local tplArv, tplPed = {}, {} if cfg.catalogo ~= false then if p.arvores > 0 and Catalogo.TERMOS_ARVORE[p.arvore] then tplArv = Catalogo.modelos(Catalogo.TERMOS_ARVORE[p.arvore], avisar) end if p.pedras > 0 then tplPed = Catalogo.modelos(Catalogo.TERMO_PEDRA, avisar) end if #tplArv + #tplPed > 0 then avisar(string.format("Usando modelos grátis da loja: %d de árvore e %d de pedra (sem scripts).", #tplArv, #tplPed)) end end local usados = {} for _, c in ipairs(p.camadas) do table.insert(usados, table.concat(c[2], "+")) end local nomesDeco = {} for _, d in ipairs(p.decos) do table.insert(nomesDeco, d[1]) end avisar(string.format("Mapa %d x %d x %d. Chão (de baixo para cima): %s%s. Relevo %d%%, água %d%%, árvores %d%% (%s), pedras %d%%%s. Clima: %s. Cenário: %s.", comp, larg, alt, table.concat(usados, " > "), p.praia and ("; praia de " .. p.praia) or "", p.relevo * 100, p.agua * 100, p.arvores * 100, p.arvore, p.pedras * 100, p.ilha and ", ilha" or "", p.humor, #nomesDeco > 0 and table.concat(nomesDeco, ", ") or "nenhum")) local decos = {} for _, d in ipairs(p.decos) do table.insert(decos, string.format('{"%s",%s}', d[1], U.num(d[2]))) end local camadas = {} for _, c in ipairs(p.camadas) do table.insert(camadas, "{" .. U.num(c[1]) .. "," .. luaLista(c[2]) .. "}") end local codigo = U.trocar(Modelos.MAPA, { ["@L@"] = comp, ["@W@"] = larg, ["@H@"] = alt, ["@SEED@"] = math.random(1, 99999), ["@RELEVO@"] = U.num(p.relevo), ["@AGUA@"] = U.num(p.agua), ["@ARV@"] = U.num(p.arvores), ["@PED@"] = U.num(p.pedras), ["@ILHA@"] = tostring(p.ilha), ["@HUMOR@"] = p.humor, ["@DECOS@"] = "{" .. table.concat(decos, ",") .. "}", ["@ARVTIPO@"] = p.arvore, ["@CAMADAS@"] = "{" .. table.concat(camadas, ",") .. "}", ["@PRAIA@"] = p.praia and ('"' .. p.praia .. '"') or "nil", ["@INTERIOR@"] = p.interior, ["@FUNDO@"] = p.interior ~= "Sandstone" and "Rock" or "Sandstone", ["@TPLARV@"] = luaLista(tplArv), ["@TPLPED@"] = luaLista(tplPed), }) avisar("Montando o terreno. Mapas grandes podem levar alguns minutos: não mexa no Studio...") local ok, r = U.rodar(codigo) if not ok then error("O mapa deu erro ao montar: " .. string.sub(tostring(r), 1, 300), 0) end avisar("Terreno pronto! Para colocar mais coisas depois, escreva por exemplo \"adicione 5 palmeiras\" (não refaz o mapa).") -- o "adicionar" usa a mesma espécie de árvore quando a pessoa pede só "árvores" workspace.Terrain:SetAttribute("GeradorArvore", p.arvore) workspace.Terrain:SetAttribute("GeradorTamanho", Vector3.new(comp, alt, larg)) local m = math.max(comp, larg) return { tipo = "mapa", terreno = true, apagar = { "Mapa_Arvores", "Mapa_Pedras", "Mapa_Decoracao" }, vista = { Vector3.new(0, m * 0.55 + alt, m * 0.55), Vector3.new(0, alt * 0.2, 0) }, } end return Mapa end ]]>ObjetosAgente 0 then table.insert(linhas, c .. " properties and events: " .. table.concat(lista, ", ")) end end sistemaPronto = Modelos.SISTEMA_AGENTE .. "\nCLASSES THAT EXIST IN THIS STUDIO for Instance.new (use ONLY these; any other name does not exist and will fail): " .. table.concat(existem, ", ") .. "." .. "\nREAL MEMBERS IN THIS STUDIO (anything not listed here does NOT exist, do not invent names):\n" .. table.concat(linhas, "\n") return sistemaPronto end -- Confere o código com o que o Studio realmente tem. Devolve a lista de problemas (em inglês, para o Gemini). function Agente.validar(codigo) local problemas, vistos = {}, {} for nome, item in string.gmatch(codigo, "Enum%.([%w_]+)%.([%w_]+)") do local chave = nome .. "." .. item if not vistos[chave] then vistos[chave] = true local okE, enum = pcall(function() return Enum[nome] end) if not okE then table.insert(problemas, "Enum." .. nome .. " does not exist.") elseif not pcall(function() return enum[item] end) then local validos = {} for _, i in ipairs(enum:GetEnumItems()) do table.insert(validos, i.Name) end table.insert(problemas, "Enum." .. chave .. " does not exist. Valid values of Enum." .. nome .. ": " .. table.concat(validos, ", ", 1, math.min(#validos, 60))) end end end local donos = {} for var, classe in string.gmatch(codigo, "([%w_]+)%s*=%s*Instance%.new%(%s*[\"']([%w_]+)[\"']") do if not vistos["new:" .. classe] then vistos["new:" .. classe] = true if not criavel(classe) then local certo = CORRECOES[string.lower(classe)] table.insert(problemas, "Instance.new('" .. classe .. "') is not a creatable class. " .. (certo and ("Use instead: " .. certo .. ". ") or "") .. "Use only the classes listed in the instructions.") end end donos[var] = donos[var] or {} donos[var][classe] = true end for var, classes in pairs(donos) do local usados = {} for membro in string.gmatch(codigo, "%f[%w_]" .. var .. "%.([%w_]+)%s*=[^=]") do usados[membro] = true end for membro in string.gmatch(codigo, "%f[%w_]" .. var .. "%.([%w_]+)%s*:%s*Connect") do usados[membro] = true end for membro in pairs(usados) do if membro ~= "Parent" and membro ~= "Name" then local achou, classeRuim = false, nil for classe in pairs(classes) do local m = membros(classe) if next(m) == nil or m[membro] then achou = true break end classeRuim = classe end if not achou and classeRuim then local lista = uteis(membros(classeRuim)) table.insert(problemas, "'" .. var .. "' is a " .. classeRuim .. " and '" .. membro .. "' is not a property or event of " .. classeRuim .. ". Valid members: " .. table.concat(lista, ", ", 1, math.min(#lista, 70))) end end end end return problemas end local function vetor(t) if type(t) == "table" and tonumber(t[1]) and tonumber(t[2]) and tonumber(t[3]) then return Vector3.new(tonumber(t[1]), tonumber(t[2]), tonumber(t[3])) end return nil end local function textoCodigo(v) if type(v) == "table" then local linhas = {} for _, l in ipairs(v) do table.insert(linhas, textoCodigo(l)) end v = table.concat(linhas, "\n") end v = tostring(v or "") v = string.gsub(v, "^%s*```%a*\n?", "") v = string.gsub(v, "\n?```%s*$", "") return v end local function area(dims) local partes = {} local c, l, a = tonumber(dims.comprimento) or 0, tonumber(dims.largura) or 0, tonumber(dims.altura) or 0 if c > 0 then table.insert(partes, "length (X) " .. c .. " studs") end if l > 0 then table.insert(partes, "width (Z) " .. l .. " studs") end if a > 0 then table.insert(partes, "height (Y) " .. a .. " studs") end if #partes == 0 then return "" end return "\nWORK AREA chosen by the user: " .. table.concat(partes, ", ") .. ". The area is centered on X=0, Z=0, starting at " .. "ground level Y=0 (use Raycast to find the real ground). Build everything INSIDE this area and use its size fully." end -- ctx: {cfg, dims, avisar, cancelado, foto(vista) -> png64 ou nil} function Agente.executar(texto, ctx) local cfg, avisar = ctx.cfg, ctx.avisar if not IA.ligada(cfg) then error("O Pedido livre precisa de uma inteligência artificial (Gemini ou Claude). Escolha uma e cole a chave na aba Ajustes. Sem ela, use Mapa, Objetos ou Figurantes, que são grátis.", 0) end local okCena, cena = U.rodar(Modelos.CENA) if not okCena then cena = "(could not read the scene)" end local op = { sistema = sistema() } local pedido = "Pedido do usuário: " .. texto .. "\nCena atual: " .. tostring(cena) .. area(ctx.dims or {}) local imagem local pasta, resumo, construiu, baseFeita, npcsFeitos = "Agente_Livre", "", false, false, false local apagar, terreno = {}, false local ultimaVista local function cancelado() if ctx.cancelado() then error("Cancelado.", 0) end end local function olhar(vista) ultimaVista = vista or ultimaVista imagem = vista and ctx.foto(vista) or nil end local rodada = 0 while rodada < MAX_RODADAS do rodada += 1 cancelado() avisar(string.format("Agente: pensando (rodada %d de %d)...", rodada, MAX_RODADAS)) op.imagem = imagem local resp = IA.perguntarJson(cfg, pedido, op) cancelado() local codigo = textoCodigo(resp.codigo) local temCodigo = string.find(codigo, "%S") ~= nil if resp.plano then avisar("Plano: " .. tostring(resp.plano)) end if type(resp.base_mapa) == "table" and not baseFeita then baseFeita = true avisar("Agente: usando o gerador de mapas para o terreno...") local base = resp.base_mapa local dims = {} for _, k in ipairs({ "comprimento", "largura", "altura" }) do dims[k] = (ctx.dims and tonumber(ctx.dims[k]) and ctx.dims[k] > 0) and ctx.dims[k] or tonumber(base[k]) or 0 end local r = Mapa.gerar(tostring(base.descricao or texto), cfg, dims, avisar) construiu, terreno = true, true for _, a in ipairs(r.apagar) do table.insert(apagar, a) end olhar(r.vista) pedido = "Pedido do usuário: " .. texto .. "\nO terreno-base já foi construído pelo gerador de mapas (" .. tostring(base.descricao) .. "), com a foto anexa. Agora adicione SOMENTE o que ainda falta para o pedido " .. "(construções, objetos especiais). NÃO apague nem refaça o terreno. Se já está completo, responda pronto true." elseif resp.pronto and not temCodigo then resumo = tostring(resp.resumo or "") break elseif type(resp.objetos) == "table" and #resp.objetos > 0 and not temCodigo then local feitos = Agente.objetos(resp.objetos, avisar) for _, a in ipairs(feitos) do table.insert(apagar, a) end construiu = construiu or #feitos > 0 olhar(vetor(resp.camera and resp.camera.de) and { vetor(resp.camera.de), vetor(resp.camera.para) or Vector3.zero } or ultimaVista) pedido = "Pedido do usuário: " .. texto .. "\nOs objetos prontos foram colocados (foto anexa; portas e plataformas só " .. "se mexem em Play). Se algo está fora do lugar, envie de novo a lista inteira corrigida ou código; se está bom, responda pronto true." elseif type(resp.npcs) == "table" and not npcsFeitos and not temCodigo then npcsFeitos = true avisar("Agente: criando figurantes que andam sozinhos...") local r = Objetos.figurantes(resp.npcs, avisar) table.insert(apagar, "Mapa_NPCs") construiu = true olhar(r.vista) pedido = "Pedido do usuário: " .. texto .. "\nOs figurantes foram criados (eles só andam em Play). Se falta algo do " .. "pedido, envie o código; senão responda pronto true." else if type(resp.npcs) == "table" and not npcsFeitos then npcsFeitos = true Objetos.figurantes(resp.npcs, avisar) table.insert(apagar, "Mapa_NPCs") end if not temCodigo then error("O agente não escreveu nenhum código para esse pedido. Tente descrever de outro jeito.", 0) end local proibido for _, p in ipairs(PROIBIDOS) do if string.find(codigo, p) then proibido = p break end end local problemas = proibido and {} or Agente.validar(codigo) if rodada == 1 and #codigo < 250 and not resp.objetos then table.insert(problemas, 1, "Your code has only " .. #codigo .. " characters: it does not build what was asked. " .. "Write the WHOLE build as complete Luau (many Parts with real sizes and positions), not just a folder.") end if proibido then avisar("O código tinha algo que não é permitido (rede, dados ou apagar o jogo). Pedindo outro jeito...") pedido = "Pedido do usuário: " .. texto .. "\nSEU CÓDIGO FOI RECUSADO por usar algo proibido (HttpService, " .. "loadstring, require, DataStore, Marketplace, Teleport, ou apagar workspace/game). Refaça sem isso." imagem = nil elseif #problemas > 0 then avisar("O código usava algo que não existe no Studio; o agente vai corrigir.") pedido = "Pedido do usuário: " .. texto .. "\nYour code has problems found BEFORE running:\n- " .. table.concat(problemas, "\n- ", 1, math.min(#problemas, 8)) .. "\nFix these and send the full corrected code." imagem = nil else pasta = string.sub(string.gsub(tostring(resp.pasta or pasta), "[^%w_]", "_"), 1, 40) avisar("Agente: construindo no Studio...") local ok, saida = U.rodar(codigo) cancelado() if not ok then avisar("O Studio devolveu um erro; o agente vai corrigir.") pedido = "Pedido do usuário: " .. texto .. "\nSEU CÓDIGO DEU ERRO no Studio:\n" .. string.sub(tostring(saida), 1, 1500) .. "\nCorrija e envie o código completo de novo (ele deve apagar a pasta anterior antes)." imagem = nil else construiu = true if not table.find(apagar, pasta) then table.insert(apagar, pasta) end if type(resp.objetos) == "table" and #resp.objetos > 0 then for _, a in ipairs(Agente.objetos(resp.objetos, avisar)) do table.insert(apagar, a) end end avisar("Agente: tirando foto para conferir...") local vista if vetor(resp.camera and resp.camera.de) and vetor(resp.camera.para) then vista = { vetor(resp.camera.de), vetor(resp.camera.para) } else local centro, tam = U.caixa(workspace:FindFirstChild(pasta)) if centro then vista = { U.vista(centro, tam) } end end olhar(vista) pedido = "Pedido do usuário: " .. texto .. "\nSeu código rodou sem erro. A foto anexa mostra o resultado. " .. "Compare com o pedido: se estiver bom, responda pronto true; se faltar algo ou estiver feio " .. "(flutuando, enterrado, escuro demais, vazio), corrija com o código completo." end end end end if rodada >= MAX_RODADAS and resumo == "" then resumo = "Fiz o que consegui em 4 rodadas. Se não ficou como queria, descreva o que faltou e peça de novo." end if not construiu then error("O agente não conseguiu construir isso (o código deu erro ou foi recusado). Tente descrever de outro jeito, com menos coisas de uma vez.", 0) end if resumo ~= "" then avisar("Resumo: " .. resumo) end return { tipo = "livre", apagar = apagar, terreno = terreno, vista = ultimaVista } end -- Coloca os objetos prontos que o agente pediu nas posições exatas. Devolve os caminhos para apagar. function Agente.objetos(lista, avisar) local feitos = {} for i, o in ipairs(lista) do if i > 40 then break end if type(o) == "table" and o.tipo and o.tipo ~= "figurantes" then local ok, r = pcall(Objetos.gerar, o, function() end) if ok then for _, a in ipairs(r.apagar) do table.insert(feitos, a) end else avisar("Não consegui colocar um objeto (" .. tostring(o.tipo) .. "): " .. tostring(r)) end end end if #feitos > 0 then avisar("Agente: " .. #feitos .. " objeto(s) pronto(s) colocado(s) (portas, plataformas etc.).") end return feitos end return Agente end ]]>Biblioteca 0.1 and frente or ponto + Vector3.new(0, 0, -1)) -- a caixa do modelo fica com o fundo no chão e a frente virada para a câmera c:PivotTo(base * CFrame.new(0, tam.Y / 2, 0) * c:GetPivot():ToObjectSpace(cf):Inverse()) elseif c:IsA("BasePart") then c.CFrame = CFrame.new(ponto + Vector3.new(0, c.Size.Y / 2, 0)) end c.Parent = workspace Selection:Set({ c }) return c end function Biblioteca.apagar(objeto) objeto:Destroy() end return Biblioteca end ]]>Jogos/ (Construir.lua monta no modo de edição; Cliente.lua é o jogo em si). local U = require("Util") local Fontes = require("JogosFontes") local Jogos = {} Jogos.LISTA = { { id = "crowd_runner", nome = "🏃 Crowd Runner", descricao = "Corrida com multidão: portões que somam e multiplicam, faixa de +1, barris, batalha contra o grupo vermelho e fases infinitas (cada uma mais difícil).", apagar = { "CrowdRunner", "game.StarterPlayer.StarterPlayerScripts.CrowdRunnerCliente" }, vista = { Vector3.new(45, 70, 50), Vector3.new(0, 0, -170) }, }, } function Jogos.achar(id) for _, j in ipairs(Jogos.LISTA) do if j.id == id then return j end end return nil end -- op: { demonstracao = bool } function Jogos.criar(id, op, avisar) local jogo, fonte = Jogos.achar(id), Fontes[id] if not jogo or not fonte then error("Esse jogo pronto não existe.", 0) end avisar("Montando o " .. jogo.nome .. "...") local ok, r = U.rodar(fonte.construir, fonte.cliente, op.demonstracao == true) if not ok then error("O jogo deu erro ao montar: " .. string.sub(tostring(r), 1, 300), 0) end avisar("Jogo montado! Aperte Play no Studio para jogar.") if op.demonstracao then avisar("Modo demonstração ligado: o jogo joga sozinho (bom para gravar vídeo). Para desligar, selecione a pasta CrowdRunner e desmarque o atributo Demonstracao.") end return { tipo = "jogo", apagar = jogo.apagar, vista = jogo.vista } end return Jogos end ]]>Licenca= 400 and r.StatusCode < 500 and r.StatusCode ~= 429 end function Licenca.ativar(plugin, chave, versao) chave = string.upper(string.gsub(chave or "", "%s+", "")) if chave == "" then return false, "Cole a sua chave (ex.: GM-7K2M-9QWE-4RTY-PL3D)." end local ok, texto = perguntar(chave, versao) if ok then gravar(plugin, { chave = chave, ok = true, conferido = os.time(), conta = Licenca.contaRoblox() }) end return ok, texto end -- Ao abrir: reconfere a chave guardada. Sem internet mantém (até 7 dias); chave recusada pelo servidor = volta ao grátis. function Licenca.reconferir(plugin, versao) local v = ler(plugin) if not v.chave or v.chave == "" then return false end local ok, texto, definitivo = perguntar(v.chave, versao) if ok then gravar(plugin, { chave = v.chave, ok = true, conferido = os.time(), conta = Licenca.contaRoblox() }) elseif definitivo then gravar(plugin, { chave = v.chave, ok = false, conferido = 0, conta = 0, motivo = texto }) end return Licenca.completa(plugin), texto end function Licenca.esquecer(plugin) gravar(plugin, {}) end -- Texto padrão quando algo é só da versão completa. function Licenca.aviso(oque) return "⭐ " .. oque .. " é da versão completa (" .. Licenca.PRECO .. ", vitalícia): compre em " .. Licenca.URL_COMPRA .. " e cole a chave em ⚙️ Ajustes › Licença." end return Licenca end ]]>Interface= #f.Text) then rolar.CanvasPosition = Vector2.new(0, math.max(0, total - alto)) end end f:GetPropertyChangedSignal("Text"):Connect(function() task.spawn(ajustar) end) rolar:GetPropertyChangedSignal("AbsoluteSize"):Connect(function() task.defer(ajustar) end) local cursor = 0 f:GetPropertyChangedSignal("CursorPosition"):Connect(function() if f.CursorPosition > 0 then cursor = f.CursorPosition end end) local function quebrarLinha() local pos = (cursor > 0 and cursor <= #f.Text + 1) and cursor or (#f.Text + 1) f.Text = string.sub(f.Text, 1, pos - 1) .. "\n" .. string.sub(f.Text, pos) task.defer(function() f:CaptureFocus() f.CursorPosition = pos + 1 end) end f.FocusLost:Connect(function(enter) if enter then quebrarLinha() end end) local shift = false f.InputBegan:Connect(function(i) if i.KeyCode == Enum.KeyCode.LeftShift or i.KeyCode == Enum.KeyCode.RightShift then shift = true elseif i.KeyCode == Enum.KeyCode.Return and shift then local antes = f.Text task.defer(function() -- o Studio não pulou linha nem tirou o foco: pula aqui if f.Text == antes and f:IsFocused() then quebrarLinha() end end) end end) f.InputEnded:Connect(function(i) if i.KeyCode == Enum.KeyCode.LeftShift or i.KeyCode == Enum.KeyCode.RightShift then shift = false end end) f.Focused:Connect(function() shift = false end) return f end local function caixaTexto(pai, op) op = op or {} if op.linhas then return caixaGrande(pai, op) end local f = novo("TextBox", { Parent = pai, Text = op.texto or "", PlaceholderText = op.dica or "", PlaceholderColor3 = Color3.fromRGB(105, 122, 145), BackgroundColor3 = COR.fundo, TextColor3 = COR.texto, FontFace = fonte(), TextSize = 14, ClearTextOnFocus = false, MultiLine = op.linhas ~= nil, TextWrapped = true, TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = op.linhas and Enum.TextYAlignment.Top or Enum.TextYAlignment.Center, Size = UDim2.new(1, 0, 0, op.linhas and (op.linhas * 20 + 16) or 34), LayoutOrder = op.ordem or 0, }) cantos(f, 8) contorno(f) espaco(f, 8) return f end -- Linha "rótulo [número]" com só números aceitos. local function campoNumero(pai, rotulo, valor, ordem, dica) local linha = novo("Frame", { Parent = pai, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 34), LayoutOrder = ordem }) novo("TextLabel", { Parent = linha, BackgroundTransparency = 1, Text = rotulo, TextColor3 = COR.texto, FontFace = fonte(), TextSize = 14, TextXAlignment = Enum.TextXAlignment.Left, Size = UDim2.new(0.58, 0, 1, 0), TextWrapped = true, }) local caixa = caixaTexto(linha, { texto = tostring(valor), dica = dica }) caixa.Size = UDim2.new(0.42, 0, 1, 0) caixa.Position = UDim2.new(0.58, 0, 0, 0) caixa.TextXAlignment = Enum.TextXAlignment.Center caixa.FocusLost:Connect(function() local n = tonumber((string.gsub(caixa.Text, ",", "."))) caixa.Text = n and tostring(n) or tostring(valor) end) return function() return tonumber(caixa.Text) or valor end, caixa end -- Caixinha de marcar. Devolve função que lê o valor. local function marcar(pai, rotulo, valor, ordem, aoMudar) local ligado = valor local b = novo("TextButton", { Parent = pai, BackgroundTransparency = 1, Text = "", Size = UDim2.new(1, 0, 0, 26), LayoutOrder = ordem, }) local quadro = cantos(novo("Frame", { Parent = b, Size = UDim2.fromOffset(20, 20), Position = UDim2.fromOffset(0, 3), BackgroundColor3 = COR.fundo }), 5) contorno(quadro, COR.borda, 1) local v = novo("TextLabel", { Parent = quadro, BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), Text = "✓", TextColor3 = COR.fundo, FontFace = fonte(Enum.FontWeight.Bold), TextSize = 15, }) novo("TextLabel", { Parent = b, BackgroundTransparency = 1, Text = rotulo, TextColor3 = COR.texto, FontFace = fonte(), TextSize = 14, TextXAlignment = Enum.TextXAlignment.Left, Position = UDim2.fromOffset(30, 0), Size = UDim2.new(1, -30, 1, 0), TextWrapped = true, }) local function pintar() quadro.BackgroundColor3 = ligado and COR.verde or COR.fundo v.Visible = ligado end pintar() aoClicar(b, function() ligado = not ligado pintar() if aoMudar then aoMudar(ligado) end end) return function() return ligado end end -- Grupo de botões em que só um fica escolhido. opcoes = { {id, nome} }. Devolve (ler, escolher). local function escolha(pai, opcoes, inicial, ordem, colunas, aoMudar) local grade = novo("Frame", { Parent = pai, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = ordem }) colunas = colunas or 2 novo("UIGridLayout", { Parent = grade, CellPadding = UDim2.fromOffset(6, 6), SortOrder = Enum.SortOrder.LayoutOrder, CellSize = UDim2.new(1 / colunas, -6 * (colunas - 1) / colunas, 0, 34), }) local atual = inicial local botoes = {} local function pintar() for id, b in pairs(botoes) do local sel = id == atual b.BackgroundColor3 = sel and COR.verdeEscuro or COR.cartao2 b.UIStroke.Color = sel and COR.verde or COR.borda end end for i, op in ipairs(opcoes) do local b = botao(grade, op.nome, { ordem = i, tamanho = 13 }) botoes[op.id] = b aoClicar(b, function() atual = op.id pintar() if aoMudar then aoMudar(atual) end end) end pintar() return function() return atual end, function(id) atual = id pintar() end end function Interface.montar(raiz, plugin, reabrir) local completa = Licenca.completa(plugin) local GR = Licenca.GRATIS local function lerAjuste(k, padrao) local ok, v = pcall(plugin.GetSetting, plugin, "GeradorMagico_" .. k) if ok and v ~= nil then return v end return padrao end local function gravarAjuste(k, v) pcall(plugin.SetSetting, plugin, "GeradorMagico_" .. k, v) end local cfg = { ia = lerAjuste("ia", "nenhuma"), chaveGemini = lerAjuste("chaveGemini", ""), chaveClaude = lerAjuste("chaveClaude", ""), modeloGemini = Gemini.MODELO_PADRAO, modeloClaude = lerAjuste("modeloClaude", Claude.MODELO_PADRAO), catalogo = lerAjuste("catalogo", true), } local fundo = novo("Frame", { Parent = raiz, BackgroundColor3 = COR.fundo, Size = UDim2.fromScale(1, 1), BorderSizePixel = 0 }) -- ===== topo ===== local topo = novo("Frame", { Parent = fundo, BackgroundColor3 = COR.cartao, Size = UDim2.new(1, 0, 0, 58), BorderSizePixel = 0 }) novo("UIGradient", { Parent = topo, Color = ColorSequence.new(Color3.fromRGB(28, 48, 40), COR.cartao), Rotation = 0 }) novo("TextLabel", { Parent = topo, BackgroundTransparency = 1, Text = "✨ " .. Interface.NOME, TextColor3 = COR.verde, FontFace = fonte(Enum.FontWeight.ExtraBold), TextSize = 20, TextXAlignment = Enum.TextXAlignment.Left, Position = UDim2.fromOffset(12, 6), Size = UDim2.new(1, -150, 0, 26), }) novo("TextLabel", { Parent = topo, BackgroundTransparency = 1, RichText = true, Text = completa and "⭐ Versão completa • mapas, objetos e mundos" or "Versão grátis • ⭐ completa por " .. Licenca.PRECO, TextColor3 = COR.suave, FontFace = fonte(), TextSize = 13, TextXAlignment = Enum.TextXAlignment.Left, Position = UDim2.fromOffset(12, 32), Size = UDim2.new(1, -150, 0, 18), }) local selo = cantos(novo("TextLabel", { Parent = topo, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1, -10, 0.5, 0), Size = UDim2.fromOffset(128, 26), BackgroundColor3 = COR.verdeEscuro, TextColor3 = COR.texto, FontFace = fonte(Enum.FontWeight.Bold), TextSize = 12, }), 13) local function pintarSelo() if cfg.ia == "gemini" and IA.ligada(cfg) then selo.Text, selo.BackgroundColor3 = "🤖 Gemini ligado", Color3.fromRGB(40, 80, 140) elseif cfg.ia == "claude" and IA.ligada(cfg) then selo.Text, selo.BackgroundColor3 = "🤖 Claude ligado", Color3.fromRGB(120, 70, 40) else selo.Text, selo.BackgroundColor3 = "💚 Grátis (sem IA)", COR.verdeEscuro end end pintarSelo() -- ===== abas ===== local barra = novo("Frame", { Parent = fundo, BackgroundTransparency = 1, Position = UDim2.fromOffset(8, 64), Size = UDim2.new(1, -16, 0, 34) }) lista(barra, 4, true) local paginas = novo("Frame", { Parent = fundo, BackgroundTransparency = 1, Position = UDim2.fromOffset(0, 104), Size = UDim2.new(1, 0, 1, -104), ClipsDescendants = true }) local abas = {} local function pagina(id, rotulo, ordem) local p = novo("ScrollingFrame", { Parent = paginas, BackgroundTransparency = 1, BorderSizePixel = 0, Size = UDim2.fromScale(1, 1), Visible = false, CanvasSize = UDim2.new(), AutomaticCanvasSize = Enum.AutomaticSize.Y, ScrollBarThickness = 6, ScrollBarImageColor3 = COR.borda, ScrollingDirection = Enum.ScrollingDirection.Y, }) novo("UIPadding", { Parent = p, PaddingLeft = UDim.new(0, 10), PaddingRight = UDim.new(0, 14), PaddingTop = UDim.new(0, 4), PaddingBottom = UDim.new(0, 16) }) lista(p, 10) local b = botao(barra, rotulo, { size = UDim2.new(0.2, -4, 1, 0), tamanho = 12, ordem = ordem, raio = 7 }) abas[id] = { pagina = p, botao = b } local function abrir() for outro, a in pairs(abas) do a.pagina.Visible = outro == id a.botao.BackgroundColor3 = outro == id and COR.verdeEscuro or COR.cartao2 a.botao.UIStroke.Color = outro == id and COR.verde or COR.borda end if abas[id].aoAbrir then abas[id].aoAbrir() end end abas[id].abrir = abrir aoClicar(b, abrir) return p end local pCriar = pagina("criar", "✨ Criar", 1) local pBib = pagina("bib", "📚 Biblioteca", 2) local pFeitos = pagina("feitos", "🕘 Feitos", 3) local pAjustes = pagina("ajustes", "⚙️ Ajustes", 4) local pAjuda = pagina("ajuda", "❓ Ajuda", 5) -- ================= CRIAR ================= local c1 = cartao(pCriar, 1) texto(c1, "1. O que você quer criar?", { tamanho = 15 }) local MODOS = { { id = "mapa", nome = "🗺️ Mapa" }, { id = "objeto", nome = "🚪 Objeto pronto" }, { id = "figurantes", nome = "🧍 Figurantes" }, { id = "livre", nome = "🤖 Pedido livre (IA)" .. (completa and "" or " ⭐") }, { id = "jogo", nome = "🎮 Jogo pronto" .. (completa and "" or " ⭐") }, } local blocos = {} local lerModo local c2 = cartao(pCriar, 2) local tituloOpcoes = texto(c2, "2. Opções", { tamanho = 15 }) -- opções de cada modo local function bloco(id, ordem) local b = novo("Frame", { Parent = c2, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = ordem, Visible = false }) lista(b, 6) blocos[id] = b return b end local bMapa = bloco("mapa", 5) texto(bMapa, "Tamanho (em studs; deixe 0 para automático)", { tamanho = 13, cor = COR.suave, ordem = 0 }) local mComp = campoNumero(bMapa, "Comprimento (X)", 400, 1) local mLarg = campoNumero(bMapa, "Largura (Z)", 400, 2) local mAlt = campoNumero(bMapa, "Altura (Y)", 60, 3) local mAgua = marcar(bMapa, "Pode ter água", true, 4) local mArv = marcar(bMapa, "Pode ter árvores", true, 5) local mPed = marcar(bMapa, "Pode ter pedras", true, 6) texto(bMapa, "⚠️ Um mapa novo troca o terreno inteiro (dá para voltar com Ctrl+Z). Para só COLOCAR coisas no mapa que já existe, comece com \"adicione\": ex. \"adicione 5 palmeiras aqui\" ou \"adicione cogumelos pelo mapa todo\".", { tamanho = 12, cor = COR.amarelo, ordem = 7 }) local bObj = bloco("objeto", 5) texto(bObj, "Qual objeto? Ele aparece onde a câmera do Studio está olhando, de frente para você.", { tamanho = 13, cor = COR.suave, ordem = 0 }) local opcoesObj = {} for _, t in ipairs(Objetos.TIPOS) do table.insert(opcoesObj, { id = t.id, nome = t.icone .. " " .. t.nome .. ((completa or GR.objetos[t.id]) and "" or " ⭐") }) end local rotuloN1 local lerObjTipo = escolha(bObj, opcoesObj, "porta", 1, 2, function(id) rotuloN1(id) end) local cDesc, tituloDescricao, caixaPedido local oN1, caixaN1 = campoNumero(bObj, "Segundos para fechar sozinha (0 = nunca)", 5, 2) local linhaN1Rotulo = caixaN1.Parent:FindFirstChildOfClass("TextLabel") local lerDir = escolha(bObj, { { id = "sobe", nome = "⬆ Sobe e desce" }, { id = "lado", nome = "↔ Vai e volta" } }, "sobe", 3, 2) local lerTecla = escolha(bObj, { { id = "E", nome = "Tecla E" }, { id = "F", nome = "Tecla F" }, { id = "G", nome = "Tecla G" }, { id = "R", nome = "Tecla R" } }, "E", 4, 4) local gradeDir for _, f in ipairs(bObj:GetChildren()) do if f:IsA("Frame") and f:FindFirstChild("UIGridLayout") and f:FindFirstChild("TextButton") and string.find(f:FindFirstChild("TextButton").Text, "Sobe") then gradeDir = f end end function rotuloN1(id) local textos = { porta = "Segundos para fechar sozinha (0 = nunca)", janela = "Segundos para fechar sozinha (0 = nunca)", bau = "Segundos para o baú voltar (0 = só uma vez)", plataforma = "Distância que ela anda (studs)", } linhaN1Rotulo.Text = textos[id] or "(este objeto não tem ajuste)" caixaN1.Parent.Visible = textos[id] ~= nil if id == "plataforma" and tonumber(caixaN1.Text) and tonumber(caixaN1.Text) < 4 then caixaN1.Text = "12" end if gradeDir then gradeDir.Visible = id == "plataforma" end if lerModo and lerModo() == "objeto" and cDesc then cDesc.Visible = id == "cartaz" or id == "bau" tituloDescricao.Text = id == "cartaz" and "3. Texto do cartaz" or "3. Nome do item que o baú dá" caixaPedido.PlaceholderText = id == "cartaz" and "Ex.: Bem-vindo à vila!" or "Ex.: Espada de ouro" end end local bFig = bloco("figurantes", 5) texto(bFig, "Pessoas de verdade (corpo do Roblox) que andam sozinhas quando você aperta Play. Aparecem onde a câmera olha.", { tamanho = 13, cor = COR.suave, ordem = 0 }) local fQtd = campoNumero(bFig, "Quantas pessoas (1 a 40)", 10, 1) local fRaio = campoNumero(bFig, "Distância que andam (studs)", 60, 2) local lerEstilo = escolha(bFig, { { id = "moradores", nome = "🏘️ Moradores" }, { id = "guardas", nome = "🛡️ Guardas" }, { id = "medievais", nome = "🏰 Medievais" }, { id = "turistas", nome = "🏖️ Turistas" }, }, "moradores", 3, 2) local bJogo = bloco("jogo", 5) texto(bJogo, "Um jogo inteiro, pronto para apertar Play: pista, regras, interface e fases. Melhor num jogo novo (modelo Baseplate): ele muda a cor do chão, o ponto de nascer e desliga o carregamento aos poucos (StreamingEnabled).", { tamanho = 13, cor = COR.suave }) local opcoesJogo = {} for _, j in ipairs(Jogos.LISTA) do table.insert(opcoesJogo, { id = j.id, nome = j.nome }) end local descJogo local lerJogo = escolha(bJogo, opcoesJogo, Jogos.LISTA[1].id, 1, 1, function(id) descJogo.Text = Jogos.achar(id).descricao end) descJogo = texto(bJogo, Jogos.LISTA[1].descricao, { tamanho = 13 }) local jDemo = marcar(bJogo, "Começar no modo demonstração (o jogo joga sozinho — ótimo para gravar vídeo)", false) texto(bJogo, "Em breve: mais jogos prontos.", { tamanho = 12, cor = COR.suave }) local bLivre = bloco("livre", 5) texto(bLivre, "Área de trabalho (0 = a inteligência artificial decide)", { tamanho = 13, cor = COR.suave, ordem = 0 }) local lComp = campoNumero(bLivre, "Comprimento (X)", 0, 1) local lLarg = campoNumero(bLivre, "Largura (Z)", 0, 2) local lAlt = campoNumero(bLivre, "Altura (Y)", 0, 3) local avisoLivre = texto(bLivre, "", { tamanho = 12, cor = COR.amarelo, ordem = 4 }) cDesc = cartao(pCriar, 3) tituloDescricao = texto(cDesc, "3. Descreva", { tamanho = 15 }) local dicaModo = texto(cDesc, "", { tamanho = 13, cor = COR.suave }) caixaPedido = caixaTexto(cDesc, { linhas = 4 }) local exemplos = novo("Frame", { Parent = cDesc, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y }) novo("UIGridLayout", { Parent = exemplos, CellPadding = UDim2.fromOffset(6, 6), CellSize = UDim2.new(0.5, -3, 0, 28) }) local EXEMPLOS = { mapa = { "Pântano sombrio com cogumelos", "Ilha tropical com palmeiras", "Deserto com oásis", "Montanhas nevadas com pinheiros", "Floresta mágica com vaga-lumes", "Vulcão com lava", "Adicione 5 árvores aqui", "Adicione flores e cogumelos pelo mapa todo" }, livre = { "Vila medieval com casas e poço", "Casa com porta e janela que abrem", "Escada de parkour com plataformas", "Praça com fonte e bancos" }, } local DICAS = { mapa = "Escreva em português como você imagina o mapa. O plugin entende terreno, água, árvores, pedras, clima e cenário. Com \"adicione\" ele só coloca coisas no mapa atual.", objeto = "", figurantes = "", jogo = "", livre = "Peça QUALQUER coisa. A inteligência artificial escreve, constrói, tira foto, confere e corrige sozinha.", } local function mostrarExemplos(modo) for _, f in ipairs(exemplos:GetChildren()) do if f:IsA("TextButton") then f:Destroy() end end for i, e in ipairs(EXEMPLOS[modo] or {}) do local b = botao(exemplos, "💡 " .. e, { tamanho = 12, ordem = i, cor = COR.fundo }) aoClicar(b, function() caixaPedido.Text = e end) end end local function aoMudarModo(modo) for id, b in pairs(blocos) do b.Visible = id == modo end dicaModo.Text = DICAS[modo] or "" dicaModo.Visible = dicaModo.Text ~= "" cDesc.Visible = modo ~= "figurantes" and modo ~= "jogo" tituloDescricao.Text = "3. Descreva" tituloOpcoes.Text = modo == "figurantes" and "2. Opções" or "2. Opções" caixaPedido.PlaceholderText = modo == "mapa" and "Ex.: um pântano sombrio com cogumelos, juncos e vaga-lumes" or "Ex.: uma vila medieval ao pôr do sol, com 5 casas de pedra, um poço e tochas acesas" if modo == "objeto" then rotuloN1(lerObjTipo()) end avisoLivre.Text = IA.ligada(cfg) and ("Usando o " .. IA.nome(cfg) .. ". Cada pedido gasta um pouco da sua cota ou créditos.") or "⚠️ O Pedido livre precisa de uma inteligência artificial (Gemini ou Claude). Ligue na aba Ajustes." mostrarExemplos(modo) end local escolherModo lerModo, escolherModo = escolha(c1, MODOS, "mapa", 1, 2, aoMudarModo) -- botão criar + andamento + prévia local c3 = cartao(pCriar, 4) local bCriar = botao(c3, "✨ Criar", { cor = COR.verde, corTexto = COR.fundo, altura = 46, tamanho = 18, peso = Enum.FontWeight.ExtraBold, corBorda = COR.verde, ordem = 1 }) local bCancelar = botao(c3, "Cancelar", { altura = 30, tamanho = 13, ordem = 2 }) bCancelar.Visible = false local quadroPrevia = cantos(novo("Frame", { Parent = c3, BackgroundColor3 = COR.fundo, Size = UDim2.new(1, 0, 0, 170), LayoutOrder = 3, ClipsDescendants = true, }), 8) local previa = novo("ImageLabel", { Parent = quadroPrevia, BackgroundTransparency = 1, Size = UDim2.fromScale(1, 1), ScaleType = Enum.ScaleType.Fit }) local semPrevia = texto(quadroPrevia, "A foto do que foi criado aparece aqui.", { tamanho = 13, cor = COR.suave, alinhar = Enum.TextXAlignment.Center }) semPrevia.Position = UDim2.new(0, 0, 0.42, 0) texto(c3, "Andamento", { tamanho = 14, ordem = 4 }) local rolagem = novo("ScrollingFrame", { Parent = c3, BackgroundColor3 = COR.fundo, BorderSizePixel = 0, Size = UDim2.new(1, 0, 0, 150), LayoutOrder = 5, CanvasSize = UDim2.new(), AutomaticCanvasSize = Enum.AutomaticSize.Y, ScrollBarThickness = 5, ScrollBarImageColor3 = COR.borda, }) cantos(rolagem, 8) espaco(rolagem, 8) local log = texto(rolagem, "", { tamanho = 13, cor = COR.suave }) local linhasLog = {} local function avisar(t) table.insert(linhasLog, os.date("%H:%M:%S") .. " " .. t) while #linhasLog > 60 do table.remove(linhasLog, 1) end log.Text = table.concat(linhasLog, "\n") task.defer(function() rolagem.CanvasPosition = Vector2.new(0, math.max(0, rolagem.AbsoluteCanvasSize.Y - rolagem.AbsoluteSize.Y)) end) end local imagemAtual local function mostrarFoto(f) if not f or not f.imagem then return end if imagemAtual then pcall(function() imagemAtual:Destroy() end) end imagemAtual = f.imagem previa.ImageContent = Content.fromObject(f.imagem) semPrevia.Visible = false end -- ================= FEITOS ================= local feitos = {} local cFeitos = cartao(pFeitos, 1) texto(cFeitos, "O que você criou nesta sessão", { tamanho = 15 }) texto(cFeitos, "Para desfazer o último, você também pode apertar Ctrl+Z no Studio.", { tamanho = 13, cor = COR.suave }) local listaFeitos = novo("Frame", { Parent = pFeitos, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = 2 }) lista(listaFeitos, 8) local function apagarItem(item) for _, caminho in ipairs(item.apagar or {}) do -- "Pasta.Coisa" = dentro do workspace; "game.StarterPlayer..." = caminho a partir do jogo local o = workspace local resto = caminho if string.sub(caminho, 1, 5) == "game." then o, resto = game, string.sub(caminho, 6) end for nome in string.gmatch(resto, "[^%.]+") do o = o and o:FindFirstChild(nome) end if o and o ~= workspace and o ~= game then o:Destroy() end end if item.terreno then workspace.Terrain:Clear() end end local function desenharFeitos() for _, f in ipairs(listaFeitos:GetChildren()) do if f:IsA("Frame") then f:Destroy() end end if #feitos == 0 then local c = cartao(listaFeitos, 1) texto(c, "Nada criado ainda. Vá na aba ✨ Criar.", { tamanho = 13, cor = COR.suave }) end for i = #feitos, 1, -1 do local item = feitos[i] local c = cartao(listaFeitos, #feitos - i + 1) texto(c, "" .. item.titulo .. "", { tamanho = 14 }) texto(c, item.hora .. (item.apagado and " • apagado" or ""), { tamanho = 12, cor = COR.suave }) local linha = novo("Frame", { Parent = c, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 30) }) lista(linha, 6, true) if item.vista then local bVer = botao(linha, "👁 Ver", { size = UDim2.new(0.5, -3, 1, 0), tamanho = 13 }) aoClicar(bVer, function() local cam = workspace.CurrentCamera cam.CFrame = CFrame.lookAt(item.vista[1], item.vista[2]) cam.Focus = CFrame.new(item.vista[2]) end) end if not item.apagado then local bApagar = botao(linha, "🗑 Apagar do jogo", { size = UDim2.new(0.5, -3, 1, 0), tamanho = 13, corBorda = COR.vermelho }) local confirmar = false aoClicar(bApagar, function() if not confirmar then confirmar = true bApagar.Text = item.terreno and "Apaga o TERRENO também. Confirmar?" or "Clique de novo para confirmar" task.delay(4, function() if bApagar.Parent then confirmar = false bApagar.Text = "🗑 Apagar do jogo" end end) return end local id = ChangeHistoryService:TryBeginRecording("Apagar " .. item.titulo) apagarItem(item) if id then ChangeHistoryService:FinishRecording(id, Enum.FinishRecordingOperation.Commit) end item.apagado = true desenharFeitos() end) end end end desenharFeitos() -- ================= rodar um pedido ================= local rodando, cancelar = false, false local function terminar() rodando = false bCriar.Text = "✨ Criar" bCriar.BackgroundColor3 = COR.verde bCancelar.Visible = false end aoClicar(bCancelar, function() cancelar = true avisar("Cancelando... (termina o passo atual e para)") end) aoClicar(bCriar, function() if rodando then return end local modo = lerModo() local pedido = caixaPedido.Text if (modo == "mapa" or modo == "livre") and not string.find(pedido, "%S") then avisar("Escreva primeiro o que você quer criar (ou clique num exemplo 💡).") return end if not completa then if modo == "livre" then avisar(Licenca.aviso("O Pedido livre")) return elseif modo == "jogo" then avisar(Licenca.aviso("Os jogos prontos")) return elseif modo == "objeto" and not GR.objetos[lerObjTipo()] then avisar(Licenca.aviso("Esse objeto")) return elseif modo == "mapa" and (mComp() > GR.mapaMax or mLarg() > GR.mapaMax) and not string.find(U.simples(pedido), "^%s*adicion") then avisar("Na versão grátis o mapa vai até " .. GR.mapaMax .. " x " .. GR.mapaMax .. ": vou criar nesse tamanho. " .. Licenca.aviso("Mapa maior")) elseif modo == "figurantes" and fQtd() > GR.figurantesMax then avisar("Na versão grátis são até " .. GR.figurantesMax .. " figurantes por vez. " .. Licenca.aviso("Até 40 figurantes")) end end if modo == "livre" and not IA.ligada(cfg) then avisar("O Pedido livre precisa de uma inteligência artificial. Na aba ⚙️ Ajustes escolha Gemini ou Claude e cole a chave.") return end rodando, cancelar = true, false bCriar.Text = "⏳ Criando..." bCriar.BackgroundColor3 = COR.verdeEscuro bCancelar.Visible = true task.spawn(function() local titulos = { mapa = "🗺️ Mapa", objeto = "🚪 Objeto", figurantes = "🧍 Figurantes", livre = "🤖 Pedido livre", jogo = "🎮 Jogo pronto" } local gravacao = ChangeHistoryService:TryBeginRecording(Interface.NOME .. ": " .. titulos[modo]) local ok, r = pcall(function() if modo == "mapa" then local maximo = completa and math.huge or GR.mapaMax return Mapa.gerar(pedido, cfg, { comprimento = math.min(mComp(), maximo), largura = math.min(mLarg(), maximo), altura = mAlt() }, avisar, { agua = mAgua(), arvores = mArv(), pedras = mPed() }) elseif modo == "objeto" then local tipo = lerObjTipo() local comTexto = tipo == "cartaz" or tipo == "bau" return Objetos.gerar({ tipo = tipo, texto = comTexto and pedido or "", tecla = lerTecla(), n1 = oN1(), dir = lerDir() }, avisar) elseif modo == "figurantes" then local qtd = completa and fQtd() or math.min(fQtd(), GR.figurantesMax) return Objetos.figurantes({ quantidade = qtd, raio = fRaio(), estilo = lerEstilo() }, avisar) elseif modo == "jogo" then return Jogos.criar(lerJogo(), { demonstracao = jDemo() }, avisar) else return Agente.executar(pedido, { cfg = cfg, dims = { comprimento = lComp(), largura = lLarg(), altura = lAlt() }, avisar = avisar, cancelado = function() return cancelar end, foto = function(vista) local f = U.foto(vista[1], vista[2], 640) mostrarFoto(f) return f and f.png64 end, }) end end) if gravacao then ChangeHistoryService:FinishRecording(gravacao, Enum.FinishRecordingOperation.Commit) end if ok then local titulo = titulos[modo] .. (string.find(pedido, "%S") and (": " .. string.sub(pedido, 1, 60)) or "") if modo == "objeto" then for _, t in ipairs(Objetos.TIPOS) do if t.id == lerObjTipo() then titulo = t.icone .. " " .. t.nome if (t.id == "cartaz" or t.id == "bau") and string.find(pedido, "%S") then titulo ..= ": " .. string.sub(pedido, 1, 50) end end end elseif modo == "figurantes" then titulo = titulos[modo] .. ": " .. fQtd() .. " " .. lerEstilo() end table.insert(feitos, { titulo = titulo, hora = os.date("%H:%M"), apagar = r.apagar, terreno = r.terreno, vista = r.vista }) desenharFeitos() if r.vista then avisar("Mostrando o resultado...") mostrarFoto(U.foto(r.vista[1], r.vista[2], 640, false)) end avisar("✅ Pronto!" .. ((modo ~= "mapa") and " Aperte Play no Studio para ver funcionando." or "")) else avisar("❌ " .. tostring(r)) end terminar() end) end) -- ================= BIBLIOTECA ================= local cb = cartao(pBib, 1) texto(cb, "Sua biblioteca de modelos", { tamanho = 15 }) texto(cb, "Selecione um modelo no Studio, escreva o que ele é e guarde. Depois coloque cópias com um clique. O Pedido livre também enxerga a biblioteca e usa os seus modelos.", { tamanho = 13, cor = COR.suave }) local descBib = caixaTexto(cb, { dica = "O que é? Ex.: casa de madeira pequena", ordem = 3 }) local bGuardar = botao(cb, "📥 Guardar o que está selecionado", { cor = COR.verdeEscuro, corBorda = COR.verde, ordem = 4 }) local msgBib = texto(cb, "", { tamanho = 13, cor = COR.verde, ordem = 5 }) local listaBib = novo("Frame", { Parent = pBib, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = 2 }) lista(listaBib, 8) local function desenharBib() for _, f in ipairs(listaBib:GetChildren()) do if f:IsA("Frame") then f:Destroy() end end local itens = Biblioteca.lista() if #itens == 0 then local c = cartao(listaBib, 1) texto(c, "A biblioteca está vazia.", { tamanho = 13, cor = COR.suave }) end for i, item in ipairs(itens) do local c = cartao(listaBib, i) texto(c, "" .. item.nome .. "", { tamanho = 14 }) texto(c, item.descricao, { tamanho = 12, cor = COR.suave }) local linha = novo("Frame", { Parent = c, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 30) }) lista(linha, 6, true) local bColocar = botao(linha, "➕ Colocar no mapa", { size = UDim2.new(0.6, -3, 1, 0), tamanho = 13 }) aoClicar(bColocar, function() local id = ChangeHistoryService:TryBeginRecording("Colocar " .. item.nome) Biblioteca.colocar(item.objeto) if id then ChangeHistoryService:FinishRecording(id, Enum.FinishRecordingOperation.Commit) end end) local bTirar = botao(linha, "🗑 Tirar", { size = UDim2.new(0.4, -3, 1, 0), tamanho = 13, corBorda = COR.vermelho }) aoClicar(bTirar, function() local id = ChangeHistoryService:TryBeginRecording("Tirar da biblioteca " .. item.nome) Biblioteca.apagar(item.objeto) if id then ChangeHistoryService:FinishRecording(id, Enum.FinishRecordingOperation.Commit) end desenharBib() end) end end aoClicar(bGuardar, function() local id = ChangeHistoryService:TryBeginRecording("Guardar na biblioteca") local n = Biblioteca.guardarSelecionados(descBib.Text) if id then ChangeHistoryService:FinishRecording(id, Enum.FinishRecordingOperation.Commit) end msgBib.TextColor3 = n > 0 and COR.verde or COR.amarelo msgBib.Text = n > 0 and ("✔ Guardado(s): " .. n) or "Selecione um modelo no mapa (no Explorer ou clicando nele) e tente de novo." if n > 0 then descBib.Text = "" end desenharBib() end) abas.bib.aoAbrir = desenharBib -- ================= AJUSTES ================= local cLic = cartao(pAjustes, 0) texto(cLic, "⭐ Licença", { tamanho = 15 }) local estadoLic = texto(cLic, "", { tamanho = 13 }) local function pintarLicenca() if Licenca.completa(plugin) then estadoLic.Text = "✔ Versão completa ativa nesta conta Roblox. Obrigado por apoiar!" else estadoLic.Text = "Você está na versão grátis (mapas até " .. GR.mapaMax .. " x " .. GR.mapaMax .. ", porta, baú, cartaz e tocha, até " .. GR.figurantesMax .. " figurantes). A versão completa libera tudo, inclusive o Pedido livre e os jogos prontos: " .. Licenca.PRECO .. ", pagamento único, vitalícia." end end pintarLicenca() texto(cLic, "Comprar (copie o endereço e abra no navegador):", { tamanho = 12, cor = COR.suave }) local link = caixaTexto(cLic, { texto = "https://" .. Licenca.URL_COMPRA }) link.TextEditable = false link.ClearTextOnFocus = false local caixaChave = caixaTexto(cLic, { dica = "Cole aqui a sua chave (GM-XXXX-XXXX-XXXX-XXXX)", texto = Licenca.chaveGuardada(plugin) }) local bAtivar = botao(cLic, "🔑 Ativar a licença", { cor = COR.verdeEscuro, corBorda = COR.verde }) local msgLic = texto(cLic, "", { tamanho = 13 }) texto(cLic, "A chave vale para UMA conta Roblox (a primeira em que você ativar). Revenda e repasse são proibidos.", { tamanho = 12, cor = COR.suave }) aoClicar(bAtivar, function() msgLic.TextColor3 = COR.suave msgLic.Text = "Conferindo a chave..." task.spawn(function() local ok, textoR = Licenca.ativar(plugin, caixaChave.Text, Interface.VERSAO) msgLic.TextColor3 = ok and COR.verde or COR.vermelho msgLic.Text = ok and ("✔ " .. textoR .. " Abrindo a versão completa...") or ("❌ " .. textoR) pintarLicenca() if ok and reabrir then task.wait(1.5) reabrir() end end) end) local ca = cartao(pAjustes, 1) texto(ca, "Inteligência artificial (opcional)", { tamanho = 15 }) texto(ca, "Sem inteligência artificial você não gasta nada com créditos: mapas, objetos e figurantes saem só do que você escreve, sem mandar nada para a internet. Com o Gemini ou o Claude, ele entende pedidos mais difíceis e libera o Pedido livre (usa a cota ou os créditos da SUA chave).", { tamanho = 13, cor = COR.suave }) local blocoGemini, blocoClaude local lerIA = escolha(ca, { { id = "nenhuma", nome = "💚 Sem IA (grátis)" }, { id = "gemini", nome = "Gemini (Google)" }, { id = "claude", nome = "Claude (Anthropic)" }, }, cfg.ia, 3, 3, function(id) cfg.ia = id gravarAjuste("ia", id) blocoGemini.Visible, blocoClaude.Visible = id == "gemini", id == "claude" pintarSelo() aoMudarModo(lerModo()) end) local _ = lerIA local msgAjustes local function campoChave(pai, nomeAjuste, dica, formatoOk, rotulo) local atual = cfg[nomeAjuste] local estado = texto(pai, "", { tamanho = 12, cor = COR.suave }) local function mostrar() local k = cfg[nomeAjuste] estado.Text = k ~= "" and ("Chave salva: " .. string.sub(k, 1, 6) .. "••••••" .. string.sub(k, -4)) or "Nenhuma chave salva." end mostrar() local caixa = caixaTexto(pai, { dica = dica }) local linha = novo("Frame", { Parent = pai, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 32) }) lista(linha, 6, true) local bSalvar = botao(linha, "💾 Salvar chave", { size = UDim2.new(0.5, -3, 1, 0), tamanho = 13, cor = COR.verdeEscuro, corBorda = COR.verde }) local bTestar = botao(linha, "🔌 Testar", { size = UDim2.new(0.5, -3, 1, 0), tamanho = 13 }) aoClicar(bSalvar, function() local k = string.gsub(string.gsub(caixa.Text, "^%s+", ""), "%s+$", "") if k == "" then msgAjustes("Cole a chave na caixa primeiro.", COR.amarelo) return end cfg[nomeAjuste] = k gravarAjuste(nomeAjuste, k) caixa.Text = "" mostrar() pintarSelo() if formatoOk(k) then msgAjustes("✔ Chave do " .. rotulo .. " salva (só neste computador).", COR.verde) else msgAjustes("Salvei, mas essa chave não parece certa. Confira se copiou a chave inteira, sem texto junto.", COR.amarelo) end end) aoClicar(bTestar, function() msgAjustes("Testando o " .. rotulo .. "...", COR.suave) task.spawn(function() local copia = table.clone(cfg) copia.ia = nomeAjuste == "chaveGemini" and "gemini" or "claude" local ok, r = pcall(IA.perguntar, copia, "Responda só com a palavra: funcionando") if ok then msgAjustes("✔ O " .. rotulo .. " respondeu: " .. string.sub(r, 1, 60), COR.verde) else msgAjustes("❌ " .. tostring(r), COR.vermelho) end end) end) local _ = atual end blocoGemini = novo("Frame", { Parent = ca, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = 4, Visible = cfg.ia == "gemini" }) lista(blocoGemini, 6) texto(blocoGemini, "Chave do Gemini: crie de graça em aistudio.google.com/apikey (começa com AIza ou AQ.).", { tamanho = 13 }) campoChave(blocoGemini, "chaveGemini", "Cole aqui a chave do Gemini", Gemini.formatoOk, "Gemini") blocoClaude = novo("Frame", { Parent = ca, BackgroundTransparency = 1, Size = UDim2.new(1, 0, 0, 0), AutomaticSize = Enum.AutomaticSize.Y, LayoutOrder = 5, Visible = cfg.ia == "claude" }) lista(blocoClaude, 6) texto(blocoClaude, "Chave do Claude: crie em console.anthropic.com › API Keys (começa com sk-ant-). Precisa de créditos na conta.", { tamanho = 13 }) campoChave(blocoClaude, "chaveClaude", "Cole aqui a chave do Claude", Claude.formatoOk, "Claude") texto(blocoClaude, "Modelo do Claude:", { tamanho = 13, cor = COR.suave }) local opcoesClaude = {} for _, m in ipairs(Claude.MODELOS) do table.insert(opcoesClaude, { id = m.id, nome = m.nome }) end escolha(blocoClaude, opcoesClaude, cfg.modeloClaude, 20, 1, function(id) cfg.modeloClaude = id gravarAjuste("modeloClaude", id) end) local caMsg = texto(ca, "", { tamanho = 13, ordem = 30 }) function msgAjustes(t, cor) caMsg.Text = t caMsg.TextColor3 = cor or COR.texto end texto(ca, "🔒 As chaves ficam salvas só neste computador, nas configurações do Studio. Nunca vão para o jogo publicado.", { tamanho = 12, cor = COR.suave, ordem = 31 }) local cOutros = cartao(pAjustes, 2) texto(cOutros, "Mapas", { tamanho = 15 }) marcar(cOutros, "Usar árvores e pedras grátis da loja do Roblox nos mapas (mais bonitas; os scripts delas são apagados)", cfg.catalogo, 2, function(v) cfg.catalogo = v gravarAjuste("catalogo", v) end) -- ================= AJUDA ================= local cAj = cartao(pAjuda, 1) texto(cAj, "Como usar", { tamanho = 16 }) texto(cAj, table.concat({ "🗺️ Mapa — escreva como imagina o mapa (ex.: \"ilha tropical com palmeiras e praia\"), escolha o tamanho e clique em Criar. Terreno, água, árvores, pedras, clima e cenário saem prontos.", "➕ Adicionar ao mapa — no modo Mapa, comece com \"adicione\" (ou coloque, ponha): \"adicione 3 pinheiros aqui\", \"adicione tochas e ruínas\", \"adicione flores pelo mapa todo\". Mire a câmera onde quer. O terreno não muda.", "🚪 Objeto pronto — porta e janela que abrem, baú que dá item, alavanca, plataforma que se move, poste de luz, cartaz e tocha. Mire a câmera do Studio onde quer e clique em Criar. Tudo já vem funcionando: aperte Play e teste.", "🧍 Figurantes — pessoas que andam sozinhas pelo mapa. Mire a câmera no lugar e clique em Criar.", "🤖 Pedido livre — peça qualquer coisa (casas, cidades, parkour...). Precisa do Gemini ou do Claude (aba Ajustes).", "🎮 Jogo pronto — um jogo inteiro com um clique (ex.: Crowd Runner). Depois é só apertar Play.", "📚 Biblioteca — guarde os seus modelos e coloque cópias com um clique.", "Desfazer: Ctrl+Z no Studio, ou a aba 🕘 Feitos › Apagar do jogo.", "Primeira vez com IA: o Studio pergunta se o plugin pode usar a internet. Clique em Permitir.", }, "\n\n"), { tamanho = 13 }) texto(cAj, Interface.NOME .. " versão " .. Interface.VERSAO, { tamanho = 12, cor = COR.suave }) -- começa na aba Criar, modo Mapa abas.criar.abrir() if Licenca.chaveGuardada(plugin) ~= "" then task.spawn(function() local agora = Licenca.reconferir(plugin, Interface.VERSAO) if agora ~= completa and reabrir then reabrir() -- a situação mudou (ativou em outro lugar ou a chave foi bloqueada): redesenha end end) end escolherModo("mapa") aoMudarModo("mapa") avisar("Olá! Escolha o que criar, descreva e clique em ✨ Criar.") return { Close = function() cancelar = true if imagemAtual then pcall(function() imagemAtual:Destroy() end) end fundo:Destroy() end, } end return Interface end ]]>