Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion Missile Booster

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Give higher initial speed to missiles as a fix of launching problems in some ships like Python. Give higher initial speed to missiles as a fix of launching problems in some ships like Python.
Identifier oolite.oxp.Norby.missile_booster oolite.oxp.Norby.missile_booster
Title Missile Booster Missile Booster
Category Mechanics Mechanics
Author Norby Norby
Version 1.1 1.1
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Missile_Booster n/a
Download URL https://wiki.alioth.net/img_auth.php/2/26/Missile_Booster_1.1.oxz n/a
License CC BY-NC-SA 4 CC BY-NC-SA 4
File Size n/a
Upload date 1610873254

Documentation

Also read http://wiki.alioth.net/index.php/Missile%20Booster

Equipment

This expansion declares no equipment.

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Scripts/missile_booster.js
"use strict";
this.name	= "missile_booster";
this.author	= "Norby";
this.copyright	= "2015 Norby";
this.description= "Give higher initial speed to missiles as a fix of launching problems in some ships like Python.";
this.licence	= "CC BY-NC-SA 4.0";

this.shipSpawned = function(ship) {
    if( ship && ship.isMissile && ship.owner && ship.owner.isValid && ship.script ) {
//      ship.velocity = ship.owner.heading.multiply(5*ship.thrust).add(ship.owner.velocity); - old code

//remove thrust to avoid break at start before the engine ignites
	ship.script.$missile_booster_thrust = ship.thrust;
	ship.thrust = 0;
//restore thrust after 1s
	eval("ship.script.$missile_booster = function() { \
			this.ship.thrust = this.$missile_booster_thrust; \
			if( this.$missile_booster_timer ) { \
				this.$missile_booster_timer.stop(); \
				delete this.$missile_booster_timer; \
			} \
		}");
	ship.script.$missile_booster_timer = new Timer(ship.script, ship.script.$missile_booster, 1, 0);
    }
}