Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 1x 1x 1x 1x 1x 1x 4x 4x 4x 1x | const l10n = require("../helpers/l10n").default;
const id = "EVENT_WAIT";
const groups = ["EVENT_GROUP_TIMER"];
const autoLabel = (fetchArg, input) => {
Iif (input.units === "frames") {
return l10n("EVENT_WAIT_LABEL", {
time: fetchArg("frames"),
units: l10n("FIELD_FRAMES"),
});
}
return l10n("EVENT_WAIT_LABEL", {
time: fetchArg("time"),
units: l10n("FIELD_SECONDS"),
});
};
const fields = [
{
key: "time",
label: l10n("FIELD_DURATION"),
description: l10n("FIELD_DURATION_WAIT_DESC"),
type: "value",
min: 0,
max: 60,
step: 0.1,
unitsField: "units",
unitsDefault: "time",
unitsAllowed: ["time", "frames"],
defaultValue: {
type: "number",
value: 0.5,
},
conditions: [
{
key: "units",
ne: "frames",
},
],
},
{
key: "frames",
label: l10n("FIELD_DURATION"),
description: l10n("FIELD_DURATION_WAIT_DESC"),
type: "value",
min: 0,
max: 3600,
width: "50%",
unitsField: "units",
unitsDefault: "time",
unitsAllowed: ["time", "frames"],
defaultValue: {
type: "number",
value: 1,
},
conditions: [
{
key: "units",
eq: "frames",
},
],
},
];
const compile = (input, helpers) => {
const { waitScriptValue } = helpers;
const duration =
input.units === "frames" ? (input.frames ?? 1) : (input.time ?? 0.5);
waitScriptValue(duration, input.units ?? "time");
};
module.exports = {
id,
description: l10n("EVENT_WAIT_DESC"),
autoLabel,
groups,
fields,
compile,
waitUntilAfterInitFade: true,
};
|