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 83 84 85 86 87 88 89 90 91 92 93 94 95 | const l10n = require("../helpers/l10n").default; const id = "EVENT_RATE_LIMIT"; const groups = ["EVENT_GROUP_TIMER"]; const autoLabel = (fetchArg, input) => { Iif (input.units === "frames") { return l10n("EVENT_RATE_LIMIT_LABEL", { time: fetchArg("frames"), units: l10n("FIELD_FRAMES"), }); } return l10n("EVENT_RATE_LIMIT_LABEL", { time: fetchArg("time"), units: l10n("FIELD_SECONDS"), }); }; const fields = [ { key: "variable", label: l10n("FIELD_RATE_LIMIT_VARIABLE"), description: l10n("FIELD_RATE_LIMIT_VARIABLE_DESC"), type: "variable", defaultValue: "LAST_VARIABLE", }, { key: "time", label: l10n("FIELD_TIME_INTERVAL"), description: l10n("FIELD_RATE_LIMIT_INTERVAL_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_TIME_INTERVAL"), description: l10n("FIELD_RATE_LIMIT_INTERVAL_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", }, ], }, { key: "true", label: l10n("FIELD_RATE_LIMITED"), description: l10n("FIELD_RATE_LIMITED_DESC"), type: "events", }, ]; const compile = (input, helpers) => { const { rateLimit } = helpers; const duration = input.units === "frames" ? (input.frames ?? 1) : (input.time ?? 0.5); rateLimit(input.variable, duration, input.units ?? "time", input.true); }; module.exports = { id, description: l10n("EVENT_RATE_LIMIT_DESC"), autoLabel, groups, fields, compile, waitUntilAfterInitFade: true, }; |