[WIP] CargoScanner.OXP

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

Moderators: winston, another_commander

User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: [WIP] CargoScanner.OXP

Post by JensAyton »

Okti wrote:
That is right Thargoid, I only scan for a display name "Cargo container", so most of the ones spawned from other OXP's will not be scanned.
I’d suggest checking for a property like ship.$okti_cargoDescription first (or ship.scriptInfo.okti_cargoDescription; that can be set in shipdata.plist, but is read-only). This way, OXPs defining custom pods can choose to integrate with your scanner.
Smivs wrote:
But by that token, most things would be illegal. Aspirin is toxic to Feline species for example.
It’s toxic to humans. As is water. :-)
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: [WIP] CargoScanner.OXP

Post by Commander McLane »

Switeck wrote:
Commander McLane wrote:
This is also why your scooped escape pods are unloaded automatically before anything else happens, whether you want it or not. Actually, the escape pod handling is another reason why your cargo cannot remain on your ship while you're docked. The Space Farers' Guild gets furious just from the mere idea that a scooped escape pod could be withheld from the port authorities in an attempt to enslave the pilot.
I wish that were true...I'm often caught leaving the station with a ton of "slaves" thanks to an escape pod that lacked a named pilot.
Yes, sometimes a blind passenger, or someone unknown to the insurance company has forced entry into the escape pod. Naturally the insurance companies want to strongly discourage this apparent breach of their contracts. What better way than to have those fraudsters publicly sold into slavery? :twisted:
User avatar
Okti
---- E L I T E ----
---- E L I T E ----
Posts: 700
Joined: Sun Sep 26, 2010 1:51 pm
Location: A GH shop, near witchpoint to Oresrati in Galaxy 8

Re: [WIP] CargoScanner.OXP

Post by Okti »

Ahruman wrote:
Okti wrote:
That is right Thargoid, I only scan for a display name "Cargo container", so most of the ones spawned from other OXP's will not be scanned.
I’d suggest checking for a property like ship.$okti_cargoDescription first (or ship.scriptInfo.okti_cargoDescription; that can be set in shipdata.plist, but is read-only). This way, OXPs defining custom pods can choose to integrate with your scanner.
Smivs wrote:
But by that token, most things would be illegal. Aspirin is toxic to Feline species for example.
It’s toxic to humans. As is water. :-)
Is there a way script wise obtaining cargo information?
My OXP's
And Latest Mission Coyote's Run
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: [WIP] CargoScanner.OXP

Post by JensAyton »

Okti wrote:
Is there a way script wise obtaining cargo information?
Hrm. Maybe I should have read the top of the thread properly before acknowledging its existence. :-)

No, there isn’t. The contents of a cargo pod can be represented in several different ways and is notionally determined at scooping time, although this doesn’t seem to serve any real purpose except for the scripted case, and there should probably be a nominal type (like “Equipment”, “People” etc.) for scripted pods.

Issue #13 for Oolite 2.
User avatar
Okti
---- E L I T E ----
---- E L I T E ----
Posts: 700
Joined: Sun Sep 26, 2010 1:51 pm
Location: A GH shop, near witchpoint to Oresrati in Galaxy 8

Re: [WIP] CargoScanner.OXP

Post by Okti »

Ahruman wrote:
Okti wrote:
Is there a way script wise obtaining cargo information?
Hrm. Maybe I should have read the top of the thread properly before acknowledging its existence. :-)

No, there isn’t. The contents of a cargo pod can be represented in several different ways and is notionally determined at scooping time, although this doesn’t seem to serve any real purpose except for the scripted case, and there should probably be a nominal type (like “Equipment”, “People” etc.) for scripted pods.

Issue #13 for Oolite 2.
So I will prefer to release a proper version with Oolite 2, for the time being this OXP gives a chance not to scoop slaves and leave them to dye for the commanders :mrgreen:
My OXP's
And Latest Mission Coyote's Run
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: [WIP] CargoScanner.OXP

Post by timer »

Hi, Okti!

Can I suggest u new script version with using target.commodity property? It looks well working in 1.77+

main content:

Code: Select all

this.shipTargetAcquired = function(target) {
    if ( ! target.isCargo || target.isPiloted
         || player.ship.equipmentStatus('EQ_CARGO_SCANNER') !== 'EQUIPMENT_OK' ) {
        return;
    }

    if ( target.commodity !== 'goods' ) {
        var ca = +target.commodityAmount;
        target.displayName = 'Cargo container (' + displayNameForCommodity( target.commodity )
                + ( ca === 1 ? '' : ' ['+ca+']' ) + ')';
    }
    else {
        target.displayName = 'Cargo container (Unknown/Broken RFID)';
    }
};
Cobra MK III owner since 1994
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: [WIP] CargoScanner.OXP

Post by timer »

I am going to create oxz version (with tiny code update) and create wiki page for this very good expansion - any objections? :)

PS I am do not claim to change ownership, Okti forever ;)
Cobra MK III owner since 1994
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: [WIP] CargoScanner.OXP

Post by Wildeblood »

timer wrote:
I am going to create oxz version (with tiny code update) and create wiki page for this very good expansion - any objections? :)
Good idea. It's an obvious piece of equipment that should be in the game. This line:

Code: Select all

target.displayName = 'Cargo container (' + displayNameForCommodity( target.commodity )
would be better as:

Code: Select all

target.displayName += " " + displayNameForCommodity( target.commodity )
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: [WIP] CargoScanner.OXP

Post by timer »

Yep, this version of name (with += ) was my first too, but it accumulate and after second targeting - you has "Cargo Conatainer Cargo Conatainer (Alloys)"

Maybe later I decide this problem and use src displayName, but now... :)

thanks for answer!
Cobra MK III owner since 1994
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: [WIP] CargoScanner.OXP

Post by Wildeblood »

Put the commodity type into target.shipUniqueName and let Oolite handle merging the displayName.
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: [WIP] CargoScanner.OXP

Post by Zireael »

Great to see this being OXZified.
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: [WIP] CargoScanner.OXP

Post by timer »

Wildeblood wrote:
Put the commodity type into target.shipUniqueName and let Oolite handle merging the displayName.
great! Thanks!
Last edited by timer on Tue Jul 29, 2014 12:26 pm, edited 1 time in total.
Cobra MK III owner since 1994
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: [WIP] CargoScanner.OXP

Post by timer »

Done. Can anybody test it?

And also review wiki page http://wiki.alioth.net/index.php/Cargo_Scanner_OXP

english is not my native )
Cobra MK III owner since 1994
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: [WIP] CargoScanner.OXP

Post by timer »

Smivs, mike! I took your description of the device and put it in the wiki: http://wiki.alioth.net/index.php/Cargo_ ... P#Overview
Cobra MK III owner since 1994
Rustem
Deadly
Deadly
Posts: 170
Joined: Mon May 25, 2015 5:23 pm
Location: Russia

Re: [WIP] CargoScanner.OXP

Post by Rustem »

No error - invalid arguments with part:

Code: Select all

    if ( target.commodity !== 'goods' ) {
        if ( ! target.shipUniqueName ) {
            var cn = target.commodity;
            var ca = +target.commodityAmount; //log(this.name, this.name+" : target : "+cn+"["+ca+"]");
            if (cn) target.shipUniqueName = displayNameForCommodity( cn )
                    + ( ca === 1 ? '' : ' ['+ca+']' )
            else {
                    target.shipUniqueName = 'Broken RFID'; // or 'Unknown RFID' /surprise-cargo /cloak
            }
        }
    }
Check with cargo : cloak-device and random cargo, no output error.
Full tweak
Post Reply