Oolite Bulletins

For information and discussion about Oolite.
It is currently Mon Dec 18, 2017 8:50 am

All times are UTC




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
 Post subject: [OXP] AutoFuel
PostPosted: Thu Mar 30, 2017 6:47 am 
Offline
Dangerous
Dangerous
User avatar

Joined: Thu Nov 18, 2010 6:08 am
Posts: 85
Location: United States
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.

Top
   
 Post subject: Re: [OXP] AutoFuel
PostPosted: Thu Mar 30, 2017 7:17 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1843
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
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.

_________________
My OXP's


Top
   
 Post subject: Re: [OXP] AutoFuel
PostPosted: Thu Mar 30, 2017 9:27 am 
Offline
Commodore
Commodore
User avatar

Joined: Sun Jan 08, 2006 7:32 pm
Posts: 148
Quote:
... 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.


Top
   
 Post subject: Re: [OXP] AutoFuel
PostPosted: Thu Mar 30, 2017 10:13 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

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

_________________
OXPs by Norby


Top
   
 Post subject: Re: [OXP] AutoFuel
PostPosted: Thu Mar 30, 2017 7:39 pm 
Offline
Dangerous
Dangerous
User avatar

Joined: Thu Nov 18, 2010 6:08 am
Posts: 85
Location: United States
Quote:
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?
Quote:
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:
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.


Top
   
 Post subject: Re: [OXP] AutoFuel
PostPosted: Thu Mar 30, 2017 8:22 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

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

Quote:
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.

Quote:
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 .

_________________
OXPs by Norby


Top
   
 Post subject: Re: [OXP] AutoFuel
PostPosted: Thu Mar 30, 2017 9:53 pm 
Offline
Dangerous
Dangerous
User avatar

Joined: Thu Nov 18, 2010 6:08 am
Posts: 85
Location: United States
Quote:
Quote:
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!


Top
   
 Post subject: Re: [OXP] AutoFuel
PostPosted: Sun Apr 02, 2017 7:13 pm 
Offline
Dangerous
Dangerous
User avatar

Joined: Thu Nov 18, 2010 6:08 am
Posts: 85
Location: United States
Quote:
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:
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
	}
}
Quote:
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! :-)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited