I am trying to save my parcel’s state while on the “Grid”.
I have a variable “down” that stores the state of an elevator (true for down, false for up). I want the “Grid” to remember it, so when other players spawn in, the elevator is configured correctly (if it was up, it loads in the up position).
Since the Grid is only a temporary instance, I can’t store a variable there. Fine. So I attempted to read the position of the elevator each time a new player spawns in.
Unfortunately, testing has revealed the Grid loads everything in its default position, then syncs as players explore together, so even if several players have positioned the elevator UP together, a new player will load it in the default down position.
I then decided to double down and make an express app on my own server (node js) and set the state there. When the elevator goes up, it uses fetch() to make a POST to my server to say it’s up. When the elevator goes down, it uses fetch() to make a POST to my server and says it’s down.
When the parcel loads, it it uses fetch() to make a GET request to my server and finds the position of the elevator and sets it. Perfect!
However, if the “Grid” is on, fetch stops working.
I then noticed on line 374 of https://github.com/cryptovoxels/scripting-bundle/blob/master/index.js that “fetch doesn’t work nicely on the grid. So we use ‘fetchJson’ when on scripthost, and fetch() when local”, so I pasted all of fetchJSON into my script and used that.
Still doesn’t work.
Am I trying to accomplish the impossible here?
I’ll admit after two days of experiments, it sure feels like it.
How to remember state on your parcel when combined with the Grid?