Page 2 of 2

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 4:06 pm
by Wildeblood
phkb wrote: Sun Feb 18, 2024 1:45 pm
Torus max speed is no longer a constant, by the way. It will keep increasing if no stellar objects (ships, planets, sperm whales, etc) are detected in your path.
Keep increasing to what upper limit?

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 9:49 pm
by phkb
Wildeblood wrote: Sun Feb 18, 2024 4:06 pm
Keep increasing to what upper limit?
There is none that I'm aware of. And certainly none you're going to reach without heading away from the planet for a long way, and I mean a *really* long way.

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 10:05 pm
by Redspear
Might it be this? (4th line)

Code: Select all

#if OO_VARIABLE_TORUS_SPEED
#define HYPERSPEED_FACTOR				[PLAYER hyperspeedFactor]
#define MIN_HYPERSPEED_FACTOR			32.0
#define MAX_HYPERSPEED_FACTOR			1024.0
#else
#define HYPERSPEED_FACTOR				32.0
#endif
If not, then it would be one less line of code for me to tweak when rescaling...

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 10:24 pm
by Wildeblood
Redspear wrote: Sun Feb 18, 2024 10:05 pm
Might it be this? (4th line)

Code: Select all

#if OO_VARIABLE_TORUS_SPEED
#define HYPERSPEED_FACTOR				[PLAYER hyperspeedFactor]
#define MIN_HYPERSPEED_FACTOR			32.0
#define MAX_HYPERSPEED_FACTOR			1024.0
#else
#define HYPERSPEED_FACTOR				32.0
#endif
If not, then it would be one less line of code for me to tweak when rescaling...
Thank you, Redspear. But, you know, a polite poster would have mentioned the name of the file he was quoting. I presume it's got some poetic title, like "player.m"?

1024 x maxSpeed sounds fast, doesn't it? Like... really fast. Like, um, that really makes a mockery of maxSpeed, man.

Anyway, below is the entirety of Bullet Drive.

Code: Select all

"use strict";

this.name    = "Bullet Drive";
this.version = "1.0.3"; // Wildeblood, May 16th, 2013

/* ====================================================================================
			MAINTAIN LOCKED HEADING AT HIGH SPEED
======================================================================================= */

this.$maintainHeading = function()
	{
	var self = player.ship;
	if (self.status !== "STATUS_IN_FLIGHT" && self.status !== "STATUS_WITCHSPACE_COUNTDOWN")
		{
		removeFrameCallback(this.$monitor);
		delete this.$monitor;
		return;
		}
	if (self.speed <= (7 * self.maxSpeed))
		{
		if (this.$heading) delete this.$heading;
		if (player.alertCondition != 1)
			{
			removeFrameCallback(this.$monitor);
			delete this.$monitor;
			}
		return;
		}
	if (self.speed > (7 * self.maxSpeed)) // Exceeding injector speed, must be cheat button speed.
		{
		if (this.$heading)
			{
			var angle = self.heading.angleTo(this.$heading);
			var cross = self.heading.cross(this.$heading).direction();
			self.orientation = self.orientation.rotate(cross,-angle);
			}
		else this.$heading = self.heading;
		}
	}

/* ====================================================================================
			STARTING $maintainHeading
======================================================================================= */

this.alertConditionChanged = function(newCondition, oldCondition)
	{
	if (newCondition == 1 && !this.$monitor)
		{
		this.$monitor = addFrameCallback(this.$maintainHeading.bind(this));
		}
	}

this.shipExitedWitchspace = function()
	{
	if (player.alertCondition == 1 && !this.$monitor)
		{
		this.$monitor = addFrameCallback(this.$maintainHeading.bind(this));
		}
	}

/* ====================================================================================
			CHANGE LOG

1.0.3 (May 16th, 2013) Added this.shipExitedWitchspace check.
1.0.2 (December 19th, 2012) Changed < to <= in speed check.
1.0.1 (December 18th, 2012) Comment removed.
1.0   (December 18th, 2012) Created.
======================================================================================= */
It seems my memory was playing tricks on me. I thought there was a timer watching the speed, and starting the frame call back, but it turns out I just started the frame call back whenever player.alertCondition == 1

I like the way it's formatted like PHP, not like javaScript.

I suppose the first thing it will need is a version check? Which version of Oolite introduced these wonders we've been discussing?

Hey guys? Where did you o? We're doing this, aren't we?

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 10:35 pm
by phkb
It's player.h.

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 10:47 pm
by Redspear
Wildeblood wrote: Sun Feb 18, 2024 10:24 pm
Thank you, Redspear. But, you know, a polite poster would have mentioned the name of the file he was quoting
Apologies if I didn't meet your standards...

