Page 6 of 7

Re: [RELEASE] Torus To Sun OXP v1.5

Posted: Mon Jul 27, 2015 8:14 pm
by Norby
avder wrote:
the longer I play, the speedup effect increases with every jump or dock/undock.
Welcome avder!

Please check if you use the latest version. Your description sounds like a bug which has been fixed in v1.5.
A missing $ sign in the StopTimer function started an additional timer and increasing bonus at every lauch and jump.

Re: [RELEASE] Torus To Sun OXP v1.5

Posted: Mon Jul 27, 2015 8:26 pm
by Layne
avder wrote:
Hello, new board member here, have been lurking for a few weeks as I only recently discovered Oolite and have been enjoying it quite a bit and this board has helped a lot.
I would also like to table a motion to petition a formal proposal to requisition an application to welcome you to the board as well!

All in favor of greeting avder? (*show of hands*)

That sounds a lot more complicated than it really needed to be.

Re: [RELEASE] Torus To Sun OXP v1.5

Posted: Mon Jul 27, 2015 8:34 pm
by avder
Norby wrote:
avder wrote:
the longer I play, the speedup effect increases with every jump or dock/undock.
Welcome avder!

Please check if you use the latest version. Your description sounds like a bug which has been fixed in v1.5.
A missing $ sign in the StopTimer function started an additional timer and increasing bonus at every lauch and jump.
The in game expansion manager says I have 1.5.

I'll try downloading it manually off the Wiki.

And as for the complexity...well I'm a "fix it yourself" kind of guy at heart :D

Re: [RELEASE] Torus To Sun OXP v1.6

Posted: Mon Jul 27, 2015 8:52 pm
by Norby
I found and fixed another typo, please update to v1.6 and try again.

Re: [RELEASE] Torus To Sun OXP v1.6

Posted: Mon Jul 27, 2015 9:54 pm
by avder
Outstanding! Works flawlessly now. And on my 3rd test I ran into about 20 pirates from the neighboring Anarchy system doing battle with Vipers and assorted do-gooders so I bagged a ton of kills and escape pods to boot. Only a few hundred more to go until I get upgraded from Dangerous to Deadly.

I have a feature request tho: an optional equipment item that would create an interface while docked that would let you manually change the maximum speed with weapons on (perhaps togglable only between 1 and 2), and the time compression variables. Maybe have it cost 15 minutes per integer of change for balance? Seems like it should be station only as it occurs to me that tweaking those settings in flight is just asking for a core meltdown or something, or a catastrophic unintentional witchspace jump to interstellar space, or a ship fire that destroys your precious Naval Energy Unit.

Also any way of getting it to work with the navigation MFD to have it display correct ETA's?

Excellent work btw, I've got a couple more of your add-ons and they all work wonderfully.

Glad I could help you pin down a bug :)

Re: [RELEASE] Torus To Sun OXP v1.6

Posted: Tue Jul 28, 2015 8:11 pm
by Day
@avder: greetings avder!

@Norby: thank you Norby for the bugfix :)
The way I play, I gradually developed ways to handle the extreme speed, but I wondered if it was the "normal" gameplay :D

Re: [RELEASE] Torus To Sun OXP v1.6

Posted: Tue Aug 01, 2017 9:10 pm
by gsagostinho
@Norby I don't know if this is still being maintained, but here is a small feature request: when using this OXP together with the Navigation MFD, the Estimated Travel Time is displayed wrongly. At every refresh moment, the Estimated Travel Time value is shown as the time that the ship would take with a regular torus (1x) regardless of the current value. Would it be possible to somehow compensate that?

Re: [RELEASE] Torus To Sun OXP v1.6

Posted: Tue Aug 01, 2017 9:37 pm
by Norby
It is possible to make support in the other side, as in CombatMFD. Ask spara there.

The next lines can calculate the real speed:

Code: Select all

