OXPs that throw errors because player.ship variables are not available
Posted: Sun Jun 13, 2021 10:33 pm
I've been looking at my logs - in the service of debugging my own OXPs - and I find that several OXPs make assumptions about player.ship that sometimes are false. To wit: that player.ship.position, or various other attributes, are set. If one is in an escape pod, or docked (though perhaps some OXPs check for being docked with the main station) then - and perhaps under other conditions - these assumptions are false. Thus such errors as the following - though I think that more OXPs than the two that I list below (namely, CustomShields and interstellar_help) are affected.
Code: Select all
[script.javaScript.exception.unexpectedType]: ***** JavaScript exception (customshields 0.83): TypeError: player.ship.position is undefined
23:06:35.404 [script.javaScript.exception.unexpectedType]: C:\Oolite/oolite.app/GNUstep/Library/ApplicationSupport/Oolite/ManagedAddOns/oolite.oxp.CommonSenseOTB.CustomShields.oxz/Scripts/customshields.js, line 88.
Code: Select all
23:06:39.074 [script.javaScript.exception.ooliteDefined]: ***** JavaScript exception (interstellar-help-ship 2.1): Error: Vector3D.distanceTo: Could not construct vector from parameters (undefined) -- expected Vector, Entity or array of three numbers.
23:06:39.074 [script.javaScript.exception.ooliteDefined]: ../AddOns/interstellar_help.oxp/Scripts/interstellar-help-ship.js, line 81.