Commit graph

86 commits

Author SHA1 Message Date
David Négrier 2aba6b1c27 Fixing loop when setting variables
Setting a variable would makes the application enter in an infinite loop of events (between all the scripts and the back)
This fix makes sure a variable does not emit any event if it is changed to a value it already has.
2021-07-23 11:51:01 +02:00
David Négrier e65e8b2097 First version with variables that actually work 2021-07-07 17:17:28 +02:00
David Négrier 86fa869b20 Actually using Type Guards in queries received by WA. 2021-07-06 10:26:44 +02:00
David Négrier bf17ad4567 Switching setVariable to a query and fixing error hangling in query mechanism 2021-07-05 18:29:34 +02:00
David Négrier 62a4814961 Migrating WA.player.getCurrentUser and WA.room.getCurrentRoom to direct property access and WA.room.getMap 2021-07-05 11:53:33 +02:00
David Négrier ea1460abaf Adding variables (on the front side for now) 2021-07-02 17:36:43 +02:00
David Négrier 280c59e6b5 Changing callback signature of registerAnswerer so that it can return a value and not necessarily a promise. 2021-07-02 17:26:28 +02:00
David Négrier 5b4a72ea1f Add new "query/answer" utility functions for the scripting API
So far, the scripting API was using events to communicate between WA and the iFrame.
But often, the scripting API might actually want to "ask" WA a question and wait for an answer.

We dealt with this by using 2 unrelated events (in a mostly painful way).

This commit adds a "queryWorkadventure" utility function in the iFrame API that allows us
to send a query, and to wait for an answer. The query and answer events have a unique ID to be
sure the answer matches the correct query.

On the WA side, a new `IframeListener.registerAnswerer` method can be used to register a possible answer.
2021-07-02 16:49:22 +02:00
GRL e1611969ce Merge branch 'develop' of github.com:thecodingmachine/workadventure into jonnytest1-tiles-start-positions 2021-07-02 14:35:28 +02:00
GRL 01d02124d1 Merge branch 'develop' of github.com:thecodingmachine/workadventure into metadataScriptAPIV2 2021-07-01 11:38:33 +02:00
GRL 6462773e7f Merge branch 'develop' of github.com:thecodingmachine/workadventure into metadataScriptAPIV2 2021-06-29 14:16:19 +02:00
GRL b457ce493b Suppress console.log 2021-06-29 09:44:57 +02:00
GRL 389ca25b6a Cowebsite opened by script can use Iframe Api 2021-06-28 18:00:48 +02:00
David Négrier 3fd4f9d384 Adding a warning message if an unauthorized iFrame tries to communicate with WA
Closes #1241
2021-06-28 15:20:27 +02:00
David Négrier 1e57028e6e Renaming changeTile to setTiles 2021-06-28 14:58:49 +02:00
GRL b182a08ca2 correction from review 2021-06-28 09:33:13 +02:00
jonny 7f61e9addd Merge remote-tracking branch 'remotes/upstream/develop' into tiles-start-positions 2021-06-25 18:14:40 +02:00
GRL 24cc340cb9 Merge branch 'metadataScriptingApi' of github.com:thecodingmachine/workadventure into metadataScriptAPIV2 2021-06-23 12:02:29 +02:00
GRL bdb32a29e1 New methods refactored 2021-06-23 11:32:11 +02:00
GRL 85fe92f604 Merge branch 'menu-commands-apiref' of github.com:jonnytest1/workadventure into metadataScriptingApi 2021-06-23 09:18:20 +02:00
GRL be23db5bcf Resolve import and LoadPageEvent issue 2021-06-22 16:07:31 +02:00
GRL ca3f5c599a Merge branch 'develop' of github.com:thecodingmachine/workadventure into metadataScriptingApi 2021-06-22 14:00:19 +02:00
jonny ba1bcf226a menu command api 2021-06-21 18:22:31 +02:00
jonny 238f333b81 Merge remote-tracking branch 'remotes/workadventure-main/develop' into load-page-api
# Conflicts:
#	front/src/Api/Events/IframeEvent.ts
#	front/src/Api/IframeListener.ts
#	front/src/Phaser/Game/GameScene.ts
#	front/src/iframe_api.ts
2021-06-15 15:05:49 +02:00
David Négrier b03ee5bd53 Fixing scripting origin check
When working on making the openCoWebsite URL relative, we introduced a regression.
In production, the iframe generated by "script" properties have no "src" and therefore, were treated as invalid messages.

