PageSourceSearch

https://cdn.v1v2.io/_next/static/chunks/pages/games/tower-69d332e0335fe8bd.js

js v1v2.io collected 2026-09-25 21:07:16 UTC 21,782 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5883],{67632:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/games/tower",function(){return r(95103)}])},45822:(e,t,r)=>{"use strict";r.d(t,{R:()=>b,A:()=>C});var o=r(74848),l=r(45703),s=r.n(l),a=r(96540),n=r(50303),i=r(40118),c=r(48706),d=r(93809),h=r(78113),p=r(17335),x=r(31849),m=r(39437);let u=e=>{let{children:t,...r}=e,[l,s]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{s(!0)},[]),l)?(0,o.jsx)(a.Fragment,{...r,children:t}):null};var y=r(19118),j=r(60067),f=r(79644);let g=()=>{let{progress:e,active:t}=(0,j.p)();return(0,o.jsx)(f.E,{center:!0,children:t&&(0,o.jsxs)("div",{style:{color:"white",width:"200px",textAlign:"center"},children:[Math.round(e),"% loaded"]})})};var w=r(91876),z=r(91588),v=r(73374);let b=()=>{let{areStatsEnabled:e,areStatsMinimal:t}=(0,w.sd)();return(0,o.jsx)(x.w,{position:"bottom-left",minimal:t,...!e&&{style:{display:"none"}}})},S=(0,a.forwardRef)((e,t)=>{let{sessionInit:r={optionalFeatures:["local-floor","bounded-floor","hand-tracking","layers"]},children:l,...s}=e;return(0,o.jsx)(p.jo,{...s,ref:t,mode:"VR",sessionInit:r,children:l})}),C=e=>{let{children:t,canvasProps:r={}}=e,[l,x]=(0,a.useState)(!1),[j,f]=(0,a.useState)(!1);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(n.z,{pos:"absolute",top:3,right:3,zIndex:10,children:[(0,o.jsx)(i.m,{label:l?"Hide stats":"Show stats",children:(0,o.jsx)(c.K,{"aria-label":"Enable stats",icon:(0,o.jsx)(d.I,{as:z.BJM}),colorScheme:"blackAlpha",onClick:()=>{l&&j?x(!1):l&&!j?f(!0):l||(f(!1),x(!0))}})}),(0,o.jsx)(i.m,{label:"Enter VR",children:(0,o.jsx)(c.K,{"aria-label":"Enter VR",icon:(0,o.jsx)(d.I,{as:v.Goo}),as:S,colorScheme:"blackAlpha"})}),(0,o.jsx)(y.A,{})]}),(0,o.jsx)(u,{children:(0,o.jsx)(h.Hl,{shadows:{type:m.BasicShadowMap},...r,children:(0,o.jsx)(p.XR,{children:(0,o.jsx)(w.Sd,{value:!0,children:(0,o.jsx)(w.nB,{value:{areStatsEnabled:l,areStatsMinimal:j},children:(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(g,{}),children:t})})})})})}),(0,o.jsx)(s(),{id:"86f489856916a0a0",children:"html,body,#__next{height:100%}body{margin:0;background:#222;font-family:sans-serif}canvas{width:100%;height:100vh;outline:none;-webkit-tap-highlight-color:rgba(255,255,255,0)}.stats{top:initial!important;right:auto;left:0!important;bottom:105px!important}"})]})}},19118:(e,t,r)=>{"use strict";r.d(t,{A:()=>d});var o=r(74848),l=r(96540),s=r(40118),a=r(48706),n=r(93809),i=r(92946),c=r(91588);let d=e=>{let{isFullscreen:t,toggleFullscreen:r}=(0,i.Hr)();return(0,l.useEffect)(()=>{if(t){var e,r;null===(r=screen)||void 0===r||null===(e=r.orientation)||void 0===e||e.lock("landscape-primary")}},[t]),(0,o.jsx)(s.m,{label:t?"Exit fullscreen":"Enter fullscreen",children:(0,o.jsx)(a.K,{colorScheme:"blackAlpha","aria-label":t?"Exit fullscreen":"Enter fullscreen",icon:(0,o.jsx)(n.I,{as:t?c.Llp:c.T$Z,boxSize:7}),onClick:r,...e})})}},31860:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let o={Early:-5,Physics:-4,Normal:-3,Late:-2,Render:-1,Destruction:0}},91876:(e,t,r)=>{"use strict";r.d(t,{GW:()=>c,Sd:()=>i,nB:()=>a,sd:()=>s});var o=r(96540);let l=(0,o.createContext)({}),s=()=>(0,o.useContext)(l),a=l.Provider,n=(0,o.createContext)(!1),i=n.Provider,c=()=>(0,o.useContext)(n)},92946:(e,t,r)=>{"use strict";r.d(t,{Hr:()=>a,hY:()=>n});var o=r(96540),l=r(85164),s=r(92267);r(81440);let a=()=>{let[e,{on:t,off:r}]=(0,l.C)(!1),s=()=>document.documentElement.requestFullscreen(),a=()=>document.exitFullscreen(),n=(0,o.useCallback)(()=>document.fullscreenElement?t():r(),[]);return(0,o.useEffect)(()=>(document.addEventListener("fullscreenchange",n),()=>{document.removeEventListener("fullscreenchange",n)}),[]),{isFullscreen:e,enterFullscreen:s,exitFullscreen:a,toggleFullscreen:e?a:s}},n=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=(0,o.useRef)(0);(0,s.A)((r,o,s)=>{l.current>t/1e3?(l.current=0,e(r,o,s)):l.current+=o},r)}},81440:(e,t,r)=>{"use strict";r.d(t,{PU:()=>l,Qx:()=>o,pi:()=>s});let o=e=>{let{x:t,y:r,z:o}=e;return[t,r,o]},l=(e,t)=>{let r=t.x-e.x,o=t.y-e.y,l=t.z-e.z;return Math.sqrt(r*r+o*o+l*l)},s=Math.PI},96287:(e,t,r)=>{"use strict";r.d(t,{t:()=>s});var o=r(92267),l=r(31860);let s=(e,t,r,s)=>{(0,o.A)((o,l)=>{for(let t of r)t.selfDestruct-=1e3*l,t.selfDestruct<=0&&!t.toBeDestroyed&&e(t);for(let e of s)t(e)},l.A.Destruction)}},47226:(e,t,r)=>{"use strict";r.d(t,{J:()=>n});var o=r(92267),l=r(52790),s=r(31860);let a=(e,t)=>{let r=60*t;(0,l.t2)(e.scaVel.all)&&(e.tra.sca.all+=e.scaVel.all*r),(0,l.t2)(e.scaVel.x)&&(e.tra.sca.x+=e.scaVel.x*r),(0,l.t2)(e.scaVel.y)&&(e.tra.sca.y+=e.scaVel.y*r),(0,l.t2)(e.scaVel.z)&&(e.tra.sca.z+=e.scaVel.z*r)},n=e=>{(0,o.A)((t,r)=>{for(let t of e)a(t,r)},s.A.Early)}},75635:(e,t,r)=>{"use strict";r.d(t,{z:()=>n});var o=r(92267),l=r(52790),s=r(31860);let a=e=>{(0,l.t2)(e.tra.pos.x)&&(e.three.position.x=e.tra.pos.x),(0,l.t2)(e.tra.pos.y)&&(e.three.position.y=e.tra.pos.y),(0,l.t2)(e.tra.pos.z)&&(e.three.position.z=e.tra.pos.z),(0,l.t2)(e.tra.rot.x)&&(e.three.rotation.x=e.tra.rot.x),(0,l.t2)(e.tra.rot.y)&&(e.three.rotation.y=e.tra.rot.y),(0,l.t2)(e.tra.rot.z)&&(e.three.rotation.z=e.tra.rot.z),(0,l.t2)(e.tra.sca.all)&&(e.three.scale.x=e.tra.sca.all),(0,l.t2)(e.tra.sca.all)&&(e.three.scale.y=e.tra.sca.all),(0,l.t2)(e.tra.sca.all)&&(e.three.scale.z
1=e.tra.sca.all),(0,l.t2)(e.tra.sca.x)&&(e.three.scale.x=e.tra.sca.x),(0,l.t2)(e.tra.sca.y)&&(e.three.scale.y=e.tra.sca.y),(0,l.t2)(e.tra.sca.z)&&(e.three.scale.z=e.tra.sca.z)},n=e=>{(0,o.A)(()=>{for(let t of e)a(t)},s.A.Render)}},37741:(e,t,r)=>{"use strict";r.d(t,{JT:()=>s,PB:()=>a});var o=r(44745),l=r(87134);let s=e=>t=>(0,l.lt)(t,{name:e}),a=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),l=1;l<t;l++)r[l-1]=arguments[l];let s=r.reduce((e,t)=>t(e),e);return(0,o.Ay)(s)}},95103:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>tg});var o=r(74848),l=r(45703),s=r.n(l),a=r(96540),n=r(92433),i=r(17995),c=r(92267),d=r(17335),h=r(59565),p=r(86129),x=r(49497),m=r(27864),u=r(39437);let y=new u.PlaneGeometry(1,1),j=new u.BoxGeometry(1,1,1),f=new u.BoxGeometry(9,9,5),g=new u.SphereGeometry(3,16),w=new u.MeshStandardMaterial({color:"#161616"}),z=new u.MeshStandardMaterial({color:"#555"}),v=new u.MeshStandardMaterial({color:"#f0f"}),b=new u.MeshStandardMaterial({color:"#0f0"}),S=new u.MeshStandardMaterial({color:"#000"}),C=new u.MeshStandardMaterial({color:"#f00"}),k=new u.MeshStandardMaterial({color:"#00f"});new u.MeshStandardMaterial({color:"#fff",wireframe:!0});let M=new u.MeshBasicMaterial({color:"#0f0"}),E=new u.MeshBasicMaterial({color:"#f60",transparent:!0,opacity:.8}),A={simple:{color:"#00ff00",material:b,geometry:g,reloadTime:200,damage:10,range:30,cost:10,projectileOriginY:6},splash:{color:"#ff0000",material:C,geometry:g,reloadTime:500,damage:10,range:20,cost:20,splashRange:20,projectileOriginY:5.2},strong:{color:"#0000ff",material:k,geometry:g,reloadTime:1e3,damage:100,range:40,cost:50,projectileOriginY:12}},_={basic:{color:"#0f0",material:b,geometry:j,hpFactor:1,speed:.012,killRewardFactor:1,size:1},fast:{color:"#f0f",material:v,geometry:j,hpFactor:.5,speed:.024,killRewardFactor:1,size:.75},tank:{color:"#f00",material:C,geometry:j,hpFactor:3,speed:.01,killRewardFactor:2,size:1.25},boss:{color:"#000",material:S,geometry:j,hpFactor:10,speed:.008,killRewardFactor:10,size:2}},F=[[1,1,1,1,1,1,1,1,1,1,1,1],[3,0,0,0,0,1,0,0,0,0,0,1],[1,1,1,1,0,1,0,1,1,1,0,1],[1,0,0,0,0,1,0,0,0,1,0,1],[1,0,1,1,1,1,1,1,0,1,0,1],[1,0,1,1,1,1,1,1,0,1,0,1],[1,0,1,1,0,0,0,0,0,1,0,1],[1,0,1,1,0,1,1,1,1,1,0,1],[1,0,1,1,0,1,1,0,0,0,0,1],[1,0,1,1,0,1,1,0,1,1,1,1],[1,0,0,0,0,1,1,0,0,0,0,2],[1,1,1,1,1,1,1,1,1,1,1,1]],I=120/F.length,R=[[10,11],[10,7],[8,7],[8,10],[1,10],[1,6],[3,6],[3,8],[6,8],[6,4],[10,4],[10,1],[3,1],[3,4],[1,4],[1,0]],P=(e,t)=>({x:-e*I-I/2+60,z:-t*I-I/2+60}),T=F.reduce((e,t,r)=>e.concat(t.reduce((e,t,o)=>{let{x:l,z:s}=P(r,o);return e.concat(1===t?{rowIndex:r,colIndex:o,x:l,z:s}:[])},[])),[]);F.map((e,t)=>e.map((e,r)=>{let{x:o,z:l}=P(t,r);return{rowIndex:t,colIndex:r,x:o,z:l,content:e}}));let B=R.map(e=>{let[t,r]=e,{x:o,z:l}=P(t,r);return{rowIndex:t,colIndex:r,x:o,z:l}});var L=r(52790),V=r(88153),D=r(12684),G=r(44329),H=r(81440);let X=new V.HK,{Component:Y,Entities:K}=(0,D._i)(X),N=e=>!(0,L.t2)(e.toBeDestroyed)&&X.addComponent(e,"toBeDestroyed",!0),$=e=>t=>t.enemy.type===e,O=X.with("enemy"),U=O.with($("fast")),W=O.with($("basic")),J=O.with($("tank")),Q=O.with($("boss")),Z=e=>t=>t.tower.type===e,q=X.with("tower"),ee=q.with(Z("simple")),et=q.with(Z("splash")),er=q.with(Z("strong")),eo=X.with("three","tra"),el=X.with("selfDestruct"),es=X.with("toBeDestroyed"),ea=X.with("projectile"),en=X.with("scaVel"),ei=e=>X.remove(e),ec=e=>(0,o.jsx)(K,{in:O,...e}),ed=e=>(0,o.jsx)(K,{in:W,...e}),eh=e=>(0,o.jsx)(K,{in:U,...e}),ep=e=>(0,o.jsx)(K,{in:J,...e}),ex=e=>(0,o.jsx)(K,{in:Q,...e}),em=e=>(0,o.jsx)(K,{in:ee,...e}),eu=e=>(0,o.jsx)(K,{in:et,...e}),ey=e=>(0,o.jsx)(K,{in:er,...e}),ej=e=>(0,o.jsx)(K,{in:ea,...e}),ef=e=>{let{children:t}=e;return(0,o.jsx)(Y,{name:"three",children:t})},eg=e=>{let{type:t,rowIndex:r,colIndex:o}=e,{x:l,z:s}=P(r,o);X.add({id:(0,G.Ak)(),tower:{type:t,shootCooldown:0},cell:{rowIndex:r,colIndex:o},tra:{pos:{x:l,y:0,z:s},rot:{},sca:{}}})},ew=e=>{let{type:t,maxHealth:r,killReward:o}=e,{x:l,z:s}=B[0],{size:a}=_[t];return X.add({id:(0,G.Ak)(),enemy:{type:t,killReward:o,health:{current:r,max:r}},tra:{pos:{x:l,y:.5,z:s},rot:{x:H.pi/2},sca:{all:.015*a}}})},ez=e=>{let{fromX:t,fromY:r,fromZ:o,toX:l,toY:s,toZ:a,towerType:n}=e;return X.add({id:(0,G.Ak)(),projectile:{fromX:t,fromY:r,fromZ:o,toX:l,toY:s,toZ:a},tra:{pos:{x:l,y:.5,z:a},rot:{},sca:"splash"===n?{x:4,y:1,z:4}:"strong"===n?{x:1,y:3,z:1}:{all:1}},scaVel:{all:.06}
1,selfDestruct:140})},ev=()=>{for(let e of O)N(e)};var eb=r(42903);let eS="/games/03-tower/models/emp-tower/emp-tower.glb",eC="/games/03-tower/models/energy-pilon/energy-pilon.glb",ek="/games/03-tower/models/big-emp-tower/big-emp-tower.glb",eM="/games/03-tower/models/buggy/buggy.glb",eE={towers:{simple:{path:eS,nodes:"EMP_Tower_level_1",material:"EnergyPylon_V006:l0001"},splash:{path:eC,nodes:"pylon_level_1",material:"pylon_01"},strong:{path:ek,nodes:"EMP_Tower_level_3",material:"EnergyPylon_V006:l03"}},enemies:{basic:{path:eM,nodes:"main"}}},eA=e=>{let{path:t,nodes:r,material:o}=e,l=(0,eb.p)(t);return{geometry:l.nodes[r].geometry,material:l.materials[o]}},e_=()=>eA(eE.towers.simple),eF=()=>eA(eE.towers.splash),eI=()=>eA(eE.towers.strong),eR=()=>eA(eE.enemies.basic);eb.p.preload(eS),eb.p.preload(eC),eb.p.preload(ek),eb.p.preload(eM);var eP=r(39174);let eT="/games/03-tower/models/buggy/buggy-red.jpg",eB="/games/03-tower/models/buggy/buggy-orange.jpg",eL="/games/03-tower/models/buggy/buggy-green.jpg",eV="/games/03-tower/models/buggy/buggy-purple.jpg",eD=e=>{let t=(0,eP.z)(e);return t.flipY=!1,t},eG=()=>eD(eT),eH=()=>eD(eB),eX=()=>eD(eL),eY=()=>eD(eV);eP.z.preload(eT),eP.z.preload(eB),eP.z.preload(eL),eP.z.preload(eV);let eK=e=>{let{enemy:t,tra:r}=e,{size:l}=_[t.type],s=(0,a.useRef)();return(0,c.A)(()=>{s.current.position.x=r.pos.x,s.current.position.y=r.pos.y+l+4.5,s.current.position.z=r.pos.z,s.current.scale.x=5*(t.health.current/t.health.max),s.current.scale.y=.6,s.current.scale.z=1}),(0,o.jsx)(n.Q,{ref:s,scale:0,children:(0,o.jsx)(m.cw,{})})},eN=R.map((e,t)=>({currentWaypoint:e,nextWaypoint:R[t+1]})),e$=e=>{let{enemy:t,tra:r}=e,{speed:l}=_[t.type],[s,n]=(0,a.useState)(0),{currentWaypoint:i,nextWaypoint:d}=eN[s],{x:h,z:p}=P(i[0],i[1]),{x:x,z:y}=P(d[0],d[1]),j=new u.Vector3(x,.5,y),f=h===x?y>p?"bottom-left":"top-right":p===y?x>h?"bottom-right":"top-left":null,g=new u.Vector3(0,.5,0);return g.x=j.x-r.pos.x,g.z=j.z-r.pos.z,g.normalize(),(0,c.A)((e,t)=>{if(r.pos.x===j.x&&r.pos.z===j.z){var o;(null===(o=eN[s+1])||void 0===o?void 0:o.nextWaypoint)&&n(s+1)}g.x>0&&r.pos.x>j.x||g.x<0&&r.pos.x<j.x||g.z>0&&r.pos.z>j.z||g.z<0&&r.pos.z<j.z?(r.pos.x=j.x,r.pos.z=j.z):(r.pos.x+=g.x*t*l*1e3,r.pos.z+=g.z*t*l*1e3)}),(0,o.jsx)(ef,{children:(0,o.jsx)(m.cw,{rotation:[H.pi/2,0,"bottom-left"===f?0:"bottom-right"===f?-H.pi/2:"top-left"===f?H.pi/2:"top-right"===f?H.pi:0]})})},eO=()=>{let e=(0,a.useRef)(null),t=(0,a.useRef)(null),r=(0,a.useRef)(null),l=(0,a.useRef)(null),s=eR().geometry,n=[{material:e.current,Entities:eh},{material:t.current,Entities:ed},{material:r.current,Entities:ep},{material:l.current,Entities:ex}],i=e.current&&t.current&&r.current&&l.current;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("meshStandardMaterial",{ref:e,map:eY()}),(0,o.jsx)("meshStandardMaterial",{ref:t,map:eX()}),(0,o.jsx)("meshStandardMaterial",{ref:r,map:eH()}),(0,o.jsx)("meshStandardMaterial",{ref:l,map:eG()}),i&&n.map((e,t)=>{let{material:r,Entities:l}=e;return(0,o.jsx)(m.X8,{geometry:s,material:r,castShadow:!0,children:(0,o.jsx)(l,{children:e$})},t)}),(0,o.jsx)(m.X8,{geometry:y,material:M,children:(0,o.jsx)(ec,{children:eK})})]})};var eU=r(29016),eW=r(95643),eJ=r(93809),eQ=r(72738),eZ=r(72853),eq=r(63505),e0=r(37741);let e1=(0,e0.PB)(e=>({isStarted:!1,start:()=>e({isStarted:!0}),wave:1,selectedTower:null,selectTower:t=>e({selectedTower:t}),enemiesKilled:0,livesLeft:20,money:100,addMoney:t=>e(e=>({money:e.money+t})),enemies:[],killedEnemyUpdate:()=>{e(e=>({enemiesKilled:e.enemiesKilled+1,wave:1+Math.round((e.enemiesKilled+1)/20)}))},decrementLivesLeft:()=>e(e=>({livesLeft:e.livesLeft-1})),currentConstruction:null,setCurrentConstruction:t=>e({currentConstruction:t}),clearCurrentConstruction:()=>e({currentConstruction:null})}),(0,e0.JT)("Tower Memory")),e2=e=>e.livesLeft>0,e3=()=>({currentConstruction:e1(e=>e.currentConstruction),setCurrentConstruction:e1(e=>e.setCurrentConstruction),clearCurrentConstruction:e1(e=>e.clearCurrentConstruction)});var e5=r(45822),e6=r(17041),e4=r(77836);let e8=new Audio("/games/03-tower/audio/Quincas Moreira - Chtulthu.mp3"),e9=e=>{let{children:t}=e,{currentConstruction:r,setCurrentConstruction:l,clearCurrentConstruction:s}=e3(),n=e1(e=>e.selectedTower),i=e1(e=>e.addMoney),c=e1(e=>e.isStarted),d=e1(e=>e.selectTower),h=e1(e=>e.start),p=e1(e=>e.wave),x=e1(e=>e.livesLeft),m=e1(e=>e.money);return(0,a.useEffect)(()=>{x<=0&&(ev(),console.log("You lost at wave ".concat(p,"!")))},[x]),(0,eq.vC)("esc",()=>{s(),d(null)}),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{style:{position:"fixed",zIndex:1},children:[(0,o.jsx)(eU.B,{direction:"row",p:2,children:r?(0,o.jsx)(eW.$,{c
1olorScheme:"blackAlpha",onClick:()=>s(),children:"Cancel"}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(eW.$,{colorScheme:"blackAlpha",leftIcon:(0,o.jsx)(eJ.I,{as:e6.Kyz}),isDisabled:m<A.simple.cost,onClick:()=>l("simple"),children:"Simple"}),(0,o.jsx)(eW.$,{colorScheme:"blackAlpha",leftIcon:(0,o.jsx)(eJ.I,{as:e6.bBD}),isDisabled:m<A.splash.cost,onClick:()=>l("splash"),children:"Splash"}),(0,o.jsx)(eW.$,{colorScheme:"blackAlpha",leftIcon:(0,o.jsx)(eJ.I,{as:e6.m3y}),isDisabled:m<A.strong.cost,onClick:()=>l("strong"),children:"Laser"}),!c&&(0,o.jsx)(eW.$,{colorScheme:"blackAlpha",bgColor:"#292",onClick:()=>{h(),e4.env.NEXT_PUBLIC_DISABLE_MUSIC||e8.play()},children:"Start"}),n&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(eW.$,{colorScheme:"blackAlpha",onClick:()=>{i(Math.round(A[n.tower.type].cost/2)),N(n),d(null)},children:"Sell"}),(0,o.jsx)(eW.$,{colorScheme:"blackAlpha",onClick:()=>d(null),children:"Cancel selection"})]})]})}),(0,o.jsxs)("div",{style:{color:"white",fontSize:24},children:[x," lives left"]}),(0,o.jsxs)("div",{style:{color:"white",fontSize:24},children:["Money: $",m]}),(0,o.jsxs)("div",{style:{color:"white",fontSize:24},children:["Wave ",p]})]}),(0,o.jsxs)(e5.A,{children:[(0,o.jsx)(e5.R,{}),(0,o.jsx)("ambientLight",{intensity:.6}),(0,o.jsx)(eQ.N,{makeDefault:!0,maxPolarAngle:H.pi/3,minPolarAngle:H.pi/3}),(0,o.jsx)(eZ.q,{makeDefault:!0,position:[100,0,100],zoom:8}),t]})]})};var e7=r(91876);let te=e=>(0,e7.GW)()?(0,o.jsx)(h.HG,{...e}):(0,o.jsx)(o.Fragment,{children:e.children}),tt=e=>{let{rowIndex:t,colIndex:r,x:l,z:s}=e,{currentConstruction:n,clearCurrentConstruction:i}=e3(),c=e1(e=>e.addMoney),d=e_(),h=eF(),p=eI(),x="simple"===n?d:"splash"===n?h:"strong"===n?p:null,[u,y]=(0,a.useState)(!1),j=(e,t)=>{n&&!q.entities.some(r=>r.cell.rowIndex===e&&r.cell.colIndex===t)&&(c(-A[n].cost),eg({rowIndex:e,colIndex:t,type:n}),i())};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(te,{onHover:()=>y(!0),onBlur:()=>y(!1),onSelect:()=>j(t,r),children:(0,o.jsx)(m.cw,{position:[60-10*t-5,.5,60-10*r-5],"rotation-x":-H.pi/2,scale:[9,9,1],onClick:()=>j(t,r),onPointerEnter:()=>y(!0),onPointerLeave:()=>y(!1),receiveShadow:!0})}),n&&u&&(0,o.jsx)("mesh",{position:[l,2-1.4,s],"rotation-x":H.pi/2,scale:.04,geometry:x.geometry,material:x.material})]})},tr=()=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("mesh",{"rotation-x":-H.pi/2,material:w,scale:[121,121,1],geometry:y,receiveShadow:!0}),(0,o.jsx)(m.X8,{limit:T.length,geometry:y,material:z,receiveShadow:!0,children:T.map(e=>(0,o.jsx)(tt,{...e},"".concat(e.rowIndex,"-").concat(e.colIndex)))}),F.map((e,t)=>e.map((e,r)=>2===e||3===e?(0,o.jsx)("mesh",{"rotation-x":-H.pi/2,position:[60-10*t-5,3.5,60-10*r-5],material:2===e?b:C,geometry:f,scale:[1,1,1.5],castShadow:!0},"cell-".concat(t,"-").concat(r)):null))]}),to=(0,a.createContext)({LaserMesh:null,ImpactMesh:null}),tl=e=>{let{projectile:t}=e,{fromX:r,fromY:l,fromZ:s,toX:n,toY:i,toZ:c}=t,d=new u.Vector3(r,l,s),h=new u.Vector3(n,i,c),p=d.distanceTo(h),x=d.clone().lerp(h,.5),m=-(Math.atan2(h.z-d.z,h.x-d.x)-H.pi/2),y=Math.atan2(d.y-h.y,p),{ImpactMesh:j,LaserMesh:f}=(0,a.useContext)(to);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f,{position:(0,H.Qx)(x),rotation:[y,m,0,"YZX"],scale:[.3,.3,p]}),(0,o.jsx)(ef,{children:(0,o.jsx)(j,{position:[n,i,c]})})]})},ts=new u.Mesh(j,E),ta=new u.Mesh(g,E),tn=()=>(0,o.jsx)(m.BO,{meshes:[ts,ta],children:(e,t)=>(0,o.jsx)(to.Provider,{value:{LaserMesh:e,ImpactMesh:t},children:(0,o.jsx)(ej,{children:tl})})});var ti=r(96287),tc=r(47226),td=r(75635);let{x:th,z:tp}=B[B.length-1],tx=()=>{let e=e1(e=>e.killedEnemyUpdate),t=e1(e=>e.addMoney),r=e1(e=>e.decrementLivesLeft);return(0,ti.t)(N,ei,el,es),(0,td.z)(eo),(0,tc.J)(en),(0,c.A)((o,l)=>{for(let e of q){let{reloadTime:t,range:r,splashRange:o,damage:s}=A[e.tower.type];if(e.tower.shootCooldown<=0){for(let l of O)if((0,H.PU)({x:l.tra.pos.x,y:l.tra.pos.y,z:l.tra.pos.z},{x:e.tra.pos.x,y:0,z:e.tra.pos.z})<r){if(o)for(let e of O)(0,H.PU)({x:l.tra.pos.x,y:l.tra.pos.y,z:l.tra.pos.z},{x:e.tra.pos.x,y:e.tra.pos.y,z:e.tra.pos.z})<o&&(e.enemy.health.current-=s);else l.enemy.health.current-=s;ez({towerType:e.tower.type,fromX:e.tra.pos.x,fromY:e.tra.pos.y+A[e.tower.type].projectileOriginY,fromZ:e.tra.pos.z,toX:l.tra.pos.x,toY:l.tra.pos.y+.5,toZ:l.tra.pos.z}),e.tower.shootCooldown=t;break}}else e.tower.shootCooldown-=1e3*l}for(let r of O)r.enemy.health.current<=0&&(t(r.enemy.killReward),e(),N(r));for(let e of O)1>Math.abs(e.tra.pos.x-th)&&1>Math.abs(e.tra.pos.z-tp)&&(r(),N(e))}),null},tm=e=>{let{cell:t}=e,r=e1(e=>e.currentConstruction),l=e1(e=>e.selectedTower),s=e1(e=>e.selectTower),a=()=>!l&&!r&&s(e),{x:n,z:i}=P(t.rowIndex,t.colIndex);return(0,o.jsx)(h.HG,{onSelect:a,children:(0,o.jsx)(m.cw,{"rotation-x":H.pi/2,scale:.04,position:[n,2-1.4,i],onClick:a})})},tu=()=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m.X8,{...e_(),castShadow:!0,children:(0,o.jsx)(em,{children:tm})}),(0,o.jsx)(m.X8,{...eF(),castShadow:!0,children:(0,o.jsx)(eu,{children:tm})}),(0,o.jsx)(m.X8,{...eI(),castShadow:!0,children:(0,o.jsx)(ey,{children:tm})})]}),ty=()=>{var e;let t=e1(e=>e.setCurrentConstruction),r=e1(e=>e.clearCurrentConstruction),l=e1(e=>e.start),s=e1(e=>e.wave),{isPresenting:c,player:x,controllers:m}=(0,d.ks)(),u=(0,a.useRef)(null);return(0,a.useEffect)(()=>{c?(x.position.x=60,x.position.y=50,x.position.z=60,x.rotation.y=H.pi/4,u.current.visible=!0):(x.position.x=50,x.position.y=50,x.position.z=50,x.rotation.y=0,u.current.visible=!1)},[c,JSON.stringify(null==m?void 0:null===(e=m[0])||void 0===e?void 0:e.controller)]),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("group",{ref:u,visible:!1,"position-x":-100,children:[(0,o.jsx)(n.Q,{"position-y":50,scale:[10,10,1],children:(0,o.jsx)(a.Suspense,{fallback:null,children:(0,o.jsxs)(i.E,{fontSize:1,children:["Wave ",s]})})}),(0,o.jsx)(h.HG,{onSelect:()=>t("simple"),children:(0,o.jsx)("mesh",{scale:3,geometry:g,material:b})}),(0,o.jsx)(h.HG,{onSelect:()=>t("splash"),children:(0,o.jsx)("mesh",{"position-z":20,scale:3,geometry:g,material:C})}),(0,o.jsx)(h.HG,{onSelect:()=>t("strong"),children:(0,o.jsx)("mesh",{"position-z":40,scale:3,geometry:g,material:k})}),(0,o.jsx)(h.HG,{onSelect:()=>l(),children:(0,o.jsx)("mesh",{"position-z":30,scale:10,geometry:j,material:b})}),(0,o.jsx)(h.HG,{onSelect:()=>r(),children:(0,o.jsx)("mesh",{position:[0,30,20],scale:10,geometry:j,material:C})})]}),(0,o.jsx)(p.k,{})]})},tj=()=>{let e=e1(e=>e.isStarted),t=e1(e=>e.wave),r=(0,a.useRef)(0),l=e1(e2);return(0,c.A)((o,s)=>{if(e&&l&&(r.current+=s,r.current>1)){r.current=0;let e=["basic","fast","tank","boss"][Math.floor(10*Math.random())%4],{hpFactor:o,killRewardFactor:l}=_[e];ew({type:e,maxHealth:o*(50+70*t),killReward:Math.floor(l*(1+.3*t))})}}),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(tr,{}),(0,o.jsx)(tu,{}),(0,o.jsx)(eO,{}),(0,o.jsx)(tx,{}),(0,o.jsx)(tn,{}),(0,o.jsx)(ty,{}),(0,o.jsx)("directionalLight",{position:[10,40,-20],intensity:1,castShadow:!0,"shadow-bias":-.001,"shadow-mapSize":[4096,4096],"shadow-camera-left":-150,"shadow-camera-right":150,"shadow-camera-top":150,"shadow-camera-bottom":-150})]})},tf=()=>(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(s(),{id:"a57600f6c08c501f",children:"html,body,#__next{height:100%;background:#222;color:white}"}),(0,o.jsx)(x.A,{title:"Tower Defense"}),(0,o.jsx)(e9,{children:(0,o.jsx)(tj,{})})]}),tg=e=>(0,o.jsx)(tf,{...e})}},e=>{var t=t=>e(e.s=t);e.O(0,[6593,8916,5422,3624,1791,203,118,6821,5692,2903,8265,2738,6129,141,636,8792],()=>
1t(67632)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.