Page 5 of 5

Re: [Split] Fuel Tweaks

Posted: Sat Apr 12, 2025 10:36 am
by cbr
phkb wrote: ↑Thu Apr 10, 2025 7:44 pm

Image
Marvellous replacement and cool video! :D

Re: [Split] Fuel Tweaks

Posted: Mon Apr 14, 2025 10:34 pm
by Cholmondely
I'd never realised that we were supposed to tweak the innards of this one. I read the wiki page and failed to understand it. I never saw any obvious markets for the fuels, nor the fuel stations or anything else. Be interesting to try it out now.

Re: [Split] Fuel Tweaks

Posted: Tue Apr 15, 2025 2:39 am
by phkb
Cholmondely wrote: ↑Mon Apr 14, 2025 10:34 pm
I'd never realised that we were supposed to tweak the innards of this one.
I Had a feeling that was the case with a lot of people. Hopefully this update will create a bit of fun with fuel.

[Edit] For legal reasons, I did not mean "molotov cocktail" types of fun! Just steady and calm fun. Nothing explosive.

Unless you shoot a refueling station, obviously...

[Edit] In the game, I mean. Not the one down the street!

Re: [Split] Fuel Tweaks

Posted: Fri Apr 18, 2025 5:00 pm
by cbr
Image

Station Ads for variations :idea: :?:

Re: [Split] Fuel Tweaks

Posted: Sat Apr 19, 2025 4:40 am
by phkb
OK, version 1.15 should be in the manager shortly. A couple of things worth mentioning.

If you have the "Isis Interstellar" OXP installed, you will need to make the following changes:
1. Find the "II_conditions.js" file, and replace the code with this:

Code: Select all

"use strict";
this.name = "II_conditions";
this.author = "Killer Wolf";
this.copyright = "(C) 2023 Killer Wolf.";
this.license = "CC-NC-by-SA 3.0";
this.description = "Condition script for equipment.";

this.allowAwardEquipment = function (equipment, ship, context) {
	return worldScripts["oolite-II"].II_allowAwardEquipment(equipment, ship, context);
}

this.updateEquipmentPrice = function (equipment, currentPrice) {
	return worldScripts["oolite-II"].II_updateEquipmentPrice(equipment, currentPrice);
}
2. Find the "II_populator.js" file, and replace the code with this:

Code: Select all

"use strict";
	// here we establish the position of the station. this needs to be the same every time the system is populated
	// you can use the system.pseudoRandomNumber property to add "randomness" to the location if you want
	// in this instance, we're just going to use the main station position, and put our station 5000m directly in front of it.
	//var stationPos = system.mainStation.position.add(system.mainStation.vectorForward.multiply(5000));
	
	// next, we use the system.setPopulator to create the actual station using a callback
	// "create_my_station" is a text string that uniquely identifies this populator function
	
this.name = "oolite-II";
this.author = "Killer Wolf";
this.copyright = "(C) 2023 Killer Wolf.";
this.license = "CC-NC-by-SA 3.0";
	
this.systemWillPopulate = function() {
	if (galaxyNumber === 1 && system.ID === 195) {
		var stationPos = Vector3D(266700, 61250, 15235).fromCoordinateSystem("pwm");
		system.setPopulator("II_station", {
			callback: function (pos) {
				system.addShips("KWii", 1, pos, 0);
			},
			location: "COORDINATES",
			coordinates: stationPos,
			deterministic:true // < this is important
		});
	}
}

this.II_allowAwardEquipment = function(equipment, ship, context) {
	if (context == "scripted") return true; // you should always do this at the top of this function.
	if ((equipment == "EQ_WEAPON_NEITH_LASER" || equipment == "EQ_WEAPON_KATHOS_LASER")  && ship.isPlayer) {
		if (player.ship.dockedStation.dataKey == "KW_II") {
			return true;
		}
		return false;
	}
	return true;
}

