feat(lua-games): полный паритет для игры 14 «Собери по тегам»

JS:
- 7 жёлтых звёзд-конусов + 5 синих кубов-обманок
- showText 'Собери все ЖЁЛТЫЕ звёзды!'
- main помечает звёзды тегом 'звезда' с задержкой 0.2с
- onMessage 'collected' → score++ + при 0 left — победа+confetti
- star: onTouch → untag + delete + broadcast 'collected'

Lua (паритет):
- 7 g14_star_N через генератор (раньше был один g14_star)
- ScreenGui 'Звёзды: N / 7' счётчик
- BindableEvent StarCollected
- main: task.delay(0.2) → AddTag всем 7 звёздам через workspace:FindFirstChild
- При collect → coin Sound + GetTagged-проверка left==0 → win+confetti
- g14_star_N: RemoveTag + Destroy + ev:Fire (с picked-флагом)
This commit is contained in:
min 2026-06-09 19:38:55 +03:00
parent 1a3c8e66e6
commit cc5717f5a3

View File

@ -1191,37 +1191,88 @@ end)`,
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
// ИГРА 14 — «Собери по тегу» // ИГРА 14 — «Собери по тегу»
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
'collect-by-tag': { 'collect-by-tag': (function() {
g14_main: `-- === ИГРА «СОБЕРИ ПО ТЕГУ» (Lua) === const TOTAL = 7;
local CollectionService = game:GetService("CollectionService") const overrides = {
g14_main: `-- === ИГРА «СОБЕРИ ПО ТЕГАМ» — главный скрипт (Lua) ===
${SNIPPET_BROADCAST} ${SNIPPET_BROADCAST}
local total = #CollectionService:GetTagged("звезда") local CollectionService = game:GetService("CollectionService")
local collected = 0 local Players = game:GetService("Players")
print("Собери все " .. total .. " звёзд!") local player = Players.LocalPlayer
local TOTAL = ${TOTAL}
local won = false
local ev = getEvent("StarCollected") __rbxl_show_text("Собери все ЖЁЛТЫЕ звёзды!", 3)
ev.Event:Connect(function()
collected = collected + 1 -- Счётчик в правом верхнем углу
print("Собрано: " .. collected .. "/" .. total) local screenGui = Instance.new("ScreenGui", player.PlayerGui)
if collected >= total then local label = Instance.new("TextLabel", screenGui)
print("ПОБЕДА! Все звёзды собраны!") label.Size = UDim2.new(0, 220, 0, 50)
label.Position = UDim2.new(1, -240, 0, 20)
label.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
label.BackgroundTransparency = 0.4
label.TextColor3 = Color3.fromRGB(255, 215, 0)
label.TextScaled = true
label.Font = Enum.Font.SourceSansBold
label.Text = "Звёзды: 0 / " .. TOTAL
local coinSound = Instance.new("Sound", workspace)
coinSound.SoundId = "coin"; coinSound.Volume = 0.8
local winSound = Instance.new("Sound", workspace)
winSound.SoundId = "win"; winSound.Volume = 1
-- Помечаем все звёзды тегом 'звезда' (с небольшой задержкой
-- скрипты звёзд должны успеть запуститься и зарегистрировать part).
task.delay(0.2, function()
for i = 1, TOTAL do
local star = workspace:FindFirstChild("Звезда_" .. i)
if star then CollectionService:AddTag(star, "звезда") end
end
end)
-- Звёзды сообщают о сборе. Главный скрипт считает оставшиеся через
-- CollectionService:GetTagged паритет с JS game.scene.getTagged.
local collectEvent = getEvent("StarCollected")
collectEvent.Event:Connect(function()
if won then return end
local left = #CollectionService:GetTagged("звезда")
label.Text = "Звёзды: " .. (TOTAL - left) .. " / " .. TOTAL
coinSound:Play()
if left == 0 then
won = true
winSound:Play()
__rbxl_show_text("Победа! Все звёзды собраны!", 5)
local px = __rbxl_player_x()
local py = __rbxl_player_y()
local pz = __rbxl_player_z()
__rbxl_spawn_particles("confetti", px, py + 3, pz, 3, 3)
end end
end)`, end)`,
g14_star: `-- === Скрипт звезды (Lua) === };
// Скрипт каждой звезды — одинаковый: на touch → untag + destroy + Fire
const starScript = `-- === Скрипт звезды (Lua) ===
local CollectionService = game:GetService("CollectionService") local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ReplicatedStorage = game:GetService("ReplicatedStorage")
local part = script.Parent local part = script.Parent
CollectionService:AddTag(part, "звезда") local picked = false
part.Touched:Connect(function(hit) part.Touched:Connect(function(hit)
if picked then return end
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid") local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
if not h then return end if not h then return end
picked = true
-- Снимаем тег и удаляем звезду, потом шлём событие.
CollectionService:RemoveTag(part, "звезда")
part:Destroy()
local ev = ReplicatedStorage:FindFirstChild("StarCollected") local ev = ReplicatedStorage:FindFirstChild("StarCollected")
if ev then ev:Fire() end if ev then ev:Fire() end
part:Destroy() end)`;
end)`, for (let i = 1; i <= TOTAL; i++) {
}, overrides['g14_star_' + i] = starScript;
}
return overrides;
})(),
// ═══════════════════════════════════════════════════════════════ // ═══════════════════════════════════════════════════════════════
// ИГРА 15 — «Тир» // ИГРА 15 — «Тир»