Page 6 of 7
Re: Weapon Laws OXZ
Posted: Tue Apr 20, 2021 4:43 pm
by Cholmondely
This OXP also conflicts with Laser Arrangement.
Now if Weapon Laws' restrictions are legal, as I adumbrated earlier, one can well see GalCop confiscating the laser I asked the shipyard to move to my aft mount! Thank heavens they didn't fine me!
But if they are not, as argued above regarding magazines & toy shops, well ... then ... it's blatant theft, and GalCop should arrest the shipyard employees! And give me my lasers back! And get those scoundrels to pay me compensation!
Re: Weapon Laws OXZ
Posted: Wed Apr 21, 2021 1:16 pm
by Redspear
Cholmondely wrote: ↑Tue Apr 20, 2021 4:43 pm
Now if Weapon Laws' restrictions are legal...
It's been a while so I'll try again.
Weapon Laws *:
- The ownership, installation and maintenance of military hardware is legal throughout the eight galactic charts within the confines of GalCop stations.
- The sale and purchasing of military hardware is restricted within systems according to their form of governmental control. The more potent the militaristic potential of the item, and the more safety focused the government, the less likely the item can be legally bought or sold.
- The fact that GalCop stations exist within government zones of control and yet are simultaneously independant of them leads to a situation of legality concerning the handling of such items rather than of the items themselves.
* purely for the purpose of this oxp
As for Laser Arrangement oxp, looks like you've been caught out by a legal loophole by the red tape merchants at GalCop...
I'm not sure if a fix would be easy without altering (or bullying) that oxp in some way.
Pretty busy lately but it's on the (ever expanding) list.
Thanks.
Re: Weapon Laws OXZ
Posted: Mon May 31, 2021 10:16 am
by Cholmondely
Here are my current tweaks to this OXP which include the VimanaHUD additions (laser, combat module
etc) & Sniperlock.
equipment-overrides.plist:
Code: Select all
{
"EQ_MISSILE" = {
condition_script = "weapon_laws.js";
};
"EQ_DEFENCE_MISSILE" = {
condition_script = "weapon_laws.js";
};
"EQ_TORPEDO_MISSILE" = {
condition_script = "weapon_laws.js";
};
"EQ_ECM" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_PULSE_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_DUAL_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_IPULSE_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_BEAM_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_IBEAM_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_BURST_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_MINING_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_BMINING_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_AMINING_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_MILITARY_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_VIMANA_BEAM" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_ASSAULT_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_EMILITARY_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_VOLT_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_STAR_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_HIRAD_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_HARDENED_MISSILE" = {
condition_script = "weapon_laws.js";
};
"EQ_SCANNER_SHOW_MISSILE_TARGET" = {
condition_script = "weapon_laws.js";
};
"EQ_MULTI_TARGET" = {
condition_script = "weapon_laws.js";
};
"EQ_TARGET_MEMORY" = {
condition_script = "weapon_laws.js";
};
"EQ_INTEGRATED_TARGETING_SYSTEM" = {
condition_script = "weapon_laws.js";
};
"EQ_TARGET_FILTERING_SYSTEM" = {
condition_script = "weapon_laws.js";
};
"EQ_VIMANA_TARGET_MODULE" = {
condition_script = "weapon_laws.js";
};
"EQ_SNIPERLOCK" = {
condition_script = "weapon_laws.js";
};
"EQ_QC_MINE" = {
condition_script = "weapon_laws.js";
};
"EQ_SHIELD_BOOSTER" = {
condition_script = "weapon_laws.js";
};
"EQ_NAVAL_SHIELD_BOOSTER" = {
condition_script = "weapon_laws.js";
};
"EQ_ENERGY_BOMB" = {
condition_script = "weapon_laws.js";
};
}
weapon_laws.js
Code: Select all
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.3";
"use strict";
// disallow free sale of military hardware at every station
this.allowAwardEquipment = function(eqKey, ship, context)
{
// democracies
if (eqKey == "EQ_SHIELD_BOOSTER" && context == "purchase" && system.government > 6) {
return false;
}
else {
// confederacies
if ((eqKey == "EQ_WEAPON_PULSE_LASER" || eqKey == "EQ_VIMANA_TARGET_MODULE" || eqKey == "EQ_SNIPERLOCK" || eqKey == "EQ_WEAPON_DUAL_LASER" || eqKey == "EQ_WEAPON_IPULSE_LASER" || eqKey == "EQ_DEFENCE_MISSILE" || eqKey == "EQ_NAVAL_SHIELD_BOOSTER") && context == "purchase" && system.government > 5) {
return false;
}
else {
// communist states
if ((eqKey == "EQ_MISSILE" || eqKey == "EQ_TARGET_FILTERING_SYSTEM" || eqKey == "EQ_MULTI_TARGET" || eqKey == "EQ_TARGET_MEMORY") && context == "purchase" && system.government > 4) {
return false;}
else {
// dictatorships
if ((eqKey == "EQ_WEAPON_BEAM_LASER" || eqKey == "EQ_WEAPON_IBEAM_LASER" || eqKey == "EQ_WEAPON_BURST_LASER" || eqKey == "EQ_TORPEDO_MISSILE" || eqKey == "EQ_SCANNER_SHOW_MISSILE_TARGET") && context == "purchase" && system.government > 3) {
return false;
}
else {
// multi-governments
if ((eqKey == "EQ_WEAPON_MILITARY_LASER" || eqKey == "EQ_WEAPON_VIMANA_BEAM" || 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_HARDENED_MISSILE" || 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;
}
}
}
}
}
}
}
}
Re: Weapon Laws OXZ
Posted: Mon May 31, 2021 10:24 am
by Cholmondely
Could I tweak it further to make buying Quirium Cascade bombs only legal on certain planet surfaces & non-Galcop stations in anarchies?
And how would I do that?
Re: Weapon Laws OXZ
Posted: Fri Sep 03, 2021 3:45 pm
by Cholmondely
I've extended coverage to some of the items which I regularly use.
To whit:
VimanaHUD: Vimana Beam Laser (multi-governments); TFS/Target Filtering System (communists), Target Module (confederacies)
SniperLock: (confederacies)
If you wish to use this, unzip your WeaponLaws.oxz, open up the folder, then open up the
Config folder and replace the old
equipment-overrides.plist with this one (don't forget to name it if it is a new file!):
Code: Select all
{
"EQ_MISSILE" = {
condition_script = "weapon_laws.js";
};
"EQ_DEFENCE_MISSILE" = {
condition_script = "weapon_laws.js";
};
"EQ_TORPEDO_MISSILE" = {
condition_script = "weapon_laws.js";
};
"EQ_ECM" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_PULSE_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_DUAL_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_IPULSE_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_BEAM_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_IBEAM_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_BURST_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_MINING_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_BMINING_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_AMINING_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_MILITARY_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_VIMANA_BEAM" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_ASSAULT_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_EMILITARY_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_VOLT_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_STAR_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_WEAPON_HIRAD_LASER" = {
condition_script = "weapon_laws.js";
};
"EQ_HARDENED_MISSILE" = {
condition_script = "weapon_laws.js";
};
"EQ_SCANNER_SHOW_MISSILE_TARGET" = {
condition_script = "weapon_laws.js";
};
"EQ_MULTI_TARGET" = {
condition_script = "weapon_laws.js";
};
"EQ_TARGET_MEMORY" = {
condition_script = "weapon_laws.js";
};
"EQ_INTEGRATED_TARGETING_SYSTEM" = {
condition_script = "weapon_laws.js";
};
"EQ_TARGET_FILTERING_SYSTEM" = {
condition_script = "weapon_laws.js";
};
"EQ_VIMANA_TARGET_MODULE" = {
condition_script = "weapon_laws.js";
};
"EQ_SNIPERLOCK" = {
condition_script = "weapon_laws.js";
};
"EQ_QC_MINE" = {
condition_script = "weapon_laws.js";
};
"EQ_SHIELD_BOOSTER" = {
condition_script = "weapon_laws.js";
};
"EQ_NAVAL_SHIELD_BOOSTER" = {
condition_script = "weapon_laws.js";
};
"EQ_ENERGY_BOMB" = {
condition_script = "weapon_laws.js";
};
}
The open up the
scripts folder and replace the old
weapon_laws.js file with this one (ditto for new files as above!)
Code: Select all
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.3";
"use strict";
// disallow free sale of military hardware at every station
this.allowAwardEquipment = function(eqKey, ship, context)
{
// democracies
if (eqKey == "EQ_SHIELD_BOOSTER" && context == "purchase" && system.government > 6) {
return false;
}
else {
// confederacies
if ((eqKey == "EQ_WEAPON_PULSE_LASER" || eqKey == "EQ_VIMANA_TARGET_MODULE" || eqKey == "EQ_SNIPERLOCK" || eqKey == "EQ_WEAPON_DUAL_LASER" || eqKey == "EQ_WEAPON_IPULSE_LASER" || eqKey == "EQ_DEFENCE_MISSILE" || eqKey == "EQ_NAVAL_SHIELD_BOOSTER") && context == "purchase" && system.government > 5) {
return false;
}
else {
// communist states
if ((eqKey == "EQ_MISSILE" || eqKey == "EQ_TARGET_FILTERING_SYSTEM" || eqKey == "EQ_MULTI_TARGET" || eqKey == "EQ_TARGET_MEMORY") && context == "purchase" && system.government > 4) {
return false;}
else {
// dictatorships
if ((eqKey == "EQ_WEAPON_BEAM_LASER" || eqKey == "EQ_WEAPON_IBEAM_LASER" || eqKey == "EQ_WEAPON_BURST_LASER" || eqKey == "EQ_TORPEDO_MISSILE" || eqKey == "EQ_SCANNER_SHOW_MISSILE_TARGET") && context == "purchase" && system.government > 3) {
return false;
}
else {
// multi-governments
if ((eqKey == "EQ_WEAPON_MILITARY_LASER" || eqKey == "EQ_WEAPON_VIMANA_BEAM" || 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_HARDENED_MISSILE" || 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;
}
}
}
}
}
}
}
}
Then add the extension
.oxp to the folder and place your tweaked .oxp in your
AddOns folder. That way both you and the Expansions Manager know it's been modified - and it will appear
red in the in-game expansions manager's list when you next check it.
Re: Weapon Laws OXZ
Posted: Sat Dec 18, 2021 5:57 pm
by Cholmondely
Query re Station Options & Weapon Laws is
here.
Re: Weapon Laws OXZ
Posted: Wed Dec 22, 2021 7:55 pm
by Redspear
Just uploaded v 1.5
No chance to test at present but just a minor change, so fingers crossed I haven't botched the syntax.
Change is significant however and should now only affect items for sale (as was supposed to be the case anyway...)
Should cause fewer oxp conflicts now.
Thanks to Cholmondely for the consistent feedback/encouragement/badgering.
Re: Weapon Laws OXZ
Posted: Wed Dec 22, 2021 8:24 pm
by Redspear
Cholmondely wrote: ↑Mon May 31, 2021 10:24 am
Could I tweak it further to make buying Quirium Cascade bombs only legal on certain planet surfaces & non-Galcop stations in anarchies?
Yes.
Er...
I think you'd need to set a ship (station in this case) context for mines in particular
if (shipKey = ... && eqKey == "EQ_QC_MINE"
Re: Weapon Laws OXZ
Posted: Wed Dec 22, 2021 10:05 pm
by Cholmondely
Redspear wrote: ↑Wed Dec 22, 2021 7:55 pm
Just uploaded v 1.5
No chance to test at present but just a minor change, so fingers crossed I haven't botched the syntax.
Change is significant however and should now only affect items for sale (as was supposed to be the case anyway...)
Should cause fewer oxp conflicts now.
Thanks to Cholmondely for the consistent feedback/encouragement/badgering.
At first shot, works just fine. Will add in my Vimana no-no's and see what happens!
Thank you, Redspear!
Shame about the triplicates....
Re: Weapon Laws OXZ
Posted: Thu Dec 23, 2021 12:35 am
by montana05
Have a look at Military Missile G2, you can use the code from there.
Re: Weapon Laws OXZ
Posted: Thu Dec 23, 2021 12:41 am
by Cholmondely
montana05 wrote: ↑Thu Dec 23, 2021 12:35 am
Have a look at Military Missile G2, you can use the code from there.
Thanks!
Re: Weapon Laws OXZ
Posted: Fri May 27, 2022 12:57 am
by phkb
There is a bug in the DM version of Weapon Laws (version 1.5).
In the "weapon_laws.js" file, the function is defined as
Code: Select all
this.allowAwardEquipment = function(context = purchase)
That is invalid. It should be:
Code: Select all
this.allowAwardEquipment = function (eqKey, ship, context)
Re: Weapon Laws OXZ
Posted: Fri May 27, 2022 3:42 am
by phkb
BTW, while it won't work in v1.90 at the moment due to the need for a code change in v1.91, you can just add this line to the top of the allowAwardEquipment and then you can drop any further need to examine "context" throughout the rest of the routine.
Code: Select all
if (context == "scripted") return true;
If you're running Oolite 1.91, this should make it compatible with Laser Arrangement and LMSS.
Re: Weapon Laws OXZ
Posted: Fri May 27, 2022 2:27 pm
by Redspear
phkb wrote: ↑Fri May 27, 2022 12:57 am
There is a bug in the DM version of Weapon Laws (version 1.5).
Thanks phkb, I'll just have to decalre it in every instance then.
phkb wrote: ↑Fri May 27, 2022 3:42 am
you can just add this line to the top of the allowAwardEquipment and then you can drop any further need to examine "context" throughout the rest of the routine.
Yeah... conflict betwwen making it work with other oxps and making it work with the current stable release.
Maybe when I've had a play with it I'll better understand how it works.
Re: Weapon Laws OXZ
Posted: Wed Nov 23, 2022 9:52 pm
by Redspear
dybal wrote: ↑Wed Dec 16, 2020 12:19 pm
Beware that a ship that has "restricted" weapons installed in any mount will not be restored correctly by Ship Storage Helper (due to
this). That affects the ship's insurance (getting the ship back with all installed equipments - for a fee - after using the escape pod), and Hyperspace Hangar.
Should be fixed.
Cholmondely wrote: ↑Tue Apr 20, 2021 4:43 pm
This OXP also conflicts with Laser Arrangement.
Likewise.
phkb wrote: ↑Fri May 27, 2022 12:57 am
There is a bug in the DM version of Weapon Laws (version 1.5).
In the "weapon_laws.js" file, the function is defined as
Code: Select all
this.allowAwardEquipment = function(context = purchase)
That is invalid. It should be:
Code: Select all
this.allowAwardEquipment = function (eqKey, ship, context)
Fixed.
Thanks to all of the above.
Also fixed an issue with the download manager (hopefully) which was only providing v1.3 (then 2 updates behind - now 3).
- v1.6 is now available which, in addition to the above, makes a few tweaks to weapon availability.
- Easier to find hardened missiles for sale (just one system in galaxy 1 was a bit harsh for an expendable item)
- Slightly less restriction re beam lasers and targeting scanners