Sleitnick / Knit

Lightweight game framework for Roblox
https://sleitnick.github.io/Knit/
MIT License
566 stars 93 forks source link

Prevent KnitServer from being destroyed when in EditMode #226

Closed Raild3x closed 1 year ago

Raild3x commented 1 year ago

This commit stems from an issue where if Knit is ever even required inside of a module that is used within a plugin like Hoarcekat, it deletes KnitServer from your game. This small change aims to prevent that

Sleitnick commented 1 year ago

The problem here is that starting Knit in Edit mode will create objects too (e.g. RemoteEvents), which can make things messy. Ideally, Knit should not be started when in Edit mode. If using Hoarcekat, it's preferred to hook into things that don't require Knit to start. This might mean creating intermediary modules that deal with whatever state is needed to drive stuff in your UI.

Raild3x commented 1 year ago

The problem here is that starting Knit in Edit mode will create objects too (e.g. RemoteEvents), which can make things messy. Ideally, Knit should not be started when in Edit mode. If using Hoarcekat, it's preferred to hook into things that don't require Knit to start. This might mean creating intermediary modules that deal with whatever state is needed to drive stuff in your UI.

Then in that case shouldn't one just disallow starting knit in edit mode instead? I've aimed to remove requires of knit in my codebase, but there are some nested requirements that sometimes need the module during runtime. It would be preferential to be able to put the require for knit at the top with the others rather than having to require dynamically when needed. I can understand not wanting Knit to run in edit mode, however, my qualm is that if this is ever attempted then the whole project needs to be reloaded and resynced to rojo to get KnitServer back in the game.