Merge pull request #2 from RyanHx/push-on-conn
Push all files on connection
This commit is contained in:
commit
5520fa3430
3 changed files with 18 additions and 3 deletions
|
@ -34,6 +34,7 @@ Here's an example of it's contents:
|
|||
"definitionFile": {
|
||||
"update": false,
|
||||
"location": "NetScriptDefinitions.d.ts"
|
||||
}
|
||||
},
|
||||
"pushAllOnConnection": false
|
||||
}
|
||||
```
|
||||
|
|
|
@ -52,6 +52,12 @@ export let config = convict({
|
|||
env: 'BB_LOCATION_DEF',
|
||||
default: "./NetScriptDefinitions.d.ts"
|
||||
}
|
||||
},
|
||||
pushAllOnConnection: {
|
||||
doc: 'Push all files when initial connection is made.',
|
||||
format: 'Boolean',
|
||||
env: 'BB_CON_PUSH',
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
|
|
12
src/index.js
12
src/index.js
|
@ -23,8 +23,16 @@ export async function start() {
|
|||
signal.emit(EventType.MessageSend, requestDefinitionFile());
|
||||
}
|
||||
|
||||
// Upload missing files to the game.
|
||||
signal.emit(EventType.MessageSend, requestFilenames());
|
||||
if (config.get("pushAllOnConnection")) {
|
||||
const extensions = config.get("allowedFiletypes");
|
||||
for (const path of watch.paths.keys()) {
|
||||
if (extensions.some(extension => path.endsWith(extension)))
|
||||
signal.emit(EventType.MessageSend, fileChangeEventToMsg({ path: path }))
|
||||
}
|
||||
} else {
|
||||
// Upload missing files to the game.
|
||||
signal.emit(EventType.MessageSend, requestFilenames());
|
||||
}
|
||||
})
|
||||
|
||||
// Add a handler for changed files.
|
||||
|
|
Loading…
Add table
Reference in a new issue