-
Notifications
You must be signed in to change notification settings - Fork 147
Use modern layers.json #405
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
base: master
Are you sure you want to change the base?
Conversation
|
This PR replaces #404. |
|
Haven't had a chance to test these changes yet, but I went through the whole diffs and the changes are looking good to me |
|
I would need a server to test this to make sure no breaking changes are occuring. |
|
There are breaking changes, for a strict definition of breaking. The new game data file contains data that the old file doesn't, and vice versa. Any plugin depending on that old deprecated data would therefore break. But since we (or at least I) don't know what custom plugins people use there is no way to know the scope of this hypothetical breakage. Also, the actual live game servers have moved away from this old data format since quite a long time (over a year?), which would already have broken any plugins depending on it. In that context, I think it is unlikely this data format change breaks any plugin that currently works correctly against master. |
|
Any changes need testing on live servers before being pushed to prod. Will only push once we have a validated test. This is from lessons learned from other incidents. |
I agree completely. I have only tested this on my test server so far, not a live server. I am in the process of deploying it on a live server "soon", hopefully in the next couple of weeks. Ideally several people should try it so we don't rely on testing only by the PR author. |
|
Ok, this is now running on a live server since a few days. The only issue I've found was that immediately after game server restart, we get one or two server information blocks without any teams defined. So I've added a check for that. |
|
I have found that this solution is not good enough for my needs. The information returned by rcon command I cannot therefore update teams and vehicle information in However, the Background for this effort: The reason I need team information timely is that I have written a plugin for automatic enforcement of vehicle claim rules. It needs to know which vehicles are available on each side at the start of the round when the race for claims occurs. |
Change how layer and factions are discoveredSince the data returned by Also, since the same layer object can be returned for both the current map and the next, we cannot store team information there. Thus, a new team object is returned in addition to the layer object. This requires parsing and returning additional fields from |
Use the newer layers.json file which contains modern game data. Look up layer factions and units in updateServerInformation().
Right after server restart, we get server information without any team information. Just skip the team creation then, we'll get those the next update.
Since the data returned by ShowServerInfo is delayed up to 30 seconds, it can not be relied on to determine current layer and faction. Especially not at the start of rounds. Instead, use ShowCurrentMap and ShowNextMap for this. They return the actual current state of the server. Also, since the same layer object can be returned for both the current map and the next, we cannot store team information there. Thus, a new team object is returned in addition to the layer object. This requires parsing and returning additional fields from rcon.getCurrentMap() and rcon.getNextMap().
f186f9f to
407ca57
Compare
|
(Rebased on master) |
|
This is running on server "Squad International", where it forms the foundation for an automatic vehicle claims handling plugin. Anyone interested in seeing it in action can join the server and/or ping me. I'm "Baxter" in Squad and Discord. |
Needs further review. This PR changes more than what is intended.
werewolfboy13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR title needs to be corrected or separate PRs need to be made for the additional changes.
|
Thank you for the feedback. Can you clarify what you consider to be additional changes and what would then be the core changes? |
This here is not in the title. Each core change needs to be its own PR. |
|
This will satisfy #386 as an interim fix. |
|
Ok, coming back to this now. @werewolfboy13 Do you require that they are separate PRs or is it enough that they are separate commits in this PR? Making two PRs means first making a PR that works with the old layer code and team objects. And then a second PR that substantially rewrites what was in the first PR. The code in the first PR will thus only live until the second is merged, which seems a little wasteful. But I can do it if you really prefer it that way. |
|
I'm getting this |
Use the newer layers.json file which contains modern game data.
Look up layer factions and units in updateServerInformation().