| Back to Index | Page generated: Nov 24, 2025, 1:21:31 AM |
| from Expansion Manager's OXP list | from Expansion Manifest | |
|---|---|---|
| Description | Restricts the sale of more dangerous weapons to the more lawless systems. Press 'i' for more information. - - - - - - - - - - Military Lasers for sale in a Democracy? Quirium Cascade Mines available in a Corporate State? No wonder the galaxy has a piracy problem... This expansion makes the more high end military equipment available only in the more dangerous systems. Tech level still applies but generally speaking the more dangerous the equipment, the more dangerous the system where you are likely to find it for sale. | Restricts the sale of more dangerous weapons to the more lawless systems. Press 'i' for more information. - - - - - - - - - - Military Lasers for sale in a Democracy? Quirium Cascade Mines available in a Corporate State? No wonder the galaxy has a piracy problem... This expansion makes the more high end military equipment available only in the more dangerous systems. Tech level still applies but generally speaking the more dangerous the equipment, the more dangerous the system where you are likely to find it for sale. |
| Identifier | oolite.oxp.redspear.weapon_laws | oolite.oxp.redspear.weapon_laws |
| Title | Weapon Laws | Weapon Laws |
| Category | Equipment | Equipment |
| Author | Redspear | Redspear |
| Version | 1.6 | 1.6 |
| Tags | ||
| Required Oolite Version | ||
| Maximum Oolite Version | ||
| Required Expansions | ||
| Optional Expansions | ||
| Conflict Expansions | ||
| Information URL | n/a | |
| Download URL | https://wiki.alioth.net/img_auth.php/f/fd/Oolite.oxp.redspear.weapon_laws.oxz | n/a |
| License | CC-BY-NC-SA 4.0 | CC-BY-NC-SA 4.0 |
| File Size | n/a | |
| Upload date | 1669239366 |
Also read http://wiki.alioth.net/index.php/Weapon%20Laws
| Path | |
|---|---|
| Scripts/weapon_laws.js | this.name = "weapon_laws";
this.author = "Redspear";
this.copyright = "2020 Redspear";
this.licence = "CC BY-NC-SA 4.0";
this.description = "Script to restrict sale of military grade equipment at the safer systems.";
this.version = "1.6";
"use strict";
// disallow free sale of military hardware at every station
this.allowAwardEquipment = function(eqKey, ship, context)
{
if (context == "scripted")
{return true; // thanks phkb!
}
else {
// democracies
if ((eqKey == "EQ_WEAPON_PULSE_LASER" || eqKey == "EQ_WEAPON_DUAL_LASER" || eqKey == "EQ_WEAPON_IPULSE_LASER" || eqKey == "EQ_DEFENCE_MISSILE" || eqKey == "EQ_SHIELD_BOOSTER") && context == "purchase" && system.government > 6) {
return false;
}
else {
// confederacies
if ((eqKey == "EQ_MISSILE" || eqKey == "EQ_NAVAL_SHIELD_BOOSTER") && context == "purchase" && system.government > 5) {
return false;
}
else {
// communist states
if ((eqKey == "EQ_WEAPON_BEAM_LASER" || eqKey == "EQ_WEAPON_IBEAM_LASER" || eqKey == "EQ_WEAPON_BURST_LASER" || eqKey == "EQ_SCANNER_SHOW_MISSILE_TARGET") && context == "purchase" && system.government > 4) {
return false;}
else {
// dictatorships
if ((eqKey == "EQ_HARDENED_MISSILE" || eqKey == "EQ_TORPEDO_MISSILE" || eqKey == "EQ_MULTI_TARGET" || eqKey == "EQ_TARGET_MEMORY") && context == "purchase" && system.government > 3) {
return false;
}
else {
// multi-governments
if ((eqKey == "EQ_WEAPON_MILITARY_LASER" || eqKey == "EQ_WEAPON_ASSAULT_LASER" || eqKey == "EQ_WEAPON_EMILITARY_LASER" || eqKey == "EQ_INTEGRATED_TARGETING_SYSTEM") && context == "purchase" && system.government > 2) {
return false;
}
else {
// feudal states
if ((eqKey == "EQ_QC_MINE") && context == "purchase" && system.government > 1) {
return false;
}
else {
// anarchies
if (eqKey == "EQ_ENERGY_BOMB" && context == "purchase" && system.government > 0) { // Moo Hoo Ha Ha Haaaaa! :-P (requires relevant oxp)
return false;
}
else {
// remainder from oolite-conditions.js
// OXP hook to allow stations to forbid specific equipment
if (context == "purchase" && player.ship.dockedStation && player.ship.dockedStation.scriptInfo["oolite-barred-equipment"])
{
if (player.ship.dockedStation.scriptInfo["oolite-barred-equipment"].indexOf(equipment) != -1)
{
return false;
}
}
// OXP hook to allow ships to forbid specific "available to all" equipment
if (ship.scriptInfo && ship.scriptInfo["oolite-barred-equipment"] && ship.scriptInfo["oolite-barred-equipment"].indexOf(equipment) != -1)
{
return false;
}
// otherwise allowed
return true;
}
}
}
}
}
}
}
}
}
|