this.II_updateEquipmentPrice = function(equipment, currentPrice) {
	var newprice = currentPrice;
	switch (equipment) {
		case "EQ_MISSILE":
		case "EQ_CARGO_BAY":
		case "EQ_FUEL":
		case "EQ_ECM":
		case "EQ_HARDENED_MISSILE":
		case "EQ_ENERGY_UNIT":
		if (player.ship.dockedStation.dataKey == "KW_II") {
				newprice = parseInt(newprice * 0.66);
		}
		break;
		case "EQ_DOCK_COMP":
		case "EQ_GAL_DRIVE":
			if (player.ship.dockedStation.dataKey == "KW_II") {
				newprice = parseInt(newprice * 0.75);
			}
			break;
	}
	return newprice;	
}
Basically what this is doing is making the condition script functions visible to other worldscripts, so Fuel Tweaks can integrate with it with regard to fuel.

So that's the house-keeping out of the way.

Aside from the new Refueling station model, the biggest change in this OXP is that you can now fiddle with the settings without going near a line of Javascript. If you have Library OXP, you can tweak a lot of settings from the comfort of your F4 screen. Rather than go in detail through all the options, I thought it might be better to run through a couple of examples of what you can do, to better explore the possibilities.

Example 1. Using Refuelling Stations for fuel.
In order to move all refuelling functions to refuelling stations, do the following:
a. Set "General Settings", "Switches", "Apply changes" to true.
b. Set "General Settings", "Switches", "Normal fuel operation" to false.
The way the defaults are set, that's all you need to do. You will, however, need to save and reload the game for the station to be visible at your current location.

Example 2. Only having Refuelling Stations in certain government types.
To limit where refuelling stations will appear by the government type, do the following:
a. Open "Fuel Stations: Governments", "Flags", and change the flag from 1 to 0 on all government types where you do not want refuelling stations to appear.
Again, if you change the setting for the system you are currently in, you will need to save and reload the game before you see the change.

Example 3. Allowing normal refuelling at some government types.
In order to allow some governments to have normal fuel operations (ie fuel can be purchased via the F3 Equip Ship screen), do the following:
a. Open "Fuel Availability: Governments", "Flags", and change the flag from 1 to 0 on all government types where you do not want normal fuel operations.
b. Open "Fuel Stations: Governments", "Flags", and ensure the opposite value is set for the government. That is, if you turned on fuel availability at Democracies, turn off fuel stations at Democracies.

Example 4. Implementing fuel rationing.
In order to allow fuel rationing, do the following:
a. Set "General Settings", "Switches", "Fuel rationing" to true.
b. Set "General Settings", "Values", "Max fuel ration" to the maximum number you want available. The default is 1 (ie only 1 LY of fuel can be purchased at the station per system visit).
Once fuel rationing is in place, any fuel availability settings will apply to rations. That is, if fuel is available in a system, it will be rationed.

If you were one of the *very* few people who explored using the JS calls to tweak things, I'd suggest disabling your code, and running

Code: Select all

worldScripts.FuelTweaks_FuelEconomy.$reset()
to get things back to a base level. You can then explore the options via Library Config.

There are some things you can't yet do via Library Config. For instance, adding in exceptions to any settings. If there's a big call for providing an interface to those settings, I'll revisit what can be done about it.

Re: [Split] Fuel Tweaks

Posted: Thu May 08, 2025 11:32 pm
by Nite Owl
Would it be possible to get a FACELIFT version of this OXZ. None of the fuel additions and options or market changes or changes to Fuel Station's locations. It would be just an update to the look of the Fuel Stations and Fuel Satellites from what they are in Thargoid's Fuel Stations OXZ. Similar to the work you have done with the Space Bars and Rock Hermits.

Much Appreciated.

Re: [Split] Fuel Tweaks

Posted: Fri May 09, 2025 2:49 am
by phkb
Nite Owl wrote: ↑Thu May 08, 2025 11:32 pm
Would it be possible to get a FACELIFT version of this OXZ. None of the fuel additions and options or market changes or changes to Fuel Station's locations. It would be just an update to the look of the Fuel Stations and Fuel Satellites from what they are in Thargoid's Fuel Stations OXZ. Similar to the work you have done with the Space Bars and Rock Hermits.

Much Appreciated.
I’ll see what I can do.