[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 »

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
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: [OXP] AutoFuel

Post by phkb »

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 »

... 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: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [OXP] AutoFuel

Post by Norby »

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 »

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: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: [OXP] AutoFuel

Post by Norby »

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 »

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 »

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
Poor
Poor
Posts: 6
Joined: Fri May 08, 2015 1:59 pm

Re: [OXP] AutoFuel

Post by Cmdr Fleegman »

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