Is this a bug?

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
phkb
Commodore
Commodore
Posts: 2433
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Is this a bug?

Post by phkb » Mon Mar 30, 2015 12:17 am

Having a look at "oolite-populator.js" as I code up my docking info OXP, but came across this:
When a trader-courier or trader-smuggler is created, it runs the this._nearbySystem function to determine what the home system and destination system will be for the ship. It passes a "range" parameter to this function, but "range" is never used in the function. So, regardless of whether "7" or "25" is passed to the function (at lines 1435, 1441, 1457, 1464, 1466, 1493, 1498) it will only ever return a system ID that is in range, as the $populatorLocals variable is always set to system.info.systemsInRange();
Is my logic correct here?

I think the _nearbySystem function should actually look like this:

Code: Select all

this._nearbySystem = function(range)
{
	if (range != 7)
	{
		var poss = system.info.systemsInRange(range);
	} 
	else 
	{
		var poss = this.$populatorLocals;
	}
	if (poss.length == 0)
	{
		return system.ID;
	}
	return poss[Math.floor(Math.random()*poss.length)].systemID;
}

User avatar
phkb
Commodore
Commodore
Posts: 2433
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Is this a bug?

Post by phkb » Wed Apr 01, 2015 1:53 am

Another in the "Is this a bug" items...

Again, in the oolite-populator.js file, in the this._addIndependendPirate function, there is this code:

Code: Select all

		if (!pos.isStation && !pos.isPlanet)
		{
			pg.ships[i].setCargoType("PIRATE_GOODS");
			<snip>
		}
And in the this._addPiratePack function, there is this code:

Code: Select all

	if (!pos.isStation && !pos.isPlanet)
	{
		lead[0].setCargoType("PIRATE_GOODS");
	}
My reading of this is that if the position where the pirates are being created is not at a station and not at a planet, then give this ship some "PIRATE_GOODS". The trouble is, there is no case for when the pirate is launching from a station. In that case, they don't seem to get any goods. Is that correct? A pirate group launching from a station will leave with nothing in the hold?

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Is this a bug?

Post by cim » Wed Apr 01, 2015 7:25 am

The first one is a bug - and you're right about the fix too. I'll add it in.

The second one is intentional - pirates added in deep space are either doing their job or returning from a raid to another system. They may therefore have cargo on board from their victims. Pirates launching from their base - planet or station - will have empty holds so that they can grab the maximum amount of cargo on this trip.

UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1103
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Is this a bug?

Post by UK_Eliter » Sat Jun 20, 2015 8:04 pm

cim wrote:pirates added in deep space [. . .]
I may not be paying enough attention, but, if Oolite itself now adds deep space pirates, should I uninstall the Deep Space Pirates OXP (wonderful though it is or at least was)?

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: Is this a bug?

Post by cim » Sun Jun 21, 2015 9:50 am

UK_Eliter wrote:adds deep space pirates
Sorry - by this I meant "pirates added a long way from a station or planet" - they're all still added on or near the lanes, so you still need that OXP to cover other locations.

Post Reply