screeps-client 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/embedded/_client/{CodePanel-CQz186KT.js → CodePanel-GQOhmg-I.js} +1 -1
- package/dist/{standalone/_client/MapViewer-BlPsc-Ax.js → embedded/_client/MapViewer-qJGNT0CU.js} +1 -1
- package/dist/embedded/_client/index-DH5qlAud.js +24 -0
- package/dist/embedded/_client/vendor-pixi-D-Qjltr2.js +1215 -0
- package/dist/embedded/index.html +2 -2
- package/dist/embedded/themes/default/test.json +84 -0
- package/dist/embedded/themes/default/test.png +0 -0
- package/dist/standalone/_client/{CodePanel-U6dyPwU0.js → CodePanel-C-DMhyuw.js} +1 -1
- package/dist/{embedded/_client/MapViewer-CvJfxsK0.js → standalone/_client/MapViewer-CFzJVSsf.js} +1 -1
- package/dist/standalone/_client/index-RbsPr76e.js +24 -0
- package/dist/standalone/_client/vendor-pixi-CVMJwxeR.js +1215 -0
- package/dist/standalone/index.html +2 -2
- package/dist/standalone/themes/default/test.json +84 -0
- package/dist/standalone/themes/default/test.png +0 -0
- package/dist/xxscreeps-mod/_client/{CodePanel-DFEeWiMS.js → CodePanel-C4wZSlgU.js} +1 -1
- package/dist/xxscreeps-mod/_client/{MapViewer-B8jKtgs1.js → MapViewer-DdHdvydQ.js} +1 -1
- package/dist/xxscreeps-mod/_client/index-BlhT0eYc.js +24 -0
- package/dist/xxscreeps-mod/_client/vendor-pixi-DOKo__Ml.js +1215 -0
- package/dist/xxscreeps-mod/index.html +3 -3
- package/dist/xxscreeps-mod/themes/default/test.json +84 -0
- package/dist/xxscreeps-mod/themes/default/test.png +0 -0
- package/package.json +2 -2
- package/dist/embedded/_client/index-RlhG0JKu.js +0 -24
- package/dist/embedded/_client/vendor-pixi-Do7-_WYv.js +0 -1160
- package/dist/standalone/_client/index-BQrrXAc2.js +0 -24
- package/dist/standalone/_client/vendor-pixi-CXkRT4gi.js +0 -1160
- package/dist/xxscreeps-mod/_client/index-63TVlkxt.js +0 -24
- package/dist/xxscreeps-mod/_client/vendor-pixi-CXkRT4gi.js +0 -1160
package/dist/embedded/index.html
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
20
20
|
}
|
|
21
21
|
</style>
|
|
22
|
-
<script type="module" crossorigin src="/client/_client/index-
|
|
22
|
+
<script type="module" crossorigin src="/client/_client/index-DH5qlAud.js"></script>
|
|
23
23
|
<link rel="modulepreload" crossorigin href="/client/_client/vendor-codemirror-D3PB7yT8.js">
|
|
24
|
-
<link rel="modulepreload" crossorigin href="/client/_client/vendor-pixi-
|
|
24
|
+
<link rel="modulepreload" crossorigin href="/client/_client/vendor-pixi-D-Qjltr2.js">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
|
27
27
|
<div id="root"></div>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{"frames": {
|
|
2
|
+
|
|
3
|
+
"controller/background":
|
|
4
|
+
{
|
|
5
|
+
"frame": {"x":1,"y":1,"w":600,"h":600},
|
|
6
|
+
"rotated": false,
|
|
7
|
+
"trimmed": false,
|
|
8
|
+
"spriteSourceSize": {"x":0,"y":0,"w":600,"h":600},
|
|
9
|
+
"sourceSize": {"w":600,"h":600},
|
|
10
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
11
|
+
},
|
|
12
|
+
"controller/segment":
|
|
13
|
+
{
|
|
14
|
+
"frame": {"x":205,"y":805,"w":158,"h":74},
|
|
15
|
+
"rotated": false,
|
|
16
|
+
"trimmed": true,
|
|
17
|
+
"spriteSourceSize": {"x":221,"y":86,"w":158,"h":74},
|
|
18
|
+
"sourceSize": {"w":600,"h":600},
|
|
19
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
20
|
+
},
|
|
21
|
+
"flag/main":
|
|
22
|
+
{
|
|
23
|
+
"frame": {"x":1,"y":603,"w":217,"h":202},
|
|
24
|
+
"rotated": true,
|
|
25
|
+
"trimmed": true,
|
|
26
|
+
"spriteSourceSize": {"x":235,"y":109,"w":217,"h":202},
|
|
27
|
+
"sourceSize": {"w":600,"h":600},
|
|
28
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
29
|
+
},
|
|
30
|
+
"flag/second":
|
|
31
|
+
{
|
|
32
|
+
"frame": {"x":505,"y":603,"w":100,"h":82},
|
|
33
|
+
"rotated": true,
|
|
34
|
+
"trimmed": true,
|
|
35
|
+
"spriteSourceSize": {"x":343,"y":145,"w":100,"h":82},
|
|
36
|
+
"sourceSize": {"w":600,"h":600},
|
|
37
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
38
|
+
},
|
|
39
|
+
"grave/cross":
|
|
40
|
+
{
|
|
41
|
+
"frame": {"x":365,"y":805,"w":59,"h":58},
|
|
42
|
+
"rotated": true,
|
|
43
|
+
"trimmed": true,
|
|
44
|
+
"spriteSourceSize": {"x":72,"y":76,"w":59,"h":58},
|
|
45
|
+
"sourceSize": {"w":200,"h":200},
|
|
46
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
47
|
+
},
|
|
48
|
+
"grave/shell":
|
|
49
|
+
{
|
|
50
|
+
"frame": {"x":373,"y":603,"w":130,"h":153},
|
|
51
|
+
"rotated": false,
|
|
52
|
+
"trimmed": true,
|
|
53
|
+
"spriteSourceSize": {"x":36,"y":22,"w":130,"h":153},
|
|
54
|
+
"sourceSize": {"w":200,"h":200},
|
|
55
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
56
|
+
},
|
|
57
|
+
"storage/fill":
|
|
58
|
+
{
|
|
59
|
+
"frame": {"x":425,"y":758,"w":116,"h":138},
|
|
60
|
+
"rotated": true,
|
|
61
|
+
"trimmed": true,
|
|
62
|
+
"spriteSourceSize": {"x":42,"y":31,"w":116,"h":138},
|
|
63
|
+
"sourceSize": {"w":200,"h":200},
|
|
64
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
65
|
+
},
|
|
66
|
+
"storage/shell":
|
|
67
|
+
{
|
|
68
|
+
"frame": {"x":205,"y":603,"w":166,"h":200},
|
|
69
|
+
"rotated": false,
|
|
70
|
+
"trimmed": true,
|
|
71
|
+
"spriteSourceSize": {"x":17,"y":0,"w":166,"h":200},
|
|
72
|
+
"sourceSize": {"w":200,"h":200},
|
|
73
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
74
|
+
}},
|
|
75
|
+
"meta": {
|
|
76
|
+
"app": "https://www.codeandweb.com/texturepacker",
|
|
77
|
+
"version": "1.1",
|
|
78
|
+
"image": "test.png?v=07a0a413850e",
|
|
79
|
+
"format": "RGBA8888",
|
|
80
|
+
"size": {"w":602,"h":880},
|
|
81
|
+
"scale": "1",
|
|
82
|
+
"smartupdate": "$TexturePacker:SmartUpdate:212e8658e6ae034c4f3f19b74ecab8dd:3c4c3a8033ac9b6e844817234caeb825:02ab132358d6d8b512e80119463a8329$"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as E,a as w,i as r,s as c,u as ee,b as te,t as u,d as oe}from"./index-
|
|
1
|
+
import{c as E,a as w,i as r,s as c,u as ee,b as te,t as u,d as oe}from"./index-RbsPr76e.js";import{l as f,e as ie,g as ne,c as re,t as le,h as P,f as b,j as $,F as R,S as L,n as de,E as se}from"./vendor-codemirror-D3PB7yT8.js";import"./vendor-pixi-CVMJwxeR.js";var ae=u("<span style=font-size:11px;color:#e3b341>Unsaved changes"),ce=u('<div style="padding:12px 10px;font-size:12px;color:#484f58;font-style:italic">Loading…'),fe=u("<div style=flex:1;display:flex;align-items:center;justify-content:center;color:#484f58;font-size:13px;font-style:italic>"),ue=u('<div style=position:absolute;inset:0px;background:#0d1117;z-index:100;display:flex;flex-direction:column;overflow:hidden><div style="display:flex;align-items:center;gap:12px;padding:10px 16px;border-bottom:1px solid #30363d;flex-shrink:0"><span style=font-size:15px;font-weight:600;color:#c9d1d9>Code</span><select style="background:#010409;color:#c9d1d9;border:1px solid #30363d;border-radius:4px;padding:4px 8px;font-size:12px;cursor:pointer"></select><div style=flex:1></div><button style="padding:5px 14px;border-radius:4px;border:1px solid #238636;font-size:12px;font-weight:600"></button><button style="background:transparent;border:none;color:#8b949e;font-size:18px;cursor:pointer;line-height:1;padding:2px 6px">✕</button></div><div style=flex:1;display:flex;overflow:hidden><div style="width:180px;flex-shrink:0;border-right:1px solid #21262d;display:flex;flex-direction:column;overflow:hidden"><div style="padding:6px 10px;font-size:10px;font-weight:700;color:#8b949e;text-transform:uppercase;letter-spacing:0.06em;border-bottom:1px solid #21262d;flex-shrink:0">Modules</div><div style=flex:1;overflow:auto></div></div><div style=flex:1;display:flex;flex-direction:column;overflow:hidden><div style="padding:5px 14px;font-size:12px;color:#8b949e;border-bottom:1px solid #21262d;flex-shrink:0;font-family:monospace;background:#0d1117">.js</div><div style=flex:1;overflow:hidden;flex-direction:column>'),pe=u("<option>"),xe=u('<div style="padding:7px 12px;font-size:12px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">');const{error:j}=te("code"),ve=se.theme({"&":{height:"100%"},".cm-scroller":{"font-family":"'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace","font-size":"13px","line-height":"1.6",overflow:"auto"},".cm-gutters":{background:"#0d1117","border-right":"1px solid #21262d"},".cm-lineNumbers .cm-gutterElement":{color:"#484f58","min-width":"3em"},".cm-activeLineGutter":{background:"#161b22"},".cm-activeLine":{background:"#161b22"}}),he=[re,de(),le,ve];function ye(W){const[A,G]=f([]),[k,F]=f(""),[m,S]=f({}),[d,C]=f(""),[_,M]=f(!1),[p,B]=f(!1),[x,z]=f(!1),J=()=>Object.keys(m()),{editorView:U,ref:q,createExtension:H}=ie({onValueChange:o=>{const t=d();!t||m()[t]===o||(S(n=>({...n,[t]:o})),z(!0))}});ne(U,()=>m()[d()]??""),H(he),P(()=>{const o=E();o&&o.http.user.branches().then(t=>{G(t.list);const n=t.list.find(s=>s.activeWorld)??t.list[0];n&&F(n.branch)}).catch(t=>{j("branches failed:",t),w("Failed to load branches","error")})}),P(()=>{const o=k(),t=E();!o||!t||(M(!0),S({}),C(""),z(!1),t.http.user.code.get(o).then(n=>{const s=n.modules??{};S(s),C(Object.keys(s)[0]??"")}).catch(n=>{j("get failed:",n),w("Failed to load code","error")}).finally(()=>M(!1)))});const I=()=>{const o=E(),t=k();!o||!t||(B(!0),o.http.user.code.set(t,m()).then(()=>{w("Code saved","success"),z(!1)}).catch(n=>{j("set failed:",n),w("Failed to save code","error")}).finally(()=>B(!1)))};return(()=>{var o=ue(),t=o.firstChild,n=t.firstChild,s=n.nextSibling,K=s.nextSibling,a=K.nextSibling,Q=a.nextSibling,X=t.nextSibling,V=X.firstChild,Y=V.firstChild,T=Y.nextSibling,D=V.nextSibling,y=D.firstChild,Z=y.firstChild,N=y.nextSibling;return s.addEventListener("change",e=>F(e.currentTarget.value)),r(s,b(R,{get each(){return A()},children:e=>(()=>{var i=pe();return r(i,()=>e.branch,null),r(i,()=>e.activeWorld?" ★":"",null),$(()=>i.value=e.branch),i})()})),r(t,b(L,{get when(){return x()},get children(){return ae()}}),a),a.$$click=I,r(a,()=>p()?"Saving…":"Save"),Q.$$click=()=>W.onClose(),r(T,b(L,{get when(){return _()},get children(){return ce()}}),null),r(T,b(R,{get each(){return J()},children:e=>(()=>{var i=xe();return i.$$click=()=>C(e),r(i,e),$(l=>{var v=d()===e?"#1f3158":"transparent",h=d()===e?"#58a6ff":"#c9d1d9",g=`2px solid ${d()===e?"#388bfd":"transparent"}`;return v!==l.e&&c(i,"background",l.e=v),h!==l.t&&c(i,"color",l.t=h),g!==l.a&&c(i,"border-left",l.a=g),l},{e:void 0,t:void 0,a:void 0}),i})()}),null),r(y,d,Z),ee(q,N),r(D,b(L,{get when(){return!d()},get children(){var e=fe();return r(e,()=>_()?"Loading code…":"Select a module"),e}}),null),$(e=>{var i=p()||_()||!x(),l=p()||!x()?"#161b22":"#1a3a2a",v=p()||!x()?"#484f58":"#3fb950",h=p()||!x()?"default":"pointer",g=d()?"block":"none",O=d()?"flex":"none";return i!==e.e&&(a.disabled=e.e=i),l!==e.t&&c(a,"background",e.t=l),v!==e.a&&c(a,"color",e.a=v),h!==e.o&&c(a,"cursor",e.o=h),g!==e.i&&c(y,"display",e.i=g),O!==e.n&&c(N,"display",e.n=O),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),$(()=>s.value=k()),o})()}oe(["click"]);export{ye as CodePanel};
|
package/dist/{embedded/_client/MapViewer-CvJfxsK0.js → standalone/_client/MapViewer-CFzJVSsf.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v,n as P,w as C,p as g,k as Q,l as r,m as G,j as p,o as L,e as oo,g as to,u as no,f as eo,h as ao,b as so,t as io,M as lo}from"./index-
|
|
1
|
+
import{c as v,n as P,w as C,p as g,k as Q,l as r,m as G,j as p,o as L,e as oo,g as to,u as no,f as eo,h as ao,b as so,t as io,M as lo}from"./index-RbsPr76e.js";import{l as I,h,s as co,r as T}from"./vendor-codemirror-D3PB7yT8.js";import"./vendor-pixi-CVMJwxeR.js";var mo=io("<div style=width:100%;height:100%;position:relative><canvas style=display:block>");const{log:B,error:z}=so("map");function Ro(t){let N,o=null;const[A,W]=I([]),[j,q]=I(1),D=()=>t.originRoom,[$,O]=I(D()??null);let X=null,Z=null;const R=new Map,E=new Map,k=new Map,_=new Map,Y=n=>{const e=C();if(!e)return!0;const i=g(n);return!!i&&ao(i.x,i.y,e)},S=n=>{var i;const e=E.get(n);return{room:n,owner:(e==null?void 0:e.username)??((i=e==null?void 0:e.own)!=null&&i.user?`user:${e.own.user}`:null),mineral:(e==null?void 0:e.mineral)??null,density:(e==null?void 0:e.density)??null}},F=200,J=0;let w=[],b=null;const U=()=>{b=null;const n=v();if(!n||!o)return;const e=new Set(A());if(w=w.filter(s=>e.has(s)&&!o.hasRoom(s)),w.length===0)return;const i=w.splice(0,F);n.stores.room.terrainBulk(i,t.shard).then(s=>{for(const[a,l]of s){o==null||o.setRoomTerrain(a,l);const c=k.get(a);c!==void 0&&(o==null||o.setRoomOwned(a,c))}for(const a of i)s.has(a)||o==null||o.markRoomFetched(a)}).catch(s=>z("terrain fetch failed:",s)).finally(()=>{w.length>0&&(b=setTimeout(U,J))})};return h(()=>{v(),t.shard,E.clear(),k.clear()}),co(()=>{N&&(async()=>{var e,i;if(o=new lo({onRoomHover:s=>{var a;(a=t.onHoveredRoomChanged)==null||a.call(t,s?S(s):null)},onRoomClick:s=>{var a;$()!==s?(O(s),o==null||o.setSelectedRoom(s),(a=t.onSelectedRoomChanged)==null||a.call(t,S(s))):Y(s)&&setTimeout(()=>t.onNavigateToRoom(s),0)},onVisibleRoomsChanged:s=>{const a=s.length===0;Z!==a&&(Z=a,a||B(`zoom in — terrain loading active, ${s.length} rooms visible`)),W(s)},onZoomChanged:s=>{var a;q(s),(a=t.onZoomChanged)==null||a.call(t,s)}}),await o.init(N),!o)return;t.initialZoom!==void 0&&t.initialZoom>0&&o.setZoom(t.initialZoom),(e=t.onZoomChanged)==null||e.call(t,o.zoom);const n=C();if(n&&o.setBounds(n.minX,n.maxX,n.minY,n.maxY),t.originRoom){const s=g(t.originRoom);s&&o.centerOn(s.x,s.y),o.setSelectedRoom(t.originRoom),(i=t.onSelectedRoomChanged)==null||i.call(t,S(t.originRoom))}else{const s=v();if(s)try{const a=await s.http.user.worldStartRoom(t.shard??"shard0");if(!o)return;const l=Array.isArray(a==null?void 0:a.room)?a.room[0]:a==null?void 0:a.room;if(typeof l=="string"){const c=g(l);c&&o.centerOn(c.x,c.y)}}catch(a){z("worldStartRoom failed:",a)}}})()}),T(()=>{b!==null&&(clearTimeout(b),b=null),w=[];for(const n of R.values())n.dispose();R.clear(),o==null||o.destroy(),o=null}),h(()=>{P({currentRoom:$,worldBounds:C,onMove:(i,s)=>{var l,c;const a=eo(i,s);O(a),o==null||o.setSelectedRoom(a),o==null||o.centerOn(i,s,!0),(l=t.onSelectedRoomChanged)==null||l.call(t,S(a)),(c=t.onHoveredRoomChanged)==null||c.call(t,S(a))}});const e=i=>{var l,c;const s=((l=i.target)==null?void 0:l.tagName)??"",a=((c=i.target)==null?void 0:c.isContentEditable)??!1;if(!(s==="INPUT"||s==="TEXTAREA"||a)&&i.key==="m"){const m=$();m&&Y(m)&&t.onNavigateToRoom(m)}};window.addEventListener("keydown",e),T(()=>window.removeEventListener("keydown",e))}),h(()=>{var c;const n=v(),e=A(),i=t.shard;if(!n||e.length===0)return;const s=new Set(e),a=e.filter(m=>!(o!=null&&o.hasRoom(m)));if(a.length>0){const m=e.reduce((d,y)=>{var f;return d+(((f=g(y))==null?void 0:f.x)??0)},0)/e.length,u=e.reduce((d,y)=>{var f;return d+(((f=g(y))==null?void 0:f.y)??0)},0)/e.length;w=a.slice().sort((d,y)=>{const f=g(d),M=g(y),x=f?Math.abs(f.x-m)+Math.abs(f.y-u):999,H=M?Math.abs(M.x-m)+Math.abs(M.y-u):999;return x-H}),b===null&&(b=setTimeout(U,0))}n.stores.mapStats.request(e,"owner0",i??void 0);const l=j()>=.4;if(l!==X&&(X=l,(c=t.onSubscriptionStateChanged)==null||c.call(t,l),l||o==null||o.clearAllMap2()),l){const m=new Set(e.map(u=>`${u}/${i}`));for(const[u,d]of R)m.has(u)||(d.dispose(),R.delete(u),o==null||o.clearRoomMap2(u.split("/")[0]));for(const u of e){const d=`${u}/${i}`;R.has(d)||R.set(d,n.stores.map.subscribeMap2(u,i))}}else{for(const[,m]of R)m.dispose();R.clear()}o==null||o.clearInvisibleRooms(s)}),h(()=>{o==null||o.setShowRoomNames(Q()),o&&(o.currentShard=t.shard??"shard0")}),h(()=>{o==null||o.setUnclaimableOverlayVisible(r())}),h(()=>{o==null||o.setOverlayMode(G())}),h(()=>{const n=v(),e=t.shard;n&&n.stores.server.worldInfo(e??void 0).then(i=>{B(`worldInfo(shard=${e??"none"}) — x: [${i.minX}, ${i.maxX}] y: [${i.minY}, ${i.maxY}]`),p(i)}).catch(i=>{})}),h(()=>{var n;o==null||o.setCurrentUser(((n=L())==null?void 0:n._id)??null)}),h(()=>{const n=C();n?(o==null||o.setBounds(n.minX,n.maxX,n.minY,n.maxY),B(`worldBounds applied — shard: ${t.shard??"none"} x: [${n.minX}, ${n.maxX}] y: [${n.minY}, ${n.maxY}] (fetched for shard: ${n.shard??"none"})`)):(o==null||o.clearBounds(),B(`worldBounds — none (shard: ${t.shard??"none"})`))}),h(()=>{const n=v();if(!n)return;const e=n.stores.map.on("room:map2update",({room:i,shard:s,data:a,source:l})=>{s===t.shard&&(o==null||o.setRoomMap2(i,a,l))});T(()=>e.dispose())}),h(()=>{var a;const n=v();if(!n)return;const e=(a=L())==null?void 0:a._id,i=new Set(A()),s=n.stores.mapStats.on("mapStats:room",({room:l,stat:c})=>{var K,V;E.set(l,c);const m=g(l),u=m?oo(m.x,m.y)||to(m.x,m.y):!1,d=c.status==="out of borders",y=!!(c.own&&c.own.user===e),f=!!(c.own&&c.own.user!==e),M=y?"own":u||d||f?"other":"none";k.set(l,M),i.has(l)&&(o==null||o.setRoomOwned(l,M),o==null||o.setRoomSafeMode(l,!!c.safeMode)),o==null||o.setRoomMineral(l,c.mineral,c.density);const x=c.badge?JSON.stringify(c.badge):"";_.get(l)!==x&&(_.set(l,x),o==null||o.setRoomBadge(l,c.badge,(K=c.own)==null?void 0:K.level)),$()===l&&((V=t.onSelectedRoomChanged)==null||V.call(t,S(l)))});T(()=>s.dispose())}),(()=>{var n=mo(),e=n.firstChild;return no(i=>N=i,e),n})()}export{Ro as MapViewer};
|