feat: 自动设置光源

This commit is contained in:
AncTe committed 2024-04-27 14:23:41 +08:00
1 parent c5492e1e77
commit 8dba57e222
3 files changed
+132 -32

No files matched your search

+2 -1
View File
@@ -28,6 +28,7 @@ export function setCanvasFilterByFloorId(
Mota.require('var', 'loading').once('coreInit', () => {
filterMap.push(
[core.floorIds.slice(60), 'brightness(80%)contrast(120%)'] // 童心佬的滤镜(
[['MT50'], 'brightness(80%)contrast(120%)'], // 童心佬的滤镜(
[core.floorIds.slice(61), 'brightness(90%)contrast(120%)'] // 童心佬的滤镜(
);
});
+42 -17
View File
@@ -85,26 +85,22 @@ const shadowInfo: Partial<Record<FloorIds, Light[]>> = {
noShelter: true
}
],
MT51: [
{
id: 'mt51_hero',
x: 0,
y: 0,
decay: 50,
r: 250,
color: 'transparent',
followHero: true
}
],
MT52: [
{
id: 'mt52_hero',
x: 0,
y: 0,
decay: 50,
id: 'mt51_1',
x: 13 * 32 + 16,
y: 6 * 32 + 16,
decay: 20,
r: 250,
color: 'transparent',
followHero: true
color: pColor('#e953')
},
{
id: 'mt51_2',
x: 1 * 32 + 16,
y: 13 * 32 + 16,
decay: 20,
r: 350,
color: pColor('#e953')
}
]
};
@@ -119,6 +115,35 @@ const shadowCache: Partial<Record<FloorIds, Polygon[]>> = {};
let calMapShadow = true;
Mota.require('var', 'loading').once('coreInit', () => {
core.floorIds.slice(61).forEach(v => {
shadowInfo[v] ??= [];
shadowInfo[v]?.push({
id: `${v}_hero`,
x: 0,
y: 0,
decay: 50,
r: 300,
color: 'transparent',
followHero: true
});
core.floors[v].map.forEach((arr, y) => {
arr.forEach((num, x) => {
if (num === 103) {
shadowInfo[v]?.push({
id: `${v}_${x}_${y}`,
x: x * 32 + 16,
y: y * 32 + 16,
decay: 20,
r: 350,
color: pColor('#e953')
});
}
});
});
});
});
export function updateShadow(nocache: boolean = false) {
// todo: 需要优化,优化成bfs
const floor = core.status.floorId;