返回提交历史

XFEstudio/MCIndustry

修复部分贴图问题

226609e
X
XFEstudio <mail@xfegzs.com>
提交于

代码差异

6 个文件 +63 -11
Modified mod.hjson +1 -1
@@ -2,6 +2,6 @@
2 2 name:磁铜工业
3 3 author:XFEstudio
4 4 "description":"[purple]磁铜工业,适合度过前期,以及为后期增加各类工厂工业制造模块,方便传输,增加新炮塔及工厂,全工业基于磁铜,持续测试中"
5 version:"2.53"
5 version:"2.54"
6 6 minGameVersion:136
7 7 }
Modified scripts/blocks/磁铜传送带.js +62 -10
@@ -58,6 +58,32 @@ function sideNeighbors(build){
58 58 ];
59 59 }
60 60
61 function isRenderConnection(magneticConveyor, build, near){
62 if(near == null || near.team != build.team){
63 return false;
64 }
65
66 // 磁铜传送带只有在其中一端确实朝向另一端时才算接通。
67 // 这样相邻但平行放置的两条线路仍会各自保留边框。
68 if(near.block == magneticConveyor){
69 return near.front() == build || near.back() == build ||
70 build.front() == near || build.back() == near;
71 }
72
73 // 正前方和正后方由本传送带自身的方向决定。
74 if(build.front() == near || build.back() == near){
75 return near.block.acceptsItems || near.block.outputsItems();
76 }
77
78 // 两侧只为真正朝向本传送带的输出端,或能够从侧面接货的建筑打开边框。
79 // 有方向的物流方块必须以正确的一端相接,避免仅仅贴在旁边也出现缺口。
80 if(near.block.rotate){
81 return near.front() == build || near.back() == build;
82 }
83
84 return near.block.acceptsItems || near.block.outputsItems();
85 }
86
61 87 function canOutputToSide(magneticConveyor, build, target, item){
62 88 if(target == null || target.team != build.team || item == null){
63 89 return false;
@@ -168,6 +194,10 @@ Events.on(ContentInitEvent, cons(() => {
168 194 return;
169 195 }
170 196
197 const magneticSideRegion = Core.atlas.find(
198 magneticConveyor.name + "-side"
199 );
200
171 201 magneticConveyor.buildType = prov(() => extend(
172 202 StackConveyor.StackConveyorBuild,
173 203 magneticConveyor,
@@ -215,22 +245,44 @@ Events.on(ContentInitEvent, cons(() => {
215 245 fillLoadingDock(magneticConveyor, this);
216 246 },
217 247
218 onProximityUpdate(){
219 this.super$onProximityUpdate();
248 drawCached(){
249 // 不使用父类的 blendprox 缓存;它只认识原版 StackConveyor 的
250 // 单向连接规则,且在旋转/拆除支路后可能留下不符合本方块规则的边框。
251 Draw.rect(
252 magneticConveyor.regions[this.state],
253 this.x,
254 this.y,
255 this.rotdeg()
256 );
220 257
221 // 补上原版 StackConveyor 没有绘制的左右磁铜支路拼接。
222 const oldBlend = this.blendprox;
258 // 接口图是以当前格中心为锚点的 32x32 单侧透明图层。
259 // 它只覆盖“中心到相邻格边界”这一半,不再发生半格贴图中心错位。
223 260 for(let i = 1; i <= 3; i += 2){
224 261 const dir = Mathf.mod(this.rotation - i, 4);
225 262 const near = this.nearby(dir);
226 if(near != null && near.team == this.team &&
227 near.block == magneticConveyor &&
228 (near.front() == this || near.back() == this)){
229 this.blendprox |= 1 << i;
263 if(isRenderConnection(magneticConveyor, this, near)){
264 Draw.rect(
265 magneticSideRegion,
266 this.x,
267 this.y,
268 dir * 90
269 );
230 270 }
231 271 }
232 if(this.blendprox != oldBlend){
233 this.recache();
272
273 // 四个方向逐一判断:只有实际连接的一侧才不绘制 edge。
274 // 因而空地一侧始终封边,端点、直线和 T/Cross 接口规则一致。
275 for(let i = 0; i < 4; i++){
276 const dir = Mathf.mod(this.rotation - i, 4);
277 const near = this.nearby(dir);
278 if(!isRenderConnection(magneticConveyor, this, near)){
279 Draw.rect(
280 magneticConveyor.edgeRegion,
281 this.x,
282 this.y,
283 (this.rotation - i) * 90
284 );
285 }
234 286 }
235 287 }
236 288 }
Modified sprites/books/磁铜传送带/磁铜传送带-0.png +0 -0
二进制文件已变更,无法进行逐行预览。
Modified sprites/books/磁铜传送带/磁铜传送带-1.png +0 -0
二进制文件已变更,无法进行逐行预览。
Modified sprites/books/磁铜传送带/磁铜传送带-2.png +0 -0
二进制文件已变更,无法进行逐行预览。
Added sprites/books/磁铜传送带/磁铜传送带-side.png +0 -0
二进制文件已变更,无法进行逐行预览。