AI turns Scavengers into Miners With a Pulse Laser

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

Moderators: another_commander, winston, Getafix

Post Reply
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

AI turns Scavengers into Miners With a Pulse Laser

Post by Frame »

Not sure where to report anymore so Ill do it here.

I started playing Oolite a bit again :)

in 1.90, official download: So, if you get an asteroid, or an asteroid that spawns near the mainStation and you mine it into a boulder and then a splinter, then the station launches scavengers as expected.

But upon not finding more loot, they turn to be Miners if there is any Mineble object nearby, and with Pulse Lasers as their only weapon. That is a bad thing as they will destroy all Asteroids or boulders instead of mining them.

Looking into the Scavenger script i find this.

Code: Select all

/* Branch for mining ships: if we can usefully mine asteroids, do so */
		{
			condition: ai.conditionScannerContainsMiningOpportunity,
			configuration: ai.configurationAcquireScannedTarget,
			behaviour: ai.behaviourMineTarget,
			reconsider: 20
		},
	
So i suggest that scavengers and miners get their own dedicated AIscript. Scavengers is not able to mine since they got a Pulse Laser as their main weapon.

Cheers.
Bounty Scanner
Number 935
User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 2020
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Re: AI turns Scavengers into Miners With a Pulse Laser

Post by maik »

Frame wrote: Sun Mar 28, 2021 2:42 pm
I started playing Oolite a bit again :)
Welcome back :)
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Re: AI turns Scavengers into Miners With a Pulse Laser

Post by Frame »

maik wrote: Sun Mar 28, 2021 6:05 pm
Frame wrote: Sun Mar 28, 2021 2:42 pm
I started playing Oolite a bit again :)
Welcome back :)
Thanks. :)
Bounty Scanner
Number 935
User avatar
Cholmondely
Archivist
Archivist
Posts: 5004
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: AI turns Scavengers into Miners With a Pulse Laser

Post by Cholmondely »

Frame wrote: Sun Mar 28, 2021 2:42 pm
Not sure where to report anymore so Ill do it here.

I started playing Oolite a bit again :)

in 1.90, official download: So, if you get an asteroid, or an asteroid that spawns near the mainStation and you mine it into a boulder and then a splinter, then the station launches scavengers as expected.

But upon not finding more loot, they turn to be Miners if there is any Mineble object nearby, and with Pulse Lasers as their only weapon. That is a bad thing as they will destroy all Asteroids or boulders instead of mining them.

Looking into the Scavenger script i find this.

Code: Select all

/* Branch for mining ships: if we can usefully mine asteroids, do so */
		{
			condition: ai.conditionScannerContainsMiningOpportunity,
			configuration: ai.configurationAcquireScannedTarget,
			behaviour: ai.behaviourMineTarget,
			reconsider: 20
		},
	
So i suggest that scavengers and miners get their own dedicated AIscript. Scavengers is not able to mine since they got a Pulse Laser as their main weapon.

Cheers.
Bump!

Did anything ever happen about this?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: AI turns Scavengers into Miners With a Pulse Laser

Post by cim »

condition: ai.conditionScannerContainsMiningOpportunity, contains

Code: Select all

if (!this.ship.forwardWeapon == "EQ_WEAPON_MINING_LASER")
	{
		return false;
	}
so should always return false for a scavenger with a pulse laser, and never set off the mining. That was the idea, and why they weren't supposed to need separate AIs.

However, I think there's a typo in that - it should probably read

Code: Select all

if (this.ship.forwardWeapon != "EQ_WEAPON_MINING_LASER")
	{
		return false;
	}
instead.

(Resources/Scripts/oolite-priorityai.js line 2261 - give the change a go and see if it works?)
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6554
Joined: Wed Feb 28, 2007 7:54 am

Re: AI turns Scavengers into Miners With a Pulse Laser

Post by another_commander »

cim's change has been committed to master. I tested the suspect syntax with an online javascript compiler and a minimal test case and it was always falling through to the end of the function regardless of what the value of the forward weapon was. With cim's change applied, it works as intended.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5004
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: AI turns Scavengers into Miners With a Pulse Laser

Post by Cholmondely »

another_commander wrote: Tue Nov 01, 2022 12:05 pm
cim's change has been committed to master. I tested the suspect syntax with an online javascript compiler and a minimal test case and it was always falling through to the end of the function regardless of what the value of the forward weapon was. With cim's change applied, it works as intended.
Thank you for doing this...
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply