[OXP] AutoFuel
Moderators: winston, another_commander
[OXP] AutoFuel
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!
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.
- phkb
- 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
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.
Re: [OXP] AutoFuel
In places that are not main-stations (Behemoths, Waystations, Navy bases, ...) prices are often higher than normal.... so the price of fuel seems to be 4Cr/1LY ...
I believe that you can use
Station.equipmentPriceFactor
to determine how much higher.- Norby
- ---- 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
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
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
}
}
Re: [OXP] AutoFuel
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?Norby wrote: ↑Thu Mar 30, 2017 10:13 amNice idea, I plan to insert into Addons for Beginners collection when once arive into the package manager.
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.There is a way to disable fuel in stations, like in an abandoned rock hermit.
The check is inoolite.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 } }
- Norby
- ---- 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
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.
I think Mechanics is better category for this package. The category descriptions are in the old OXP List page.
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 .Re: [OXP] AutoFuel
Oh okay, i understand what you're saying now. I'll work on this either tonight or tomorrow. Thanks for the info!Norby wrote: ↑Thu Mar 30, 2017 8:22 pmI 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 meanoolite-barred-equipment
key contain EQ_FUEL within scriptInfo of a station in shipdata.plist .
Re: [OXP] AutoFuel
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 inoolite.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 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!
- Cmdr Fleegman
- Poor
- Posts: 6
- Joined: Fri May 08, 2015 1:59 pm