This should fix everything in prod.
2021-06-07 16:48:52 +02:00
GRL 858a513569 correction of adding custom menu
correction of setProperty
updating CHANGELOG
updating api-reference
2021-05-28 12:13:10 +02:00
GRL 9cd3ff1d31 Merge branch 'correct-merge' into metadataScriptAPIV2 2021-05-27 10:16:00 +02:00
GRL acbe4f89a6 Merge branch 'update-game-tiles' into correct-merge 2021-05-27 09:45:25 +02:00
GRL 5565ddd3f4 Merge branch 'develop' of github.com:thecodingmachine/workadventure into metadataScriptingApi 2021-05-26 17:22:37 +02:00
GRL a5cb93541a correction from code review 2021-05-25 17:21:02 +02:00
GRL d4bc999c54 pause loading tileset on fly 2021-05-25 10:15:56 +02:00
GRL a7b09e91ba Revert "Merge branch 'update-game-tiles' into metadataScriptingApi"
This reverts commit 428625e61b, reversing
changes made to a3165a0540.
2021-05-25 10:09:58 +02:00
GRL 428625e61b Merge branch 'update-game-tiles' into metadataScriptingApi 2021-05-25 09:54:00 +02:00
GRL b18b2fe0e3 preparation for merge with metadataScriptApi 2021-05-25 09:50:59 +02:00
DESKTOP-FMM8UI0\CLV 0c3b9ccfbf Merge branch 'develop' of https://github.com/thecodingmachine/workadventure into SoundInMapScript
# Conflicts:
#	front/src/Api/IframeListener.ts
#	front/src/Phaser/Game/GameScene.ts
#	front/src/iframe_api.ts
#	maps/Tuto/scriptTuto.js
#	maps/Village/Village.json
2021-05-21 17:45:26 +02:00
GRL 1110f4fb7f Revert "Merge branch 'update-game-tiles' into metadataScriptingApi"
This reverts commit 796a9418d3, reversing
changes made to 3506063e65.
2021-05-21 16:24:48 +02:00
GRL 796a9418d3 Merge branch 'update-game-tiles' into metadataScriptingApi 2021-05-21 15:56:35 +02:00
GRL 3506063e65 first step on loading a tileset from a script 2021-05-20 17:09:10 +02:00
GRL 2f9cc393a7 Implementation of getTag of the current user
documentation of getTag
Adding map for test of getTag
2021-05-20 10:57:36 +02:00
GRL ce0a72c6ce Merge branch 'menu-command-api' of github.com:jonnytest1/workadventure into metadataScriptingApi 2021-05-19 09:36:11 +02:00
GRL aa78bf44ef implementation of DataLayerEvent
update GetGameState to add nickname to the returned data
update GameMap to separate phaserLayer and mapLayer
2021-05-18 15:41:16 +02:00
GRL 201fcf6afa Merge branch 'gamestate-api-read' of github.com:jonnytest1/workadventure into metadataScriptingApi 2021-05-18 15:18:35 +02:00
GRL 2ee62c9e9e Merge branch 'develop' of github.com:thecodingmachine/workadventure into metadataScriptingApi 2021-05-18 11:50:03 +02:00
GRL 3edfd5b285 GameState is now save in cache
HasPlayerMoved is send when the player is actually moving on the map every 200ms.
2021-05-18 11:33:16 +02:00
David Négrier 127a4759ac Merge branch 'develop' of github.com:thecodingmachine/workadventure into menu-command-api
# Conflicts:
#	front/src/Api/Events/IframeEvent.ts
#	front/src/Api/IframeListener.ts
#	front/src/iframe_api.ts
2021-05-18 10:16:44 +02:00
David Négrier fe573893a1
Merge pull request #1039 from thecodingmachine/importsNotUsedAsValues
Setting "importsNotUsedAsValues": "error"
2021-05-13 19:43:34 +02:00
GRL 43aad4ab14 phaserLayers managed by Gamemap
Implementation of LayersFlattener
Implementation of Setting properties of a layer form script
Update show/hide layer form script
Update unit test of LayersIteratorTest
2021-05-12 14:30:12 +02:00
David Négrier 8c1e01566a Upgrading all dependencies in front
Upgrading to Webpack 5, Typescript 4, ...
2021-05-12 10:35:14 +02:00
David Négrier 4d4f845b9e Setting "importsNotUsedAsValues": "error"
Turning the "importsNotUsedAsValues" TS config value to "error".
This will require us to use `import type` instead of `import` when we are importing a value that is only used as a type (and therefore that is dropped by the Typescript compiler).

Why this change?
This is a requirement to be able to use Svelte in the future. See https://github.com/sveltejs/svelte-preprocess/issues/206#issuecomment-663193798
2021-05-12 09:13:25 +02:00
jonny 8cef4f6e90 Merge remote-tracking branch 'remotes/workadventure-main/develop' into gamestate-api-read
# Conflicts:
#	front/src/Api/IframeListener.ts
2021-05-10 21:48:11 +02:00