Re: [Updated Release] Turret Toggler 1.1
Posted: Sat Feb 02, 2013 3:31 pm
Hmm. I'll investigate.
For information and discussion about Oolite.
https://bb.oolite.space/
Actually, there is only one relevant part in your shipdata (no plural): in the shipdata entry of your ship (player variant, main entity). It does not belong in the subentities' entries. This may be your problem.UK_Eliter wrote:Thanks for the reply. But I think I havein the relevant parts of my shipdata alreadyCode: Select all
frangible = no;
Thanks McLane, but my definitions of subentities - the turrets - contain no mention of frangibility. Rather the mentions of frangibility are within some (not all) of the ship definitions. Perhaps I misunderstand . .Commander McLane wrote:Actually, there is only one relevant part in your shipdata (no plural): in the shipdata entry of your ship (player variant, main entity). It does not belong in the subentities' entries. This may be your problem.
Poking around in the Ferdy3G shipdata.plist, I found something strange.UK_Eliter wrote:Thanks McLane, but my definitions of subentities - the turrets - contain no mention of frangibility. Rather the mentions of frangibility are within some (not all) of the ship definitions. Perhaps I misunderstand . .Commander McLane wrote:Actually, there is only one relevant part in your shipdata (no plural): in the shipdata entry of your ship (player variant, main entity). It does not belong in the subentities' entries. This may be your problem.
Code: Select all
"ferdelance3-playerVariant" =
{
like_ship = "ferdelance3GVariantTemplate"; ****Has no subentities declared****
script = "ferdelance3_hackForTurrets.js";
"ferdelance3-playerPlusModel" =
{
like_ship = "ferdelance3G+Template"; ****Has no subentities declared****
script = "ferdelance3_hackForTurrets.js";
"ferdelance3-playerPlusModelWithTurrets" =
{
like_ship = "ferdelance3G+(t)Template"; ****Has subentities declared****
script = "ferdelance3_hackForTurrets.js";
"ferdelance3-playerPlusModelWithTurretsPoliceDecomissioned" =
{
like_ship = "ferdelance3PoliceDecomissionedTemplate"; ****Has subentities declared****
script = "ferdelance3_hackForTurrets.js";
Is it, perhaps, worth getting a copy of Solonar's mod of the Fer de Lance 3G+(t) and, after testing it to make sure it works correctly on your machine, compare it with the code in your own version?Solonar wrote:When using your Fer de Lance 3G+(t) for my prototype, and then later with a Dark Rainbow and a Takinia CX-1, I had to insert a frangible false line into their ship data plist. When I was using the Fer de Lance 3G+(t), I made it frangible false and removed your turret hack script entirely with no problems and the script no longer served a purpose..
Indeed: they shouldn't invoke that script at all. Well spotted. I've fixed that (and make some considerable improvements to the script itself).Diziet Sma wrote:
I'm wondering if this might be the cause of your woes? As in, the reason you have to keep hammering the turrets onto those two ships is because you forgot to declare them in the first place? If they're not supposed to have turrets, then why are they invoking ferdelance3_hackForTurrets.js at all?
Is it, perhaps, worth getting a copy of Solonar's mod of the Fer de Lance 3G+(t) and, after testing it to make sure it works correctly on your machine, compare it with the code in your own version?Solonar wrote:When using your Fer de Lance 3G+(t) for my prototype, and then later with a Dark Rainbow and a Takinia CX-1, I had to insert a frangible false line into their ship data plist. When I was using the Fer de Lance 3G+(t), I made it frangible false and removed your turret hack script entirely with no problems and the script no longer served a purpose..
Object.keys(PS.subEntities[0])
in the debug console to investigate.player.ship.subEntities[x].isTurret
can be used to check if a subentity is a turret.He last logged in here exactly 11 months ago today.. you could try PMing him.Lone_Wolf wrote:Is solanar still around ?
Code: Select all
---
Scripts/tt_worldscript_events.js | 9 ++++++++-
Scripts/turret_toggler.js | 6 ++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/Scripts/tt_worldscript_events.js b/Scripts/tt_worldscript_events.js
index e3e4ad9..85b6635 100644
--- a/Scripts/tt_worldscript_events.js
+++ b/Scripts/tt_worldscript_events.js
@@ -26,7 +26,9 @@ this.shipWillDockWithStation = function(station)
if ( worldScripts["Turret Toggler"]._tt_turret_status == "inactive" )
{
// if the turrets are not on the ship on docking, a maintenance overhaul is offered to restore them!
+ var service_level = player.ship.serviceLevel
player.ship.restoreSubEntities();
+ player.ship.serviceLevel = service_level
};
};
@@ -39,7 +41,12 @@ this.playerBoughtEquipment = function(equipmentKey)
missionVariables.uni_turret = "active";
break;
case "EQ_UNI_TURRET_REMOVAL":
- if ( worldScripts["Turret Toggler"]._tt_turret_status == "inactive" ) { player.ship.restoreSubEntities(); };
+ if ( worldScripts["Turret Toggler"]._tt_turret_status == "inactive" )
+ {
+ var service_level = player.ship.serviceLevel
+ player.ship.restoreSubEntities();
+ player.ship.serviceLevel = service_level
+ };
player.ship.removeEquipment("EQ_UNI_TURRET");
player.ship.removeEquipment("EQ_UNI_TURRET_REMOVAL");
player.credits += 1500;
diff --git a/Scripts/turret_toggler.js b/Scripts/turret_toggler.js
index 438082f..34cda2e 100644
--- a/Scripts/turret_toggler.js
+++ b/Scripts/turret_toggler.js
@@ -21,18 +21,24 @@ this._tt_toggle_turret_status = function(set)
switch (set)
{
case "active":
+ var service_level = player.ship.serviceLevel
player.ship.restoreSubEntities();
+ player.commsMessage("Turrets online!",6);
+ player.ship.serviceLevel = service_level
// refresh ship target , this should make sure turrets get current target
var current_target = player.ship.target
player.ship.target = null;
player.ship.target = current_target;
break;
case "inactive":
+ player.commsMessage("Turrets disabled.",6);
+ var service_level = player.ship.serviceLevel
var subCounter = 0;
for ( subCounter = player.ship.subEntities.length - 1;subCounter>=0;subCounter-- )
{
if ( player.ship.subEntities[subCounter].isTurret ) { player.ship.subEntities[subCounter].remove(); };
};
+ player.ship.serviceLevel = service_level
break;
default:
break;