Skip to content

Commit

Permalink
feat: Wait action
Browse files Browse the repository at this point in the history
  • Loading branch information
Alorel committed Dec 15, 2022
1 parent b293f50 commit d099218
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/actions/core/delay-action.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import {map, noop, timer} from 'rxjs';
import {InternalCategory} from '../../lib/registries/action-registry.mjs';
import {defineLocalAction} from '../../lib/util/define-local.mjs';

interface Props {
duration: number;
}

defineLocalAction<Props>({
category: InternalCategory.CORE,
execute: ({duration}) => timer(duration).pipe(map(noop)),
label: 'Wait',
localID: 'wait',
media: cdnMedia('assets/media/main/timer.svg'),
options: [
{
description: 'Wait for the given number of milliseconds. The actual wait may be significantly longer if the game is minimised in the browser.',
label: 'Duration',
localID: 'duration',
min: 0,
required: true,
type: Number,
},
],
});
1 change: 1 addition & 0 deletions src/actions/core/index.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '../../option-types/option-types.mjs';
import './buy-item-action.mjs';
import './delay-action.mjs';
import './equip-item-action.mjs';
import './sell-item-action.mjs';
import './set-step-idx-action.mjs';
Expand Down

0 comments on commit d099218

Please sign in to comment.