StarfallEx
StarfallEx copied to clipboard
Editor file auto-reload on upload
This PR adds an option that, if enabled, will read script files from disk before spawning a starfall chip. This makes it easier to use an external editor side-by-side with Garry's Mod.
The option can be toggled with a checkbox in the editor settings. This option is disabled by default so that if nothing is done then everything should continue to work as usual.
There is also a confirmation prompt that show's up when clicking theRefresh file button if this button is clicked while there are unsaved changes.
Wasn't this already achievable by making sure the file isn't open in the editor and using the tool reload key on a chip you wish to update?
I'll look it all over soon.
Yeah, you could already make the script reload from disk if it wasn't open in an editor, but it was nasty when you wanted to replace the chip, you had open editor, dig for the file, place the chip, open editor, close tab, close editor... kinda messy, this is a great feature IMO
Even better if we could mark instance to watch it's files for changes and reload automatically :heart_eyes:
Yeah, autoreload sounds like a cool option. Just need to query the file modify time on a timer.
I added the timer and the query to the file's last modified time. Now you can edit on another editor and see the text update live (when you save on the other editor).
That's nice, but not all that useful IMO, I was thinking of having the chip automatically reload with the new code once a change is detected. That way you could just focus on coding and watch the changes update in real time, instead of still having to switch to GMod and reload the chip manually.
Isn't that what he said he added?
Isn't that what he said he added?
Nah, right now only the code in editor updates once a change is detected, but the chip doesn't reload automatically.
Ah, yeah both features would be good to have.
That's nice, but not all that useful IMO, I was thinking of having the chip automatically reload with the new code once a change is detected. That way you could just focus on coding and watch the changes update in real time, instead of still having to switch to GMod and reload the chip manually.
Ok, I didn't understand that at first. This new update should have that working.
To enabled it just hold C and right click the chip, then in the starfall submenu just enable the option to reupload on reload. For this to work the checkbox in the editor settings must be enabled.
Oh, it works for included files too. Amazing feature!
I don't see any issues with the rest of the code. Should be good after that comment is addressed.