// === BUILD PLAN ===
// Style: arctic industrial excavation facility — Valorant "Icebox" recreation
// Footprint: 176 x 166 playable. X = west->east (A site LEFT, B site RIGHT).
// Z = north->south (Defender Spawn TOP, Attacker Spawn BOTTOM).
// Height: ground pad Y=6, walk Y=7, outer boundary wall 18 tall, crane to Y~36
//
// TOP VIEW (1 char = 8 blocks, 23 cols x 21 rows; col c -> X=6+8c, row r -> Z=2+8r)
// #######################
// #....AAAA..DDDD..KKKK.# D=Defender Spawn K=B Kitchen
// #...AAAAAA.DDDD..KKKK.# A=A site complex
// #..RRAAAAA.LLbb..KKKH.# R=A Rafters L=link b=Boiler H=B Hall
// #..RRAAAAAnn=TTTT=SSSH.# n=A Nest =T= Tube over mid S=B Site
// #..PPAAAAA..MMMM.oSSSH.# P=A Pipes M=Mid o=B Orange
// #..PP.gggg..MMMM..SSSb.# g=A Generator b=B Back
// #...mmmm....MMcM..yyy..# m=A Main c=crane y=B Yellow
// #..BBB......MBMM..GGG..# B=A Belt MB=Mid Blue G=B Garage
// #..BBB......MMpM...ggg.# p=Mid Pallet g=B Green
// #..BBB......MMMM...ggg.#
// #...BBB.....MMMM...ggg.#
// #.....XXXXXXXXXXXXXX...# X=spawn approach lanes
// #......TTTTTTTTTTTT....# T=Attacker Spawn
// #######################
//
// MATERIALS PLAN:
// ground : snow_block(70)+white_concrete(15)+packed_ice(15) over packed_ice/stone - WHY: arctic shelf
// paving : light_gray_concrete(60)+gray_concrete(25)+stone(15) - WHY: man-made pads read against snow
// buildings: light_gray_concrete(45)+gray_concrete(20)+smooth_stone(20)+iron(8) - WHY: cold industrial metal
// boundary : deepslate_tiles + stone, snow-capped - WHY: dark frame contains the white field
// wood : spruce_planks + stripped_spruce_log (rafters, pallets, crates)
// accents : orange/yellow/blue/lime concrete containers (phase 3)
// PHASES: 1 planta+estructura | 2 alturas (rafters/nest/tube/boiler/crane) | 3 contenedores
// | 4 props+ziplines+detalle | 5 nieve, luces, desgaste
// === END PLAN ===
var W = 7; // walk level
var PADY = 6; // ground surface top block
// ---------- PALETTES ----------
var MSNOW = palette([{block:"snow_block",weight:68},{block:"white_concrete",weight:18},{block:"packed_ice",weight:14}]);
var MPAVE = palette([{block:"light_gray_concrete",weight:52},{block:"gray_concrete",weight:24},{block:"stone",weight:14},{block:"andesite",weight:10}]);
var MWALL = palette([{block:"light_gray_concrete",weight:44},{block:"gray_concrete",weight:22},{block:"smooth_stone",weight:20},{block:"iron_block",weight:7},{block:"white_concrete",weight:7}]);
var MDARK = palette([{block:"deepslate_tiles",weight:45},{block:"stone",weight:25},{block:"polished_deepslate",weight:20},{block:"gray_concrete",weight:10}]);
var MWOOD = palette([{block:"spruce_planks",weight:58},{block:"stripped_spruce_log",weight:26},{block:"oak_planks",weight:16}]);
var MICE = palette([{block:"packed_ice",weight:60},{block:"blue_ice",weight:25},{block:"ice",weight:15}]);
// ---------- LOCAL HELPERS ----------
function pave(x0,z0,x1,z1,pat){ fill(x0,PADY,z0,x1,PADY,z1,pat); }
function wall(x0,z0,x1,z1,h,pat){ fill(x0,W,z0,x1,W+h-1,z1,pat); }
function clr(x0,z0,x1,z1,h){ fill(x0,W,z0,x1,W+h,z1,"air"); }
function shell(x0,z0,x1,z1,h,t,pat){
fill(x0,W,z0,x1,W+h-1,z0+t-1,pat);
fill(x0,W,z1-t+1,x1,W+h-1,z1,pat);
fill(x0,W,z0,x0+t-1,W+h-1,z1,pat);
fill(x1-t+1,W,z0,x1,W+h-1,z1,pat);
}
// ================= TERRAIN =================
var h = hills({base:PADY, amp:8, scale:0.035, seed:4});
var pad = flatten(h, {x0:6, z0:2, x1:184, z1:172}, PADY, 10);
var land = zoneRect(0,0,189,175);
var groundMat = patches(["snow_block","snow_block","white_concrete","packed_ice"], 0.045, 7);
surface(land, pad, groundMat, {sub:"packed_ice", deep:"stone", depth:5, bounds:{x0:0,z0:0,x1:189,z1:175}});
checkpoint("TERRAIN");
// clear everything above the pad so nothing intrudes
fill(6, W, 2, 184, W+30, 172, "air");
pave(6,2,184,172, MSNOW);
checkpoint("CLEARED");
// ================= BOUNDARY =================
shell(6,2,184,172, 20, 3, MDARK);
fill(6,W+20,2,184,W+20,172,"snow_block");
checkpoint("BOUNDARY");
// ================= PAVED PADS =================
pave(24,38,58,70, MPAVE); // A site
pave(16,56,28,76, MPAVE); // A pipes floor
pave(30,66,48,84, MPAVE); // A main
pave(16,78,32,122, MPAVE); // A belt
pave(78,8,120,32, MPAVE); // defender spawn
pave(72,44,122,120, MPAVE); // mid
pave(128,46,162,76, MPAVE); // B site
pave(140,84,166,104, MPAVE); // B garage
pave(144,14,178,44, MPAVE); // B kitchen
pave(158,44,178,76, MPAVE); // B hall / back
pave(158,96,180,130, MPAVE); // B green
pave(58,132,128,166, MPAVE); // attacker spawn
pave(80,118,116,136, MPAVE); // mid -> spawn
pave(28,118,80,140, MPAVE); // spawn -> belt
pave(126,118,166,140, MPAVE); // spawn -> green
checkpoint("PADS");
// ================= A SITE COMPLEX =================
// north wall of A behind screens
wall(14,30,58,33,14,MWALL);
// west wall of A
wall(14,30,17,58,14,MWALL);
// A / mid divider (long wall with A Nest gap)
wall(62,26,65,40,14,MWALL);
wall(62,54,65,80,14,MWALL);
// A generator block
wall(50,60,62,72,6,MWALL);
// A pipes raised platform base
wall(16,56,28,60,4,MDARK);
// A main funnel walls
wall(30,64,33,84,12,MWALL);
wall(45,66,48,84,12,MWALL);
// A belt corridor walls
wall(13,78,16,124,12,MWALL);
wall(32,84,35,124,12,MWALL);
// A link to defender spawn (top corridor)
wall(58,20,78,23,12,MWALL);
wall(58,32,78,35,12,MWALL);
checkpoint("A_STRUCT");
// ================= DEFENDER SPAWN =================
shell(76,6,122,34, 14, 3, MWALL);
clr(80,10,118,30,12);
pave(80,10,118,30,MPAVE);
// doorways: west (A link), south (mid/boiler), east (B kitchen)
clr(74,22,82,32,7);
clr(94,30,110,38,7);
clr(118,14,128,28,7);
checkpoint("DEF_SPAWN");
// ================= MID =================
// boiler platform base
wall(96,44,118,62,8,MDARK);
// mid / B divider with B Orange gap
wall(120,40,123,58,14,MWALL);
wall(120,72,123,110,14,MWALL);
// mid south wall funnel to spawn
wall(70,110,80,113,12,MWALL);
wall(116,108,122,111,12,MWALL);
checkpoint("MID_STRUCT");
// ================= B SITE COMPLEX =================
// B kitchen building
shell(142,12,180,44, 13, 3, MWALL);
clr(146,16,176,40,11);
pave(146,16,176,40,MPAVE);
clr(140,24,148,36,7); // kitchen -> B hall/site door
clr(150,42,166,50,7); // kitchen -> hall
// B hall / back walls
wall(156,46,159,74,13,MWALL);
wall(160,74,180,77,13,MWALL);
// B site north edge
wall(124,42,156,45,13,MWALL);
// B garage
shell(138,82,168,106, 12, 3, MWALL);
clr(142,86,164,102,10);
pave(142,86,164,102,MPAVE);
clr(136,88,144,98,7);
clr(150,104,164,112,7);
// B green corridor
wall(155,98,158,132,12,MWALL);
wall(178,96,181,132,12,MWALL);
checkpoint("B_STRUCT");
// ================= ATTACKER SPAWN =================
shell(56,130,130,168, 14, 3, MWALL);
clr(60,134,126,164,12);
pave(60,134,126,164,MPAVE);
clr(52,136,62,150,7); // west exit -> belt
clr(88,126,110,136,7); // north exit -> mid
clr(124,136,134,150,7); // east exit -> green
checkpoint("ATK_SPAWN");
// ================= ICE / SNOW ACCENTS =================
noisyReplace(6,PADY,2,184,PADY,172,"snow_block", MICE, 0.10, 21);
checkpoint("DONE_PHASE1");