mirror of
https://github.com/modrinth/code.git
synced 2026-09-04 22:10:15 +00:00
feat: exclude loaders from randomizing
This commit is contained in:
+38
-6
@@ -1,4 +1,4 @@
|
|||||||
import { defineMessages } from '@modrinth/ui'
|
import { defineMessages, type MessageDescriptor } from '@modrinth/ui'
|
||||||
|
|
||||||
import backpack from '@/assets/instance-icons/backpack.png'
|
import backpack from '@/assets/instance-icons/backpack.png'
|
||||||
import beacon from '@/assets/instance-icons/beacon.png'
|
import beacon from '@/assets/instance-icons/beacon.png'
|
||||||
@@ -207,6 +207,14 @@ const names = defineMessages({
|
|||||||
quilt: { id: 'instance.icon-editor.symbol.quilt', defaultMessage: 'Quilt' },
|
quilt: { id: 'instance.icon-editor.symbol.quilt', defaultMessage: 'Quilt' },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export interface SymbolOption {
|
||||||
|
id: string
|
||||||
|
name: MessageDescriptor
|
||||||
|
asset: string
|
||||||
|
category: 'loader' | 'modded' | 'vanilla'
|
||||||
|
excludeFromRandomization?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export const backgroundOptions = [
|
export const backgroundOptions = [
|
||||||
{
|
{
|
||||||
id: 'rose',
|
id: 'rose',
|
||||||
@@ -351,10 +359,34 @@ export const symbolOptions = [
|
|||||||
// loaders
|
// loaders
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
{ id: 'fabric', name: names.fabric, asset: fabric, category: 'loader' },
|
{
|
||||||
{ id: 'forge', name: names.forge, asset: forge, category: 'loader' },
|
id: 'fabric',
|
||||||
{ id: 'neoforge', name: names.neoForge, asset: neoForge, category: 'loader' },
|
name: names.fabric,
|
||||||
{ id: 'quilt', name: names.quilt, asset: quilt, category: 'loader' },
|
asset: fabric,
|
||||||
|
category: 'loader',
|
||||||
|
excludeFromRandomization: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'forge',
|
||||||
|
name: names.forge,
|
||||||
|
asset: forge,
|
||||||
|
category: 'loader',
|
||||||
|
excludeFromRandomization: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'neoforge',
|
||||||
|
name: names.neoForge,
|
||||||
|
asset: neoForge,
|
||||||
|
category: 'loader',
|
||||||
|
excludeFromRandomization: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'quilt',
|
||||||
|
name: names.quilt,
|
||||||
|
asset: quilt,
|
||||||
|
category: 'loader',
|
||||||
|
excludeFromRandomization: true,
|
||||||
|
},
|
||||||
|
|
||||||
// Cobblemon: Poké Ball
|
// Cobblemon: Poké Ball
|
||||||
{ id: 'poke_ball', name: names.pokeBall, asset: pokeBall, category: 'modded' },
|
{ id: 'poke_ball', name: names.pokeBall, asset: pokeBall, category: 'modded' },
|
||||||
@@ -455,7 +487,7 @@ export const symbolOptions = [
|
|||||||
{ id: 'lantern', name: names.lantern, asset: lantern, category: 'vanilla' },
|
{ id: 'lantern', name: names.lantern, asset: lantern, category: 'vanilla' },
|
||||||
{ id: 'tnt', name: names.tnt, asset: tnt, category: 'vanilla' },
|
{ id: 'tnt', name: names.tnt, asset: tnt, category: 'vanilla' },
|
||||||
{ id: 'command_block', name: names.commandBlock, asset: commandBlock, category: 'vanilla' },
|
{ id: 'command_block', name: names.commandBlock, asset: commandBlock, category: 'vanilla' },
|
||||||
] as const
|
] as const satisfies readonly SymbolOption[]
|
||||||
|
|
||||||
export type BackgroundId = (typeof backgroundOptions)[number]['id']
|
export type BackgroundId = (typeof backgroundOptions)[number]['id']
|
||||||
export type SymbolId = (typeof symbolOptions)[number]['id']
|
export type SymbolId = (typeof symbolOptions)[number]['id']
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
DEFAULT_SYMBOL_ID,
|
DEFAULT_SYMBOL_ID,
|
||||||
RANDOM_CONFIG_BLACKLIST,
|
RANDOM_CONFIG_BLACKLIST,
|
||||||
type SymbolId,
|
type SymbolId,
|
||||||
|
type SymbolOption,
|
||||||
symbolOptions,
|
symbolOptions,
|
||||||
} from './editor-catalog'
|
} from './editor-catalog'
|
||||||
|
|
||||||
@@ -202,7 +203,8 @@ function surpriseMe() {
|
|||||||
const configurations = backgroundOptions.flatMap((background) =>
|
const configurations = backgroundOptions.flatMap((background) =>
|
||||||
symbolOptions
|
symbolOptions
|
||||||
.filter(
|
.filter(
|
||||||
(symbol) =>
|
(symbol: SymbolOption) =>
|
||||||
|
!symbol.excludeFromRandomization &&
|
||||||
background.id !== selectedBackground.value &&
|
background.id !== selectedBackground.value &&
|
||||||
symbol.id !== selectedSymbol.value &&
|
symbol.id !== selectedSymbol.value &&
|
||||||
!RANDOM_CONFIG_BLACKLIST.some(
|
!RANDOM_CONFIG_BLACKLIST.some(
|
||||||
|
|||||||
Reference in New Issue
Block a user