var p = player.ship;
var sp = Math.round(p.velocity.magnitude()/10)*10; //stable but can not show FTL drive nor Torus multiplier
var t = worldScripts.torustosun;
if( t && t.$TorusToSunBonus > 1 ) {
        sp = Math.round(t.$TorusToSunBonus * 3.2 * p.maxSpeed)*10;
        if( t.$TimeFw > 1 ) { //time forwarding active
                sp *= t.$TimeFw;
        }
} else {
        if(sp > 31 * p.maxSpeed ) { //support for FarPlanets and any other position changer drives
                var psp = Math.round(0.1*p.position.distanceTo(this.$PlayerPrevPos))*10;
                if( psp > 1.1*sp ) sp = psp;//instable but needed to follow position changes
        }
}
this.$PlayerPrevPos = p.position;
//now sp contain the approximated player speed

Re: [RELEASE] Torus To Sun OXP v1.6

Posted: Tue Aug 01, 2017 11:15 pm
by gsagostinho
Of course that has to be implemented on the MFD side, my bad :oops: I already wrote a request on that thread, thanks!

Re: [RELEASE] Torus To Sun OXP v1.6

Posted: Sun Aug 19, 2018 1:15 pm
by tokugawa
Hi. I have made what i'm hoping is improvement. Frame Callback is scary regardless of computing power :). TTS is executing it even if torus isn't enabled (like in fights...). This crude but seems to be working hack starts frame callback only for torus maxed. Frame callback removes itself if no speedup is to apply.

Code: Select all

--- a/Scripts/torustosun.js
+++ b/Scripts/torustosun.js
@@ -74,6 +74,11 @@ this._FCB = function( delta ) { //masslockcheck in this framecallback
                var s = ps.maxSpeed * 32;
                var t = this.$TimeFw - 1; //torus speed with time forwarding
                ps.position = ps.position.add( f.multiply( delta * s * ( t + b - 1 ) ) ); //apply speed bonus
+       } else
+       {
+               var ws = worldScripts.torustosun;
+               if( isValidFrameCallback( ws.$FCB ) )
+                       removeFrameCallback( ws.$FCB );
        }
 }
 
@@ -112,8 +117,6 @@ this._StartTimer = function() {
        ws.$PrevEnergy = player.ship.maxEnergy;
        ws.$FwSec = 0; //part of a second during forwarding
        ws.$Timer = new Timer(ws, ws._Timed.bind(ws), 1, 0.25);
-       if( !isValidFrameCallback( ws.$FCB ) )
-               ws.$FCB = addFrameCallback( ws._FCB.bind(ws) );
 }
 
 this._StopTimer = function() {
@@ -132,6 +135,9 @@ this._Timed = function() {
        if( !ps || !ps.isValid ) return; //player died
        if( player.alertCondition == 1 && ps.speed > ps.maxSpeed * 31.9 ) {//Green Alert and Torus maxed
                this._TorusSpeedUp();
+               var ws = worldScripts.torustosun;
+               if( !isValidFrameCallback( ws.$FCB ) )
+                       ws.$FCB = addFrameCallback( ws._FCB.bind(ws) );
        }
 }

Re: [RELEASE] Torus To Sun OXP v1.7

Posted: Sun Aug 19, 2018 3:13 pm
by Norby
Thank you tokugawa, Torus To Sun v1.7 contain your patch for better offline performance.

Re: [RELEASE] Torus To Sun OXP v1.7

Posted: Sun Aug 19, 2018 7:54 pm
by tokugawa
That was fast! I didn't have enough time to roast new patch - maybe you will like it (because this oxp is beautiful - for non-standard ooniverses especially). I can't find which version has alertConditionChanged, but using it i simplified "if" in timed callback - and more importantly the callback isn't called during combat at all!. So nothing bothers me 4 times per second:P All should work to Your intent (i hope you don'y mind my meddling..)

I can sleep now :)

remove log if you integrate this - i'm currently testing this

Code: Select all

