BadgerCode / GMod-SDK-VSCode

A VS Code extension to make GMod addon development easier
https://marketplace.visualstudio.com/items?itemName=BadgerCode.gmod-sdk
MIT License
14 stars 0 forks source link

Notify gmod of file change #1

Open UltraBlackLinux opened 2 years ago

UltraBlackLinux commented 2 years ago

Hey there, It turns out, that gmod can load lua files, that changed by observing the filesystem events, in this case the save-file event (no clue, how it's called)

I would be really pleased, if this addon could somehow call that event, so gmod recognizes the change and doesn't force me to always reload the map when I make changes ;) Thanks!

BadgerCode commented 2 years ago

Hey! Yeah I've always wanted changes made to my projects to automatically refresh/update in-game.

The way I've gotten this to work is using symbolic links (../garrysmod/addons/myaddon -> ../My Projects/gmod/myaddon). This allows me to keep my projects in a more convenient location, while also having the files available to garry's mod.

But this isn't very user friendly and it's quite manual.

I would like to make this VS Code extension take care of this. I've considered a few approaches (synchronising files, symbolic links, publish button, ...) but I need to spend some time actually trying something out.

UltraBlackLinux commented 2 years ago

@BadgerCode Yeah I attempted that too, but I was somewhat unsuccessful at linking that. I might try again, but ln just created an invalid link file. Might be related to the fact that it's on a different drive...

BadgerCode commented 2 years ago

Here's an example of making a symbolic link on PC in command prompt

mklink /J "C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\addons\myaddon" "C:\Users\mike-\Documents\Projects\gmod\myaddon"

This should work for other drives too

UltraBlackLinux commented 2 years ago

Here's an example of making a symbolic link on PC in command prompt

mklink /J "C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\addons\myaddon" "C:\Users\mike-\Documents\Projects\gmod\myaddon"

This should work for other drives too

I got it to work in the end, and btw, I am on Linux ;) Seems like I just managed to mess it up the first time, I have no clue how

BadgerCode commented 2 years ago

Yeah it's easy enough to mess up making a symbolic link. More reason why this extension should take care of it!