[UPDATED RELEASE] Quirium Mine Detector V1.4 (26/04/14)

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

Moderators: winston, another_commander

User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Diziet Sma »

Wildeblood wrote:
Why the obsessive checking to determine if a spawned ship is a Q-mine?

Code: Select all

if(ship.isMine && ship.AI==="timebombAI.plist" && ship.name==="Quirium Cascade Mine" && ship.script.name==="oolite-default-ship-script")
Surely if(ship.AI==="timebombAI.plist") is all you need? If a replacement ship set uses a name other than "Quirium Cascade Mine", your test will fail and give a false negative. But any ship which has its active AI set to timebombAI.plist will be a Q-mine. Is there any possibility of that simple test giving a false positive?
The "why" is that that snippet of code was lifted from BGS. Svengali seemed to find it necessary, so I decided not to mess with something that somebody smarter than me had created. I should add that I actually had to remove the first part of the the check, which originally ran if(ship.isValid &&..., in order to get consistent detection. Until then, sometimes it worked, sometimes it didn't.

Comment by Svengali on this point would be appreciated.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Svengali »

Diziet Sma wrote:
Comment by Svengali on this point would be appreciated.
BGS has the rule not to mess with other OXPs stuff if they don't call functionality in BGS explicitely. The checks are explicitely there to minimize possible clashes. BGS does (if the option is enabled) a monkeypatch to play a sound on explosion and I've decided to do it only for Q-Mines which are using the default setup (AI, name and script). And we have quite a few OXPs out there which are removing entities without checking anything, so testing .isValid is necessary.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Diziet Sma »

Hmm.. so, would you recommend I leave the QBD code as-is, or implement Wildeblood's suggestion?

I never got to the bottom of why the .isValid test caused detection to fail sometimes.. from what you've said, I'm guessing if the Q-Bomb was launched by an OXP ship that perhaps in some situations the test may fail? My theorising at the time was that if the ship that spawned the Q-Bomb was destroyed before the test was performed, it may have been causing the test-failure.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Svengali »

You can't make it failsafe - OXPs can do own cascading mines easily (with different AIs, names, scripts, roles, etc). So I'd suggest - use what feels right for your OXP.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Diziet Sma »

Ok.. under the old "don't fix what ain't broke" principle, I'll leave it as is then. I gather that in 1.77, Q-Bomb detection is much simpler. I'll leave the fix for that version.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Tricky
---- E L I T E ----
---- E L I T E ----
Posts: 821
Joined: Sun May 13, 2012 11:12 pm
Location: Bradford, UK. (Anarchic)

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Tricky »

Or you could modify this bit of code that is modified from [EliteWiki] Random Hits OXP...

Code: Select all

    /* Scan for cascade weapons. Won't be needed when v1.78 comes out.
     * Reacts with a 'CASCADE_WEAPON_FOUND' AI message rather than 'CASCADE_WEAPON_DETECTED' used by Oolite v1.77+
     *
     * INPUT
     *   callerShip - caller ship.
     */
    this.$scanForCascadeWeapon = function (callerShip) {
        /* This is modified from some code in Random Hits spacebar ship script. */
        var cascadeWeaponRoles = [
            "EQ_QC_MINE",
            "EQ_CASCADE_MISSILE",
            "EQ_LAW_MISSILE",
            "EQ_OVERRIDE_MISSILE",
            "energy-bomb",
            "RANDOM_HITS_MINE"
        ],
        cascadeWeapons;

        /* Search for any cascade weapons within maximum scanner range of the caller ship. */
        cascadeWeapons = system.filteredEntities(this, function (entity) {
                return (cascadeWeaponRoles.indexOf(entity.primaryRole) > -1);
            }, callerShip, callerShip.scannerRange);

        if (cascadeWeapons.length > 0) {
            /* Found at least one. First one in the cascadeWeapons array is the closest.
             * Set the target and send a CASCADE_WEAPON_FOUND message to the AI.
             */
            callerShip.target = cascadeWeapons[0];
            callerShip.reactToAIMessage("CASCADE_WEAPON_FOUND");
        }
    };
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Diziet Sma »

Thanks! That's one place I hadn't considered looking.. I'll check it out. 8)
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Wildeblood »

I added this into my HUD script yesterday, among other things:

Code: Select all

this.shipSpawned = function(ship)
	{
	if (ship.isMine && ship.AI === "timebombAI.plist" && ship.position.distanceTo(player.ship.position) < 25600) this.$panicAlert();
	}
- where panicAlert() is the function that turns the scanner bright red when it's time to panic. That seems to be a sufficient number of checks to me.
User avatar
JazHaz
---- E L I T E ----
---- E L I T E ----
Posts: 2991
Joined: Tue Sep 22, 2009 11:07 am
Location: Enfield, Middlesex
Contact:

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by JazHaz »

Do NPC ships in normal play (ie not in OXP missions) actually use the Q-mine against the player?
JazHaz

Gimi wrote:
drew wrote:
£4,500 though! :shock: <Faints>
Cheers,
Drew.
Maybe you could start a Kickstarter Campaign to found your £4500 pledge. 8)
Thanks to Gimi, I got an eBook in my inbox tonight (31st May 2014 - Release of Elite Reclamation)!
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Commander McLane »

JazHaz wrote:
Do NPC ships in normal play (ie not in OXP missions) actually use the Q-mine against the player?
Yes, they can, if they have the key Image has_energy_bomb (klick to see the other conditions) defined and set to something else than "no" or "0" in their shipdata.

None of the in-built ships have this key defined, though. Therefore you'll never see one of the standard ships use a Q-mine. Depending on their shipdata, this may be different for OXP ships.
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1248
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by UK_Eliter »

Ah yes, q-mines. I think I'll increase the chance of these being carried by the NPC versions of some the ships I've created . .
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Thargoid »

And a new script event went into trunk today which will make things easier. 5476 (I think,maybe 5475) added cascadeWeaponDictated as a ship script event.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Commander McLane »

Thargoid wrote:
I wonder what a psychiatrist would analyze about you from that Freudian error... :wink:
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: [RELEASE] Quirium Cascade Mine Detector (V1.1)

Post by Thargoid »

Dictated, detected, let's call the whole thing off... :oops:

Yak herring poet.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: [UPDATED RELEASE] Quirium Cascade Mine Detector (V1.2)

Post by Diziet Sma »

Now updated to version 1.2. :D

I was going to wait until the Q-Bomb detector reached the 100th download (currently on 97) but, being Christmas and all, I'm too excited to hold off. :lol:

The QBD is now able to function correctly both in 1.76.1 and 1.77+ (the old code did not work in trunk). I've simplified the pre-1.77 detection code as suggested by Wildeblood, and added code that will use the new this.cascadeWeaponDetected function instead, if the QBD detects that it is running in Oolite 1.77 or later.

Download link is in the first post of the thread.

Merry Christmas, all!
Last edited by Diziet Sma on Tue Dec 25, 2012 10:13 am, edited 1 time in total.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
Post Reply