feat(g22): полный паритет «Зона опасности»
JS: - showText 'Пробеги через красную зону к финишу!' - every(0.6): если inZone — damage(12) + hit - onMessage 'zone-enter' → inZone=true + 'Опасно! Беги быстрее!' - onMessage 'zone-leave' → inZone=false - onMessage 'win' → 'Победа!' + win + confetti - g22_zone: onTouch → 'zone-enter', onUntouch → 'zone-leave' - g22_heal: onTouch → heal(60) + '+60 HP' + pickup + delete - g22_finish: onTouch → 'win' Lua (паритет): - __rbxl_show_text + Sounds - BindableEvents ZoneEnter/ZoneLeave/WinReached - Heartbeat-таймер 0.6с для урона пока inZone - g22_zone: Touched/TouchEnded → ev:Fire - g22_heal: Touched → __rbxl_heal_player(60) + pickup Sound + Destroy - g22_finish: Touched → WinReached:Fire Shim добавил __rbxl_heal_player(amount) → cmd 'player.heal'.
This commit is contained in:
parent
cbc4b87643
commit
59769932e5
@ -1860,28 +1860,104 @@ end)`,
|
|||||||
// ИГРА 22 — «Опасная зона»
|
// ИГРА 22 — «Опасная зона»
|
||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
'danger-zone': {
|
'danger-zone': {
|
||||||
g22_main: `-- === ИГРА «ОПАСНАЯ ЗОНА» (Lua) ===
|
g22_main: `-- === ИГРА «ЗОНА ОПАСНОСТИ» — главный скрипт (Lua) ===
|
||||||
print("Не стой в красной зоне!")`,
|
${SNIPPET_BROADCAST}
|
||||||
g22_zone: `-- === Скрипт опасной зоны (Lua) ===
|
|
||||||
|
local RunService = game:GetService("RunService")
|
||||||
|
local inZone = false
|
||||||
|
local won = false
|
||||||
|
local damageTimer = 0
|
||||||
|
|
||||||
|
__rbxl_show_text("Пробеги через красную зону к финишу!", 3)
|
||||||
|
|
||||||
|
local hitSound = Instance.new("Sound", workspace)
|
||||||
|
hitSound.SoundId = "hit"; hitSound.Volume = 0.6
|
||||||
|
local winSound = Instance.new("Sound", workspace)
|
||||||
|
winSound.SoundId = "win"; winSound.Volume = 1
|
||||||
|
|
||||||
|
-- Слушатели событий зоны
|
||||||
|
local enterEvent = getEvent("ZoneEnter")
|
||||||
|
enterEvent.Event:Connect(function()
|
||||||
|
inZone = true
|
||||||
|
__rbxl_show_text("Опасно! Беги быстрее!", 1.5)
|
||||||
|
end)
|
||||||
|
local leaveEvent = getEvent("ZoneLeave")
|
||||||
|
leaveEvent.Event:Connect(function()
|
||||||
|
inZone = false
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Урон каждые 0.6с пока игрок в зоне
|
||||||
|
RunService.Heartbeat:Connect(function(dt)
|
||||||
|
if won then return end
|
||||||
|
if not inZone then return end
|
||||||
|
damageTimer = damageTimer + (dt or 0.016)
|
||||||
|
if damageTimer >= 0.6 then
|
||||||
|
damageTimer = 0
|
||||||
|
__rbxl_damage_player(12)
|
||||||
|
hitSound:Play()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Финиш сообщает о победе
|
||||||
|
local winEvent = getEvent("WinReached")
|
||||||
|
winEvent.Event:Connect(function()
|
||||||
|
if won then return end
|
||||||
|
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)`,
|
||||||
|
g22_zone: `-- === Скрипт зоны опасности (Lua) ===
|
||||||
|
-- Touched при входе, TouchEnded при выходе.
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
local part = script.Parent
|
local part = script.Parent
|
||||||
local insiders = {}
|
|
||||||
|
|
||||||
part.Touched:Connect(function(hit)
|
part.Touched:Connect(function(hit)
|
||||||
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||||
if h then insiders[h] = true end
|
if not h then return end
|
||||||
|
local ev = ReplicatedStorage:FindFirstChild("ZoneEnter")
|
||||||
|
if ev then ev:Fire() end
|
||||||
end)
|
end)
|
||||||
part.TouchEnded:Connect(function(hit)
|
part.TouchEnded:Connect(function(hit)
|
||||||
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||||
if h then insiders[h] = nil end
|
if not h then return end
|
||||||
end)
|
local ev = ReplicatedStorage:FindFirstChild("ZoneLeave")
|
||||||
|
if ev then ev:Fire() end
|
||||||
|
end)`,
|
||||||
|
g22_heal: `-- === Скрипт аптечки (Lua) ===
|
||||||
|
local part = script.Parent
|
||||||
|
local taken = false
|
||||||
|
|
||||||
-- Урон каждые 0.5 сек пока стоят
|
part.Touched:Connect(function(hit)
|
||||||
while true do
|
if taken then return end
|
||||||
task.wait(0.5)
|
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||||
for h in pairs(insiders) do
|
if not h then return end
|
||||||
if h.Parent then h:TakeDamage(5) end
|
taken = true
|
||||||
end
|
-- Лечим на 60 HP (через damage с отрицательным значением неудобно;
|
||||||
end`,
|
-- используем напрямую player.Health прибавлением).
|
||||||
|
__rbxl_heal_player(60)
|
||||||
|
__rbxl_show_text("+60 HP", 1.5)
|
||||||
|
local pickupSound = Instance.new("Sound", part)
|
||||||
|
pickupSound.SoundId = "pickup"; pickupSound.Volume = 0.8
|
||||||
|
pickupSound:Play()
|
||||||
|
part:Destroy()
|
||||||
|
end)`,
|
||||||
|
g22_finish: `-- === Скрипт финиша (Lua) ===
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
local part = script.Parent
|
||||||
|
local fired = false
|
||||||
|
|
||||||
|
part.Touched:Connect(function(hit)
|
||||||
|
if fired then return end
|
||||||
|
local h = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
|
||||||
|
if not h then return end
|
||||||
|
fired = true
|
||||||
|
local ev = ReplicatedStorage:FindFirstChild("WinReached")
|
||||||
|
if ev then ev:Fire() end
|
||||||
|
end)`,
|
||||||
},
|
},
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════
|
||||||
|
|||||||
@ -1961,6 +1961,10 @@ export function registerRobloxShim(lua, opts) {
|
|||||||
global.set('__rbxl_damage_player', (amount) => {
|
global.set('__rbxl_damage_player', (amount) => {
|
||||||
send('player.damage', { amount: Number(amount) || 0 });
|
send('player.damage', { amount: Number(amount) || 0 });
|
||||||
});
|
});
|
||||||
|
// Лечение игрока — паритет с JS game.player.heal(amount).
|
||||||
|
global.set('__rbxl_heal_player', (amount) => {
|
||||||
|
send('player.heal', { amount: Number(amount) || 0 });
|
||||||
|
});
|
||||||
// Подброс игрока — паритет с JS game.player.boostJump(strength).
|
// Подброс игрока — паритет с JS game.player.boostJump(strength).
|
||||||
// 1.0 = обычный прыжок, 3.0 = втрое выше, и т.д.
|
// 1.0 = обычный прыжок, 3.0 = втрое выше, и т.д.
|
||||||
global.set('__rbxl_boost_jump', (strength) => {
|
global.set('__rbxl_boost_jump', (strength) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user