mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-19 17:16:08 +08:00
提高楼传分区的性能
This commit is contained in:
parent
d09da5711b
commit
2860dccc01
@ -226,8 +226,8 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
|
|||||||
});
|
});
|
||||||
// 然后根据位置依次绘制对应位置的伤害
|
// 然后根据位置依次绘制对应位置的伤害
|
||||||
for (const dam of v.damage) {
|
for (const dam of v.damage) {
|
||||||
const d = (dam.damage - min) / delta;
|
const d = ((dam.damage - min) / delta) * 255;
|
||||||
const color = core.arrayToRGB([d * 255, 255 - d * 255, 0]);
|
const color = core.arrayToRGB([d, 255 - d, 0]);
|
||||||
if (dam.dir === 'down' || dam.dir === 'up') {
|
if (dam.dir === 'down' || dam.dir === 'up') {
|
||||||
const dir = dam.dir === 'down' ? '↑' : '↓';
|
const dir = dam.dir === 'down' ? '↑' : '↓';
|
||||||
core.status.damage.extraData.push({
|
core.status.damage.extraData.push({
|
||||||
|
@ -27,11 +27,11 @@ const bfsCache: Partial<Record<FloorIds, MapBFSResult>> = {};
|
|||||||
*/
|
*/
|
||||||
const drawCache: Record<string, MapDrawData> = {};
|
const drawCache: Record<string, MapDrawData> = {};
|
||||||
|
|
||||||
const arrow: Partial<Record<AllIds, Dir>> = {
|
const arrow: Partial<Record<AllNumbers, Dir>> = {
|
||||||
leftPortal: 'left',
|
92: 'left',
|
||||||
rightPortal: 'right',
|
94: 'right',
|
||||||
upPortal: 'up',
|
91: 'up',
|
||||||
downPortal: 'down'
|
93: 'down'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,13 +175,13 @@ export function getMapData(
|
|||||||
|
|
||||||
while (queue.length > 0) {
|
while (queue.length > 0) {
|
||||||
const now = queue.shift()!;
|
const now = queue.shift()!;
|
||||||
const change = core.floors[now].changeFloor;
|
const floor = core.floors[now];
|
||||||
const blocks = core.getMapBlocksObj(now, noCache);
|
const change = floor.changeFloor;
|
||||||
for (const [loc, ev] of Object.entries(change)) {
|
for (const [loc, ev] of Object.entries(change)) {
|
||||||
const target = ev.floorId as FloorIds;
|
const target = ev.floorId as FloorIds;
|
||||||
if (target.startsWith(':')) continue;
|
if (target.startsWith(':')) continue;
|
||||||
const block = blocks[loc as LocString];
|
const [x, y] = loc.split(',').map(v => parseInt(v));
|
||||||
const id = block.event.id;
|
const id = floor.map[y][x] as AllNumbers;
|
||||||
if (id in arrow) {
|
if (id in arrow) {
|
||||||
if (!used[target]) {
|
if (!used[target]) {
|
||||||
const from = `${now},${loc},${arrow[id]}` as BFSFromString;
|
const from = `${now},${loc},${arrow[id]}` as BFSFromString;
|
||||||
|
Loading…
Reference in New Issue
Block a user