"use strict";
this.name = "fuelTweaks_alertFX";
this.author = "Svengali & Thargoid, phkb";
this.copyright = "CC-by";
this.description = "FX script";
this.version = "1.0";

this.effectSpawned = function () {
	var scr = worldScripts.FuelTweaks_StationSetup;
	this.getRid = 0;
	// size and align ve
	this.visualEffect.scale(scr._fxScale);
	var p = player.ship;
    this.visualEffect.position = p.position.add(p.vectorForward.multiply(scr._fxForward)).add(p.vectorUp.multiply(scr._fxUp));
	this.visualEffect.orientation = p.orientation;
	// start the frame callback
	this.ovFCBID = addFrameCallback(this.repos.bind(this));
}

this.effectRemoved = function () {
	removeFrameCallback(this.ovFCBID);
}

this.repos = function (delta) {
	var p = player.ship;
	if (!p.isValid || this.getRid > 6) {
		this.visualEffect.remove();
		return;
	}
	var scr = worldScripts.FuelTweaks_StationSetup;

    this.visualEffect.position = p.position.add(p.vectorForward.multiply(scr._fxForward)).add(p.vectorUp.multiply(scr._fxUp));
    this.visualEffect.orientation = p.orientation;

	this.getRid += delta;
	return;
}
