-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Partial Layers to server object for MOD support #222
base: master
Are you sure you want to change the base?
Add Partial Layers to server object for MOD support #222
Conversation
Initial constructPartial Modded maps fail the lookup in Layers.getLayerBy(...) This attempts to build a partial layer from A2S and RCON. NEW_GAME may require a short delay as the server transitions maps. Update index.js
ecf7de7
to
fd6ca29
Compare
Convo with Shanno about his JSON showed a few values where mis-attributed. classname from layers is the rawname we would get from logs, which is hard to do inside of general layerUpdates.
This has been running stable at TT for some time. I'm not sure if anything needs to be done, but it should be viable to merge. |
@ect0s is this still good to be merged? |
I feel like this could be redone a lot cleaner. It currently does work, and I've been running this for a long time, but there may be implications inside plugins to look at. One of the issues would be missing properties when a "partial" layer is generated, should some plugin or other code depend on it being there. |
This Pull Request attemps to add partial layers to correct various issues when a server is running mods.
The benefit is that certain layer properties should be guaranteed across mods and the base game, which will fix a number of plugins breaking when either the current layer or the layerhistory is null.
https://github.com/Thomas-Smyth/SquadJS/blob/f34426d61f5f24c183c7d3baaf913fdda203378a/squad-server/index.js#L187
A lookup into Layers can fail, this creates a layer object containing null;
We also send this layer object into server.layerHistory
this.server.UpdateLayerInformation()
https://github.com/Thomas-Smyth/SquadJS/blob/f34426d61f5f24c183c7d3baaf913fdda203378a/squad-server/index.js#L400
Same as above, we set this.server.currentLayer to null.
This code may need some stylistic changes. It also needs extensive testing, particularly around NEW_GAME, when we may lose RCON while the server loads the next map.
Additionally, I feel like this code would better fit inside of the Layers class, as an additional method for keeping this clearly defined, but I haven't investigated changes to that effect.