Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Commit

Permalink
Merge pull request #115 from latitudegames/default-modules
Browse files Browse the repository at this point in the history
Default modules
  • Loading branch information
Sean Gillespie authored Oct 6, 2021
2 parents b6949bd + cec2aac commit 8f87d18
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 165 deletions.
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react-simple-code-editor": "^0.11.0",
"rebass": "^4.0.7",
"regenerator-runtime": "^0.13.9",
"rete-connection-reroute-plugin": "^0.4.0",
"rete-context-menu-plugin": "^0.6.0-rc.1",
"rete-react-render-plugin": "^0.2.1",
"rxdb": "^9.21.0",
Expand Down
52 changes: 16 additions & 36 deletions client/scripts/engine.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
// import spell from "./spell";
import thothCore from '@latitudegames/thoth-core/dist/server'

import { TenseTransformer } from "@latitudegames/thoth-core/components/TenseTransformer";
import { ModuleInput } from "@latitudegames/thoth-core/components/ModuleInput";
import { ModuleOutput } from "@latitudegames/thoth-core/components/ModuleOutput";
import { ModuleTriggerOut } from "@latitudegames/thoth-core/components/ModuleTriggerOut";
import { ModuleTriggerIn } from "@latitudegames/thoth-core/components/ModuleTriggerIn";
// import { InputComponent } from "@latitudegames/thoth-core/components/Input";
// import { JoinListComponent } from "@latitudegames/thoth-core/components/JoinList";
// import { RunInputComponent } from "@latitudegames/thoth-core/components/RunInput";
// import { ActionTypeComponent } from "@latitudegames/thoth-core/components/ActionType";
// import { ItemTypeComponent } from "@latitudegames/thoth-core/components/ItemDetector";
// import { DifficultyDetectorComponent } from "@latitudegames/thoth-core/components/DifficultyDetector";
// import { EntityDetector } from "@latitudegames/thoth-core/components/EntityDetector";
// import { SafetyVerifier } from "@latitudegames/thoth-core/components/SafetyVerifier";
// import { BooleanGate } from "@latitudegames/thoth-core/components/BooleanGate";
// import { TimeDetectorComponent } from "@latitudegames/thoth-core/components/TimeDetector";
// import { Alert } from "@latitudegames/thoth-core/components/AlertMessage";
// import { SwitchGate } from "@latitudegames/thoth-core/components/SwitchGate";
// import { PlaytestPrint } from "@latitudegames/thoth-core/components/PlaytestPrint";
// import { PlaytestInput } from "@latitudegames/thoth-core/components/PlaytestInput";
// import { StateWrite } from "@latitudegames/thoth-core/components/StateWrite";
// import { StateRead } from "@latitudegames/thoth-core/components/StateRead";
// import { StringProcessor } from "@latitudegames/thoth-core/components/StringProcessor";
// import { ForEach } from "@latitudegames/thoth-core/components/ForEach";
// import { EnkiTask } from "@latitudegames/thoth-core/components/EnkiTask";
// import { Generator } from "@latitudegames/thoth-core/components/Generator";
// import { Code } from "@latitudegames/thoth-core/components/Code";
// import { ModuleComponent } from "@latitudegames/thoth-core/components/Module";
const {
components: {
moduleInput,
moduleOutput,
moduleTriggerIn,
moduleTriggerOut,
tenseTransformer,
},
} = thothCore

