The turrets on my Fer-de-Lance 3G+(t) keep getting shot off, almost no matter how tough I make them (for I designed the ship in question). Now, I'm presuming that subentities get repaired automatically when docked - but is that true? If not, perhaps it should be - but a workaround is possible.
The turrets on my Fer-de-Lance 3G+(t) keep getting shot off, almost no matter how tough I make them (for I designed the ship in question). Now, I'm presuming that subentities get repaired automatically when docked - but is that true?
No. They get repaired when you do a maintenance overhaul. Hence I presume that you're offered one fairly often, which is fairly costly.
In order to make up for the not-yet-satisfactory subentity-handling subentities on player ships shouldn't be able to get shot off in the first place. As it is now, the ability to have them shot off is almost a bug in the OXP.
The only thing you need to do to correct this is to change the line
Afterwards you should return the turrets' energy levels to their original values, or all damage done to your ship will be diverted to your subentities, turning them almost into an indestructibility-cheat.
Now, I'm presuming that subentities get repaired automatically when docked - but is that true?
On the contrary, since 1.75 these missing bits are even stored in your save file to make sure they are not magically restored after reloading a commander.
However: I want the turrets to be damageable, only I don't want the damage to accumulate between trips. Or rather, I think, now, that having the damage accumulate would be a good idea, but I don't want that accumulation to mean that the turrets always get damaged instead of the ship itself. Is there some fairly easy (script?) way of achieving this behaviour, please?
I have to admit that I know zilch about the distribution of damage over main entity and subentities. But often it seems to me that the subentities tend to get damaged first, and that's also true for NPCs. It gets to the point where subentities effectively act as a shield to the main entity. This is especially noticeable for ships with many subentities.
What you can do is to restore the subentities every time you dock, or even instantly. But that would only mean an even more efficient deflection of damage away from your ship's main entity.
There is the 'this.shipTakingDamage' routine. But to use that to distribute damage as I want it (to the shields or the energy or the turret . . ) I'd have to (1) know whether the damage has penetrated whichever shield is relevant, (2) know how Oolite would automatically, and despite my script(?) distribute the damage, (3) get around the fact that (lacking a certain OXP) NPCs lack shields. And 1 and 3 seem like nightmares. Perhaps I'd better just send frangible to false.
McLane: I thought, for a while, that you were right and that I'd neglected to do that. But then, on exiting a superbulk hauler, I noticed that, AGAIN, I'd lost my turrets. . Argh!
Just an idea: at the time you set frangible to no, were the turrets there or shot off? If they were shot off at the time, it is possible that this is the problem. Shot-off subentities are stored in your save-game, therefore maybe the save-game is overriding the new setting.
What is the value of subentities_status in your save-file?
Also, just to be sure, I hope that you didn't use Notepad for editing the shipdata. That would give a fair chance that the file got screwed-up in the process.
Just an idea: at the time you set frangible to no, were the turrets there or shot off? If they were shot off at the time, it is possible that this is the problem. Shot-off subentities are stored in your save-game, therefore maybe the save-game is overriding the new setting.
I can't recall; but I have re-saved my ship, post disabling frangibility, when it had it turrets.
What is the value of subentities_status in your save-file?
If I'm not completely wrong this means that your saved commander has two subentities, both of which are currently not on the ship. Try setting the value to <string>11</string> and restart your game. If I'm right the subentities should reappear (and stay!) from thereon.
In order to not screw anything up if I happen to be wrong I suggest you make a copy of your save-file before the edit.
That change to the save file restored both turrets. But - I checked - they can still get shot off! (For I flew out of the station, attacked it, took lots of damage and lost a turret.) What's going on? Is there a mistake in the code I posted above?