使い方
- インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
- 必要なツール、認証情報、対応環境を原文で確認します。
- 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/drincs-productions/nqtr --skill nqtr-activity開始前の確認
- 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
- スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。
NQTR activities
Official docs: pixi-vn.com/nqtr/activity. Index: nqtr. Ink commands: nqtr-ink.
An activity is an action the player can take (sleep in the bed, order a product, ...) linked to a navigation element (rooms/locations/maps). How it is shown and triggered (button, icon, sprite) is up to your UI.
Initialize
new ActivityBaseModel(id, onRun, props); register with RegisteredActivities.add(...) (required). onRun(activity, props) receives the OnRunProps; typically navigate to the narration screen, then jump to the story label/knot. When the story is written in ink, jump to the ink knot with the same name.
import { ActivityBaseModel, RegisteredActivities, timeTracker } from "@drincs/nqtr";
import { narration } from "@drincs/pixi-vn";
export const bed = new ActivityBaseModel(
"bed",
async (_, props) => {
await props.navigate({ to: "/game/narration" });
await narration.jump(timeTracker.nowIsBetween(5, 22) ? "nap" : "sleep", props);
},
{ name: "bed" },
);
RegisteredActivities.add(bed);=== nap ===
mc: A short nap.
# wait 2
-> DONEActivityProps: name, timeSlot ({ from, to? }, active only in that time range), dateScheduling ({ from, to? }, active only in that date range), disabled / hidden (boolean or a Pixi'VN flag name), renderIcon.
Link (many-to-many)
An activity is only available when linked to a navigation element.
- At initialization —
activities: ["bed"]in the room/location/map constructor. Not saved with the game, so you can change it between versions without migrations. - During the game — saved with the game; for temporary activities.
# add activity order_product in mc_roommcRoom.addActivity("order_product"); // or the activity instanceUnlink
Only activities linked at runtime can be removed:
# remove activity order_product from mc_roommcRoom.removeActivity("order_product");Init-time links cannot be removed; use disabled/hidden or timeSlot/dateScheduling to control them.
Get
RegisteredActivities.get(id) and RegisteredActivities.values(). activity.isActive(options?) tells whether it is available for the current time/date; activity.expired whether its date range has passed.
Custom class
Extend ActivityStoredClass and implement ActivityInterface; augment the interface in nqtr.d.ts with name, disabled, hidden, sprite?, icon?. Constructor: super(id, onRun, props) with ActivityStoredClassProps (timeSlot, dateScheduling). Persist disabled/hidden via getStorageProperty/setStorageProperty. Override isActive to return false when hidden, and run to refresh the UI after running (await runProps.invalidateInterfaceData()), as the templates do.
Pitfalls
- Forgetting
RegisteredActivities.add. - Linking by id before the activity is registered: register activities before use, or rely on the id lists/Vite plugin for validation.
- Prefer a stable id: ink commands use it.