And that's not sarcasm on my part, rather it's to do with the nature of politeness itself.

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 10:49 pm
by Wildeblood
Redspear wrote: Sun Feb 18, 2024 10:47 pm
Wildeblood wrote: Sun Feb 18, 2024 10:24 pm
Thank you, Redspear. But, you know, a polite poster would have mentioned the name of the file he was quoting
Apologies if I didn't meet your standards...

And that's not sarcasm on my part, rather it's to do with the nature of politeness itself.
I don't understand that remark. Have I offended you?

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 11:02 pm
by Redspear
Wildeblood wrote: Sun Feb 18, 2024 10:49 pm
I don't understand that remark. Have I offended you?
No and furthermore my apology was genuine. What's considered polite tends to vary somewhat however so consider that my defence, if you will.

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Sun Feb 18, 2024 11:48 pm
by Wildeblood
Wildeblood wrote: Sun Feb 18, 2024 10:24 pm
Anyway, below is the entirety of Bullet Drive.

Code: Select all

"use strict";

this.name    = "Bullet Drive";
this.version = "1.0.3"; // Wildeblood, May 16th, 2013

/* ====================================================================================
			MAINTAIN LOCKED HEADING AT HIGH SPEED
======================================================================================= */

this.$maintainHeading = function()
	{
	var self = player.ship;
	if (self.status !== "STATUS_IN_FLIGHT" && self.status !== "STATUS_WITCHSPACE_COUNTDOWN")
		{
		removeFrameCallback(this.$monitor);
		delete this.$monitor;
		return;
		}
	if (self.speed <= (7 * self.maxSpeed))
		{
		if (this.$heading) delete this.$heading;
		if (player.alertCondition != 1)
			{
			removeFrameCallback(this.$monitor);
			delete this.$monitor;
			}
		return;
		}
	if (self.speed > (7 * self.maxSpeed)) // Exceeding injector speed, must be cheat button speed.
		{
		if (this.$heading)
			{
			var angle = self.heading.angleTo(this.$heading);
			var cross = self.heading.cross(this.$heading).direction();
			self.orientation = self.orientation.rotate(cross,-angle);
			}
		else this.$heading = self.heading;
		}
	}

/* ====================================================================================
			STARTING $maintainHeading
======================================================================================= */

this.alertConditionChanged = function(newCondition, oldCondition)
	{
	if (newCondition == 1 && !this.$monitor)
		{
		this.$monitor = addFrameCallback(this.$maintainHeading.bind(this));
		}
	}

this.shipExitedWitchspace = function()
	{
	if (player.alertCondition == 1 && !this.$monitor)
		{
		this.$monitor = addFrameCallback(this.$maintainHeading.bind(this));
		}
	}

/* ====================================================================================
			CHANGE LOG

1.0.3 (May 16th, 2013) Added this.shipExitedWitchspace check.
1.0.2 (December 19th, 2012) Changed < to <= in speed check.
1.0.1 (December 18th, 2012) Comment removed.
1.0   (December 18th, 2012) Created.
======================================================================================= */
It seems it doesn't actually check for 32 x maxSpeed anywhere, just speed > 7 x maxSpeed, so - assuming injectors speed hasn't also been changed - it should still work fine. No need to change anything.

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Mon Feb 19, 2024 12:08 am
by phkb
Nice!

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Mon Feb 19, 2024 12:47 am
by Wildeblood
I copy/pasted it out of the debug console, so it looks more like javaScript, and less like PHP, and just uploaded it as version 1.0.4 - easiest "update" ever. :mrgreen:

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Mon Feb 19, 2024 7:50 am
by Wildeblood
phkb wrote: Sun Feb 18, 2024 9:49 pm
Wildeblood wrote: Sun Feb 18, 2024 4:06 pm
Keep increasing to what upper limit?
There is none that I'm aware of. And certainly none you're going to reach without heading away from the planet for a long way, and I mean a *really* long way.
Only took about 10-12 minutes to build up from 32x to 1024x.
Fell through from 1024x back down to 32x - and stayed there.
Because of the way it's implemented - based on distance from zero point, NOT time spent accelerating - the multiplier is increasing as you head outward, but always falling as you head inward.
But if it falls through from 1024 to 32, as it did for me, it can't decrease because it's at the lowest possible torus speed - 32x.
Bottom line: 12 minutes outwards, an hour to get back.
Nice one, seriously noice.

Re: p.s.torusEngaged & p.s.injectorsEngaged Booleans

Posted: Mon Feb 19, 2024 10:08 am
by Redspear
As I made systems bigger for my rescaling, I found it necessary to increase all of those values that I posted (and not just max value).

Then I needed to increase the deceleration rate upon exiting torus speed too.