screeps-client 0.7.2 → 0.7.3
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-DQ-gtCIA.js → CodePanel-D9_QoSKt.js} +1 -1
- package/dist/{standalone/_client/MapViewer-ChA27vix.js → embedded/_client/MapViewer-B9YQqu-y.js} +1 -1
- package/dist/embedded/_client/{index-B_26EkhX.js → index-CiIFojZ8.js} +5 -5
- package/dist/embedded/index.html +1 -1
- package/dist/embedded/themes/default/test.json +99 -36
- package/dist/embedded/themes/default/test.png +0 -0
- package/dist/{xxscreeps-mod/_client/CodePanel-4SfZ7lcX.js → standalone/_client/CodePanel-BVffzTP9.js} +1 -1
- package/dist/{embedded/_client/MapViewer-CBzlhSR4.js → standalone/_client/MapViewer-BZFlOYMm.js} +1 -1
- package/dist/standalone/_client/{index-D3lZ5ALP.js → index-B34meIT0.js} +5 -5
- package/dist/standalone/index.html +1 -1
- package/dist/standalone/themes/default/test.json +99 -36
- package/dist/standalone/themes/default/test.png +0 -0
- package/dist/{standalone/_client/CodePanel-DDVe4v82.js → xxscreeps-mod/_client/CodePanel-rvH6VDdF.js} +1 -1
- package/dist/xxscreeps-mod/_client/{MapViewer-CRlkqmaa.js → MapViewer-DKem8ATA.js} +1 -1
- package/dist/xxscreeps-mod/_client/{index-DheecpH5.js → index-l6aLrGf1.js} +5 -5
- package/dist/xxscreeps-mod/index.html +1 -1
- package/dist/xxscreeps-mod/themes/default/test.json +99 -36
- package/dist/xxscreeps-mod/themes/default/test.png +0 -0
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
to { opacity: 1; transform: translate(-50%, -50%); }
|
|
27
27
|
}
|
|
28
28
|
</style>
|
|
29
|
-
<script type="module" crossorigin src="/_client/index-
|
|
29
|
+
<script type="module" crossorigin src="/_client/index-B34meIT0.js"></script>
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/_client/rolldown-runtime-QTnfLwEv.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/_client/vendor-pixi-NbxvK8iu.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/_client/vendor-codemirror-B_kaIH0M.js">
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
"controller/background":
|
|
4
4
|
{
|
|
5
|
-
"frame": {"x":1,"y":1,"w":
|
|
5
|
+
"frame": {"x":1,"y":1,"w":180,"h":180},
|
|
6
6
|
"rotated": false,
|
|
7
7
|
"trimmed": false,
|
|
8
|
-
"spriteSourceSize": {"x":0,"y":0,"w":
|
|
9
|
-
"sourceSize": {"w":
|
|
8
|
+
"spriteSourceSize": {"x":0,"y":0,"w":180,"h":180},
|
|
9
|
+
"sourceSize": {"w":180,"h":180},
|
|
10
10
|
"anchor": {"x":0.5,"y":0.5}
|
|
11
11
|
},
|
|
12
12
|
"controller/segment":
|
|
13
13
|
{
|
|
14
|
-
"frame": {"x":
|
|
15
|
-
"rotated":
|
|
14
|
+
"frame": {"x":408,"y":284,"w":158,"h":74},
|
|
15
|
+
"rotated": true,
|
|
16
16
|
"trimmed": true,
|
|
17
17
|
"spriteSourceSize": {"x":221,"y":86,"w":158,"h":74},
|
|
18
18
|
"sourceSize": {"w":600,"h":600},
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
},
|
|
21
21
|
"deposit/biomass/fill":
|
|
22
22
|
{
|
|
23
|
-
"frame": {"x":
|
|
24
|
-
"rotated":
|
|
23
|
+
"frame": {"x":331,"y":612,"w":62,"h":57},
|
|
24
|
+
"rotated": false,
|
|
25
25
|
"trimmed": true,
|
|
26
|
-
"spriteSourceSize": {"x":
|
|
27
|
-
"sourceSize": {"w":
|
|
26
|
+
"spriteSourceSize": {"x":1,"y":5,"w":62,"h":57},
|
|
27
|
+
"sourceSize": {"w":64,"h":64},
|
|
28
28
|
"anchor": {"x":0.5,"y":0.5}
|
|
29
29
|
},
|
|
30
30
|
"deposit/biomass/shape":
|
|
31
31
|
{
|
|
32
|
-
"frame": {"x":
|
|
32
|
+
"frame": {"x":139,"y":394,"w":128,"h":128},
|
|
33
33
|
"rotated": false,
|
|
34
34
|
"trimmed": false,
|
|
35
35
|
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
},
|
|
39
39
|
"deposit/metal/fill":
|
|
40
40
|
{
|
|
41
|
-
"frame": {"x":
|
|
41
|
+
"frame": {"x":395,"y":607,"w":54,"h":60},
|
|
42
42
|
"rotated": false,
|
|
43
43
|
"trimmed": true,
|
|
44
|
-
"spriteSourceSize": {"x":
|
|
45
|
-
"sourceSize": {"w":
|
|
44
|
+
"spriteSourceSize": {"x":4,"y":3,"w":54,"h":60},
|
|
45
|
+
"sourceSize": {"w":64,"h":64},
|
|
46
46
|
"anchor": {"x":0.5,"y":0.5}
|
|
47
47
|
},
|
|
48
48
|
"deposit/metal/shape":
|
|
49
49
|
{
|
|
50
|
-
"frame": {"x":
|
|
50
|
+
"frame": {"x":1,"y":437,"w":128,"h":128},
|
|
51
51
|
"rotated": false,
|
|
52
52
|
"trimmed": false,
|
|
53
53
|
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
},
|
|
57
57
|
"deposit/mist/fill":
|
|
58
58
|
{
|
|
59
|
-
"frame": {"x":
|
|
60
|
-
"rotated":
|
|
59
|
+
"frame": {"x":261,"y":615,"w":64,"h":55},
|
|
60
|
+
"rotated": false,
|
|
61
61
|
"trimmed": true,
|
|
62
|
-
"spriteSourceSize": {"x":
|
|
63
|
-
"sourceSize": {"w":
|
|
62
|
+
"spriteSourceSize": {"x":0,"y":0,"w":64,"h":55},
|
|
63
|
+
"sourceSize": {"w":64,"h":64},
|
|
64
64
|
"anchor": {"x":0.5,"y":0.5}
|
|
65
65
|
},
|
|
66
66
|
"deposit/mist/shape":
|
|
67
67
|
{
|
|
68
|
-
"frame": {"x":
|
|
68
|
+
"frame": {"x":269,"y":410,"w":128,"h":128},
|
|
69
69
|
"rotated": false,
|
|
70
70
|
"trimmed": false,
|
|
71
71
|
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"deposit/silicon/fill":
|
|
76
76
|
{
|
|
77
|
-
"frame": {"x":
|
|
77
|
+
"frame": {"x":1,"y":567,"w":94,"h":94},
|
|
78
78
|
"rotated": false,
|
|
79
79
|
"trimmed": true,
|
|
80
80
|
"spriteSourceSize": {"x":17,"y":17,"w":94,"h":94},
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"deposit/silicon/shape":
|
|
85
85
|
{
|
|
86
|
-
"frame": {"x":
|
|
86
|
+
"frame": {"x":131,"y":524,"w":128,"h":128},
|
|
87
87
|
"rotated": false,
|
|
88
88
|
"trimmed": false,
|
|
89
89
|
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
"flag/main":
|
|
94
94
|
{
|
|
95
|
-
"frame": {"x":
|
|
95
|
+
"frame": {"x":261,"y":540,"w":73,"h":68},
|
|
96
96
|
"rotated": true,
|
|
97
97
|
"trimmed": true,
|
|
98
98
|
"spriteSourceSize": {"x":78,"y":36,"w":73,"h":68},
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
},
|
|
102
102
|
"flag/second":
|
|
103
103
|
{
|
|
104
|
-
"frame": {"x":
|
|
105
|
-
"rotated":
|
|
104
|
+
"frame": {"x":139,"y":183,"w":34,"h":28},
|
|
105
|
+
"rotated": false,
|
|
106
106
|
"trimmed": true,
|
|
107
107
|
"spriteSourceSize": {"x":114,"y":48,"w":34,"h":28},
|
|
108
108
|
"sourceSize": {"w":200,"h":200},
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
},
|
|
111
111
|
"grave/cross":
|
|
112
112
|
{
|
|
113
|
-
"frame": {"x":
|
|
114
|
-
"rotated":
|
|
113
|
+
"frame": {"x":393,"y":546,"w":59,"h":58},
|
|
114
|
+
"rotated": true,
|
|
115
115
|
"trimmed": true,
|
|
116
116
|
"spriteSourceSize": {"x":72,"y":76,"w":59,"h":58},
|
|
117
117
|
"sourceSize": {"w":200,"h":200},
|
|
@@ -119,16 +119,79 @@
|
|
|
119
119
|
},
|
|
120
120
|
"grave/shell":
|
|
121
121
|
{
|
|
122
|
-
"frame": {"x":
|
|
123
|
-
"rotated":
|
|
122
|
+
"frame": {"x":183,"y":1,"w":130,"h":153},
|
|
123
|
+
"rotated": true,
|
|
124
124
|
"trimmed": true,
|
|
125
125
|
"spriteSourceSize": {"x":36,"y":22,"w":130,"h":153},
|
|
126
126
|
"sourceSize": {"w":200,"h":200},
|
|
127
127
|
"anchor": {"x":0.5,"y":0.5}
|
|
128
128
|
},
|
|
129
|
+
"mineral/H":
|
|
130
|
+
{
|
|
131
|
+
"frame": {"x":328,"y":160,"w":143,"h":122},
|
|
132
|
+
"rotated": false,
|
|
133
|
+
"trimmed": true,
|
|
134
|
+
"spriteSourceSize": {"x":33,"y":42,"w":143,"h":122},
|
|
135
|
+
"sourceSize": {"w":192,"h":192},
|
|
136
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
137
|
+
},
|
|
138
|
+
"mineral/K":
|
|
139
|
+
{
|
|
140
|
+
"frame": {"x":338,"y":1,"w":157,"h":124},
|
|
141
|
+
"rotated": true,
|
|
142
|
+
"trimmed": true,
|
|
143
|
+
"spriteSourceSize": {"x":7,"y":37,"w":157,"h":124},
|
|
144
|
+
"sourceSize": {"w":192,"h":192},
|
|
145
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
146
|
+
},
|
|
147
|
+
"mineral/L":
|
|
148
|
+
{
|
|
149
|
+
"frame": {"x":139,"y":264,"w":132,"h":128},
|
|
150
|
+
"rotated": false,
|
|
151
|
+
"trimmed": true,
|
|
152
|
+
"spriteSourceSize": {"x":24,"y":37,"w":132,"h":128},
|
|
153
|
+
"sourceSize": {"w":192,"h":192},
|
|
154
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
155
|
+
},
|
|
156
|
+
"mineral/O":
|
|
157
|
+
{
|
|
158
|
+
"frame": {"x":273,"y":284,"w":133,"h":124},
|
|
159
|
+
"rotated": false,
|
|
160
|
+
"trimmed": true,
|
|
161
|
+
"spriteSourceSize": {"x":32,"y":43,"w":133,"h":124},
|
|
162
|
+
"sourceSize": {"w":192,"h":192},
|
|
163
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
164
|
+
},
|
|
165
|
+
"mineral/U":
|
|
166
|
+
{
|
|
167
|
+
"frame": {"x":183,"y":133,"w":143,"h":129},
|
|
168
|
+
"rotated": false,
|
|
169
|
+
"trimmed": true,
|
|
170
|
+
"spriteSourceSize": {"x":19,"y":39,"w":143,"h":129},
|
|
171
|
+
"sourceSize": {"w":192,"h":192},
|
|
172
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
173
|
+
},
|
|
174
|
+
"mineral/X":
|
|
175
|
+
{
|
|
176
|
+
"frame": {"x":1,"y":313,"w":136,"h":122},
|
|
177
|
+
"rotated": false,
|
|
178
|
+
"trimmed": true,
|
|
179
|
+
"spriteSourceSize": {"x":25,"y":39,"w":136,"h":122},
|
|
180
|
+
"sourceSize": {"w":192,"h":192},
|
|
181
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
182
|
+
},
|
|
183
|
+
"mineral/Z":
|
|
184
|
+
{
|
|
185
|
+
"frame": {"x":1,"y":183,"w":136,"h":128},
|
|
186
|
+
"rotated": false,
|
|
187
|
+
"trimmed": true,
|
|
188
|
+
"spriteSourceSize": {"x":28,"y":34,"w":136,"h":128},
|
|
189
|
+
"sourceSize": {"w":192,"h":192},
|
|
190
|
+
"anchor": {"x":0.5,"y":0.5}
|
|
191
|
+
},
|
|
129
192
|
"storage/fill":
|
|
130
193
|
{
|
|
131
|
-
"frame": {"x":
|
|
194
|
+
"frame": {"x":331,"y":540,"w":60,"h":70},
|
|
132
195
|
"rotated": false,
|
|
133
196
|
"trimmed": true,
|
|
134
197
|
"spriteSourceSize": {"x":20,"y":15,"w":60,"h":70},
|
|
@@ -137,20 +200,20 @@
|
|
|
137
200
|
},
|
|
138
201
|
"storage/shell":
|
|
139
202
|
{
|
|
140
|
-
"frame": {"x":
|
|
141
|
-
"rotated":
|
|
203
|
+
"frame": {"x":399,"y":444,"w":84,"h":100},
|
|
204
|
+
"rotated": false,
|
|
142
205
|
"trimmed": true,
|
|
143
|
-
"spriteSourceSize": {"x":
|
|
144
|
-
"sourceSize": {"w":
|
|
206
|
+
"spriteSourceSize": {"x":8,"y":0,"w":84,"h":100},
|
|
207
|
+
"sourceSize": {"w":100,"h":100},
|
|
145
208
|
"anchor": {"x":0.5,"y":0.5}
|
|
146
209
|
}},
|
|
147
210
|
"meta": {
|
|
148
211
|
"app": "https://www.codeandweb.com/texturepacker",
|
|
149
212
|
"version": "1.1",
|
|
150
|
-
"image": "test.png?v=
|
|
213
|
+
"image": "test.png?v=46dcd48d738a",
|
|
151
214
|
"format": "RGBA8888",
|
|
152
|
-
"size": {"w":
|
|
215
|
+
"size": {"w":484,"h":671},
|
|
153
216
|
"scale": "1",
|
|
154
|
-
"smartupdate": "$TexturePacker:SmartUpdate:
|
|
217
|
+
"smartupdate": "$TexturePacker:SmartUpdate:9fed4eb6cc4f2f9926dd68070e0cafcb:0bd497ed383f23f5b5a1e19577a2e079:02ab132358d6d8b512e80119463a8329$"
|
|
155
218
|
}
|
|
156
219
|
}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,d as n,f as r,h as i,i as a,m as o,n as s,o as c,r as l,t as u,y as d}from"./vendor-codemirror-B_kaIH0M.js";import{S as f,_ as p,b as m,f as h,g,v as _,x as v,y}from"./index-
|
|
1
|
+
import{_ as e,a as t,d as n,f as r,h as i,i as a,m as o,n as s,o as c,r as l,t as u,y as d}from"./vendor-codemirror-B_kaIH0M.js";import{S as f,_ as p,b as m,f as h,g,v as _,x as v,y}from"./index-l6aLrGf1.js";var b=v(`<span style=font-size:11px;color:#e3b341>Unsaved changes`),x=v(`<div style="padding:12px 10px;font-size:12px;color:#484f58;font-style:italic">Loading…`),S=v(`<div style=flex:1;display:flex;align-items:center;justify-content:center;color:#484f58;font-size:13px;font-style:italic>`),C=v(`<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>`),w=v(`<option>`),T=v(`<div style="padding:7px 12px;font-size:12px;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">`),{error:E}=g(`code`),D=c.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`}}),O=[l,s(),u,D];function k(s){let[c,l]=d([]),[u,g]=d(``),[_,v]=d({}),[D,k]=d(``),[A,j]=d(!1),[M,N]=d(!1),[P,F]=d(!1),I=()=>Object.keys(_()),{editorView:L,ref:R,createExtension:z}=t({onValueChange:e=>{let t=D();!t||_()[t]===e||(v(n=>({...n,[t]:e})),F(!0))}});a(L,()=>_()[D()]??``),z(O),i(()=>{let e=h();e&&e.http.user.branches().then(e=>{l(e.list);let t=e.list.find(e=>e.activeWorld)??e.list[0];t&&g(t.branch)}).catch(e=>{E(`branches failed:`,e),p(`Failed to load branches`,`error`)})}),i(()=>{let e=u(),t=h();!e||!t||(j(!0),v({}),k(``),F(!1),t.http.user.code.get(e).then(e=>{let t=e.modules??{};v(t),k(Object.keys(t)[0]??``)}).catch(e=>{E(`get failed:`,e),p(`Failed to load code`,`error`)}).finally(()=>j(!1)))});let B=()=>{let e=h(),t=u();!e||!t||(N(!0),e.http.user.code.set(t,_()).then(()=>{p(`Code saved`,`success`),F(!1)}).catch(e=>{E(`set failed:`,e),p(`Failed to save code`,`error`)}).finally(()=>N(!1)))};return(()=>{var t=C(),i=t.firstChild,a=i.firstChild.nextSibling,l=a.nextSibling.nextSibling,d=l.nextSibling,p=i.nextSibling.firstChild,h=p.firstChild.nextSibling,_=p.nextSibling,v=_.firstChild,E=v.firstChild,O=v.nextSibling;return a.addEventListener(`change`,e=>g(e.currentTarget.value)),y(a,o(n,{get each(){return c()},children:t=>(()=>{var n=w();return y(n,()=>t.branch,null),y(n,()=>t.activeWorld?` ★`:``,null),e(()=>n.value=t.branch),n})()})),y(i,o(r,{get when(){return P()},get children(){return b()}}),l),l.$$click=B,y(l,()=>M()?`Saving…`:`Save`),d.$$click=()=>s.onClose(),y(h,o(r,{get when(){return A()},get children(){return x()}}),null),y(h,o(n,{get each(){return I()},children:t=>(()=>{var n=T();return n.$$click=()=>k(t),y(n,t),e(e=>{var r=D()===t?`#1f3158`:`transparent`,i=D()===t?`#58a6ff`:`#c9d1d9`,a=`2px solid ${D()===t?`#388bfd`:`transparent`}`;return r!==e.e&&m(n,`background`,e.e=r),i!==e.t&&m(n,`color`,e.t=i),a!==e.a&&m(n,`border-left`,e.a=a),e},{e:void 0,t:void 0,a:void 0}),n})()}),null),y(v,D,E),f(R,O),y(_,o(r,{get when(){return!D()},get children(){var e=S();return y(e,()=>A()?`Loading code…`:`Select a module`),e}}),null),e(e=>{var t=M()||A()||!P(),n=M()||!P()?`#161b22`:`#1a3a2a`,r=M()||!P()?`#484f58`:`#3fb950`,i=M()||!P()?`default`:`pointer`,a=D()?`block`:`none`,o=D()?`flex`:`none`;return t!==e.e&&(l.disabled=e.e=t),n!==e.t&&m(l,`background`,e.t=n),r!==e.a&&m(l,`color`,e.a=r),i!==e.o&&m(l,`cursor`,e.o=i),a!==e.i&&m(v,`display`,e.i=a),o!==e.n&&m(O,`display`,e.n=o),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),e(()=>a.value=u()),t})()}_([`click`]);export{k as CodePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as e,h as t,w as n,y as r}from"./vendor-codemirror-B_kaIH0M.js";import{S as i,a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,x}from"./index-
|
|
1
|
+
import{T as e,h as t,w as n,y as r}from"./vendor-codemirror-B_kaIH0M.js";import{S as i,a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,n as m,o as h,p as g,r as _,s as v,t as y,u as b,x}from"./index-l6aLrGf1.js";var S=x(`<div style=width:100%;height:100%;position:relative><canvas style=display:block>`),{log:C,error:w}=l(`map`);function T(l){let x,T=null,[E,D]=r([]),[O,k]=r(1),[A,j]=r(l.originRoom??null),M=null,N=null,P=new Map,F=new Map,I=new Map,L=new Map,R=e=>{let t=u();if(!t)return!0;let n=o(e);return!!n&&v(n.x,n.y,t)},z=e=>{let t=F.get(e);return{room:e,owner:t?.username??(t?.own?.user?`user:${t.own.user}`:null),mineral:t?.mineral??null,density:t?.density??null}},B=[],V=null,H=new Set,U=()=>{V=null;let e=c();if(!e||!T)return;let t=new Set(E());if(B=B.filter(e=>t.has(e)&&!T.hasRoom(e)&&!H.has(e)),B.length===0)return;let n=B.splice(0,200);for(let e of n)H.add(e);e.stores.room.terrainBulk(n,l.shard).then(async e=>{let t=[];for(let[n,r]of e){let e=T?.setRoomTerrain(n,r);e&&t.push(e);let i=I.get(n);i!==void 0&&T?.setRoomOwned(n,i)}for(let t of n)e.has(t)||T?.markRoomFetched(t);await Promise.all(t)}).catch(e=>w(`terrain fetch failed:`,e)).finally(()=>{for(let e of n)H.delete(e);B.length>0&&(V=setTimeout(U,0))})};return t(()=>{c(),l.shard,F.clear(),I.clear()}),e(()=>{x&&(async()=>{if(T=new y({onRoomHover:e=>{l.onHoveredRoomChanged?.(e?z(e):null)},onRoomClick:e=>{A()===e?R(e)&&setTimeout(()=>l.onNavigateToRoom(e),0):(j(e),T?.setSelectedRoom(e),l.onSelectedRoomChanged?.(z(e)))},onVisibleRoomsChanged:e=>{let t=e.length===0;N!==t&&(N=t,C(t?`zoom out — too many rooms visible, terrain loading paused`:`zoom in — terrain loading active, ${e.length} rooms visible`)),D(e)},onZoomChanged:e=>{k(e),l.onZoomChanged?.(e)}}),await T.init(x),!T)return;l.initialZoom!==void 0&&l.initialZoom>0&&T.setZoom(l.initialZoom),l.onZoomChanged?.(T.zoom);let e=u();if(e&&T.setBounds(e.minX,e.maxX,e.minY,e.maxY),l.originRoom){let e=o(l.originRoom);e&&T.centerOn(e.x,e.y),T.setSelectedRoom(l.originRoom),l.onSelectedRoomChanged?.(z(l.originRoom))}else{let e=c();if(e)try{let t=await e.http.user.worldStartRoom(l.shard??`shard0`);if(!T)return;let n=Array.isArray(t?.room)?t.room[0]:t?.room;if(typeof n==`string`){let e=o(n);e&&T.centerOn(e.x,e.y)}}catch(e){w(`worldStartRoom failed:`,e)}}})()}),n(()=>{V!==null&&(clearTimeout(V),V=null),B=[],H.clear();for(let e of P.values())e.dispose();P.clear(),T?.destroy(),T=null}),t(()=>{_({currentRoom:A,worldBounds:u,onMove:(e,t)=>{let n=d(e,t);j(n),T?.setSelectedRoom(n),T?.centerOn(e,t,!0),l.onSelectedRoomChanged?.(z(n)),l.onHoveredRoomChanged?.(z(n))}});let e=e=>{let t=e.target?.tagName??``,n=e.target?.isContentEditable??!1;if(!(t===`INPUT`||t===`TEXTAREA`||n)&&e.key===`m`){let e=A();e&&R(e)&&l.onNavigateToRoom(e)}};window.addEventListener(`keydown`,e),n(()=>window.removeEventListener(`keydown`,e))}),t(()=>{let e=c(),t=E(),n=l.shard;if(!e||t.length===0)return;let r=new Set(t),i=t.filter(e=>!T?.hasRoom(e)&&!H.has(e));if(i.length>0){let e=t.reduce((e,t)=>e+(o(t)?.x??0),0)/t.length,n=t.reduce((e,t)=>e+(o(t)?.y??0),0)/t.length;B=i.slice().sort((t,r)=>{let i=o(t),a=o(r);return(i?Math.abs(i.x-e)+Math.abs(i.y-n):999)-(a?Math.abs(a.x-e)+Math.abs(a.y-n):999)}),V===null&&(V=setTimeout(U,0))}e.stores.mapStats.request(t,`owner0`,n??void 0);let a=O()>=.4;if(a!==M&&(M=a,l.onSubscriptionStateChanged?.(a),a||T?.clearAllMap2()),a){let r=new Set(t.map(e=>`${e}/${n}`));for(let[e,t]of P)r.has(e)||(t.dispose(),P.delete(e),T?.clearRoomMap2(e.split(`/`)[0]));for(let r of t){let t=`${r}/${n}`;P.has(t)||P.set(t,e.stores.map.subscribeMap2(r,n))}}else{for(let[,e]of P)e.dispose();P.clear()}T?.clearInvisibleRooms(r)}),t(()=>{T?.setShowRoomNames(f()),T&&(T.currentShard=l.shard??`shard0`)}),t(()=>{T?.setUnclaimableOverlayVisible(s())}),t(()=>{T?.setMapVisualVisible(b())}),t(()=>{T?.setOverlayMode(m())}),t(()=>{let e=c(),t=l.shard;e&&e.stores.server.worldInfo(t??void 0).then(e=>{C(`worldInfo(shard=${t??`none`}) — x: [${e.minX}, ${e.maxX}] y: [${e.minY}, ${e.maxY}]`),g(e)}).catch(e=>{C(`worldInfo(shard=${t??`none`}) failed:`,e)})}),t(()=>{T?.setCurrentUser(p()?._id??null)}),t(()=>{let e=u();e?(T?.setBounds(e.minX,e.maxX,e.minY,e.maxY),C(`worldBounds applied — shard: ${l.shard??`none`} x: [${e.minX}, ${e.maxX}] y: [${e.minY}, ${e.maxY}] (fetched for shard: ${e.shard??`none`})`)):(T?.clearBounds(),C(`worldBounds — none (shard: ${l.shard??`none`})`))}),t(()=>{let e=c();if(!e)return;let t=e.stores.user.subscribeMapVisual(l.shard),r=e.stores.user.on(`user:mapVisual`,({shard:e,data:t})=>{e===l.shard&&(t?T?.setMapVisual(t):T?.clearMapVisual())});n(()=>{t.dispose(),r.dispose()})}),t(()=>{let e=c();if(!e)return;let t=e.stores.map.on(`room:map2update`,({room:e,shard:t,data:n,source:r})=>{t===l.shard&&T?.setRoomMap2(e,n,r)});n(()=>t.dispose())}),t(()=>{let e=c();if(!e)return;let t=p()?._id,r=new Set(E()),i=e.stores.mapStats.on(`mapStats:room`,({room:e,stat:n})=>{F.set(e,n);let i=o(e),s=i?a(i.x,i.y)||h(i.x,i.y):!1,c=n.status===`out of borders`,u=!!(n.own&&n.own.user===t),d=!!(n.own&&n.own.user!==t),f=u?`own`:s||c||d?`other`:`none`;I.set(e,f),r.has(e)&&(T?.setRoomOwned(e,f),T?.setRoomSafeMode(e,!!n.safeMode)),T?.setRoomMineral(e,n.mineral,n.density);let p=n.badge?JSON.stringify(n.badge):``;L.get(e)!==p&&(L.set(e,p),T?.setRoomBadge(e,n.badge,n.own?.level)),A()===e&&l.onSelectedRoomChanged?.(z(e))});n(()=>i.dispose())}),(()=>{var e=S(),t=e.firstChild;return i(e=>x=e,t),e})()}export{T as MapViewer};
|