For a new OXP I am pursuing the idea that the player's wormhole can be restored after a misjump. The basic idea is that the Thargoids are placing Witchspace Jammers in interstellar space. Once the jammers are destroyed, your wormhole re-opens.
Technically the death of the last jammer spawns an object which will jump into the player's original target system. The object is simply an alloy with scanClass CLASS_NO_DRAW and a sufficient density to create a wormhole that will last about 1.5 minutes. Here's the shipdata:
Code: Select all
<key>wormhole-restoration-wormhole-creator</key>
<dict>
<key>ai_type</key>
<string>nullAI.plist</string>
<key>cargo_type</key>
<string>CARGO_NOT_CARGO</string>
<key>density</key>
<integer>500</integer>
<key>fuel</key>
<integer>70</integer>
<key>like_ship</key>
<string>alloy</string>
<key>name</key>
<string>Wormhole</string>
<key>roles</key>
<string>wormhole_restoration_wormhole_creator</string>
<key>scanClass</key>
<string>CLASS_NO_DRAW</string>
<key>script</key>
<string>wormhole-restoration-wormhole-creator.js</string>
<key>script_info</key>
<dict>
<key>npc_shields</key>
<string>no</string>
</dict>
</dict>
Code: Select all
this.$attemptJump = function()
{
// attempts to jump out to the player's original target system
if(this.ship.exitSystem(worldScripts["wormhole-restoration"].targetSystem) === true)
{
this.jumpAttemptTimer.stop();
delete this.jumpAttemptTimer;
}
}
this.shipSpawned = function()
{
this.jumpAttemptTimer = new Timer(this, this.$attemptJump, 0.1, 0.5)
}
During my test I have simulated some situations which won't occur usually, and the bug showed up in one of them.
Initially everything's working fine. The Witchspace Jammers are destroyed, the tweaked alloy appears and creates a wormhole as expected, leading to my target system.
But, if I don't go to my target system, but instead I misjump again, things get strange. It doesn't matter whether I misjump by pulling up while entering the wormhole or by pressing 'H'.
After the second misjump I again arrive in interstellar space, again with some Witchspace Jammers. I kill them again, another tweaked alloy appears and...
This time it creates a blue disk like a wormhole disk. But it's not a wormhole. I can't target it, and I fly straight through it. The viewscreen turns blue while I'm crossing the disk, and then I see the disk in my rear view. No jump happens.
The same will happen reliably for each subsequent misjump. Blue disk: yes. Wormhole: no.
I can break the cycle by jumping out into normal space. When I now misjump again, the first time a correct wormhole is created. Again, for subsequent misjumps I only get the blue disk without a wormhole.
My guess is that for some reason some of the properties of the first wormhole stay in the cache and prevent the creation of further wormholes while still in interstellar space.
However, if I target any ship with enough fuel during subsequent misjumps and type
PS.target.exitSystem()
in the console, that ship correctly exits the system and correctly leaves a usable wormhole.Perhaps it has something to do with using the
targetSystem
parameter? I now seem to remember that there was a similar bug report recently with the reaching-Oresrati OXP.I'm using rev 4514.
EDIT: more tests:
PS.target.exitSystem()
on other ships works, PS.target.exitSystem(number)
doesn't work and returns false. It seems that exitSystem
with parameter only works once each time in interstellar space.