Back to Index Page generated: Nov 12, 2024, 11:02:04 PM

Expansion Laserific Crosshairs

Content

Warnings

  1. http://wiki.alioth.net/index.php/Laserific%20Crosshairs -> 404 Not Found

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Adds a circular dial showing the laser heat level around the central cross-hairs. Compatible with most HUDs. Adds a circular dial showing the laser heat level around the central cross-hairs. Compatible with most HUDs.
Identifier oolite.oxp.Wildeblood.LaserificCrosshairs oolite.oxp.Wildeblood.LaserificCrosshairs
Title Laserific Crosshairs Laserific Crosshairs
Category HUDs HUDs
Author Wildeblood Wildeblood
Version 1.3 1.3
Tags crosshairs crosshairs
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://aegidian.org/bb/viewtopic.php?f=4&t=14368 n/a
Download URL https://wiki.alioth.net/img_auth.php/5/56/LaserificCrosshairs1.3.oxz LaserificCrosshairs.oxz
License See within. See within.
File Size n/a
Upload date 1610873301

Documentation

Laserific Crosshairs READ ME.txt

---------------------------------
Laserific Crosshairs OXP ver. 1.3
---------------------------------
  Date: October 6th, 2014
Author: Wildeblood


---------------------
Installation and use:
---------------------

Adds a circular dial showing the laser heat level around the central cross-hairs. Compatible with most HUDs.


-----------
Known bugs:
-----------

In _hideDisplay function:
     // FixMe: player.ship.crosshairs = null causes a HUD reset;
     // similar fix to that used in Auto Crosshairs required.


-----------
Change Log:
-----------

1.3 (October 6th, 2014) Revised all crosshair files again, made script compatible with Auto Crosshairs OXP.

1.2 (October 4th, 2014) Revised all crosshair files: now have pulse laser crosshair as well as animation.

1.1.2 (October 4th, 2014) Load all crosshair files at start-up, to avoid stuttering on first display.

1.1.1 (October 4th, 2014) Fixed bug: crosshairs not being reset when frame callback ended by shipWillEnrterWitchspace etc.

1.1 (October 4th, 2014) Improved 16-step dial animation.

1.0 (October 3rd, 2014) First published.

Equipment

This expansion declares no equipment. This may be related to warnings.

Ships

This expansion declares no ships. This may be related to warnings.

Models

This expansion declares no models. This may be related to warnings.

Scripts

Path
Scripts/laserific_crosshairs.js
"use strict";

this.name    = "Laserific Crosshairs"; // "Wildeblood", 2014.
this.version = "1.3";

this.$maxSteps   = 16;
this.$cutOffHeat = 0.85;

/* ====================================================================================
			AVOID STUTTERING THE FIRST TIME THE ANIMATION RUNS?
======================================================================================= */

    this.$autoCrosshairs = {
        default: {
            off: "wildeblood_combat_crosshairs_0.plist",
            on: "wildeblood_combat_crosshairs_on.plist"
        }
    }

    this.startUp = function () {
        "use strict";
        for (var i = 0; i <= this.$maxSteps; i++) {
            player.ship.crosshairs = "wildeblood_combat_crosshairs_" + i + ".plist";
        }
        player.ship.crosshairs = null;
        if (worldScripts["Auto Crosshairs"]) {
            this._showDisplay = this._showDisplay_v2;
        }
        delete this._showDisplay_v2;
    }

/* ====================================================================================
			STARTING & STOPPING FRAME CALLBACK

	FCB starts when player.alertCondition becomes 3 or a target is acquired.
	FCB ends when !player.ship.target && player.ship.laserHeatLevel === 0 && player.alertCondition < 3
	Display is shown while player.ship.target or player.ship.laserHeatLevel > 0 or player.alertHostiles

======================================================================================= */

    this.alertConditionChanged = function (newState, oldState) {
        "use strict";
        if (newState ==3 && !this.$runningFCB) {
            this.$runningFCB = addFrameCallback(this._monitorLaser.bind(this));
        }
    }

    this.shipTargetAcquired = function (target) {
        "use strict";
        if (!this.$runningFCB) {
            this.$runningFCB = addFrameCallback(this._monitorLaser.bind(this));
        }
    }

    this.shipWillDockWithStation = this.shipWillEnterWitchspace = this.shipDied = function () {
        "use strict";
        this._endFCB();
    }

    this._endFCB = function () {
        "use strict";
        if (this.$runningFCB) {
            removeFrameCallback(this.$runningFCB);
            delete this.$runningFCB;
            this._hideDisplay();
        }
    }

    this._monitorLaser = function (delta) {
        "use strict";
        if (player.alertHostiles ||
            player.ship.target ||
            player.ship.laserHeatLevel) {
            this._showDisplay();
        } else if (player.alertCondition < 3) {
            this._endFCB();
        } else {
            this._hideDisplay();
        }
    }

    this._showDisplay = function () {
        "use strict";
        var level = (player.ship.laserHeatLevel / this.$cutOffHeat * this.$maxSteps);
        var step = level.toFixed();
        if (step != this.$lastStep) {
            if (step > this.$maxSteps) {
                step = this.$maxSteps; // Thank you, javascript automatic variable typing.
            }
            player.ship.crosshairs = "wildeblood_combat_crosshairs_" + step + ".plist";
            this.$lastStep = step;
        }
    }

    this._showDisplay_v2 = function () {
        "use strict";
        var level = (player.ship.laserHeatLevel / this.$cutOffHeat * this.$maxSteps);
        var step = level.toFixed();
        if (step != this.$lastStep) {
            if (step > this.$maxSteps) {
                step = this.$maxSteps;
            }
            player.ship.crosshairs = "wildeblood_combat_crosshairs_" + step + ".plist";
            worldScripts["Auto Crosshairs"].$offTargetCrosshairs = "wildeblood_combat_crosshairs_" + step + ".plist";
            this.$lastStep = step;
        }
    }

    this._hideDisplay = function () {
        "use strict";
     // FixMe: player.ship.crosshairs = null causes a HUD reset;
     // similar fix to that used in Auto Crosshairs OXP required.
        if (this.$lastStep != "-1") {
            player.ship.crosshairs = null; // "crosshairs.plist";
            this.$lastStep = "-1";
        }
    }

/* ====================================================================================
			COPYRIGHT NOTICE

	(C) 2013,2014 Wildeblood. All rights reserved. 
	Free to use, but DO NOT PROMULGATE MODIFIED VERSIONS.

This was created by some fellow with the user name "Wildeblood" on the Oolite forums, 
he'll tell you his real name if you bother to ask.
To use means to play with, modify or re-use in whole or in part, and to distribute freely.
To use DOES NOT imply to use for commercial gain, which would be a breach of copyright.
To promulgate means to make official announcements.
======================================================================================= */