Back to Hathor stations...
So, we've identified that we want food prices at or near Poor Ag prices, have some textiles and liquor/wines available, and pretty much nothing else.
I did some analysis of the spawning criteria across all charts and this is what I found:
G1 15 systems (Mainly/Rich/Average Agricultural, TL8-11)
G2 19 systems (Mainly/Rich/Average Agricultural, TL8-11)
G3 17 systems (Mainly/Rich/Average Agricultural, TL8-10)
G4 12 systems (Mainly/Rich Agricultural, TL8-10)
G5 18 systems (Mainly/Rich/Average Agricultural, TL8-11)
G6 21 systems (Mainly/Rich Agricultural, TL8-10)
G7 16 systems (Mainly/Rich Agricultural, TL8-10)
G8 17 systems (Mainly/Rich/Average Agricultural, TL8-10)
We have 3 economy types to cater for, and nothing greater than a TL11.
To make sure we don't apply a Mainly Ag discount on a Average Ag system, we need to change the way we spawn stations in. This will require 2 things: some extra shipdata.plist entries, and a condition script.
Let's have a look at the changes required in shipdata:
Code: Select all
// *************************************************
// * H A T H O R *
// *************************************************
{
"hathor_template" = {
is_template = yes;
condition_script = "hathor_conditions.js";
ai_type = "stationAI.plist";
auto_ai = yes;
aft_eject_position = "0.0 13.0 0.0";
beacon = "TSBEACON";
energy_recharge_rate = 40;
frangible = "false";
has_ecm = "true";
heat_insulation = 5;
market_monitored = yes;
market_capacity = 256; // we're giving this station a big capacity
max_energy = 20000;
model = "2xhath.dat";
name = "Hathor Station";
roles = "station(0) KW_hathor";
subentities = (
... list of subentities, trimmed for brevity ...
);
shaders = {
... shader definitions, trimmed for brevity ...
};
smooth = "false";
thrust = 50;
};
"hathor_mainly_ag" = {
like_ship = "hathor_template";
market_definition = (
{
type = "good";
name = "food";
price_multiplier = 0.6;
quantity_multiplier = 5;
},
{
type = "good";
name = "textiles";
price_multiplier = 0.7;
quantity_multiplier = 2.0;
},
{
type = "good";
name = "liquor_wines";
price_multiplier = 0.85;
quantity_multiplier = 2.0;
},
{
type = "default";
quantity_multiplier = 0.0; // no other products
},
);
};
"hathor_rich_ag" = {
like_ship = "hathor_template";
market_definition = (
{
type = "good";
name = "food";
price_multiplier = 0.7;
quantity_multiplier = 5;
},
{
type = "good";
name = "textiles";
price_multiplier = 0.75;
quantity_multiplier = 2.0;
},
{
type = "good";
name = "liquor_wines";
price_multiplier = 0.88;
quantity_multiplier = 2.0;
},
{
type = "default";
quantity_multiplier = 0.0; // no other products
},
);
};
"hathor_average_ag" = {
like_ship = "hathor_template";
market_definition = (
{
type = "good";
name = "food";
price_multiplier = 0.8;
quantity_multiplier = 5;
},
{
type = "good";
name = "textiles";
price_multiplier = 0.8;
quantity_multiplier = 2.0;
},
{
type = "good";
name = "liquor_wines";
price_multiplier = 0.91;
quantity_multiplier = 2.0;
},
{
type = "default";
quantity_multiplier = 0.0; // no other products
},
);
};
... sub-entities after this point ...
So, the original data key, "hathor", we've renamed to "hathor_template", and applied the "is_template" property to it. We've taken the market_definition out this entry, because the "is_template" flag will prevent this ship key from being spawned on its own. Instead, we've created three new ship keys: hathor_mainly_ag, hathor_rich_ag, and hathor_average_ag. These are like_shipped from the template (so they inherit all the template's properties), but they also define a slightly different market_definition, with slightly less discounts applying for the rich ag version, and even less in the average ag version.
The next bit is to create the condition script. I've called mine "hathor_conditions.js", and it will go into the "Scripts" folder of the OXP. Here's what it looks like:
Code: Select all
"use strict";
this.name = "Hathor_Conditions";
this.author = "phkb";
this.copyright = "2023 phkb";
this.description = "Condition script for ships.";
this.license = "CC BY-NC-SA 3.0";
this.allowSpawnShip = function (shipKey) {
if (shipKey === "hathor_mainly_ag" && system.info.economy == 4) return true;
if (shipKey === "hathor_rich_ag" && system.info.economy == 5) return true;
if (shipKey === "hathor_average_ag" && system.info.economy == 6) return true;
return false;
}
You might have noticed I didn't change the roles on any of the new station versions I defined. They will each have the "KW_hathor" role, will is picked up from the template. So, the spawning routine will ask the Oolite ship database to create a station with the role "KW_hathor". For each of the three ship keys, the "allowSpawnShip" function of the hathor_conditions.js file is executed. Then based on the ship key in question, we do a check of the current systems' economy, and we only allow it (ie return "true") if the ship key matches the appropriate system economy value.
With all that set up out of the way, how are our numbers looking? Well, I'm glad you asked.
As you can see, bargain basement prices on food, with lots available, some tempting prices on textiles, as well as on Liquor/Wines. And nothing else for sale at the moment, with all the other prices matching the main station. We can look at those items next time.
So, is this method helpful? Let me know what you think.