Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

p.s.torusEngaged & p.s.injectorsEngaged Booleans

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2309
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

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

Post 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?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4704
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

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

Post 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.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2649
Joined: Thu Jun 20, 2013 10:22 pm

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

Post 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...
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2309
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

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

Post 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?
Last edited by Wildeblood on Sun Feb 18, 2024 10:48 pm, edited 1 time in total.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4704
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

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

Post by phkb »

It's player.h.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2649
Joined: Thu Jun 20, 2013 10:22 pm

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

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2309
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

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

Post 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?
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2649
Joined: Thu Jun 20, 2013 10:22 pm

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

Post 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.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2309
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

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

Post 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.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4704
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

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

Post by phkb »

Nice!
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2309
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

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

Post 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:
"So anti-globalist, he's practically a flat-earther."
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2309
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia

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

Post 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.
"So anti-globalist, he's practically a flat-earther."
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2649
Joined: Thu Jun 20, 2013 10:22 pm

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

Post 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.
Post Reply