No Repair Systems (RepairBots repair system or otherwise) on my ship at this time.
Sometimes the duplicate buoys aren't added until after I dock and relaunch from a station...especially funny if it's a Rock Hermit, since I "see double" after launching.
Part of the problem may be with the way Rock Hermit Locator is coded, in rockHermitLocator.js line 45:
if (this.buoyTimer) {this.buoyTimer.stop(); delete this.buoyTimer};
This line gets called after buoys are added, but it seems remotely possible for the buoyTimer to trigger again before reaching the shutoff line. Which might explain why I see duplicated buoys but never 3 buoys in 1 spot.
if (this.buoyTimer) {this.buoyTimer.stop(); delete this.buoyTimer};
This line gets called after buoys are added, but it seems remotely possible for the buoyTimer to trigger again before reaching the shutoff line. Which might explain why I see duplicated buoys but never 3 buoys in 1 spot.
It should not be possible to be called twice. The only way it could happen is when you launch within 0.9 seconds from a station, after entering a system from witchspace.
[private note]check if entering a system while docked on a carrier works correct[/private note]
is not part of the release version. You probably added it yourself to absolutely make sure the timer is stopped. It won't hurt and ensures the timer is not firing again by an hypothetical oolite bug.
To me it looks more like a double installation of the oxp. You can double check that by adding a log line.
is not part of the release version. You probably added it yourself to absolutely make sure the timer is stopped. It won't hurt and ensures the timer is not firing again by an hypothetical oolite bug.
Perhaps the link here: http://www.box.com/shared/5e46br3nus
...that I downloaded from has the wrong or corrupted file/s?
Is the release version hosted somewhere else?
Eric Walch wrote:
To me it looks more like a double installation of the oxp. You can double check that by adding a log line.
I did better, I added 2 log lines to the this.addBuoys section:
this.addBuoys = function ()
{
log(this.name,"Adding Buoys!");
this.buoy = (player.ship.equipmentStatus("EQ_ROCKHERMIT_SCANNER") === "EQUIPMENT_OK") ? "rockbeacon" : "rockbeacof";
function addIfRockHermit(ships, buoy)
{
for (var i = 0; i < ships.length; i++)
{
if (ships[i].name === "Rock Hermit")
{
log(this.name,"Adding Buoy for: "+ships[i].name+" #: "+i);
if (0 < oolite.compareVersion("1.75"))
system.addShips(buoy, 1, ships[i].position.add(ships[i].orientation.vectorForward().multiply(10E3)), 1);
else
system.addShips(buoy, 1, ships[i].position.add(ships[i].vectorForward.multiply(10E3)), 1);
}
}
}
addIfRockHermit(system.shipsWithPrimaryRole("rockhermit"), this.buoy);
addIfRockHermit(system.shipsWithPrimaryRole("pirate-cove"), this.buoy);
this.buoysAdded = true;
if (this.buoyTimer) {this.buoyTimer.stop(); delete this.buoyTimer};
};
I caught probably how/why duplicate Buoys are being created thanks to the logging.
...A Pirate Cove being added at an odd moment!
But the output from it is downright bizarre:
is not part of the release version. You probably added it yourself to absolutely make sure the timer is stopped. It won't hurt and ensures the timer is not firing again by an hypothetical oolite bug.
Perhaps the link here: http://www.box.com/shared/5e46br3nus
...that I downloaded from has the wrong or corrupted file/s?
Is the release version hosted somewhere else?
Eric Walch wrote:
To me it looks more like a double installation of the oxp. You can double check that by adding a log line.
I did better, I added 2 log lines to the this.addBuoys section:
this.addBuoys = function ()
{
log(this.name,"Adding Buoys!");
this.buoy = (player.ship.equipmentStatus("EQ_ROCKHERMIT_SCANNER") === "EQUIPMENT_OK") ? "rockbeacon" : "rockbeacof";
function addIfRockHermit(ships, buoy)
{
for (var i = 0; i < ships.length; i++)
{
if (ships[i].name === "Rock Hermit")
{
log(this.name,"Adding Buoy for: "+ships[i].name+" #: "+i);
if (0 < oolite.compareVersion("1.75"))
system.addShips(buoy, 1, ships[i].position.add(ships[i].orientation.vectorForward().multiply(10E3)), 1);
else
system.addShips(buoy, 1, ships[i].position.add(ships[i].vectorForward.multiply(10E3)), 1);
}
}
}
addIfRockHermit(system.shipsWithPrimaryRole("rockhermit"), this.buoy);
addIfRockHermit(system.shipsWithPrimaryRole("pirate-cove"), this.buoy);
this.buoysAdded = true;
if (this.buoyTimer) {this.buoyTimer.stop(); delete this.buoyTimer};
};
I caught probably how/why duplicate Buoys are being created thanks to the logging.
...A Pirate Cove being added at an odd moment!
But the output from it is downright bizarre:
Also I would have used displayName rather than name.
I wouldn't, for two reasons: the wiki says if displayName isn't set it will be equal to name, but when I have used it it seems that unless specifically set displayName is undefined; pirate coves have "Rock Hermit" as their displayName anyway, so what would you learn?
I would, however, remove the version check designed to discriminate between Oolite 1.74 and 1.75, which seems out-dated.
All the strange things seems explainable. That leaves why the liner are logged twice, 3 seconds apart. That shows that there is no second version of the oxp is active. Does this.shipExitedWitchspace fire twice?
One fix could be to add to the start of the addBuoys funtion:
if (this.systemID == system.ID) return; // never fire twice in a system.
this.systemID = system.ID;
That probably cures the symptoms, but not the reason why the function is called twice.
Sometimes the duplicate buoys aren't added until after I dock and relaunch from a station...especially funny if it's a Rock Hermit, since I "see double" after launching.
Adding on launch should never happen, except on the first launch after loading a game. Somehow I get the feeling there is an other oxp that manipulates this one.
Also I would have used displayName rather than name.
I wouldn't, for two reasons: the wiki says if displayName isn't set it will be equal to name, but when I have used it it seems that unless specifically set displayName is undefined;
Right answer, but wrong reasons. this.name in the log refers to the name of the script, not of an entity. Scripts don't have displayNames.
Inside the function addIfRockHermit the this refers to that function. But that function doesn't have a name property, thus this.name becomes undefined.
That's the reason why I always write out the name of the script in the first parameter of the log method. Thus,
Also I would have used displayName rather than name.
I wouldn't, for two reasons: the wiki says if displayName isn't set it will be equal to name, but when I have used it it seems that unless specifically set displayName is undefined;
Right answer, but wrong reasons. this.name in the log refers to the name of the script, not of an entity. Scripts don't have displayNames.
It was this bit that Tricky altered, that I commented on:-
Not only the duplicate buoys, it will stop any addition after the one on the very first launch. this.buoysAdded is set to true at the first launch and stays true. It is only used to handle the special addition after loading a game. After that, buoys only need to be added when arriving from other systems.