mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-11-27 13:42:58 +08:00
fix: 多个 id 共用一个偏移导致画不出来
This commit is contained in:
parent
1c27014ab3
commit
15f5282d8c
@ -9,9 +9,10 @@ function extractClsBlocks<C extends Exclude<Cls, 'tileset'>>(
|
|||||||
icons: Record<string, number>
|
icons: Record<string, number>
|
||||||
): IBlockIdentifier[] {
|
): IBlockIdentifier[] {
|
||||||
const max = Math.max(...Object.values(icons));
|
const max = Math.max(...Object.values(icons));
|
||||||
const arr = Array(max).fill(0);
|
const arr = Array(max).fill(void 0);
|
||||||
for (const [key, value] of Object.entries(icons)) {
|
for (const [key, value] of Object.entries(icons)) {
|
||||||
if (!(key in map)) continue;
|
// 样板编辑器 bug 可能会导致多个 id 使用一个偏移,因此要判断下
|
||||||
|
if (!(key in map) || !isNil(arr[value])) continue;
|
||||||
const id = key as AllIdsOf<C>;
|
const id = key as AllIdsOf<C>;
|
||||||
const num = map[id] as keyof NumberToId;
|
const num = map[id] as keyof NumberToId;
|
||||||
const identifier: IBlockIdentifier = {
|
const identifier: IBlockIdentifier = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user