Scripts/riredi_navbuoy.js |
"use strict";
this.name = "riredi_navbuoy";
this.author = "phkb";
this.copyright = "2024";
this.license = "CC BY-NC-SA 4.0";
this._key = "oolite";
this._diffuse = "cb68_navbuoy.png";
this._emission = "cb68_navbuoy_illumination.png";
this._normal = "oolite_buoy_normal.png";
this._specular = "oolite_buoy_specular.png";
//-------------------------------------------------------------------------------------------------------------
this.startUp = function() {
// check if the DHI Nav Buoy is installed
if (Ship.shipDataForKey("DHI_Nav_Buoy")) {
this._normal = "DHI_Nav_Buoy_Normal.png";
this._specular = "DHI_Nav_Buoy_Specular.png";
this._key = "DHI";
}
var pf = worldScripts.PlanetFall2;
if (!pf) return;
pf._locationOverrides["0 210"] = {
main: [
{
roles: ["capitalCity", "capitalCity", "leisureComplex", "leisureComplex", "factory", "factory"],
names: ["Triflinger (Capital City)", "Colubis (City)", "New Beatnik (Visitor's Facility)", "Riredian Mountain Slug Reserve", "Crab-Boolean Corporation (Factory)", "Coluber Works (Factory)"],
},
],
};
}
//-------------------------------------------------------------------------------------------------------------
this.startUpComplete = function() {
// make sure our texture wins any races to be the last texture installed
var info = System.infoForSystem(0, 210);
info.texture = "riredi_diffuse.png";
}
//-------------------------------------------------------------------------------------------------------------
this.shipSpawned = function(ship) {
if (galaxyNumber == 0 && system.ID == 210) {
switch (ship.dataKey) {
case "buoy":
case "buoy-witchpoint":
case "DHI_Nav_Buoy":
case "DHI_Nav_Buoy-witchpoint":
if (this._key == "oolite") {
ship.setMaterials({"oolite_buoy_diffuse.png": {
shininess:20, gloss:0.65, specular_color:[0.8, 0.83, 0.85, 1.0],
diffuse_map:this._diffuse,
emission_map:this._emission,
normal_map:this._normal,
specular_map:this._specular}});
} else {
ship.setMaterials({"DHI_Nav_Buoy.png": {
shininess:20, gloss:0.65, specular_color:[0.8, 0.83, 0.85, 1.0],
diffuse_map:this._diffuse,
emission_map:this._emission,
normal_map:this._normal,
specular_map:this._specular}});
}
break;
}
}
} |
Scripts/sodalite-newcargoes.js |
"use strict";
this.author = "cim";
this.copyright = "© 2011-2014 cim.";
this.license = "CC-BY-SA 3.0";
this.name = "CargoTypeExtension-Station-Sodalite";
this.description = "Sodalite station market definition";
this.startUp = function () {
if (!worldScripts.CargoTypeExtension) {
for (var prop in this) {
if (prop !== 'name' && prop !== 'version' && prop !== "oolite_manifest_identifier") {
delete this[prop];
}
}
return;
}
else {
if (!worldScripts["RandomStationNames"]) {
worldScripts["CargoTypeExtension"].registerOXPStation(this.name, "cb68_sodalite_station-riredi-coluber");
} else {
worldScripts["CargoTypeExtension"].registerOXPStation(this.name, "cb68_sodalite_station-riredi-coluber_no_beacon_version");
}
this.$registerNewCargoTypes();
}
}
this.$registerNewCargoTypes = function () {
var obj = new Object;
obj.ID = "RC-MGE1";
obj.genericType = "luxuries";
obj.specificType = "Riredian Mountain Slug Emollient";
obj.buySystems = [[210], [], [], [], [], [], [], []];
obj.sellSystems = [[5,57,59,60,69,78,92,99,156,167,218,223,231,241,249,253,],
[14,53,81,89,113,115,144,224],
[31,53,67,84,95,107,127,195,198,212,223],
[25,46,47,51,56,72,89,104,111,115,120,121,153,174,175,179,184,200,217,232,239,243,248,249],
[5,34,35,43,44,47,48,51,105,191,196,212,216,239,240],
[22,34,35,53,59,80,96,110,119,132,159,204,227,232,234,242],
[0,3,17,39,84,87,97,106,124,129,162,179,184,222,233,241],
[0,19,22,54,67,72,73,87,135,142,143,154,156,184,209,241,252]];
obj.desc = "A secretion of the Riredian Mountain Slug, with scientifically proven benefits for a variety of insectoid exoskeleton conditions.";
worldScripts["CargoTypeExtension"].registerCargoType(obj);
}
/* Station API */
this.randomCargoChance = function (good) {
var generic = worldScripts["CargoTypeExtension"].cargoDefinition(good, "genericType");
if (generic == "luxuries") {
return 0.75;
}
return 0;
}
this.randomCargoAmount = function (good) {
return 3;
}
this.exportCargoAmount = function (good) {
var generic = worldScripts["CargoTypeExtension"].cargoDefinition(good, "genericType");
if (good == "RC-MGE1") return 2;
return 0;
}
this.exportCargoPrice = function (good) {
return 0.9 + (Math.random() * 0.2);
}
this.randomImportChance = function (good) {
return 0;
}
this.systemImportChance = function (good) {
var generic = worldScripts["CargoTypeExtension"].cargoDefinition(good, "genericType");
if (generic == "luxuries") {
return 1;
} else {
return 0;
}
}
this.importCargoPrice = function (good) {
return 0.9 + (Math.random() * 0.2);
}
// they have police patrol ships, so they probably obey Galcop rules here
this.importPermitCheck = function () {
return true;
}
this.exportPermitCheck = function () {
return true;
}
this.stationGossip = function () {
return false;
}
|
Scripts/sodalite_station.js |
"use strict";
this.name = "sodalite_station_script";
this.author = "phkb";
this.copyright = "2024 phkb";
this.license = "CC BY-NC-SA 4.0";
this._types = ["cb68_pitviper-player", "cb68_pitviper-beast-player",
"cb68_pitviper2-player", "cb68_pitviper2b-player", "cb68_pitviper2c-player", "cb68_pitviper2d-player", "cb68_pitviper2e-player",
"cb68_blue_racer-player", "cb68_red_racer-player", "cb68_yellowbelly_racer-player", "cb68_yellowbelly_racer-player2", "cb68_black_racer-player"];
//-------------------------------------------------------------------------------------------------------------
this.shipSpawned = function () {
var sy = this.ship.shipyard;
var i = sy.length;
// look for an existing coluber ships in the shipyard
while (i--) {
if (this._types.indexOf(sy[i].shipdata_key) >= 0) {
// there are already coluber ships
return;
}
}
// make sure we only have spawnable ships in the _types array
i = this._types.length;
while (i--) {
if (!Ship.shipDataForKey(this._types[i])) this._types.splice(i, 1);
}
// if we don't have any coluber ship oxps installed, exit at this point
if (this._types.length == 0) return;
// if we get here, there were no coluber ships in the shipyard, but there are some oxps installed
// first, make sure there aren't many other ships
i = sy.length;
while (i--) {
if (Math.random() > 0.25) this.ship.removeShipFromShipyard(i);
}
// now go and add some ships
this.$addPitvipersToShipyard();
}
//-------------------------------------------------------------------------------------------------------------
this.$addPitvipersToShipyard = function () {
var optional = ["EQ_ECM", "EQ_ADVANCED_NAVIGATIONAL_ARRAY", "EQ_PASSENGER_BERTH", "EQ_ENERGY_UNIT", "EQ_FUEL_INJECTION",
"EQ_SCANNER_SHOW_MISSILE_TARGET", "EQ_MULTI_TARGET", "EQ_GAL_DRIVE", "EQ_SHIELD_BOOSTER", "EQ_HEAT_SHIELD"];
var forSale = parseInt(Math.random() * 5) + 6; // something between 6 and 10 ships for sale
for (var shps = 0; shps <= forSale; shps++) {
var s = this._types[parseInt(Math.random() * this._types.length)];
var extras = [];
var txt = "";
var extrasCount = parseInt(Math.random() * 3);
var extrasCost = 0;
for (var i = 1; i <= extrasCount; i++) {
if (Math.random() > 0.75) {
// pick a piece of equipment to add
var itm = optional[parseInt(Math.random() * optional.length)];
var eq = EquipmentInfo.infoForKey(itm);
if (eq.techLevel <= system.techLevel && eq.techLevel <= this.ship.equivalentTechLevel) {
extras.push(itm);
txt += (txt == "" ? "Includes " : " and ") + eq.name;
extrasCost += (eq.price / 10);
}
}
}
if (txt != "") txt += ". ";
this.$addShip(s, extras, txt, extrasCost);
this._types.splice(this._types.indexOf(s), 1);
}
}
//-------------------------------------------------------------------------------------------------------------
this.$addShip = function (shipKey, extras, extrasText, extrasCost) {
var shp = Ship.shipDataForKey(shipKey);
if (!shp) return;
var price = (parseInt(shp._oo_shipyard.price) + extrasCost) * 0.9; // discounted when buying at a Sodalite station
this.ship.addShipToShipyard({
short_description: shp.name + ": Standard customer model. " + extrasText + "Price " + formatCredits(price, false, true) + ".",
shipdata_key: shipKey,
price: price,
personality: Math.floor(Math.random() * 32768),
extras: extras
});
} |