Dev console finds materials by display name from the real material table (t82)
This commit is contained in:
@@ -74,6 +74,24 @@ check('give turns rock into its rubble and says so', run(`(() => { enableDevCons
|
||||
check('give refuses things that cannot be in a bag', run(`(() => { enableDevConsole(); const out = devCommand('give steam 5').join(' '); return /cannot go in the bag/.test(out) && bag[STEAM] === 0; })()`));
|
||||
|
||||
check('material matching ignores spaces and case', run("devMaterial('CoPpErOrE') === CUORE && devMaterial('copper bar') === BARCU"));
|
||||
const withoutAlias = run(`(() => {
|
||||
const saved = DEV_MATERIALS.CUORE;
|
||||
delete DEV_MATERIALS.CUORE;
|
||||
try {
|
||||
const before = bag[CUORE];
|
||||
devCommand('give CoPpEr OrE 7');
|
||||
return {
|
||||
lookup: devMaterial('CoPpEr OrE') === CUORE && bag[CUORE] === before + 7,
|
||||
prefix: devMaterial('copperor').startsWith('Ambiguous material:') && devMaterial('copperor').includes(', Copper ore.'),
|
||||
list: devMaterialList('CoPpErOrE').some(([, id]) => id === CUORE),
|
||||
suggestions: devSuggestions('coperore').includes(MD[CUORE].name),
|
||||
completion: devComplete('give copperore 25').matches.includes('give Copper ore 25')
|
||||
};
|
||||
} finally { DEV_MATERIALS.CUORE = saved; }
|
||||
})()`);
|
||||
for (const [feature, works] of Object.entries(withoutAlias)) {
|
||||
check('display-name ' + feature + ' works without an internal alias', works);
|
||||
}
|
||||
check('unknown material suggests close giveable names', /Did you mean:.*Copper ore/i.test(command('give coperore')[0]));
|
||||
check('materials lists giveable names with internal names', command('materials').some(s => /Copper ore.*CUORE/.test(s)) && !command('materials').some(s => /STEAM/.test(s)));
|
||||
check('materials filtering ignores spaces and case', command('materials CoPpErOrE').every(s => /Copper ore/i.test(s)) && command('materials copperore').some(s => /CUORE/.test(s)));
|
||||
|
||||
Reference in New Issue
Block a user