|
from Expansion Manager's OXP list |
from Expansion Manifest |
Description |
This OXP contains four modules, altering game mechanics: Collapsible Shields and Fuel Consumption, Gravity Well, Solar Wind Scoop, Warp Drive. |
This OXP contains four modules, altering game mechanics: Collapsible Shields and Fuel Consumption, Gravity Well, Solar Wind Scoop, Warp Drive. |
Identifier |
oolite.oxp.stranger.HardWay |
oolite.oxp.stranger.HardWay |
Title |
Hard Way |
Hard Way |
Category |
Mechanics |
Mechanics |
Author |
stranger |
stranger |
Version |
2.8.0 |
2.8.0 |
Tags |
fuel, shields, mass-lock, ship |
fuel, shields, mass-lock, ship |
Required Oolite Version |
|
|
Maximum Oolite Version |
|
|
Required Expansions |
oolite.oxp.stranger.SunGear:4.4
|
oolite.oxp.stranger.SunGear:4.4
|
Optional Expansions |
|
|
Conflict Expansions |
oolite.oxp.Norby.TorusToSun:0
oolite.oxp.Frame.FuelCollector:0
|
oolite.oxp.Norby.TorusToSun:
oolite.oxp.Frame.FuelCollector:
|
Information URL |
http://aegidian.org/bb/viewtopic.php?f=4&t=20047 |
n/a |
Download URL |
https://wiki.alioth.net/img_auth.php/d/d9/HardWay.oxz |
n/a |
License |
CC-BY-NC-SA 3.0 |
CC-BY-NC-SA 3.0 |
File Size |
n/a |
Upload date |
1610873481 |
Documentation
Also read http://wiki.alioth.net/index.php/Hard%20Way
ReadMe & License.txt
Hard Way OXP by Stranger
This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license.
You are free to use and distribute this OXP on non-commercial basis.
Rebundling of this OXP within another distribution is permitted as long as it is unchanged.
Any mods/derivatives of this OXP must be distributed under another names.
The license information (either as this file or merged into a larger one) must be included in the OXP.
--------------------------------------------------------------
This OXP contains four modules. altering game mechanics:
� Collapsible Shields and Fuel Consumption
� Gravity Well
� Solar Wind Scoop
� Warp Drive
Collapsible Shields and Fuel Consumption
Forward/Aft shield level decreases to 1/4 of nominal level (red/yellow border level) in Torus drive mode and flight become a bit risky: recuperation of shields after mass locking takes a time (approx. 45 s for Cobra Mk III without extra energy unit). It is a good idea now to wait for complete shield recharging before attacking enemy ships! And it is a good idea now for green Jameson to use Torus drive carefully. So skill of visual observing of any potentially dangerous targets beyond scanner range will be extremely helpful.
Rate of energy recharging on Torus mode is limited to minimal rate 1 unit per second.
In vanilla Elite/Oolite you have unlimited source of power for ship systems. You spend fuel only for hyperjumps or for witchfuel injector. You have completely functional ship even if fuel tank is empty. You may fight, you may continue patrol space without time limit.
In this OXP fuel is consumed in cruise mode by core energy unit to provide power for ship systems.
If you�ll burn up all fuel (typically during combat), core energy unit will shut down and ship will switch to auxiliary energy unit. Shields will be disabled and energy bank will set to minimal power consumption. Main engine will shut down also and you�ll have only auxiliary engine, restricting your max speed to 0.5 of normal max speed. You�ll have chance to reach safe station, but your chances to win combat in such condition will be virtually nil.
Rate on fuel consumption depends on ship state:
� In economy cruise mode (speed below red zone) fuel consumption rate is 0.1 LY per 6 min
� In fast cruise mode (speed in red zone - approx. 80�100%) fuel consumption rate increased to 0.1 LY per 3 min.
� The additional fuel is needed to maintain function of gravity field compensator in mass lock state (total fuel consumption increased to 0.1 LY per 3 min in economy cruise mode and 0.1 LY per 2 min in fast cruise mode).
� Flight on Torus drive also requires extra fuel (total fuel consumption 0.1 LY/min).
� Additional fuel consumption is needed to charge energy stack (energy regeneration after enemy hit or collision, firing ECM and ore processing).
� An attempt to use Torus drive after burning up all fuel leads to dramatic loss of energy and� Uh-oh! Press Space, commander!
� You have limited time to reach station on auxiliary unit. Press Space, commander, after auxiliary unit depletion! Or pull hard Eject lever (I mean hit twice E key of course!) before auxiliary unit shutdown and continue journey on board of escape capsule, if you have this device.
I think fuel consumption rate is reasonably game-balanced: in Green state you have 7 hours patrol time in system with full fuel tank and 3 extra hours patrol time with one extra fuel tank. Route from entry witchpoint to main station without Torus drive typically takes approx. 30�45 min - 0.5�0.75 LY of fuel in Green state or 1.0...1.5 LY being mass-locked by system traffic in Yellow state. Not unacceptable big value (you need extra fuel tank to reach safely station after jump on 6.8 LY distance, of course!).
Gravity Well
Gravity Well module changes game mechanics by simulating gravity field distortion in proximity of celestial bodies. Attempt to hyperjump below safe altitude can cause fuel leakage, cargo/equipment damage and/or misjump. Probability of malfunction increased as function of diving onto gravity well (less altitude � more chance of misjump).
Upper boundary of gravity well influence (gravity well horizon) in case of planet is equal to mass-lock radius (H = R). In case of moon gravity well horizon is H = R too, but due to hardcoded minimal mass-lock radius for moons 25600 m gravity well horizon will be inside mass-lock radius.
For safe departure from main station climb above station and activate hyperjump. For safe departure from planet port climb to leave planet mass-lock zone.
To provide more visual cue altimeter dial is hiding above gravity well of nearest celestial body. It helps to discern mass-locking caused by planet from mass-locks caused by ships/stations. You have no any useful info watching completely filled altitude dial, right?
Watch carefully for altimeter dial before hyperjump countdown activation. Safe active hyperjump is possible only if altimeter dial is empty.
In case of hyperjump countdown activation below safe altitude abort countdown by repeated pressing of j key, climb to safe altitude and repeat activation of hyperjump.
You can safely follow another ship's wormhole in green altimeter zone (AI often jumps below mass-lock horizon), but the general rule is to avoid hyperjump below safe limit. Actually there is some margin of error below gravity well horizon for safe hyperjump � but not too wide.
Custom altimeter data source is added: altitude is calculated as ratio to planet/moon radius instead default fixed 40,000 m scale (4000 km in planet scale). See more details on custom altimeter mode below.
Additional digital altimeter provides altitude data in range from 2500 to 500 km in planet scale. It intended to provide safe planet landing and works only during descent to minimize interference with other messages.
Solar Wind Scoop
This option allows to compensate fuel consumption by collection solar wind in proximity of sun (minimal solar wind flux to start collect fuel is 0.1 LY/min). Sometimes solar wind flux exceeds this minimal value even en-route from entry witchpoint to station - but as a rule you need journey to sun to fill the tanks. Solar wind collection is fully automatic process, you need only Fuel Collector installed. If solar wind collection is started you�ll see animated icon of fuel scoop indicator on HUD and hear noise.
To give info for solar wind flux lock Advanced Space Compass ono sun and switch MFD onto Sun Info page.
Pay attention - solar wind collection is possible only during cruise mode and Green condition, not in Torus drive mode nor in WFI (afterburner) mode! Solar wind readings on MFD will be zero if you are NOT in Green condition.
Warp Drive
Well, this module was initially written as standalone OXP, but it is best suited for additional changes of ship dynamic properties.
The main function of this module is high velocity engine mode for exploration of vast new solar systems, available since Oolite 1.82.
If player's ship is beyond range 25 radii from sol and 25 radii from nearest planet and fly on Torus drive, ship speed multiplied up by warp factor as function of distance to sun, expressed in sun radii.
It takes only several minutes now to reach any object in solar system using warp drive in clear space (actually you�ll have occasionally mass-locks if you have OXPs like Deep Space Pirates or Deep Space Dredgers).
Warp mode activated automatically in Green state and aborted if any entity detected in proximity of ship (scan range proportional to warp factor), preventing accidental collision with ship or asteroid (but jump drive remains working in case of asteroids!).
To abort warp mode manually just press J to switch OFF Torus drive.
Shield energy bars indication turns OFF if Torus mode activated and ON in case of Torus drive deactivated. Use it to check Torus drive status in case of manual deceleration. It takes several seconds to decelerate from warp velocity in case of manual Torus mode deactivation!
Additional functions of Warp Drive module:
� Player's ship turn rate in jump/warp mode is inverse proportion of speed.
� Turn rate in yaw channel set to 1/4 turn rate in pitch channel
� Player ship's max speed, thrust and energy recharge rate depends on ship's technical state.
If you have vanilla Cobra Mk III for example it has max speed 350 and energy recharge rate 4.0. Ship technical state degrades by time from initial 100 points to 75 points. Max speed of highly used Cobra is reduced to 328, energy recharge rate to 3.5.
Wear & tear effect affects also fuel collection rate. If you have fuel collection rate 1.0 LY/min in vanilla Cobra Mk III, fuel collection rate of highly used Cobra drops to 0.8 LY/min.
Do regular maintenance to restore ship's maximum performance!
Custom Altimeter mode
This optional mode allows display of altitude as function of planet/moon radius.
Use SW HUD CAI with custom altitude dial to exploit this option.
Or you can edit any other HUD with analog altitude dial.
Find in hud.plist code line
selector = "drawAltitudeBar:";
and replace it for next two code lines:
selector = "drawCustomBar:";
data_source = "RALT";
If you have no SW HUD CAI installed or any HUD modified in above described way you�ll get default altitude fixed scale.
Dependencies and conflicts
You need Sun Gear OXP installed to collect solar wind.
Hard Way conflicts with Torus to Sun due to similar functionality.
Hard Way has conflicting functionality with Fuel Collector.
It is recommended, but not obligatory, to use Planetary Systems OXP, not Additional Planets OXP, if you�ll have Hard Way installed. Hard Way OXP using event this.shipEnteredPlanetaryVicinity to switch altimeter onto nearest celestial body. It is safe for Planetary Systems / Moons � you'll never have false switches because planets and moons widely separated. Having more tight planet-moon configurations in Additional Planets you�ll sometimes possibly have false switches due to overlapping horizons of this.shipEnteredPlanetaryVicinity event (3 planet/moon radii).
Enjoy!
--------------------------------------------------------------
Credits:
Wildblood - part of script from Altimeter OXP.
Thargoid - part of script from Military Fuel Injector OXP.
Norby � algorithm of detection of potentially dangerous entities in advance.
Tch - algorithm of calculation of distance to nearest celestial body.
Commander vasig - very useful help in refining concept of Gravity Well during initial development.
dybal - detection of issues with this OXP and valuable proposals for fixing these issues.
--------------------------------------------------------------
Version history:
28.11.2020 - Version 2.8.0 Improved procedure of modifying player ship dynamic.
20.05.2020 - Version 2.7.0 Additional refining of energy balance on Torus mode and after fuel depletion.
19.05.2020 - Version 2.6.1 Fixed issue with energy drain on Torus drive flight in case of energy boosters such as shield capacitors
or naval energy grid installed.
Fuel used to recharge energy banks now is function of ship energy recharge rate, not constant value.
05.03.2020 - Version 2.5.1 This readme file edited.
04.03.2020 - Version 2.5.0 Fixed logical flaw in conditions for fuel scoop activation, leading to 'scoop active' message being played
while docked on Rock Hermits and other external ports without mass-locking.
Declared incompatibility with Fuel Collector OXZ with conflicting functionality.
21.04.2019 - Version 2.4.0 Fixed bug, generating error messages in log after player ejection on escape pod.
11.02.2019 - Version 2.3.1 Converted onto OXZ.
13.01.2019 - Version 2.3 manifest.plist added.
Code refactoring.
01.06.2018 - Version 2.2 Indication of solar wind collection added.
09.05.2018 - Version 2.1 Code edited to satisfy OXP Standards recommendations.
Solar wind collection script updated to refactored AstroLibrary.
Custom altimeter data source is added.
17.08.2017 - Version 2.0 Injector speed factor and fuel burn rate readjusting for player and NPS ships transferred onto Stranger Set bundle OXP.
30.12.2016 - Version 1.9 Injector speed factor for player and NPS ships reset to 4 instead default 7.
Fuel burn rate reduced from default 0.25 LY/s to 0.125 LY/s.
04.07.2016 - Version 1.8 Altitude calculation procedure improved (system scan on this.shipEnteredPlanetaryVicinity event).
25.12.2015 - Version 1.7 Max speed after burning all fuel set to 0.5 * max speed in normal state.
08.09.2015 - Version 1.6 Wear & tear effect readjusted.
05.09.2015 - Version 1.5 Max speed after burning all fuel reduced to 0.25 * max speed in normal state.
04.09.2015 - Version 1.4 Wear & tear effect for fuel collection added.
Wear & tear effect for energy recharge rate added.
03.09.2015 - Version 1.3 Warp drive script transferred into package.
Additional wear & tear effect on ship dynamic properties implemented.
25.06.2015 - Version 1.2 Direct check of Torus drive status.
06.03.2015 - Version 1.1. Forward/Aft shield levels in jump drive mode readjusted from 0 to 1/4 nominal level.
Altimeter scale sensitivity reduced to integer numbers.
22.10.2014 - Version 1.0. Integrated HUDs removed to provide better support for extra HUDs and to fix bug with MFD display switch.
Auxiliary unit capacity depends on energy stack capacity.
24.06.2014 - Version 0.9. solar_wind.js transferred from Sun Gear OXP to Hard Way OXP.
New MFD feature added to integrated HUDs.
03.06.2014 - Version 0.8. Fuel consumption in proximity of massive celestial bodies readjusted from 0.1 LY/min to 0.1 LY per 2 min
(ship speed below red zone)
and 0.1 LY per 1.5 min (ship speed in red zone)
31.05.2014 - Version 0.7. Fuel consumption in cruise mode reduced twofold if ship speed is below red zone
(0.1 LY per 6 min in economic mode vs 0.1 LY per 3 min in full speed mode).
23.12.2013 - Version 0.6. Digital altimeter switched ON during descent and OFF during climb.
21.12.2013 - Version 0.5. Digital altimeter is added to provide altitude readout during EDL phase.
15.11.2013 - Version 0.4. Fuel consumption in proximity of massive celestial bodies increased.
Additional fuel consumption to charge energy stack is added.
04.10.2013 - Version 0.3. Minor bug in calculation of moon gravity well is fixed.
Calculation of gravity well effect refined: probability of misjump is correlated with jump altitude.
01.10.2013 - Version 0.2. Fuel counter refined.
Fuel consumption in jump drive mode slightly increased.
30.09.2013 - Version 0.1. Initial release (internal testing).
Path |
Scripts/collaps_shields.js |
"use strict";
this.name = "CollapsShields";
this.author = "Stranger";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description = "Script simulates collapsing shields and fuel consumption";
this.version = "2.7";
this.startUp = function()
{
this.self = player.ship;
}
this.shipWillLaunchFromStation = this.startFuelTimer = function()
{
this.$fuelFlag = 0;
this.$fuelCounter = 0;
this.$energyCounter = this.self.maxEnergy;
if(this.$fuelWatchTimer)
{ this.$fuelWatchTimer.start(); }
else
{ this.$fuelWatchTimer = new Timer(this, this.$checkFuel,0,1); }
}
this.shipWillDockWithStation = this.shipDied = this.stopFuelTimer = function()
{
this.$fuelFlag = 0;
this.$fuelCounter = 0;
this.$energyCounter = this.self.maxEnergy;
if(this.$fuelWatchTimer && this.$fuelWatchTimer.isRunning) { this.$fuelWatchTimer.stop(); }
}
this.$checkFuel = function()
{
if(this.self.speed > 0) // basic fuel consumption
{ // increment flag, looping between 0 and 60
this.$fuelFlag += 1;
this.$fuelFlag = this.$fuelFlag % 60;
if (this.self.speed < 0.8 * this.self.maxSpeed)
{
this.$fuelCounter += 1; // cruise mode
}
else
{
this.$fuelCounter += 2; // high speed mode
}
}
if(player.alertCondition != 1)
{
this.$fuelCounter += 1; // additional fuel consumption in mass lock state
}
if(this.self.energy < this.self.maxEnergy)
{
this.$fuelCounter += this.self.energyRechargeRate; // additional fuel consumption to recharge energy stock
}
if(this.$fuelCounter >= 360)
{
this.self.fuel -= 0.1; // fuel decrement
this.$fuelCounter -= 360; //reset fuel counter
}
if(this.self.fuel == 0.1) // warning message - fuel low
{
player.consoleMessage("FUEL LOW!", 3);
}
if(this.self.fuel == 0) // fuel empty - shields switch to auxiliary battery
{
this.self.aftShield = 0;
this.self.forwardShield = 0;
this.self.energy += this.self.aftShieldRechargeRate + this.self.forwardShieldRechargeRate - this.self.energyRechargeRate + 1; // to compensate energy drain for shield recharging
this.$energyCounter -= 0.1; // auxiliary battery discharge rate
if(this.self.energy > this.$energyCounter)
{
this.self.energy = this.$energyCounter;
}
if(this.self.energy <= 0)
{
this.self.explode();
}
}
if(this.self.torusEngaged == true) // if the ship is under Torus drive
{
if(this.self.aftShield > 0.25 * this.self.maxAftShield)
{
this.self.aftShield = 0.25 * this.self.maxAftShield; // Aft shield level decreased
}
if(this.self.forwardShield > 0.25 * this.self.maxForwardShield)
{
this.self.forwardShield = 0.25 * this.self.maxForwardShield; // Forward shield level decreased
}
this.self.energy += this.self.aftShieldRechargeRate + this.self.forwardShieldRechargeRate - this.self.energyRechargeRate + 1; // to compensate energy drain for shield recharging
this.$fuelCounter += 4; // additional fuel consumption in Torus drive mode
if(this.self.fuel == 0)
{
this.self.energy -= 10;
}
if(this.self.energy <= 0)
{
this.self.explode();
}
}
else
{ return; } // if not under Torus drive, exit function
} |
Scripts/gravity_well.js |
"use strict";
this.name = "GravityWell";
this.author = "Stranger";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description = "Script for simulation hyperjump malfunctions in close proximity to planet";
this.version = "2.3";
this.startUp = this.shipExitedWitchspace = function()
{
this.self = player.ship;
if (system.isInterstellarSpace) return;
this.$planet = system.mainPlanet;
this.$altitude = 1000000;
this.$altBuffer = this.$altitude;
}
this.shipWillLaunchFromStation = this.$startAltTimer = function()
{
this.$altFlag = 0;
if (this.$altWatchTimer)
{ this.$altWatchTimer.start(); }
else
{ this.$altWatchTimer = new Timer(this, this.$checkAlt,0,1); }
}
this.shipWillDockWithStation = this.shipDied = this.$stopAltTimer = function()
{
this.$altFlag = 0;
if (this.$altWatchTimer && this.$altWatchTimer.isRunning) { this.$altWatchTimer.stop(); }
}
this.$checkAlt = function()
{
this.$altFlag += 1;
this.$altFlag = this.$altFlag % 60;
if (this.self.status == "STATUS_IN_FLIGHT")
{
if (system.isInterstellarSpace) return;
this.$altitude = (self.position.distanceTo(this.$planet.position) - this.$planet.radius - self.collisionRadius).toFixed(0);
this.$altitude_scaled = this.$altitude / 10;
if (this.$altitude < this.$planet.radius)
{
this.$altitude_ratio = this.$altitude / this.$planet.radius;
this.self.showHUDSelector("drawAltitudeBar:");
}
else
{
this.$altitude_ratio = 0;
this.self.hideHUDSelector("drawAltitudeBar:");
}
if (this.$altitude < 25000 && this.$altitude > 4500 && this.$altitude < this.$altBuffer) //set digital altimeter range
{
player.consoleMessage("\n\n\n\n\n\n\n\n\n\n ALT " + this.$altitude_scaled.toFixed(0) + " km",2);
}
this.$altBuffer = this.$altitude;
this.self.setCustomHUDDial("RALT", this.$altitude_ratio);
}
}
this.playerStartedJumpCountdown = function()
{
if (this.$altitude < this.$planet.radius) //check if ship is below well horizon
{
this.$misjumpFlag = 1; //hyperjump wrong setting
}
else
{
this.$misjumpFlag = 0; //hyperjump setting OK
}
}
this.playerCancelledJumpCountdown = function()
{
this.$misjumpFlag = 0; //reset hyperjump setting
}
this.shipWillEnterWitchspace = function()
{
this.$wellHorizon = this.$planet.radius;
if (this.$altitude < this.wellHorizon) //check if ship is below well horizon
{
if (this.$misjumpFlag > 0 || this.$altitude < this.$wellHorizon * 0.75) //hyperjump countdown was started OR finished below safe level
{
if (Math.random() > this.$altitude / this.wellHorizon)
{
this.self.takeInternalDamage();
this.self.fuelLeakRate = 1;
if (Math.random() > this.$altitude / this.wellHorizon)
{
this.self.scriptedMisjump = true;
}
}
}
}
}
this.shipEnteredPlanetaryVicinity = function(planet)
{
this.$planet = planet;
} |
Scripts/solar_wind.js |
"use strict";
this.name = "SolarWind";
this.author = "Stranger";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description = "This script simulates collection of fuel from solar wind in sun proximity";
this.version = "2.5";
this.startUp = this.playerBoughtNewShip = function()
{
this.self = player.ship;
}
this.shipWillLaunchFromStation = this.$startCollectFuelTimer = function()
{
this.$fuelCollectFlag = 0;
this.$fuelCollectCounter = 0;
this.$endurance = this.self.serviceLevel/100;
this.$wear = 1 - this.$endurance;
if(this.$fuelCollectWatchTimer)
{ this.$fuelCollectWatchTimer.start(); }
else
{ this.$fuelCollectWatchTimer = new Timer(this, this.$checkCollectFuel,0,1); }
}
this.shipWillDockWithStation = this.shipDied = this.$stopCollectFuelTimer = function()
{
this.$fuelCollectFlag = 0;
this.$fuelCollectCounter = 0;
this.self.scoopOverride = false; // to avoid the 'scoop active' message being played while docked on Rock Hermits
log(this.name, "Docking: solar wind scooping stops");
if(this.$fuelCollectWatchTimer && this.$fuelCollectWatchTimer.isRunning)
{
log(this.name, "stopping fuelCollectWatchTimer...");
this.$fuelCollectWatchTimer.stop();
}
}
this.$checkCollectFuel = function()
{
if (player.alertCondition != 1 && this.self.scoopOverride == true)
{
this.self.scoopOverride = false;
}
if (system.isInterstellarSpace || player.alertCondition != 1 || !this.self.position) return;
var w = worldScripts.AstroLibrary;
var sunDistance = this.self.position.distanceTo(system.sun).toFixed(0);
var solarWind = w.$astroLib_SolarWind(sunDistance);
if(this.self.speed < 1.1 * this.self.maxSpeed && solarWind > 0.1 && this.self.equipmentStatus( "EQ_FUEL_SCOOPS" ) == "EQUIPMENT_OK") // ship in cruise mode AND sun proximity AND functional Fuel Scoop installed
{
this.$fuelCollectFlag += 1; // increment flag, looping between 0 and 60
this.$fuelCollectFlag = this.$fuelCollectFlag % 60;
this.$fuelCollectCounter += solarWind * (1 - 2 * this.$wear * this.$wear);
if(this.self.scoopOverride == false)
{
this.self.scoopOverride = true;
}
}
else
{
if(this.self.scoopOverride == true)
{
this.self.scoopOverride = false;
}
}
if(this.$fuelCollectCounter >= 6)
{
this.self.fuel += 0.1; // fuel increment
this.$fuelCollectCounter -= 6; // reset fuel collector counter
}
if(this.$fuelCollectCounter >= 12)
{
solarWind = 0; // shut off collector on overload
this.$fuelCollectCounter = 0; // reset fuel collector counter
}
} |
Scripts/warp_drive.js |
"use strict";
this.name = "WarpDrive";
this.author = "Stranger";
this.copyright = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description = "Script for hypervelocity drive & adjusting ship dynamics";
this.version = "2.8";
// This script uses FTL drive idea from Norby's Far Planets
// Ship dinamics readjusted - see readme for details
this.startUp = this.playerBoughtNewShip = function()
{
this.self = player.ship;
this.$endurance = this.self.serviceLevel/100;
this.$wear = 1 - this.$endurance;
this.$basicMaxSpeed = Math.floor(this.self.maxSpeed * (1 - this.$wear * this.$wear) + 0.5);
this.$basicMaxThrust = Math.floor(this.self.maxThrust * (1 - 2 * this.$wear * this.$wear) + 0.5);
this.$basicEnergyRechargeRate = 0.1 * Math.floor(10 * this.self.energyRechargeRate * (1 - 2 * this.$wear * this.$wear) + 0.5);
this.$basicMaxPitch = this.self.maxPitch;
this.$lockDistance = 10000000;
this.$scanRange = 25600;
this.$scanScale = 1;
}
this.shipExitedWitchspace = function()
{
this.$shipSetDynamic();
this.$scanScale = 1;
}
this.shipWillLaunchFromStation = this.$startWarpTimer = function()
{
this.$shipSetDynamic();
this.$warpCounter = 0;
this.$warpFlag = 0;
if(this.$warpWatchTimer)
{ this.$warpWatchTimer.start(); }
else
{ this.$warpWatchTimer = new Timer(this, this.$checkDistance,0,0.25); }
}
this.shipWillDockWithStation = this.shipDied = this.$stopWarpTimer = function()
{
this.$warpCounter = 0;
if(this.$warpWatchTimer && this.$warpWatchTimer.isRunning) { this.$warpWatchTimer.stop(); }
}
this.$checkDistance = function()
{
if (system.isInterstellarSpace) return; // interstellar space check
this.$warpCounter += 1;
this.$warpCounter = this.$warpCounter % 600;
if (this.self.status == "STATUS_IN_FLIGHT" && this.self.torusEngaged == true)
{
this.self.hideHUDSelector("drawForwardShieldBar:");
this.self.hideHUDSelector("drawAftShieldBar:");
var aPlanets = system.planets;
var playerPosition = player.ship.position;
var playerVector;
var nplayerVector;
var distanceToPlanet = 0;
var ndistanceToPlanet = 9E9;
var nNumber = 0;
var nplanetRadius = 0;
if (aPlanets.length == 0)
{
return null;
}
for (var i = 0; i < aPlanets.length; i++)
{
playerVector = new Vector3D(playerPosition.subtract(aPlanets[i].position));
distanceToPlanet = Math.floor(playerVector.magnitude()) - aPlanets[i].radius;
if (aPlanets[i].radius > 25000 && distanceToPlanet < ndistanceToPlanet)
{
nNumber = i;
nplayerVector = playerVector;
ndistanceToPlanet = distanceToPlanet;
this.$lockDistance = 25 * aPlanets[i].radius;
}
}
if (ndistanceToPlanet > this.$lockDistance)
{
this.$warpFlag = 1;
}
else
{
this.$warpFlag = 0;
}
var sunDistance = this.self.position.distanceTo(system.sun).toFixed(0);
var warpFactor = sunDistance / (25 * system.sun.radius);
if (warpFactor < 1)
{
this.$warpFlag = 0;
}
var e = system.filteredEntities(this, function(e){return(e.isValid && !e.isVisualEffect && (!e.dataKey || e.dataKey != "telescopemarker"));}, this.self, this.$scanScale * this.$scanRange);
if (e && e[0])
{
this.$warpFlag = 0;
}
if (this.$warpFlag == 1)
{
this.self.maxSpeed = this.$basicMaxSpeed * warpFactor;
this.self.maxPitch = this.$basicMaxPitch / (32 * warpFactor);
this.self.maxYaw = 0.25 * this.self.maxPitch;
this.$scanScale = warpFactor;
}
else
{
this.self.maxSpeed = this.$basicMaxSpeed;
this.self.maxPitch = this.$basicMaxPitch / 32;
this.self.maxYaw = 0.25 * this.self.maxPitch;
this.$scanScale = warpFactor;
}
}
else
{
this.self.showHUDSelector("drawForwardShieldBar:");
this.self.showHUDSelector("drawAftShieldBar:");
if (this.self.fuel > 0)
{
this.self.maxSpeed = this.$basicMaxSpeed;
}
else
{
this.self.maxSpeed = 0.50 * this.$basicMaxSpeed;
}
if (this.self.speed > this.self.injectorSpeedFactor * this.$basicMaxSpeed)
{
this.self.maxPitch = this.$basicMaxPitch * this.$basicMaxSpeed / this.self.speed;
}
else
{
this.self.maxPitch = this.$basicMaxPitch;
}
this.self.maxYaw = 0.25 * this.self.maxPitch;
this.$scanScale = 1;
}
}
this.$shipSetDynamic = function()
{
this.self.maxSpeed = this.$basicMaxSpeed;
this.self.maxThrust = this.$basicMaxThrust;
this.self.energyRechargeRate = this.$basicEnergyRechargeRate;
this.self.maxPitch = this.$basicMaxPitch;
this.self.maxYaw = 0.25 * this.self.maxPitch;
} |