info = { type = "image", title = "Fire", category = "nature", author = "BRRRO", version = "1.0", license = "MIT", desc = "Campfire, fireplace or an alcohol burner", api = 33, } local px, blend = gfx.px, gfx.blend local floor, ceil, abs, sin, fmod, sqrt = math.floor, math.ceil, math.abs, math.sin, math.fmod, math.sqrt local unpack, schar, concat, hash32, umod = table.unpack, string.char, table.concat, math.hash32, math.umod local W, H, FPS = gfx.W, gfx.H, gfx.FPS local FW, FH = 48, 38 local PAL_N = 37 local N_SPARK = 6 local tr = ({ sk = { ["Intensity"] = "Intenzita", ["„random“ = changes by itself"] = "„náhodne“ = mení sa samo", ["random"] = "náhodne", ["weak"] = "slabo", ["medium"] = "stredne", ["intense"] = "silno", ["Sparks"] = "Iskry", ["flying up from the embers"] = "vzlietajú zo žeravých uhlíkov", ["Scene"] = "Scéna", ["where the fire burns"] = "kde horí oheň", ["campfire"] = "táborák", ["none"] = "žiadne", ["brick"] = "tehla", ["stone"] = "kameň", ["alcohol"] = "lieh", ["Flame"] = "Plameň", ["„drawn“ = tongues in flat bands"] = "„kreslené“ = jazyky v plochých pásoch", ["drawn"] = "kreslené", ["simulated"] = "simulované" }, cs = { ["Intensity"] = "Intenzita", ["„random“ = changes by itself"] = "„náhodně“ = mění se samo", ["random"] = "náhodně", ["weak"] = "slabě", ["medium"] = "středně", ["intense"] = "silně", ["Sparks"] = "Jiskry", ["flying up from the embers"] = "vzlétají ze žhavých uhlíků", ["Scene"] = "Scéna", ["where the fire burns"] = "kde hoří oheň", ["campfire"] = "táborák", ["none"] = "žádné", ["brick"] = "cihla", ["stone"] = "kámen", ["alcohol"] = "líh", ["Flame"] = "Plamen", ["„drawn“ = tongues in flat bands"] = "„kreslené“ = jazyky v plochých pásech", ["drawn"] = "kreslené", ["simulated"] = "simulované" }, })[lang] or {} local function T(s) return tr[s] or s end settings = { { key = "flame", type = "int", default = "random", label = T("Intensity"), hint = T("„random“ = changes by itself"), opts = { keys = { "random", "weak", "medium", "intense" }, T("random"), T("weak"), T("medium"), T("intense") } }, { key = "sparks", type = "bool", default = true, label = T("Sparks"), hint = T("flying up from the embers") }, { key = "frame", type = "int", default = "camp", label = T("Scene"), hint = T("where the fire burns"), opts = { keys = { "camp", "none", "brick", "stone", "alcohol" }, T("campfire"), T("none"), T("brick"), T("stone"), T("alcohol") } }, { key = "fire", type = "int", default = "sim", label = T("Flame"), hint = T("„drawn“ = tongues in flat bands"), opts = { keys = { "drawn", "sim" }, T("drawn"), T("simulated") } }, } local SH_RECT, SH_ARCH = 0, 1 local F_CAMP, F_NONE, F_BRICK, F_STONE, F_ALCO = "camp", "none", "brick", "stone", "alcohol" local FRAMES = { [F_CAMP] = { x = 12, y = 9, w = 40, h = 44, shape = SH_RECT, arc = 0, logs = "camp", heat = 0.00, behind = true }, [F_NONE] = { x = 0, y = 26, w = W, h = 38, shape = SH_RECT, arc = 0, logs = false, heat = 0.00 }, [F_BRICK] = { x = 8, y = 10, w = 48, h = 46, shape = SH_RECT, arc = 0, logs = true, heat = 0.00 }, [F_STONE] = { x = 9, y = 13, w = 46, h = 43, shape = SH_ARCH, arc = 15, logs = true, heat = 0.00 }, [F_ALCO] = { x = 7, y = 17, w = 50, h = 26, shape = SH_RECT, arc = 0, logs = false, heat = -0.04 }, } for k, f in pairs(FRAMES) do f.id = k end local F = FRAMES[F_CAMP] local function mix(ar, ag, ab, br, bg, bb, t) return floor(ar + (br - ar) * t), floor(ag + (bg - ag) * t), floor(ab + (bb - ab) * t) end local PAL_WOOD, PAL_ALCO, PAL_DRAWN = {}, {}, {} for i = 0, PAL_N - 1 do local t = i / (PAL_N - 1) local r, g, b if t < 0.22 then r, g, b = mix(0, 0, 0, 110, 16, 4, t / 0.22) elseif t < 0.50 then r, g, b = mix(110, 16, 4, 225, 85, 10, (t - 0.22) / 0.28) elseif t < 0.80 then r, g, b = mix(225, 85, 10, 255, 185, 35, (t - 0.50) / 0.30) else r, g, b = mix(255, 185, 35, 255, 245, 205, (t - 0.80) / 0.20) end PAL_WOOD[i * 3 + 1], PAL_WOOD[i * 3 + 2], PAL_WOOD[i * 3 + 3] = r, g, b if t < 0.18 then r, g, b = mix(0, 0, 0, 80, 26, 6, t / 0.18) elseif t < 0.45 then r, g, b = mix(80, 26, 6, 235, 120, 20, (t - 0.18) / 0.27) elseif t < 0.56 then r, g, b = mix(235, 120, 20, 255, 210, 110, (t - 0.45) / 0.11) elseif t < 0.70 then r, g, b = mix(255, 210, 110, 80, 210, 230, (t - 0.56) / 0.14) else r, g, b = mix(80, 210, 230, 40, 120, 255, (t - 0.70) / 0.30) end PAL_ALCO[i * 3 + 1], PAL_ALCO[i * 3 + 2], PAL_ALCO[i * 3 + 3] = r, g, b if t < 0.25 then r, g, b = mix(0, 0, 0, 210, 25, 15, t / 0.25) elseif t < 0.45 then r, g, b = mix(210, 25, 15, 255, 110, 10, (t - 0.25) / 0.20) elseif t < 0.70 then r, g, b = mix(255, 110, 10, 255, 195, 35, (t - 0.45) / 0.25) elseif t < 0.88 then r, g, b = mix(255, 195, 35, 255, 235, 150, (t - 0.70) / 0.18) else r, g, b = mix(255, 235, 150, 255, 250, 225, (t - 0.88) / 0.12) end PAL_DRAWN[i * 3 + 1], PAL_DRAWN[i * 3 + 2], PAL_DRAWN[i * 3 + 3] = r, g, b end local PAL = PAL_WOOD local fire, tng_row = {}, {} for i = 1, FW * FH do fire[i] = 0 end local DW, DH = 24, 19 local dfire = {} for i = 1, DW * DH do dfire[i] = 0 end local M32 = 0xFFFFFFFF local rng = 0x2545F491 local function rnd() rng = (rng ~ (rng << 13)) & M32 rng = rng ~ (rng >> 17) rng = (rng ~ (rng << 5)) & M32 return rng end local A_HOLD_MIN, A_HOLD_SPAN = gfx.FPS * 25, gfx.FPS * 60 local a_rng, a_cur, a_tgt, a_hold = 0x2545F491, 1.0, 1.0, 0 local function a_rnd() a_rng = (a_rng ~ (a_rng << 13)) & M32 a_rng = a_rng ~ (a_rng >> 17) a_rng = (a_rng ~ (a_rng << 5)) & M32 return a_rng end local LVL = { random = 0, weak = 1, medium = 2, intense = 3 } local function auto_level(opt, n) if opt > 0 and opt <= n then a_cur, a_tgt, a_hold = opt - 1, opt - 1, 0; return a_cur end if a_hold == 0 then local span = n - 1 for i = 1, 8 do local t = umod(a_rnd(), 1000) / 999.0 * span if abs(t - a_tgt) >= span * 0.30 then a_tgt = t; break end if i == 8 then a_tgt = span - a_tgt end end a_hold = A_HOLD_MIN + umod(a_rnd(), A_HOLD_SPAN) end a_hold = a_hold - 1 a_cur = a_cur + (a_tgt - a_cur) * (0.096 / FPS) return a_cur end local FLAME_BOOST = { -0.20, 0.0, 0.18 } local function amb_lerp(v, n, t) if t <= 0 then return v[1] end if t >= n - 1 then return v[n] end local i = floor(t) return v[i + 1] + (v[i + 2] - v[i + 1]) * (t - i) end local flame_lvl = 1.0 local FUEL_U, FUEL_K, FUEL_KC = {}, {}, {} for x = 0, FW - 1 do local u = x / (FW - 1) FUEL_U[x + 1] = u FUEL_K[x + 1] = 1.0 - 0.70 * (abs(u - 0.5) * 2.0) ^ 2.6 FUEL_KC[x + 1] = 1.0 - 0.98 * (abs(u - 0.5) * 2.0) ^ 1.3 end local FUEL_ROW = (FH - 1) * FW + 1 local function stoke_fuel(f) local t, g = f * 1.8 / FPS, fire local boost = amb_lerp(FLAME_BOOST, 3, flame_lvl) + F.heat local alco = F.id == F_ALCO local fk = F.behind and FUEL_KC or FUEL_K for x = 1, FW do local u = FUEL_U[x] local heat = 0.82 + 0.18 * sin(fmod(u * 6.2 + t, 6.28318)) + 0.14 * sin(fmod(u * 11.0 - t * 1.7, 6.28318)) heat = heat * fk[x] if alco and (x - 1) % 6 >= 3 then heat = heat * 0.42 end heat = heat + boost if heat < 0 then heat = 0 elseif heat > 1 then heat = 1 end g[FUEL_ROW + x - 1] = floor(heat * (PAL_N - 1)) end end local function step_fire(f) stoke_fuel(f) local g, r = fire, rng for y = FH - 1, 1, -1 do local row, above = y * FW + 1, (y - 1) * FW + 1 for x = 0, FW - 1 do local src = g[row + x] if src == 0 then g[above + x] = 0 else r = (r ~ (r << 13)) & M32 r = r ~ (r >> 17) r = (r ~ (r << 5)) & M32 local k = r % 3 if r < 0 then k = (k + 1) % 3 end local nx = x + k - 1 if nx < 0 then nx = 0 elseif nx >= FW then nx = FW - 1 end local v = src - ((r >> 8) % 3) g[above + nx] = v > 0 and v or 0 end end end rng = r end local spark = {} for i = 1, N_SPARK do spark[i] = { on = false, x = 0, y = 0, vy = 0, wob = 0 } end local function log_y() return F.y + F.h - 6 end local function step_sparks() local wspan = F.w - 12 for i = 1, N_SPARK do local s = spark[i] if not s.on then if umod(rnd(), 100) < 3 then s.on = true s.x = F.x + 6 + umod(rnd(), wspan) s.y = log_y() - 1 s.vy = -0.35 - umod(rnd(), 100) / 300.0 s.wob = umod(rnd(), 628) / 100.0 end else s.y = s.y + s.vy s.wob = s.wob + 0.25 s.vy = s.vy * 0.995 if s.y < F.y - 4 then s.on = false end end end end local function draw_sparks() local ci = (PAL_N - 6) * 3 local r, g, b = PAL[ci + 1], PAL[ci + 2], PAL[ci + 3] local span = log_y() - F.y for i = 1, N_SPARK do local s = spark[i] if s.on then local life = (s.y - (F.y - 4)) / span blend(floor(s.x + 1.6 * sin(s.wob) + 0.5), floor(s.y + 0.5), r, g, b, 0.25 + 0.75 * (life < 0 and 0 or life)) end end end local drawn = false local function draw_fire() local fh = F.h - (F.id == F_ALCO and 2 or 0) if drawn then gfx.blit_indexed(dfire, PAL, F.x, F.y, F.w, fh, DW, DH, true) else gfx.blit_indexed(fire, PAL, F.x, F.y, F.w, fh, FW, FH, true) end end local spanL, spanR = {}, {} local function build_spans() for y = 0, H - 1 do local i = y + 1 local x0, x1 = F.x, F.x + F.w local ok = not F.behind if ok and (y < F.y or y >= F.y + F.h) then ok = false elseif ok and F.shape == SH_ARCH then local hw = F.w / 2.0 local cx, cy = F.x + hw, F.y + F.arc if y < cy then local t = (cy - y) / F.arc local k = 1.0 - t * t if k <= 0 then ok = false else local half = hw * sqrt(k) x0, x1 = ceil(cx - half), floor(cx + half) end end end if not ok or x1 <= x0 or x0 >= W or x1 <= 0 then spanL[i], spanR[i] = 0, 0 else spanL[i] = x0 < 0 and 0 or x0 spanR[i] = x1 > W and W or x1 end end end local function brick_col(x, y) local row = y // 5 local off = (row & 1) == 1 and 4 or 0 if y % 5 == 0 or (x + off) % 9 == 0 then return 44, 28, 28 end if ((row + (x + off) // 9) & 1) == 1 then return 97, 51, 44 end return 82, 42, 37 end local STONE_PAL = { { 106, 101, 95 }, { 128, 121, 110 }, { 86, 84, 79 }, { 145, 136, 123 } } local function stone_col(x, y) local row = y // 6 local off = umod(hash32(row * 0x9E3779B1), 8) local u, v = (x + off) % 8, y % 6 if u == 0 or v == 0 then return 48, 46, 44 end if (u == 1 or u == 7) and (v == 1 or v == 5) then return 48, 46, 44 end local c = STONE_PAL[umod(hash32(row * 257 + (x + off) // 8), 4) + 1] return c[1], c[2], c[3] end local SKY, GROUND, GROUND_D, PEBBLE = { 18, 14, 60 }, { 52, 46, 48 }, { 30, 26, 30 }, { 84, 78, 80 } local CAMP_GY = 54 local function camp_col(x, y) if y < CAMP_GY then return SKY[1], SKY[2], SKY[3] end local h = umod(hash32(y * 0x9E3779B1 + x * 131), 9) if h == 0 then return PEBBLE[1], PEBBLE[2], PEBBLE[3] end if h % 3 == 0 then return GROUND_D[1], GROUND_D[2], GROUND_D[3] end return GROUND[1], GROUND[2], GROUND[3] end local A_BX, A_BY, A_BW, A_BH = 4, 13, 56, 34 local function alco_col(x, y) if x >= A_BX and x < A_BX + A_BW and y >= A_BY and y < A_BY + A_BH then if x == A_BX or x == A_BX + A_BW - 1 or y == A_BY or y == A_BY + A_BH - 1 then return 96, 100, 110 end return 26, 26, 30 end if y >= A_BY + A_BH and y < A_BY + A_BH + 3 and x >= A_BX + 2 and x < A_BX + A_BW - 2 then local d = y - (A_BY + A_BH) if d == 0 then return 12, 11, 10 end if d == 1 then return 20, 19, 18 end return 28, 26, 24 end return 34, 32, 30 end local MAT = { [F_CAMP] = { col = camp_col, out = { 0, 0, 0 }, t = 0, flat = CAMP_GY }, [F_BRICK] = { col = brick_col, out = { 44, 28, 28 }, t = 1 }, [F_STONE] = { col = stone_col, out = { 48, 46, 44 }, t = 1 }, [F_ALCO] = { col = alco_col, out = { 116, 120, 130 }, t = 1 }, } local FGRID = "" local FPAL = { 0, 0, 0 } local fpal_n, fpal_ix = 1, {} local function fidx(r, g, b) local key = (r << 16) | (g << 8) | b local i = fpal_ix[key] if not i then i = fpal_n if i > 255 then return 1 end FPAL[i * 3 + 1], FPAL[i * 3 + 2], FPAL[i * 3 + 3] = r, g, b fpal_ix[key], fpal_n = i, i + 1 end return i end local function build_frame() FGRID = "" local m = MAT[F.id] if not m then return end FPAL, fpal_n, fpal_ix = { 0, 0, 0 }, 1, {} local col, t = m.col, m.t local orr, org, orb = m.out[1], m.out[2], m.out[3] local rows, row = {}, {} for y = 0, H - 1 do if m.flat and y < m.flat then rows[y + 1] = schar(fidx(col(0, y))):rep(W) else local yl, yr = spanL[y + 1], spanR[y + 1] for x = 0, W - 1 do local v if x >= yl and x < yr then v = 0 else local edge = false for dy = -t, t do local l, r = spanL[y + dy + 1], spanR[y + dy + 1] if l and r > l and x + t >= l and x - t < r then edge = true; break end end if edge then v = fidx(orr, org, orb) else v = fidx(col(x, y)) end end row[x + 1] = v end rows[y + 1] = schar(unpack(row, 1, W)) end end FGRID = concat(rows) end local function draw_frame() if FGRID ~= "" then gfx.blit_indexed(FGRID, FPAL, 0, 0, W, H, W, H, true) end end local BARK, BARK_D, BARK_L = { 58, 34, 22 }, { 34, 19, 12 }, { 92, 56, 32 } local function draw_log(x, y, w, body, top, bot) gfx.rect(x, y, w, 1, top[1], top[2], top[3]) gfx.rect(x, y + 1, w, 2, body[1], body[2], body[3]) gfx.rect(x, y + 3, w, 1, bot[1], bot[2], bot[3]) gfx.rect(x - 1, y + 1, 1, 2, bot[1], bot[2], bot[3]) gfx.rect(x + w, y + 1, 1, 2, bot[1], bot[2], bot[3]) end local function embers(f, x0, dx, y0, n) local ci = (PAL_N - 10) * 3 local r, g, b = PAL[ci + 1], PAL[ci + 2], PAL[ci + 3] for i = 0, n do local k = 0.55 + 0.45 * sin(fmod(f * 3.6 / FPS + i * 1.3, 6.28318)) blend(x0 + i * dx // n, y0 + (i % 2), r, g, b, 0.35 + 0.55 * k) end end local function draw_logs(f) local y0 = log_y() local half = F.w // 2 draw_log(F.x + 4, y0 + 2, half + 2, BARK, BARK_L, BARK_D) draw_log(F.x + half - 4, y0, half, BARK_D, BARK_L, BARK_D) embers(f, F.x + 6, F.w - 12, y0 + 4, 8) end local function log_line(x0, y0, x1, y1, th) local n = abs(x1 - x0) local sx = x1 > x0 and 1 or -1 for i = 0, n do local x = x0 + i * sx local y = floor(y0 + (y1 - y0) * i / n + 0.5) px(x, y, BARK_L[1], BARK_L[2], BARK_L[3]) gfx.rect(x, y + 1, 1, th - 2, BARK[1], BARK[2], BARK[3]) px(x, y + th - 1, BARK_D[1], BARK_D[2], BARK_D[3]) end gfx.rect(x0, y0, 2, th, BARK_L[1], BARK_L[2], BARK_L[3]) end local function draw_camp_logs(f) local cx = F.x + F.w // 2 local y0 = CAMP_GY - 6 log_line(cx - 17, y0 + 4, cx + 4, y0 - 1, 4) log_line(cx + 17, y0 + 4, cx - 4, y0 - 1, 4) log_line(cx - 12, y0 + 6, cx + 10, y0 + 6, 3) embers(f, cx - 9, 18, y0 + 1, 6) end local N_STAR = 16 local ST_X, ST_Y, ST_SP, ST_PH = {}, {}, {}, {} for i = 1, N_STAR do local h = hash32(i * 0x9E3779B1) local x, y for _ = 1, 8 do x, y = math.random(0, W - 1), math.random(0, CAMP_GY - 13) local free = true for j = 1, i - 1 do if abs(ST_X[j] - x) < 3 and abs(ST_Y[j] - y) < 3 then free = false; break end end if free then break end end ST_X[i], ST_Y[i] = x, y ST_SP[i], ST_PH[i] = (0.6 + umod(h >> 4, 30) * 0.03) / FPS, umod(h >> 16, 628) / 100.0 end local function draw_stars(f) for i = 1, N_STAR do local k = 0.5 + 0.5 * sin(fmod(f * ST_SP[i] + ST_PH[i], 6.28318)) blend(ST_X[i], ST_Y[i], 220, 228, 255, 0.25 + 0.75 * k) end end local function draw_burner() local y0, x0, w = F.y + F.h - 2, F.x + 3, F.w - 6 gfx.rect(x0, y0, w, 1, 124, 128, 138) gfx.rect(x0, y0 + 1, w, 1, 48, 50, 56) for x = x0 + 2, x0 + w - 2, 6 do px(x, y0, 20, 20, 24) end end local N_TONGUE = 5 local T_X, T_H, T_W, T_S, T_PH, T_SP = {}, {}, {}, {}, {}, {} for i = 1, N_TONGUE do local u = (i - 0.5) / N_TONGUE local mid = 1.0 - abs(u - 0.5) * 2.0 T_X[i] = DW * 0.5 + (u - 0.5) * DW * 0.58 T_H[i] = (DH - 1) * (0.50 + 0.50 * mid ^ 0.5) T_W[i] = 2.5 + 3.0 * mid T_S[i] = 0.8 + 1.8 * (1.0 - mid) T_PH[i] = u * 5.7 T_SP[i] = (3 + 1.8 * u) / FPS end local T_BAND = { 10, 15, 21, 27, 32, 36 } local function step_drawn(f, boost) local g, fld, base = dfire, tng_row, DH - 1 for i = 1, DW * DH do g[i] = 0 end for j = 0, DH - 2 do local row = (base - j) * DW + 1 local a, e = DW, -1 for x = 0, DW - 1 do fld[x + 1] = 0 end for i = 1, N_TONGUE do local ph = fmod(T_PH[i] + f * T_SP[i], 6.28318) local hh = T_H[i] * (0.80 + 0.20 * sin(ph)) * (1.0 + boost) if j < hh then local v = j / hh local w = T_W[i] * (1.0 - v) ^ 0.62 * (1.0 + 0.22 * sin(v * 5.5 + ph * 2.0)) if w >= 0.6 then local c = T_X[i] + T_S[i] * v * v * sin(ph * 1.3 + v * 2.4) local hot = 1.0 - v * 0.82 local i0, i1 = ceil(c - w), floor(c + w) if i0 < 0 then i0 = 0 end if i1 > DW - 1 then i1 = DW - 1 end if i0 < a then a = i0 end if i1 > e then e = i1 end for x = i0, i1 do local d = (x - c) / w local k = hot * (1.0 - d * d) if k > 0 then fld[x + 1] = fld[x + 1] + k end end end end end for x = a, e do local k = fld[x + 1] if k > 0 then local q = floor(k * 4.0) + 1 if q > 6 then q = 6 end g[row + x] = T_BAND[q] end end end end local GLOW = "" local GR_X, GR_Y = 22, 19 local function build_glow() local cx, cy = F.x + F.w / 2.0, log_y() - 6.0 local x0, x1 = math.max(0, ceil(cx - GR_X)), math.min(W - 1, floor(cx + GR_X)) local y0, y1 = math.max(F.id == F_CAMP and CAMP_GY or 0, ceil(cy - GR_Y)), math.min(H - 1, floor(cy + GR_Y)) local zrow = ("\0"):rep(W) local rows, row = {}, {} for x = 1, W do row[x] = 0 end for y = 0, H - 1 do if y < y0 or y > y1 then rows[y + 1] = zrow else local dy = (y - cy) / GR_Y local dy2 = dy * dy for x = x0, x1 do local dx = (x - cx) / GR_X local k = 1.0 - sqrt(dx * dx + dy2) row[x + 1] = k > 0 and floor(k * 255 + 0.5) or 0 end rows[y + 1] = schar(unpack(row, 1, W)) end end GLOW = concat(rows) end local GLOW_MID = floor(FH / 3) * FW + 1 local GLOW_MIDD = floor(DH / 3) * DW + 1 local function draw_glow() local sum = 0 local g, n, o = fire, FW, GLOW_MID if drawn then g, n, o = dfire, DW, GLOW_MIDD end for x = 0, n - 1 do sum = sum + g[o + x] end local lvl = sum / (n * (PAL_N - 1)) gfx.blend_mask(GLOW, 255, 170, 70, 0, 0, W, H, W, H, 0.30 * (0.72 + 0.28 * lvl)) end function on_settings() F = FRAMES[cfg.frame] or FRAMES[F_CAMP] drawn = cfg.fire == "drawn" PAL = F.id == F_ALCO and PAL_ALCO or (drawn and PAL_DRAWN or PAL_WOOD) for i = 1, FW * FH do fire[i] = 0 end for i = 1, DW * DH do dfire[i] = 0 end if not drawn then for x = 0, FW - 1 do fire[(FH - 1) * FW + x + 1] = PAL_N - 1 end end build_spans() build_frame() build_glow() end function update() flame_lvl = auto_level(LVL[cfg.flame] or 2, 3) if drawn then step_drawn(frame, amb_lerp(FLAME_BOOST, 3, flame_lvl) + F.heat) else step_fire(frame) end step_sparks() end function render() gfx.clear(0, 0, 0) if F.behind then draw_frame() draw_stars(frame) end draw_fire() if F.logs == "camp" then draw_camp_logs(frame) elseif F.logs then draw_logs(frame) elseif F.id == F_ALCO then draw_burner() end if cfg.sparks and F.id ~= F_ALCO then draw_sparks() end if not F.behind then draw_frame() end draw_glow() end