--- a/Scripts/torustosun.js
+++ b/Scripts/torustosun.js
@@ -51,11 +51,24 @@ this.shipWillEnterWitchspace = function() {
 }
 
 this.shipWillExitWitchspace = function() {
-       this._StartTimer(); //must start before Telescope FCBs!
+       this.alertConditionChanged(player.alertCondition, -1); //must start before Telescope FCBs!
 }
 
 this.shipWillLaunchFromStation = function() {
-       this._StartTimer(); //must start before Telescope FCBs!
+       this.alertConditionChanged(player.alertCondition, -1);
+}
+
+this.alertConditionChanged = function(newCondition, oldCondition)
+{
+       log("alertConditionChanged", newCondition  + "::" + oldCondition)
+       if (newCondition == 1)
+       {
+               this._StartTimer();
+       }
+       else
+       {
+               this._StopTimer();
+       }
 }
 
 //TorusToSun functions
@@ -133,7 +146,7 @@ this._StopTimer = function() {
 this._Timed = function() {
        var ps = player.ship;
        if( !ps || !ps.isValid ) return; //player died
-       if( player.alertCondition == 1 && ps.speed > ps.maxSpeed * 31.9 ) {//Green Alert and Torus maxed
+       if( ps.speed > ps.maxSpeed * 31.9 ) {//Green Alert and Torus maxed
                this._TorusSpeedUp();
                var ws = worldScripts.torustosun;
                if( !isValidFrameCallback( ws.$FCB ) )
[EDIT] I'll be sure with one timer only, [EDIT2] don't stress the garbage collector.

Code: Select all

@@ -37,10 +37,13 @@ this.$WFP = null; //store worldScripts.farplanets
 //world script events
 this.startUp = function() {
 	this.$WED = worldScripts.escortdeck;
 	this.$WFP = worldScripts.farplanets;
 	var n = worldScripts.numerichudv3;
+	var ws = worldScripts.torustosun;
+	ws.$Timer = new Timer(ws, ws._Timed.bind(ws), 1, 0.25);
+	ws.$Timer.stop();
 //	if( n && n.version * 1 >= 3.24 ) this.$Messages = false;
 }
 
 this.shipWillDockWithStation = function() {
 	this._StopTimer();
@@ -112,30 +128,30 @@ this._Proximity = function(ws) { //there is a similar function in TimeControl ox
 	return(false);
 }
 
 this._StartTimer = function() {
 	var ws = worldScripts.torustosun;
+	if( ws.$Timer.start() ) {
+		log("t","was started before")
+		return
+	}
 	ws.$PrevEnergy = player.ship.maxEnergy;
 	ws.$FwSec = 0; //part of a second during forwarding
-	ws.$Timer = new Timer(ws, ws._Timed.bind(ws), 1, 0.25);
 }
 
 this._StopTimer = function() {
 	var ws = worldScripts.torustosun;
-	if( ws.$Timer ) {
 	ws.$Timer.stop();
-		delete ws.$Timer;
-	}
 	if( isValidFrameCallback( ws.$FCB ) )
 		removeFrameCallback( ws.$FCB );
 	this._TorusSlowDown(); //set bonus to 1
 }

Re: [RELEASE] Torus To Sun OXP v1.7

Posted: Mon Aug 20, 2018 6:44 pm
by Norby
Thank you for your ideas, now I uploaded these.

Re: [RELEASE] Torus To Sun OXP v1.7

Posted: Sun Dec 06, 2020 10:09 pm
by KaiserZandrich
Recently picked up TorusToSun after I realised the distance adjustments were too heavy, but I noticed Torus engine "trail" artifacting above x1 Torus speed, which extends too far to see at about x6 Torus speed. Is there any way I can disable the Torus engine "lights" within your OXP (or even Oolite entirely)? It's a minor detail, but my OCD is driving me insane.

Also, this is probably a necro, but PMs are disabled and I was 110% unsure which board to post this on.

Re: [RELEASE] Torus To Sun OXP v1.7

Posted: Sun Dec 06, 2020 10:26 pm
by Cody
KaiserZandrich wrote: Sun Dec 06, 2020 10:09 pm
PMs are disabled and I was 110% unsure which board to post this on.
Once your first post has been approved (which it now has been), PMs will work - and welcome aboard.