[OXP] AutoFuel

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

Moderators: winston, another_commander

Post Reply
User avatar
byronarn
Dangerous
Dangerous
Posts: 85
Joined: Thu Nov 18, 2010 6:08 am
Location: United States

[OXP] AutoFuel

Post by byronarn » Thu Mar 30, 2017 6:47 am

This tiny OXP (only 2 KB) fills your tank for you whenever you dock at a station, and deducts the cost from your account. If you do not have enough money to purchase the fuel, it gives you a message alerting you of the fact. It automatically does this whenever you dock with a station, so no need to buy any equipment.

The inspiration for this OXP came from the fact that there has been a few times that I have launched from a station having forgotten to buy fuel, and so have had to redock in order to buy the fuel. If there is anyone else who does this, here is the solution!

You can download the OXP using the download manager, or you can download it here.

Feel free to download it and test it out. Comments and suggestions are always welcome!
Last edited by byronarn on Sun Apr 02, 2017 7:40 pm, edited 3 times in total.

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

Re: [OXP] AutoFuel

Post by phkb » Thu Mar 30, 2017 7:17 am

Nice job! My only suggestion is a kind of ... well, anyway, I think you should call it AutoRefuel, so it's clear it's not a cheat. AutoFuel sounds a bit like you're going to get something for nothing.

User avatar
hoqllnq
Commodore
Commodore
Posts: 154
Joined: Sun Jan 08, 2006 7:32 pm

Re: [OXP] AutoFuel

Post by hoqllnq » Thu Mar 30, 2017 9:27 am

... so the price of fuel seems to be 4Cr/1LY ...
In places that are not main-stations (Behemoths, Waystations, Navy bases, ...) prices are often higher than normal.
I believe that you can use Station.equipmentPriceFactor to determine how much higher.

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2543
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [OXP] AutoFuel

Post by Norby » Thu Mar 30, 2017 10:13 am

Nice idea, I plan to insert into Addons for Beginners collection when once arive into the package manager.

There is a way to disable fuel in stations, like in an abandoned rock hermit.
The check is in oolite.app/Resources/Scripts/oolite-conditions.js, you can do something similar:

Code: Select all

var ds = player.ship.dockedStation;
if (ds) {
	var barred = false;
	var si = ds.scriptInfo;
	if (si) barred = si["oolite-barred-equipment"];
	if (!barred || barred.indexOf("EQ_FUEL") == -1)  {
		//ok to refuel
	}
}

User avatar
byronarn
Dangerous
Dangerous
Posts: 85
Joined: Thu Nov 18, 2010 6:08 am
Location: United States

Re: [OXP] AutoFuel

Post by byronarn » Thu Mar 30, 2017 7:39 pm

Norby wrote:
Thu Mar 30, 2017 10:13 am
Nice idea, I plan to insert into Addons for Beginners collection when once arive into the package manager.
How do i go about putting this in the package manager? Also, i put it in the miscellaneous category. Is this the correct category, or should I put it elsewhere?
There is a way to disable fuel in stations, like in an abandoned rock hermit.
The check is in oolite.app/Resources/Scripts/oolite-conditions.js, you can do something similar:

Code: Select all

var ds = player.ship.dockedStation;
if (ds) {
	var barred = false;
	var si = ds.scriptInfo;
	if (si) barred = si["oolite-barred-equipment"];
	if (!barred || barred.indexOf("EQ_FUEL") == -1)  {
		//ok to refuel
	}
}
I don't want to disable fuel in the stations. Imagine someone docked with a really low credit balance because they spent all their money on the last cargo load. I want them to still be able to buy fuel on the F3 screen once they sell their cargo.

User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2543
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [OXP] AutoFuel

Post by Norby » Thu Mar 30, 2017 8:22 pm

byronarn wrote:
Thu Mar 30, 2017 7:39 pm
How do i go about putting this in the package manager?
Easy way if you ask somebody to upload who already has rights. Otherwise ask access for yourself when go through the steps listed in The All-in-One Guide to OXZ Packaging and Distribution.

byronarn wrote:
Thu Mar 30, 2017 7:39 pm
Also, i put it in the miscellaneous category. Is this the correct category, or should I put it elsewhere?
I think Mechanics is better category for this package. The category descriptions are in the old OXP List page.

byronarn wrote:
Thu Mar 30, 2017 7:39 pm
I don't want to disable fuel in the stations.
I mean you give fuel in all stations regardless of it is a custom one in an oxp where the author willfully disabled it, like in a dockable ship or abandoned asteroid. I made the above code for you to check the property of stations where oxp authors can disable fuel access. This mean oolite-barred-equipment key contain EQ_FUEL within scriptInfo of a station in shipdata.plist .

User avatar
byronarn
Dangerous
Dangerous
Posts: 85
Joined: Thu Nov 18, 2010 6:08 am
Location: United States

Re: [OXP] AutoFuel

Post by byronarn » Thu Mar 30, 2017 9:53 pm

Norby wrote:
Thu Mar 30, 2017 8:22 pm
byronarn wrote:
Thu Mar 30, 2017 7:39 pm
I don't want to disable fuel in the stations.
I mean you give fuel in all stations regardless of it is a custom one in an oxp where the author willfully disabled it, like in a dockable ship or abandoned asteroid. I made the above code for you to check the property of stations where oxp authors can disable fuel access. This mean oolite-barred-equipment key contain EQ_FUEL within scriptInfo of a station in shipdata.plist .
Oh okay, i understand what you're saying now. I'll work on this either tonight or tomorrow. Thanks for the info!

User avatar
byronarn
Dangerous
Dangerous
Posts: 85
Joined: Thu Nov 18, 2010 6:08 am
Location: United States

Re: [OXP] AutoFuel

Post by byronarn » Sun Apr 02, 2017 7:13 pm

Norby wrote: Nice idea, I plan to insert into Addons for Beginners collection when once arive into the package manager.

There is a way to disable fuel in stations, like in an abandoned rock hermit.
The check is in oolite.app/Resources/Scripts/oolite-conditions.js, you can do something similar:

Code: Select all

var ds = player.ship.dockedStation;
if (ds) {
	var barred = false;
	var si = ds.scriptInfo;
	if (si) barred = si["oolite-barred-equipment"];
	if (!barred || barred.indexOf("EQ_FUEL") == -1)  {
		//ok to refuel
	}
}
phkb wrote:
Thu Mar 30, 2017 7:17 am
Nice job! My only suggestion is a kind of ... well, anyway, I think you should call it AutoRefuel, so it's clear it's not a cheat. AutoFuel sounds a bit like you're going to get something for nothing.
I have updated the Original Post with Version 1.0 (the original version was 0.1). Your suggestions have been added and you have been credited in the README.txt file. Thank you! :-)

You can also download it now in the download manager! :-)

User avatar
Cmdr Fleegman
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Fri May 08, 2015 1:59 pm

Re: [OXP] AutoFuel

Post by Cmdr Fleegman » Fri May 24, 2019 3:30 pm

hoqllnq wrote:
Thu Mar 30, 2017 9:27 am
... so the price of fuel seems to be 4Cr/1LY ...
... prices are often higher than normal.
In that case I would also suggest checking with the user before filling up with (expensive) fuel - I'd probably choose to wait till I got to the main station.

Post Reply