v0.47.2
Pre-releaseCore
Function templateReplace
is now passed into custom actions.
Click to expand
const handler: CustomHandler = ({ state, templateReplace }) => {
const object = {
ru: 'Текст по-русски',
en: 'Text in English'
}
console.log(templateReplace(object, state()); // By default global data will be used instead of state, could be any object anyway
}
handler.id = 'my-custom-action';
handler.key = 'my-custom-action--1';
Each NovelyAsset
get's id
property. It's randomly generated at asset creation.
Click to expand
When NovelyAsset['source']
is accessed that asset will always use that value. NovelyAsset
is typically used to get best supported image/audio format that will weight less. For the simplicity the new id
property will help with asset determination.
const showSomething = (asset: NovelyAsset) => {
const handler: CustomHandler = () => {
// it's safe to access `source` now
asset.source;
}
handler.id = 'show-something';
handler.key = `show-something--${asset.id}`; //
return handler;
}
Added asset.image
and asset.audio
methods. Both accept always one argument, does not check for asset to be of certain type.
Click to expand
Sometimes we do not need to pick the best asset or get the resource type automatically. It just makes an asset with certain type.
import background_avif from './background.png?format=avif';
import background_webp from './background.png?format=webp';
import background_jpeg from './background.png?format=jpeg';
const background = import.meta.env.DEV ? asset.image(background_jpeg) : asset(background_avif, background_webp, background_jpeg);
Fixes playSound
. Now when restoring a save, sound only be played if there are no blocking actions ahead of it.
@novely/solid-renderer@0.45.1
Characters and background now uses div
with background-image
property instead of canvas.
Custom showImage
and hideImage
actions were rewritten with some bugs fixed.