Skip to content

Commit

Permalink
fix: generator creation
Browse files Browse the repository at this point in the history
  • Loading branch information
BigJk committed Feb 9, 2024
1 parent 6c0f557 commit d767fb8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions frontend/src/js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ store.actions.loadAll().then(() => {
'/template/:id/create': TemplateCreateEntity,
'/template/:id/edit/:eid': TemplateCreateEntity,
'/generator': GeneratorAll,
'/generator/:id': GeneratorSingle,
'/generator/:id/edit': GeneratorEdit,
'/generator/create': GeneratorCreate,
'/generator/create/:id': GeneratorCreate,
'/generator/:id': GeneratorSingle,
'/generator/:id/edit': GeneratorEdit,
'/data-source': DataSourceAll,
'/data-source/:id': DataSourceSingle,
'/workshop': WorkshopAll,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/js/core/templating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const rngScript = (seed: any) => `
<script src="https://cdn.jsdelivr.net/npm/@dice-roller/[email protected]/lib/umd/bundle.min.js"></script>
<script>
window.random = new Math.seedrandom('${seed}');
Math.random = window.random;
rpgDiceRoller.NumberGenerator.generator.engine = {
next () {
Expand Down Expand Up @@ -203,7 +204,7 @@ export const render = (
};

let additional = '';
additional += rngScript(clonedState.config.seed ?? 'test-seed');
additional += rngScript(clonedState.config.seed ?? Math.ceil(Math.random() * 500000000));
additional += aiScript;

if (minimal) {
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/js/ui/components/editor/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default (): m.Component<GeneratorEditorProps> => {
centerContainer: true,
render: () =>
m(Editor, {
current: fillConfigValues(state.config, attrs.generator?.config ?? []),
current: state.config,
definition: [
{
key: 'seed',
Expand All @@ -159,7 +159,6 @@ export default (): m.Component<GeneratorEditorProps> => {
...(attrs.generator ? attrs.generator.config : []),
],
onChange: (updated) => {
console.log(updated);
state.config = updated;
m.redraw();
},
Expand Down

0 comments on commit d767fb8

Please sign in to comment.