tehstone / IngressDronePath

15 stars 9 forks source link

Conflict with an other IITC plugin that uses S2 functions #4

Closed dataspiller closed 4 years ago

dataspiller commented 4 years ago

Ingress Drone Path does not check to see if S2 functions are defined already, thus over writing any previous S2 functions.

I have an IITC plugin that i use (Region Score Lead) that Drone Path is conflicting with.

I fixed the part about not checking if previous S2 is defined before defining your own S2, but Region score has two functions in the S2 code that Drone path doesn't have.

I thought that if I could get Region Score to load first, Drone path would use Region's S2 code.

That didn't work - only way I am able to get both to work properly is to copy the 2 functions from Region Score over to DronePath - which I did in my own project

An other fix would be for DronePath to define its S2 functions in its own class/function so that it never conflicts with other plugins, as well as not having to carry functions that Dronepath doesn't use, but others might need.

I don't know which option is best or if there is a better solution.

tehstone commented 4 years ago

I'm not sure exactly which plugin you're referring to, but I added Ingress scoring regions which also defines the same S2 code and made some changes such that there is no conflict between my plugin and that one. There may still be some issue based on the order in which plugins load? I'm not sure how to modify that.

dataspiller commented 4 years ago

That seemed to do the trick.

As for order, In tampermonkey if you go to settings for the script, supposedly changing the position setting will change the order of loading the script. I played with that after adding the check to see if the S2 code exists already, but it didn't seem to do any thing. Maybe multiple tabs were causing confusion, don't know.

But it works now