| Back to Index | Page generated: Nov 24, 2025, 1:21:31 AM |
| from Expansion Manager's OXP list | from Expansion Manifest | |
|---|---|---|
| Description | Laser Cannons are developed from Mining Lasers. Consume more energy and cause extreme heat, but a single shot deliver similar damage than a series of Beam Lasers. Fit into large ships only except Mini Cannons, usually short ranged and must aim carefully. Pilots tend to eject from cannon hits when energy is low. | Laser Cannons are developed from Mining Lasers. Consume more energy and cause extreme heat, but a single shot deliver similar damage than a series of Beam Lasers. Fit into large ships only except Mini Cannons, usually short ranged and must aim carefully. Pilots tend to eject from cannon hits when energy is low. |
| Identifier | oolite.oxp.Norby.LaserCannons | oolite.oxp.Norby.LaserCannons |
| Title | Laser Cannons | Laser Cannons |
| Category | Weapons | Weapons |
| Author | Norby | Norby |
| Version | 1.13.1 | 1.13.1 |
| Tags | ||
| Required Oolite Version | ||
| Maximum Oolite Version | ||
| Required Expansions | ||
| Optional Expansions |
|
|
| Conflict Expansions | ||
| Information URL | http://wiki.alioth.net/index.php/LaserCannons | n/a |
| Download URL | https://wiki.alioth.net/img_auth.php/9/9f/LaserCannons_1.13.1.oxz | n/a |
| License | CC BY-NC-SA 4 | CC BY-NC-SA 4 |
| File Size | n/a | |
| Upload date | 1693392820 |
Also read http://wiki.alioth.net/index.php/Laser%20Cannons
Laser Cannons
Laser Cannons are developed from mining lasers. Consume very much energy and cause extreme heat, but a single shot deliver similar damage than a series of beam lasers.
Pilots tend to eject if facing against a cannon when a single energy bank is left only to prevent a fatal next hit.
Usually short ranged and has low fire rates (0.5 - 3 seconds/shot) so must aim carefully.
Cannons usually fit into ships over 130t only like a Cobra Mark III, except:
* Mini Cannon and Mini Plasma Ray are designed for escorts over 30t,
* Plasma Web and Vulcan Cannon need a Python (>250t),
* Twin Military and Twin Artillery Cannons need an Anaconda (>400t),
* Battle and Plasma Artillery Cannons need a ship over 800t like Carriers, Kirin, Maelstrom or Serpent Class Cruiser,
* Behemoth Cannons need a ship over 8000t like Behemoth or BigShips,
* Base Cannons need a ship over 200000t like Andromeda or Liners.
Always check the distance of your target! Don't waste a shot when over the range of your cannon!
All cannons can break apart asteroids as Mining lasers.
Name Range Dmg/s Dmg/Ht DmgToOv Energy Damage Delay Heat Tech Cost Color
Kruger CRM38 Mining Cannon 5 33 2 700 10 100 3 50 5 500 Light Blue
Ingram 3838C8 Mini Cannon 5 60 3 (S) 960 10 60 1 20 6 1000 Light Red
Hassoni C38 Dual Cannon 5 120 3 780 10 60 0.5 20 7 2000 Light Red
Lance & Ferman Military Cannon 10 100 3 (S) 900 7 75 0.75 25 8 8000 Light Magenta
LF38 Twin Military Cannon 10 200 1.5 (S) 600 14 150 0.75 100 8 10000 White
Ergon A38 Blunderbuss Cannon 5 133 3 1100 5 100 0.75 33 10 12000 Light Green
Volt V38 Vulcan Cannon 15 120 6 (S) 1860 5 60 0.5 10 12 24000 Light Cyan
JK-38 Mini Plasma Ray 2 80 * 4 1240 0 40 0.5 10 12 25000 Orange
ColtMaster CM-38 Plasma Web 1 80 ** 5 1760 -20 80 1 16 12 30000 Light Orange
JK-V38 Plasma Ray 6 80 * 4 (S) 1240 0 40 0.5 10 12 40000 Orange
Kruger Artillery Cannon 20 67 5 (S) 1950 5 50 0.75 10 12 50000 Blue
Kruger Twin Artillery Cannon 20 133 5 (S) 1500 10 100 0.75 20 12 100000 Light Blue
Kruger Battle Artillery Cannon 20 133 5 1600 20 200 1.5 40 12 110000 White
JK Plasma Artillery Cannon 8 80 8 4000 0 40 0.5 5 12 120000 Orange
Ergon Behemoth Cannon 5 200 5 1500 15 300 1.5 60 12 150000 Light Green
ColtMaster Behemoth Plasma Web 4 160 ** 8 2400 -20 80 0.5 10 12 160000 Light Orange
Lance & Ferman Base Cannon 10 300 5 1500 15 300 1 60 12 200000 Light Magenta
Kruger Base Artillery Cannon 20 300 6 1500 15 150 0.5 25 12 220000 Light Blue
* Plasma weapons has some chance to make critical damage which force the pilot to eject.
** Plasma Web has 4 times more chance than Plasma Ray to make critical damage.
(S) Could heat up slower with Separated Lasers OXP. http://wiki.alioth.net/index.php/Separated_Lasers
Originally discussed in the New lasers topic: http://aegidian.org/bb/viewtopic.php?f=4&t=16931&start=15#p238374
There is another comparsion table of New lasers also: http://wiki.alioth.net/index.php/New_lasers
=== Small Cannons ===
Kruger CRM38 Mining Cannon
The cheapest laser cannon ever made. Ideal for mineral extraction with single shots from point-blank range (5km) due to deliver double damage than the common Mining Laser. Too slow to use in combat and not so cooled for this cost.
Ingram 3838C8 Mini Cannon
Short range (5km) laser cannon both for mining and defence. Perform similarly with a Beam Laser but make less heat and can mine asteroids also. Due to the mini size fit into small ships also (escorts over 30t).
Hassoni C38 Dual Cannon
Two Mini Cannons in alternation mode result double firing rate, as fast as a Pulse Laser but hit 4x harder. The range is short (5km), need a lot of energy and the heat is going up fast but perform well in dogfight due to the large damage - can do the double than a Beam Laser in each seconds.
=== Military Cannons ===
Lance & Ferman Military Cannon
You can make your career as a famous bounty hunter with this weapon - one shot clear more than a full energy bank! Provide longer range (10km) and use less energy than a Mini Cannon but heat up faster than the more costly cannons. Can mine asteroids in short time.
LF38 Twin Military Cannon
Strong laser cannon in damage as predictable from two Military Cannons linked to fire together. Aim carefully and run when a white beam incoming. Provide easy mining from large asteroids but the size of the heatsink is reduced in this type so overheats after a few shots. Need at least an Anaconda (>400t mass) to hold it.
Ergon A38 Blunderbuss Cannon
Powerful laser contain quad Mining Cannons for higher fire rate. Short ranged (5km) but as fast and stronger than a Military Cannon, moreover use less energy to get an exceptional combat performance. Better in dogfight than the well known Military Laser.
=== Special Cannons ===
Volt V38 Vulcan Cannon
Fearsome weapon, a longer variant of the Dual Cannon to get high range (15km) and fire rate in cannons, although a shot do much less damage than a Military Cannon. Energy saver and produce one of the best damage/heat in the Ooniverse but the huge cooling system fit into Pythons (>250t) only.
JK-38 Mini Plasma Ray
Hot plasma is able to pierce through the whole hull, sometimes cause critical damages either in life support, ship controls or reactor coolers which forcing the pilot to eject, leaving a good loot or a bomb in the derelict ship. Use next to the target: range is 2km only. Works without energy because recycle plasma smoke from engines but heat up fast. Good in mining also.
ColtMaster CM-38 Plasma Web
Plasma in web form has double charge capacity so damage is doubled but recharge time also and range is halved (1km). Regenerates some energy(!) at each shot, in side mount usable as an emergency energy generator. Well cooled but only a Python can hold it (>250t). Do critical damages much more often than a Plasma Ray, but against you too! Don't be surprised if an orange beam auto-eject you, stay far for sure.
JK-V38 Plasma Ray
A crazy scientist once filled plasma into a Vulcan Cannon and successfully earned 6km range in this way. Cobra Mark III owners aready wanted a single barrel version of Vulcan to fit into his ships and this discovery was a good reason to release a weaker, humanitarian version of Vulcan which fire plasma shots. Cause critical damages as often as a Mini Plasma Ray.
=== Artillery Cannons ===
Kruger Artillery Cannon
As the name predict Kruger company aim the longest range regardless of compromises in heat, energy and cost. The winner of this competition is quad Mining Cannons with much longer barrel in alternating mode to increase fire rate to combat level. Damage is smaller due to must focus in long range. Well cooled, has 20km range and enough fearsome to the target use his Escape Pod when his energy is low.
Kruger Twin Artillery Cannon
Anaconda owners wanted to benefit from the larger capacity of his oversized ships so bought two Artillery Cannons to fire at once - the Twin Artillery Cannon was born. New pilots asks why this weapon is exist at all due to similar lasers are much cheaper: the answer is only cannons are enough fearsome to pilots ejects often.
Kruger Battle Artillery Cannon
Since much larger ships are in production than Anaconda, for example Carriers, Kirin, Maelstrom or Serpent Class Cruiser, some guys in these was enough brave to put more coolers around a Twin Artillery Cannon to 4 barrels be reconfigurable to fire together. Shot down almost anything within seconds, even a Thargoid Warship need four hits only (5 seconds). Fit into ships with at least 800t mass.
JK Plasma Artillery Cannon
Thanks to the long artillery barrels the range of this plasma cannon is extended to 8km. Does not need energy and cause critical damages as often as a Plasma Ray but produce much less heat so can fire continually much longer. Need a ship with at least 800t mass like Carriers, Kirin, Maelstrom or Serpent Class Cruiser.
=== Big Cannons ===
Ergon Behemoth Cannon
The Navy is ordered an improved Blunderbuss with 50% more barrels to get enough firepower to shot down Thargoid Warships with two shots. Need a ship over 8.000t like Behemoth or BigShips. Range is 5km only, but fire two times faster than a Battle Artillery Cannon so much more effective in dogfight.
ColtMaster Behemoth Plasma Web
This cannon load hot plasma in web form into twin artillery barrels to get longer range (4km), lower heat and double fire rate than a Plasma Web, which mean double energy regeneration in each seconds also. The best weapon to kick out pilots from any ships in Escape Pods and also better in caused damage/seconds than any other cannons below behemoths. Need a ship over 8.000t (Behemoth or BigShips).
Lance & Ferman Base Cannon
Need a station-sized ship over 200.000t like Andromeda or Liners, has the same range than Military Cannons (10km) and the more barrel configured to fire faster than Behemoth Cannon which give the highest existing damage/seconds. Combined with a good cooling system and high damage to shot down Thargoid Warships with 3 shots, the result is the most dangerous cannon. Awesome.
Kruger Base Artillery Cannon
Bundled 6 Artillery Cannons together to get the same high range (20km) but much more damage and fire rate. Improved further to require less energy and produce a bit less heat. A Thargoid Warship need 5 hits but definitely the best long range cannon. The cost is the exceptional size which need a ship over 200.000t like Andromeda or Liners.
Instructions:
Do not unzip the .oxz file, just move into the AddOns folder of your Oolite installation.
License:
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License version 4.0.
If you are re-using any piece of this OXP, please let me know by sending an e-mail to norbylite@gmail.com.
Sounds:
The sounds from BGS Soundset by P.A. Groove:
- "cannonlaser.ogg" is renamed a "bgs_PAG_laser.ogg".
- "cannonlaser_esc_hits.ogg" is renamed a "bgs_PAG_laserhits.ogg".
- "cannonlaser_esc_hits_pl.ogg"; is renamed a "bgs_PAG_hit.ogg".
Credits to Pagroove!
Changelog:
2019.04.06. v1.13 Adds sound effect for cannons hits. Draft release (rustem).
2017.10.31. v1.12 Typo fix in the damage of Military Cannon, thanks to Damocles Edge.
2016.03.06. v1.11 Twin Artillery Cannon heat is halved so dmg/heat is increased from 2.5 to 5.
Plasma Ray and Web has much less chance against larger ships to force an eject.
Far Arm Titan got a Kruger Battle Artillery Cannon.
2016.01.25. v1.9 Halved damage, delay, energy and heat of Military and Battle Cannons.
Doubled heat of Twin Artillery, Behemoth and Base Cannons.
Damages of Behemoth and Base Cannons are reduced a bit.
Many BigShips are equipped with laser cannons (22 ship types).
Plasma weapons report when you placed an almost critical hit.
Plasma Vulcan Cannon renamed to Plasma Ray.
Support made for Separated Lasers OXP.
2015.07.03. v1.8 Militay Cannons do 25% less damage and has lower techlevel.
Mini Plasma Cannon renamed to Mini Plasma Ray.
Mini Cannon and Mini Plasma Ray need a ship over 30t.
NPC Mambas and Morays with Mini Cannons added, Geckos removed.
2015.06.27. v1.7 Behemoth cannons for ships over 8000t like Behemoth or BigShips.
Base cannons for ships over 200000t like Andromeda or Liners.
Plasma Artillery Cannon added for ships over 800t like Carriers.
Battle Artillery Cannon heat increased, cost reduced.
Plasma weapons are improved: more damage, less energy and heat.
Plasma Ray is renamed to Mini Plasma Cannon and fit into escort ships.
Ranges of Plasma Cannons are improved, Plasma Web is halved.
Dual Cannon color matched to Mini Cannon (light red).
2015.06.24. v1.6 Plasma Vulcan, Artillery Cannons and Battle Cannon added.
Plasma Web is cheaper, fit into a Python and more likely force to eject.
Adjusted the heat of Plasma Ray and Twin Military Cannon.
2015.06.22. v1.5 Plasma Ray and Plasma Web added.
Enemy ejects when a cannon decrease his energy into the last bank.
NPCs with cannons added.
2015.06.20. v1.4 Mini Cannon fit into small ships.
Lower prices for Twin Military Cannon and Blunderbuss.
Max. required techlevel is 12, now Zaonce introduce the full list.
2015.06.18. v1.3 Mining cannon toned down, Blunderbuss toned up.
2015.06.18. v1.2 Refined stats for better fire rates but smaller damages.
Name and description changes to follow data changes.
2015.06.17. v1.1 Blunderbuss and Vulcan added.
Reduced energy usage of Military Cannons to normal level.
2015.06.15. v1.0 First release.
| Name | Visible | Cost [deci-credits] | Tech-Level |
|---|---|---|---|
| Kruger CRM38 Mining Cannon | yes | 5000 | 5+ |
| JK-V38 Plasma Ray | yes | 400000 | 12+ |
| Kruger Artillery Cannon | yes | 500000 | 12+ |
| Kruger Twin Artillery Cannon | yes | 1000000 | 12+ |
| Kruger Battle Artillery Cannon | yes | 1100000 | 12+ |
| JK Plasma Artillery Cannon | yes | 1200000 | 12+ |
| Ergon Behemoth Cannon | yes | 1500000 | 12+ |
| ColtMaster Behemoth Plasma Web | yes | 1600000 | 12+ |
| Lance & Ferman Base Cannon | yes | 2000000 | 12+ |
| Kruger Base Artillery Cannon | yes | 2200000 | 12+ |
| Ingram 3838C8 Mini Cannon | yes | 10000 | 6+ |
| Hassoni C38 Dual Cannon | yes | 20000 | 7+ |
| Lance & Ferman Military Cannon | yes | 80000 | 8+ |
| LF38 Twin Military Cannon | yes | 100000 | 8+ |
| Ergon A38 Blunderbuss Cannon | yes | 120000 | 10+ |
| Volt V38 Vulcan Cannon | yes | 240000 | 12+ |
| JK-38 Mini Plasma Ray | yes | 250000 | 12+ |
| ColtMaster CM-38 Plasma Web | yes | 300000 | 12+ |
| Path | |
|---|---|
| Scripts/lasercannons-conditions.js | "use strict";
this.name = "lasercannons-conditions";
this.author = "Norby";
this.copyright = "2013 Norbert Nagy";
this.licence = "CC BY-NC-SA 4.0";
this.description = "This equipment is usable only for ships over 130t like the Cobra Mark III.";
this.allowAwardEquipment = function(equipment, ship, context)
{
// 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;
}
// player.consoleMessage( eqKey+" "+ship+" "+context );//debug
//Base weapons need an Andromeda or Liners
if( ship.mass < 200000000 &&
( equipment == "EQ_WEAPON_CANNON_17"
|| equipment == "EQ_WEAPON_CANNON_18" ) ) return false;
//Behemoth weapons need a Behemoth or a ship from BigShips
if( ship.mass < 8000000 &&
( equipment == "EQ_WEAPON_CANNON_15"
|| equipment == "EQ_WEAPON_CANNON_16" ) ) return false;
//Battle Cannon and Plasma Artillery need a Carrier or similar huge ship
if( ship.mass < 800000 &&
( equipment == "EQ_WEAPON_CANNON_13"
|| equipment == "EQ_WEAPON_CANNON_14" ) ) return false;
//Twin Military Cannon and Twin Artillery need an Anaconda
if( ship.mass < 400000 &&
( equipment == "EQ_WEAPON_CANNON_5"
|| equipment == "EQ_WEAPON_CANNON_12" ) ) return false;
//Vulcan Cannon and Plasma Web need as large ship as a Python
if( ship.mass < 250000 &&
( equipment == "EQ_WEAPON_CANNON_7"
|| equipment == "EQ_WEAPON_CANNON_9" ) ) return false;
//Mini Cannon and Mini Plasma Ray fit into escort ships from 30t
if( ship.mass > 30000 &&
( equipment == "EQ_WEAPON_CANNON_2"
|| equipment == "EQ_WEAPON_CANNON_8" ) ) return true;
//Other cannons for large ships only like Cobra Mark III
if( ship.mass < 130000 ) return false;
return true;
}
|
| Scripts/lasercannons.js | "use strict";
this.name = "lasercannons";
this.author = "Norby";
this.copyright = "2015 Norby";
this.description= "Combat-capable Mining lasers";
this.licence = "CC BY-NC-SA 4.0";
// adds soundsource by rustem
//customizable properties
this.$CannonHitVolume = 0.3; //loudness of cannon hit sounds, adjust between 0 and 1
this.$PlasmaHitVolume = 0.6; //loudness of plasma hit sounds, adjust between 0 and 1
//worldscript events
this.startUp = function() {
this.$Towbar = worldScripts.lasercannons;
// initialize sound effects : hits on the player and critical hits has more volume
this.$Sound = new SoundSource; //soundsource of unsuccessfully cannon hit on the player
this.$Sound.sound = "cannonlaser_1.ogg";
this.$Sound0 = new SoundSource; //soundsource of shield cannon hit on the player
this.$Sound0.sound = "cannonlaser_1.ogg";
this.$Sound1 = new SoundSource; //soundsource of partial and far cannon hit on the player
this.$Sound1.sound = "cannonlaser_1.ogg";
this.$Sound2 = new SoundSource; //soundsource of cannon hit on player's target
this.$Sound2.sound = "cannonlaser_2.ogg";
//this.$Sound3 = new SoundSource; //additional soundsource of critical cannon hit on the player
//this.$Sound3.sound = "cannonlaser_esc_hits.ogg";
this.$Sound4 = new SoundSource; //additional soundsource of critical cannon hit on player's target
this.$Sound4.sound = "cannonlaser_1.ogg";
//this.$Sound5 = new SoundSource; //additional soundsource of cannon hit on the player, auto eject (not used, for testing)
//this.$Sound5.sound = "cannonlaser_esc_hits_pl.ogg";
this.$plasmaSound = new SoundSource; //soundsource of unsuccessfully plasma hit on the player
this.$plasmaSound.sound = "cannonlaser_plasma.ogg";
this.$plasmaSound0 = new SoundSource; //soundsource of shield plasma hit on the player
this.$plasmaSound0.sound = "cannonlaser_plasma.ogg";
this.$plasmaSound1 = new SoundSource; //soundsource of partial and far plasma hit on the player
this.$plasmaSound1.sound = "cannonlaser_plasma.ogg";
this.$plasmaSound2 = new SoundSource; //soundsource of plasma hit on player's target
this.$plasmaSound2.sound = "cannonlaser_plasma.ogg";
this.$plasmaSound4 = new SoundSource; //additional soundsource of critical plasma hit on player's target
this.$plasmaSound4.sound = "cannonlaser_esc_hits.ogg";
if( !worldScripts["BGS"] & !worldScripts["BGS-M"] ) {
this.$CannonHitVolume *= 0.6;
this.$PlasmaHitVolume *= 0.6;
}
this.$Sound.loop = false;
this.$Sound.repeatCount = 1;
this.$Sound.volume = 0.5 * this.$CannonHitVolume;
this.$Sound0.loop = false;
this.$Sound0.repeatCount = 1;
this.$Sound0.volume = 0.6 * this.$CannonHitVolume;
this.$Sound1.loop = false;
this.$Sound1.repeatCount = 1;
this.$Sound1.volume = 0.7 * this.$CannonHitVolume;
this.$Sound2.loop = false;
this.$Sound2.repeatCount = 1;
this.$Sound2.volume = 0.5 * this.$CannonHitVolume;
this.$Sound4.loop = false;
this.$Sound4.repeatCount = 1;
this.$Sound4.volume = 0.9 * this.$CannonHitVolume;
//this.$Sound3.loop = false;
//this.$Sound3.repeatCount = 1;
//this.$Sound3.volume = 0.7 * this.$CannonHitVolume;
//this.$Sound5.loop = false;
//this.$Sound5.repeatCount = 1;
//this.$Sound5.volume = 0.7 * this.$CannonHitVolume;
this.$plasmaSound.loop = false;
this.$plasmaSound.repeatCount = 1;
this.$plasmaSound.volume = 0.5 * this.$PlasmaHitVolume;
this.$plasmaSound0.loop = false;
this.$plasmaSound0.repeatCount = 1;
this.$plasmaSound0.volume = 0.6 * this.$PlasmaHitVolume;
this.$plasmaSound1.loop = false;
this.$plasmaSound1.repeatCount = 1;
this.$plasmaSound1.volume = 0.7 * this.$PlasmaHitVolume;
this.$plasmaSound2.loop = false;
this.$plasmaSound2.repeatCount = 1;
this.$plasmaSound2.volume = 0.5 * this.$PlasmaHitVolume;
this.$plasmaSound4.loop = false;
this.$plasmaSound4.repeatCount = 1;
this.$plasmaSound4.volume = 0.9 * this.$PlasmaHitVolume;
}
this.shipAttackedOther = function(other) { //player hits other
if( !other || !other.isValid || other.isPlayer || !player.ship || !player.ship.isValid )
return; //exit if the target is died or player (for sure)
var c = player.ship.currentWeapon, cw = "";
if( c ) cw = c.equipmentKey;
var cwt = this.$getCannonType( c ); //_isCannonOrPlasma
if( cwt > 1 && !other.isDerelict && !other.isThargoid ) { //cannon or plasma hit
if( cwt === 2 ) {
this.$plasmaSound2.play()
} else this.$Sound2.play();
//the next cannon hit can destroy the target
var rnd = Math.random();
//eject when less than 64 energy left and hit by any cannon
if( other.energy < 64 && other.energy > 0 ||
( ( cw.indexOf("EQ_WEAPON_CANNON_8") > -1
|| cw.indexOf("EQ_WEAPON_CANNON_10") > -1
|| cw.indexOf("EQ_WEAPON_CANNON_14") > -1 )
//Mini Plasma Ray, Plasma Ray and Plasma Artillery critical hit <5% chance
&& ( other.energy < 40 || rnd < 0.05 * 30/other.collisionRadius ) ) ||
//eject when less than 80 energy left and hit by Plasma Web
( ( cw.indexOf("EQ_WEAPON_CANNON_9") > -1 || cw.indexOf("EQ_WEAPON_CANNON_16") > -1 )
//Plasma Web and Behemoth Plasma Web critical hit <20% chance
&& ( other.energy < 80 || rnd < 0.2 * 30/other.collisionRadius ) ) ) {
if( rnd < 0.5 ) other.awardEquipment("EQ_ESCAPE_POD"); //more Pod in Plasma era
//this.$Sound4.play();
if( cwt === 2 ) {
this.$plasmaSound4.play() //plasma
} else this.$Sound4.play(); //or cannon hit
other.fireMissile();//last resort
if( other.equipmentStatus("EQ_ESCAPE_POD") === "EQUIPMENT_OK"
&& other.abandonShip()) {//eject only if has Escape Pod
if( worldScripts["detectors"] ) {
var dn = other.script.$Detectors_Origname;//short name with version
} else {
var dn = other.displayName;
other.displayName = "Derelict " + other.displayName;
}
player.consoleMessage(dn+" ejected!");
if( other.script && !other.script.$AlreadyScored ) {
other.script.$AlreadyScored = true;
player.score++;
}
} else if( other.energy > 1 ) other.energy = 1; //critical hit without escape pod
} else if( rnd < 0.2 && ( cwt === 2 ) ) {
this.$plasmaSound2.play();
player.consoleMessage("Almost critical hit on "+other.name, 4.5);
}
}
if( other.isDerelict && !other.isThargoid ) {
if( cwt === 2 ) {
this.$plasmaSound0.play()
} else if( cwt === 3 ) this.$Sound0.play(); //also may be sniper gun hit
player.consoleMessage("Derelict!", 10); //warn to stop fire if want to salvage it
if( player.ship.equipmentStatus("EQ_LASERREDUCTOR") == "EQUIPMENT_OK"
&& cw.indexOf("EQ_WEAPON_CANNON_") > -1
&& other.energy < 200 && other.energy < other.maxEnergy
&& ( !this.$Towbar || ( this.$Towbar.$TowbarLaserReductorOn && other.script
&& other.script.$TowbarDerelictAttack <= this.$Towbar.$TowbarMaxReduct ) ) ) {
other.energy = Math.min(other.maxEnergy, 200); //reduce cannon power
}
}
this.$Bounty( other );
}
this.shipTakingDamage = function(amount, whom, type) {
// log(this.name, amount+" : "+whom+" - "+type); //debug //log(this.name, amount+" : "+whom.scanClass+" - "+whom.owner);
if( !whom || !whom.isValid || whom.isPlayer || !player.ship || !player.ship.isValid
|| whom.isMissile || whom.isDerelict ) return; //exit if the target is died or missile, player (for sure)
var c = whom.currentWeapon, cw = "";
if( c ) cw = c.equipmentKey;
var cwt = this.$getCannonType( c ); //_isCannonOrPlasma
if( cwt && type == "energy damage" ) { //sniper, plasma or cannon hit
log(this.name, amount+" : "+whom+" - "+type+" by "+cw); //debug
if( amount == 0 ) {
//this.$Sound0.play();
if( cwt === 2 ) {
this.$plasmaSound0.play()
} else if( cwt === 3 ) this.$Sound0.play();
return //exit if shield hit only
}
} else return; //exit if is other hit or scrape damage
log(this.name, amount+" : "+whom+" - "+type+" by "+cw); //debug
//this.$Sound1.play(); //cannon or plasma hit
if( cwt === 2 ) {
this.$plasmaSound1.play()
} else if( cwt === 3 ) this.$Sound1.play();
if( ( cw.indexOf("EQ_WEAPON_CANNON_8") > -1 || cw.indexOf("EQ_WEAPON_CANNON_10") > -1
|| cw.indexOf("EQ_WEAPON_CANNON_14") > -1 )
//Mini Plasma Ray, Plasma Ray and Plasma Artillery critical hit <5% chance
&& ( player.ship.energy < 40 || Math.random() < 0.05 * 30/player.ship.collisionRadius )
|| ( cw.indexOf("EQ_WEAPON_CANNON_9") > -1 || cw.indexOf("EQ_WEAPON_CANNON_16") > -1 )
//Plasma Web and Behemoth Plasma Web critical hit <20% chance
&& ( player.ship.energy < 80 || Math.random() < 0.2 * 30/player.ship.collisionRadius ) ) {
if( player.ship.equipmentStatus("EQ_ESCAPE_POD") === "EQUIPMENT_OK"
&& player.ship.abandonShip()) {//eject only if has Escape Pod
//this.$Sound5.play();
player.consoleMessage("Critical plasma hit on your ship, auto eject!", 10);
} else {
//this.$Sound3.play();
player.consoleMessage("Critical plasma hit on your ship!", 10);
if( player.ship.energy > 1 ) player.ship.energy = 1; //critical hit without escape pod
}
} else if( cwt === 2 ) {
this.$plasmaSound1.play();
player.consoleMessage("Plasma hit on your ship, go away to avoid a critical hit!", 10);
} else if( cwt && player.ship.energy < 64 ) {
//this.$Sound3.play();
if( player.ship.equipmentStatus("EQ_ESCAPE_POD") === "EQUIPMENT_OK"
&& player.ship.abandonShip()) {//eject only if has Escape Pod
//this.$Sound5.play();
player.consoleMessage("Cannon hit on your ship and energy is low, auto eject!", 10);
} else player.consoleMessage("Cannon hit on your ship and energy is low!", 10);
}
}
this.shipBeingAttackedUnsuccessfully = function(whom) {
var p = player.ship;
if( !whom || !whom.isValid || !p || !p.isValid )
return; //exit if the target is died (for sure)
// log(this.name, whom); //debug
var c = whom.currentWeapon, cw = "";
if( c ) cw = c.equipmentKey;
var cwt = this.$getCannonType( c ); //_isCannonOrPlasma
if( cwt > 1 ) { //cannon or plasma hit
if( cwt === 2 ) {
this.$plasmaSound.play()
} else this.$Sound.play() //notify the player about the hit on his ship
}
}
//lasercannons functions
this.$Bounty = function( ship ) {
if( ship.isDerelict && ship.bounty > 0 ) {
player.credits += ship.bounty;
player.consoleMessage("Bounty: "+formatCredits(ship.bounty, true, true));
player.consoleMessage("Total: "+formatCredits(player.credits, true, true));
if( ship.script ) ship.script.$TowbarBounty = ship.bounty;//save to Towbar award illegal cargo
ship.bounty = 0;
if( !this.$Towbar && Math.random() < 0.2 )
ship.explode(); //imitate a bomb added in Towbar
}
}
this.$getCannonType = function( weapon ) { //is cannon or plasma or sniper gun and sapper
var eq;
if( weapon && weapon.equipmentKey ) eq = weapon.equipmentKey;
else eq = weapon; //the key is directly in the parameter
if( !eq || !eq.length ) return false;
if( eq.indexOf("EQ_WEAPON_CANNON_") > -1 ) {
if( eq.indexOf("_SNIPER_GUN") > -1 || eq.indexOf("_SAPPER") > -1 ) { //Sniper Gun, Sapper, Heavy Sniper Gun and Heavy Sapper
return 1
} else if( eq.indexOf("EQ_WEAPON_CANNON_8") > -1 || eq.indexOf("EQ_WEAPON_CANNON_10") > -1 || eq.indexOf("EQ_WEAPON_CANNON_14") > -1
//Mini Plasma Ray, Plasma Ray and Plasma Artillery
|| eq.indexOf("EQ_WEAPON_CANNON_9") > -1 || eq.indexOf("EQ_WEAPON_CANNON_16") > -1 ) {
//Plasma Web
return 2
} else return 3 //any cannons
}
return false;
}
/*/ not works : a change of laser sound based on the 'customsounds.plist'
this.$currentWeapon = 0;
// initialize sound effects : adds to this.startUp
this.$direct_hit_sound = new SoundSource();
this.$direct_hit_sound.loop = false;
this.$direct_hit_sound.sound = "[player-direct-hit]";
this.$laser_miss_sound = new SoundSource();
this.$laser_miss_sound.loop = false;
this.$laser_miss_sound.sound = "[player-laser-miss]";
this.viewDirectionChanged = function(viewString) {
var p = player.ship;
var c = p.currentWeapon, cw = "";
var w = worldScripts.lasercannons;
if( c ) cw = c.equipmentKey;
if( cw.indexOf("EQ_WEAPON_CANNON_") > -1 ) { //any cannon
//"[player-direct-hit]" = w.$Sound1;
//"[player-laser-miss]" = w.$Sound0;
if( w.$currentWeapon !== 2 ) player.consoleMessage("Laser cannon", 5);
w.$currentWeapon = 2;
} else if( cw.indexOf("EQ_WEAPON_NONE") > -1 ){ //none laser
if( w.$currentWeapon ) player.consoleMessage("No laser", 5);
w.$currentWeapon = 0;
} else { //usual laser
// basic laser sound
//"[player-direct-hit]" = w.$direct_hit_sound;
//"[player-laser-miss]" = w.$laser_miss_sound;
if( w.$currentWeapon !== 1 ) player.consoleMessage("Usual laser", 5);
w.$currentWeapon = 1;
}
}
//*/ |