rbx-net
rbx-net copied to clipboard
Connecting a running game to a rojo server deletes events
Problem
When a game is running and calls Net.CreateDefinitions
then Event
s are created under the net.out._NetManaged
Instance
When starting a rojo server using a "$path"
to load dependencies including rbx-net, the rojo server creates a DataModel
with a net.out
Instance
without the events, as it only knows about what is on the filesystem.
If I attempt to connect a running game to that running rojo server using the rojo plugin, the plugin(?) will overwrite the runtime Instance
s currently in the game with the ones the server knows about. This removes the Event
s created by Net.CreateDefinitions
.
Then event handlers in the game no longer work.
Workaround
When go into my dependency tree and add a file net/out/init.meta.json
with contents
{"ignoreUnknownInstances": true}
the previous setup will keep the Event
s created by Net.CreateDefinitions
, as rojo will ignore the _NetManaged
Instance
when updating. Then I can use the rewire library to hot reload code as desired.
Potential Fix
Adding this file to the repo might be a solution, but I have not given proper consideration to the ramifications of leaving old events around, and how such a choice could conflict with the intentional design decision mentioned in #78.