map-starter-kit icon indicating copy to clipboard operation
map-starter-kit copied to clipboard

Editing map breaks floorLayer?

Open Moon-developer opened this issue 2 years ago • 3 comments

Description:

When editing the map it seems to break the floorLayer object. When you walk onto it, it does not show the clock, Jitsi popup or silent zone actions being executed. Chrome console also does not show any errors.

Steps to reproduce:

  • Clone this template as per guide instructions
  • Clone repo
  • Open map.json with Tiled (version 1.9.0 or 1.8.2)
  • Edit map (add plant) and save.
  • run npm install and npm run dev Output:
(base) ➜  office git:(master) ✗ npm run dev

> [email protected] dev
> vite

failed to load config from /home/user/Downloads/tiled/office/vite.config.ts
error when starting dev server:
/home/user/Downloads/tiled/office/node_modules/wa-map-optimizer-vite/dist/index.js:42
    const distFolder = options?.output?.path ?? "./dist";
                               ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/user/Downloads/tiled/office/vite.config.ts:26:36)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.require.extensions.<computed> [as .ts] (/home/user/Downloads/tiled/office/node_modules/vite/dist/node/chunks/dep-59dc6e00.js:61924:20)
npm ERR! code 1
npm ERR! path /home/user/Downloads/tiled/office
npm ERR! command failed
npm ERR! command sh -c vite

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2022-07-21T14_22_47_617Z-debug.log

Here is that log file generated:

0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:/home/marco/Downloads/tiled/office/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/home/marco/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 6ms
19 verbose npm-session 47e67993d63bb2f4
20 timing npm:load Completed in 13ms
21 timing command:run-script Completed in 242ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> (/usr/share/nodejs/@npmcli/promise-spawn/index.js:64:27)
22 verbose stack     at ChildProcess.emit (events.js:314:20)
22 verbose stack     at maybeClose (internal/child_process.js:1022:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
23 verbose pkgid [email protected]
24 verbose cwd /home/marco/Downloads/tiled/office
25 verbose Linux 5.11.0-49-generic
26 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
27 verbose node v12.21.0
28 verbose npm  v7.5.2
29 error code 1
30 error path /home/marco/Downloads/tiled/office
31 error command failed
32 error command sh -c vite
33 verbose exit 1

Environment:

OS: Ubuntu 21.04 node --version: v12.21.0 Tiled: 1.9.0 & 1.8.2

Moon-developer avatar Jul 21 '22 14:07 Moon-developer

Hello, thank you for your feedback! Please can you retry with a more up-to-date version of Node (lts 16 or 18) ?

Nolway avatar Jul 21 '22 15:07 Nolway

Hello, thank you for your feedback! Please can you retry with a more up-to-date version of Node (lts 16 or 18) ?

So I was finally able to purge and update nodejs to 16. I'm now able to run a local instance but the floorLayer is still not working.

Moon-developer avatar Jul 21 '22 16:07 Moon-developer

Update on this issue:

The map was initially saved with Tiled 1.9.0, this version of Tiled has a param called Class on the object layers. It was left blank when I saved it. Opening the map again with Tiled 1.8.2 didn't fix the issue since damage had been done.

This issue seems to be related to #39 .

Optional fixes:

  • Manually add {"type": "area", ...} to each layer object in the map.json
  • Use 1.8.2 and never 1.9.0.
  • Add default settings as mentioned in #39

Moon-developer avatar Jul 21 '22 16:07 Moon-developer

@Moon-developer everyone that is going to open a map with Tiled v>=1.9 but that has been saved from a Tiled v<=1.8 (or with a 1.8 but saved from a 1.9) will have this issue. From Tiled 1.9 the parameter Type is now called Class so all objects (variables and areas) will be broken in this case. So yes you have to do the changes by hand. image.

You can use >1.9 but just stick with it and don't work with >1.8 anymore. that way you can get the new versions of Tiled ;)

ValdoTR avatar Jan 02 '23 10:01 ValdoTR