export const components = [
// new ActionTypeComponent(),
Expand All @@ -42,10 +24,10 @@ export const components = [
// new ItemTypeComponent(),
// new JoinListComponent(),
// new ModuleComponent(),
new ModuleInput(),
new ModuleOutput(),
new ModuleTriggerOut(),
new ModuleTriggerIn(),
moduleInput(),
moduleOutput(),
moduleTriggerOut(),
moduleTriggerIn(),
// new PlaytestPrint(),
// new PlaytestInput(),
// new RunInputComponent(),
Expand All @@ -54,8 +36,6 @@ export const components = [
// new StateRead(),
// new StringProcessor(),
// new SwitchGate(),
new TenseTransformer(),
tenseTransformer(),
// new TimeDetectorComponent(),
];

export let modules = [];
]
123 changes: 0 additions & 123 deletions client/scripts/runSpell.ts

This file was deleted.

6 changes: 3 additions & 3 deletions core/src/editor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NodeEditor } from 'rete'
import ConnectionPlugin from 'rete-connection-plugin'
// import ConnectionReroutePlugin from 'rete-connection-reroute-plugin'
import ConnectionReroutePlugin from 'rete-connection-reroute-plugin'
import ContextMenuPlugin from 'rete-context-menu-plugin'
import ReactRenderPlugin from 'rete-react-render-plugin'
import { Data } from 'rete/types/core/data'
Expand Down Expand Up @@ -75,7 +75,7 @@ export const initEditor = async function ({
// connection plugin is used to render conections between nodes
editor.use(ConnectionPlugin)
// @seang: temporarily disabling because dependencies of ConnectionReroutePlugin are failing validation on server import of thoth-core
// editor.use(ConnectionReroutePlugin)
editor.use(ConnectionReroutePlugin)

// React rendering for the editor
editor.use(ReactRenderPlugin, {
Expand Down Expand Up @@ -123,7 +123,7 @@ export const initEditor = async function ({
}, {} as Record<string, ModuleType>)

// The engine is used to process/run the rete graph
const engine = initSharedEngine('[email protected]', modules, components)
const engine = initSharedEngine('[email protected]', components, false, modules)
// @seang TODO: update types for editor.use rather than casting as unknown here, we may want to bring our custom rete directly into the monorepo at this point

// WARNING: ModulePlugin needs to be initialized before TaskPlugin during engine setup
Expand Down
6 changes: 3 additions & 3 deletions core/src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ export type EngineContext = {
onUpdateModule?: Function
sendToPlaytest?: Function
}

// @seang TODO: update this to not use positional arguments
export const initSharedEngine = (
name: string,
modules: Record<string, ModuleType>,
components: any[],
server = false
server = false,
modules: Record<string, ModuleType> = {}
) => {
const engine = new Rete.Engine(name)

Expand Down
42 changes: 42 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,23 @@
"@types/yargs" "^16.0.0"
chalk "^4.0.0"

"@latitudegames/thoth-core@^0.0.47":
version "0.0.47"
resolved "https://npm.pkg.github.com/download/@latitudegames/thoth-core/0.0.47/debf55884ea59db1d621e76a32e686b46b6efb7818a382339b54f53a0fb7c330#ec6feaf9c36988ab9b7ea2b8f53dad15926932ae"
integrity sha512-seAbSeF2p32eCImjDB4Z0BVniuOXiL25numaJGaTMSvCooIgoh6QNX2n8IxGQ8jDT0MTxZF3JvNpF9wHjq3Ihg==
dependencies:
deep-equal "^2.0.5"
handlebars "^4.7.7"
path "^0.12.7"
react "^17.0.2"
rete "https://github.com/latitudegames/rete.git#master"
rete-area-plugin "^0.2.1"
rete-connection-plugin "^0.9.0"
rete-context-menu-plugin "^0.6.0-rc.1"
rete-module-plugin "^0.4.1"
rete-react-render-plugin "^0.2.1"
uuid "^8.3.2"

"@lerna/[email protected]":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@lerna/add/-/add-4.0.0.tgz#c36f57d132502a57b9e7058d1548b7a565ef183f"
Expand Down Expand Up @@ -5568,6 +5585,18 @@ cyclist@^1.0.1:
resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9"
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=

d3-path@1:
version "1.0.9"
resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-1.0.9.tgz#48c050bb1fe8c262493a8caf5524e3e9591701cf"
integrity sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==

d3-shape@^1.3.5:
version "1.3.7"
resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-1.3.7.tgz#df63801be07bc986bc54f63789b4fe502992b5d7"
integrity sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==
dependencies:
d3-path "1"

dargs@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc"
Expand Down Expand Up @@ -12200,6 +12229,14 @@ rete-connection-plugin@^0.9.0:
resolved "https://registry.yarnpkg.com/rete-connection-plugin/-/rete-connection-plugin-0.9.0.tgz#3a6df36f55493a5c2ea021ae3147a0f0a6ada6ed"
integrity sha512-D+H1yAONBBFYXeMkz0sdpDm76XiqcF2N3FduaqMUqcoThocMaFB2O8TX3nJc76ksuYaLYqo/+OLXTxNa+5HQYQ==

rete-connection-reroute-plugin@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/rete-connection-reroute-plugin/-/rete-connection-reroute-plugin-0.4.0.tgz#30fb8f8e2d5d32a379f8c8bd743145a326a42e08"
integrity sha512-DWZrK/qk9kt83o2cELjKpabD0YIJ6rhzp7rnTqEV4IHpSJxhruNSBKG2V7hxXq4wMy7T0zVFh9f0TIRJ5qvTqQ==
dependencies:
d3-shape "^1.3.5"
vue "2.6.10"

rete-context-menu-plugin@^0.6.0-rc.1:
version "0.6.0-rc.1"
resolved "https://registry.yarnpkg.com/rete-context-menu-plugin/-/rete-context-menu-plugin-0.6.0-rc.1.tgz#0e5ba94057952ec9c07c0efd0d2ab27e9cc683a1"
Expand Down Expand Up @@ -13976,6 +14013,11 @@ vm-browserify@^1.0.1:
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==

[email protected]:
version "2.6.10"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.10.tgz#a72b1a42a4d82a721ea438d1b6bf55e66195c637"
integrity sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ==

vue@^2.5.17:
version "2.6.14"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235"
Expand Down

0 comments on commit 8f87d18

Please sign in to comment.