1
0
Fork 0

Continue prototype fix

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2024-08-13 17:35:15 +08:00
parent 43a0b0c10f
commit 1337250b07
2 changed files with 24 additions and 9 deletions

View File

@ -52,13 +52,12 @@ const wiring_constraint = (name) => {
}
}
const phaser_not_fit = (data, index, counters, crate) => {
const phaser_next_card_long = (data, index, counters, crate) => {
const nbrOccupied = resource_counters.hp(crate.items, -1);
const nbrHP = useShopStore.getState().crateParams(crate.crate_mode).hp;
console.log(data, index, counters, crate)
return (index < data.length - 1) ? (
(data[index+1].consumes && data[index+1].consumes.depth && data[index+1].consumes.depth >= 8.5 && nbrOccupied >= nbrHP && nbrHP > 0)
) : (nbrOccupied >= nbrHP-2 && nbrHP > 0)
(data[index+1].consumes && data[index+1].consumes.depth && data[index+1].consumes.depth >= 8.5)
) : (nbrOccupied >= nbrHP && nbrHP > 0)
}
const Types = {
@ -97,10 +96,10 @@ const Types = {
trigger: wiring_constraint("eem"),
message: "Due to wiring constraints, the carrier can only connect to EEM cards immediately at its right, without crossing another carrier."
},
"phaser_not_fit": {
level: "warning",
trigger: phaser_not_fit,
message: "PHASER."
"phaser_next_card_long": {
level: "reminder",
trigger: phaser_next_card_long,
message: "Next card may interfere with this Phaser. Consider placing a short card after this Phaser."
},
"default": {
level: "warning",
@ -157,6 +156,22 @@ const crate_warnings = {
const nbrHPDesktop = useShopStore.getState().crate_modes.desktop.hp;
return crate.crate_mode === useShopStore.getState().crate_modes.rack.id && occupied < nbrHPDesktop;
}
},
"phaser_not_fit": {
message: "Since one or more Phasers may interfere with their next cards, they may additional space, that wouldn't fit into the crate. Consider removing cards, placing short cards after Phaser(s), or choosing larger crate.",
level: "warning",
trigger: (crate, occupied) => {
const nbrHP = useShopStore.getState().crateParams(crate.crate_mode).hp;
const stacked_phasers = crate.items.filter((elem, index, data) => {
console.log(elem, index)
return (elem.name_codename === "Phaser") && ((index < data.length - 1) ? (
(data[index + 1].consumes && data[index + 1].consumes.depth && data[index + 1].consumes.depth >= 8.5)
) : (occupied >= nbrHP && nbrHP > 0))
}
).length;
console.log(stacked_phasers, occupied)
return stacked_phasers > 0 && (occupied + stacked_phasers*2 >= nbrHP) && nbrHP >0;
}
}
}

View File

@ -776,7 +776,7 @@ const shop_data = {
warnings: [
"no_eem_source",
"no_clk_source",
"phaser_not_fit"
"phaser_next_card_long"
],
consumes: {
hp: 4,