Planetfall OXP

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

User avatar
ffutures
---- E L I T E ----
---- E L I T E ----
Posts: 2125
Joined: Wed Dec 04, 2013 12:34 pm
Location: London, UK
Contact:

Re: Planetfall OXP

Post by ffutures »

Sorry, I've been out all day - it's working fine now. I did try to download at the wrong time.

My thoughts on future development is that an inhabited planet would probably not want people landing a spaceship anywhere they liked, so designated zones with some sort of air traffic control seem logical. Maybe a future release could included some sort of guidance corridor that cuts in at low altitude - you have to fly inside it or get fined for violating traffic regulations, or shot at if you really get stupid. Have some other air traffic around (shuttles and things like airliners) to keep pilots on their toes. The landing is a bit slower now, it might as well be interesting!

It would be nice if the location was consistent for repeated visits to the planet, maybe seed a pseudo-random location from something that stays the same like the system coordinates.

Terrain lets things down a bit at present - going in the planet looks less realistic as you get closer, where you'd expect to start seeing things like hills etc. at low altitude.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: Planetfall OXP

Post by gsagostinho »

Hi all,

I just want to make a couple of comments about the Planetfall OXP. First of all, this is a *really* great OXP, thanks a lot to all involved! My comments are about the sky colour during the landing:

- it is really great to see the transition from the dark space to the blue skies, but if one lands in the night side of a planet the skies also turn light blue instead of being dark as on Earth at night? I imagine this might be a bit tricky to implement, but it is just one idea.

- I also noticed that all planets have blue skies. Perhaps some variance could be added to the hue of the skies.

Cheers!
Gilberto
CalebOfIronAssMiner
Above Average
Above Average
Posts: 23
Joined: Mon Oct 12, 2020 8:44 am
Location: Slovakia

Re: Planetfall OXP

Post by CalebOfIronAssMiner »

Hello, I am not sure if this discussion is still alive or what as it is 3 years or so from now but I have a few questions I wanted to ask and some suggestions.

First, I would like to ask Thargoid if he really intended to tack a 80+ Cr hidden cost to each planefall (plus the requirement to hunt down 9+ tech level systems every 20-30 landings)?

The "critical maintenance" costs 2500 Cr. It has to be done at least once per 30 landings and on average once per 15 landings. That translates to 83.3 Cr minimal and 166.6 Cr average cost per planetfall.

Second it doesn't make much sense to me. I just got a Quirium Processor and 74 Quirium canisters (I am flying a Miner Cobra right now) and am currently at Ceesxe (you know, that 15 Tech Level "capital" of Santaari). Now I can go to one of the harshest places in the whole ooniverse, drink Quirium like a rainbow (with a Miner Cobra I need to do that in two sessions with catching a bit of a nice, cold vacuum) then go back, dump it onto some station, rinse and repeat until there isn't even a Quirium capable bucket with a free space for more with pretty much no reprecussions. On Ceesxe there is the Torus, a Superhub and a Pi42 so that quite a number of trips before their markets are all maxed up.

And yet the ship cannot handle the, rather mundane and pretty harmless, planet's atmosphere reliably? Especially a habitable planet's atmosphere? You know, habitability of a planet kind of limits the atmosphere to pretty harmless gases that tend to avoid reacting with the kind of materials spaceships are made from.

So, here are my suggestions how to make this "maintenance charge" a little bit more realistic and believable.

1. Make the "2% cumulative chance of failure" dependent on the ship's service level. Something like if the service level is 85 or higher, then the "cumulative chance" of failure is 0 (or see the next suggestion). Below that and it gets progressively worse, with the 2% being for service level of 75. This way the commanders who wish to do planetfalls regularly and frequently, will be financially motivated to keep their ship's maintenance up to the snuff.

2. Ok, maybe the "landing gear" is wearing off, that's the reason? Then, my suggestion is that it is more of a "landing sled" and the energy of the shields is used to prevent this wear from occuring to a degree. Meaning to get "free planetary landings" the commander needs to get better shields. My idea is that (provided the ship is maintained up to the snuff), with standard shield the chance would be 1%, shield boosters would get that down to 0.5, one shield capacitor would drop that to 0.25 and the second one drop to 0. An extra energy unit would bring these numbers down to half, a naval one to a quarter of these values. The point is that there must be enough shield energy available to prevent the landing sled from picking up the wear. If there isn't, some wear happens, leading to the eventual failure. This shall add another incentive to the players to get these military shields along with the capacitors (besides the fact that, especially the capacitors are really nice pieces of defensive kit, allowing the ship to evade damage much more easily)

Now some more suggestions (not related to the maintenance issue):

--- snip ---

A random amount of time (something between 2-3 minutes and 20-30 minutes) shall pass on landing. This represents the ship spending time cruising in the lower atmosphere towards the landing site before that touchdown sequence actually happens.

--- snip ---

There was a large discussion of how to make the locations selectable with stuff like landing runways, "selection stations" with "redocking" and so on. My suggestion is to make this very simple (like Thargoid keeps repeating all the time). Make the Capability primable. Then a function could be used to scan the planet for locations, which would show up as HUD markers similar to what "Targetting System Engancement" does but the marker would be something like the pictogram for a meeting point (a point in the middle, 4 arrows pointing at it around, the point coinciding with the location), Then you would line the ship's reticule with a marker and use the function to select it. A circle would appear, denoting a "landing zone". Touch-down within this "landing zone" and you will get the location associated with the marker. Touch-down outside and you will get a random location.

Not every landing location is visible through this interface, though. Think about these "official places" as having some sort of beacon to advertise to spacers their intent to allow space traffic.

Some would need to be hunted down by landing repeatedly. Once hit, they would be remembered in the navigational system. Useful for shadier markets or top secret mission sites. Imagine e.g. a planetside naval research base which pays a premium for Alien Items.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4977
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re:

Post by Cholmondely »

Eric Walch wrote: Fri Dec 05, 2008 11:53 am
Thargoid wrote:
.... would suffer from the same issue as Eric's thoughts on a landing strip, in scale terms if you could see it on the planet, it would be hoooooooooooooooooooooooooge!
I disagree. A landing strip can me made quite small at a realistic size.

Just to show a landing strip can be made and need not to be huge I added it to thargoid's planetfall.oxp.

- Below every mainstation it adds a landingstrip. Just launch and head towards the surface (don't hit the buoy please!).
- Halfway the surface your radar will pick up the tower near the strip.
- The strip itself will be hidden by clouds. At a height of a few hundreds meter you will break through the clouds and see the tower with strip.
- Landing speed must be below 30% of maximum speed and landing angle should be less than 45 degree.
- I didn't add a distance check so you still can ignore the strip and land everywhere. Just watch your speed and angle.

Planetfall.oxp with landingstrip

EDIT:
I forgot. My added code only works with 1.72. (It could even can crash 1.71)
Are there any copies of this floating about?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Cholmondely
Archivist
Archivist
Posts: 4977
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Planetfall OXP

Post by Cholmondely »

CalebOfIronAssMiner wrote: Mon Oct 26, 2020 1:31 pm
And yet the ship cannot handle the, rather mundane and pretty harmless, planet's atmosphere reliably? Especially a habitable planet's atmosphere? You know, habitability of a planet kind of limits the atmosphere to pretty harmless gases that tend to avoid reacting with the kind of materials spaceships are made from.
Some super ideas in your post. But as regards the above, the problem isn't quite the gases, is it? It is exposure to the friction caused by moving against the gases at high speed - high enough speed so as not to fall and crash!

Now, we are talking about Oolite. No laws of physics. I can magically reduce my speed to 0 and just "hover" over the revolving planet, expending no energy as I do so. And yes, the same oddities (and more) apply to visiting a sun.

But yes, I take your point about the illogicality of high maintenance costs for dropping down on planets vs negligeable maintenance costs for sun-skimming.

I suppose that really the heatshielding should wear out in the same way that Spara's Glare Filter does (lasts 2-6 minutes depending on the setting!) and need constant re-applications. And should last less time if sun-skimming. And that this should be kept separate from the maintenance costs. And just think about the implications of getting hot enough to manage disinfestation! It should destroy wines/liquors, and damage some foods, furs, luxuries, narcotics, slaves, and possibly even make firearms explode!

But then that reduces the playability, no? Sunskimming makes the game more playable, but really only works because of the ridiculous distance between sun and planet/witchpoint. Higher costs will deter this. (I much prefer Stranger's adaptation where one can (slowly) skim the solar flux within a certain distance of the sun, and this is enhanced by occasional flares (Hard Way)).

I feel that this would make the game less enjoyable for many. The obvious solution is to tweak PlanetFall to reduce maintenance costs. And as you pointed out, if sunskimming does not involve maintenance neither should planet fall. So maybe such a tweak should add the ability to increase them (and add further increased costs for sun-skimming) using Library.oxp. I very much like your solution - it makes a lot of sense to me.

It would be good to see which parts of the code should be commented out to eliminate the increased degradation. That would be a very simple first solution. Having had a peek at the end of the planetFall_worldscript.js file, Thargoid did write it in such a way as to make it immersive.

And, I've never seen a choice of landing sites appear. Should it?

And as regards your ideas about this, see Thargoid's response here. I suppose that with the use of eg Povray Planets and the introduction of Waypoints that it might be possible for somebody to mark our landing sites for each Povray planet. It does seem like a lot of hard work to me. And it would probably not even be as convincing as the original Frontier.


Reference: planetFall_worldscript.js file:

Code: Select all

this.name			= "PlanetFall";
this.author			= "Thargoid, with bits from Eric Walch, Frame and Svengali";
this.copyright		= "Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme.txt.";
this.description	= "Enables planetary landing";
this.version		= "1.51";

this.startUp = function()
	{ 
	this.lastPlanet = system.mainPlanet; // details of the last planet to be landed on, so we know what to move the player away from on launch
	this.planetFallLaunch = false; // as in 1.77 the alert condition is still set on launch - need a mask
	this.lastPlanetType = "Prime"; // what type of planet/moon we landed on
	this.messageBlock = false; // flag to stop request/cancel messages at launch from planet
	this.planetCount = 1; // default setting
	this.moonCount = 0; // default setting
	this.$systemScan(); // set up the initial planet and moon count
	this.planetFallOverride = false; // flag to allow other OXPs to override PlanetFall locations
	this.overrideRole = "default"; // if other OXPs want to ensure a specific role is used
	this.$checkForSpecialPlanets();

/* For convenience of mission writers, access for other OXPs is via "worldScripts.PlanetFall.lastPlanet" and "worldScripts.PlanetFall.lastPlanetType". 
Values for lastPlanetType are "Prime" for the main planet, "Sub" for every other planet, "Moon" for any moon and "Sun" / "GasGiant" for a sun or a Solar System OXP 
gas giant (for completeness - cannot land on either of the last two). */
	}

this.$turnStation = function(tempStation)
	{
	if(!tempStation) { return; } // just in case the station doesn't survive spawning.
	let stationVector = tempStation.position.subtract(this.lastPlanet.position).direction(); // unit vector pointing away from the planet
	let angle = tempStation.heading.angleTo(stationVector); // angle between current heading and target heading
	let cross = tempStation.heading.cross(stationVector).direction(); // set the plane where we should rotate in
	tempStation.orientation = tempStation.orientation.rotate(cross, -angle); // re-orient the station away from the planet
	tempStation.position = tempStation.position.add(stationVector.multiply(3000));
	tempStation.breakPattern = false;
	}

this.shipApproachingPlanetSurface = function(planet) 
	{
	if(!planet || player.ship.equipmentStatus("EQ_PLANETFALL") != "EQUIPMENT_OK" || planet.hasOwnProperty("PFNoLandQuiet"))
		{
		return;
		}

	if(planet.hasOwnProperty("PFNoLand"))
		{
		player.commsMessage(system.name + " Planetary Control - Urgent warning - landing is not possible here!", 6);
		return;	
		}	
	
	this.lastPlanet = planet;	
	
	if(!this.landingTimer)  
		{
		if(!planet.isSun && !planet.hasOwnProperty("solarGasGiant") && !planet.hasOwnProperty("isGasGiant"))
			{
			this.messageBlock = true;
			if(planet === system.mainPlanet)
				{
				this.lastPlanetType = "Prime";
				this.landingChoice = (Math.random()*10);				
				if(this.planetFallOverride)
					{
					if(this.overrideRole === "default")
						{ this.overrideRole = "planetFall_mainSurface_externalOXP" };
					this.port = player.ship.spawnOne(this.overrideRole);
					this.$turnStation(this.port);
					this.overrideRole = "default";
					}
				else
					{
					if(this.landingChoice < 3) // spawn capital city
						{
						this.port = player.ship.spawnOne("planetFall_mainSurface_capitalCity"); 
						this.$turnStation(this.port);
						} 
					if(this.landingChoice >= 3 && this.landingChoice < 4.5) // spawn external OXP location, or if none then Capital City
						{
						if(this.overrideRole !== "default") 
							{ this.port = player.ship.spawnOne(this.overrideRole); }
							else
							{ this.port = player.ship.spawnOne("planetFall_mainSurface_externalOXP"); }
						if(!this.port)
							{
							log(this.name, "Main surface external spawn failure");
							this.port = player.ship.spawnOne("planetFall_mainSurface_capitalCity"); 
							}						
						this.$turnStation(this.port);
						this.overrideRole = "default";			
						} 
					if(this.landingChoice >= 4.5 && this.landingChoice < 6.5) // spawn a shipyard
						{
						this.port = player.ship.spawnOne("planetFall_mainSurface_shipYard");
						this.$turnStation(this.port);
						} 
					if(this.landingChoice >= 6.5 && this.landingChoice < 7.5) // spawn a military base
						{
						this.port = player.ship.spawnOne("planetFall_mainSurface_militaryBase"); 
						this.$turnStation(this.port);
						} 
					if(this.landingChoice >= 7.5 && this.landingChoice < 8.9) // spawn seedy bar or leisure complex
						{
						if((system.government == 0 || this.landingChoice < 8.05) && worldScripts["Random_Hits"])
							{
							this.port = player.ship.spawnOne("planetFall_mainSurface_seedyBar");
							this.$turnStation(this.port);
							this.barName = expandDescription('[planetFall_barName]');
						    missionVariables.random_hits_seedy_spacebar_header = worldScripts["Random_Hits"].barDescription(barName);
							this.port.displayName = this.barName;
							}
						else
							{
							this.port = player.ship.spawnOne("planetFall_mainSurface_leisureComplex");
							this.$turnStation(this.port);
							}
						} 
					if(this.landingChoice >= 8.9 && this.landingChoice < 9.8) // spawn factory or farm
						{
						if(system.economy < 4)
							{
							this.port = player.ship.spawnOne("planetFall_mainSurface_factory");
							this.$turnStation(this.port);
							}
						else
							{
							this.port = player.ship.spawnOne("planetFall_mainSurface_farm");
							this.$turnStation(this.port);
							}
						} 
					if(this.landingChoice >= 9.8) // spawn open fields or waste dump
						{
						if(system.economy < 4)
							{
							this.port = player.ship.spawnOne("planetFall_mainSurface_dump");
							this.$turnStation(this.port);
							}
						else
							{
							this.port = player.ship.spawnOne("planetFall_mainSurface_fields");
							this.$turnStation(this.port);
							}
						} 
					}
					
				if(this.lastPlanet.name)
					{ this.port.displayName = this.lastPlanet.name + " - " + this.port.displayName; }
				else
					{ this.port.displayName = system.name + " Prime - " + this.port.displayName; } // set the name to the surface of the prime planet in the system
				}
			else
				{
				if(planet.hasAtmosphere)
					{
					this.lastPlanetType = "Sub";
					this.landingChoice = (Math.random()*10);
					if(this.planetFallOverride)
						{
						if(this.overrideRole == "default") { this.overrideRole = "planetFall_subSurface_externalOXP"; };
						this.port = player.ship.spawnOne(this.overrideRole);
						this.$turnStation(this.port);
						this.overrideRole = "default";
						}
					else
						{
						if(this.landingChoice < 3) // spawn capital city
							{
							this.port = player.ship.spawnOne("planetFall_subSurface_colony"); 
							this.$turnStation(this.port);
							} 
						if(this.landingChoice >= 3 && this.landingChoice < 4.5) // spawn external OXP location, or if none then a colony
							{
							if(this.overrideRole !== "default") 
								{ this.port = player.ship.spawnOne(this.overrideRole); }
								else
								{ this.port = player.ship.spawnOne("planetFall_subSurface_externalOXP"); }	
							if(!this.port)
								{
								log(this.name, "Sub surface external spawn failure");
								this.port = player.ship.spawnOne("planetFall_subSurface_colony"); 
								}	
						this.$turnStation(this.port);
							this.overrideRole = "default";
							} 
						if(this.landingChoice >= 4.5 && this.landingChoice < 6.5) // spawn a shipyard
							{
							this.port = player.ship.spawnOne("planetFall_subSurface_shipYard");
							this.$turnStation(this.port);
							} 
						if(this.landingChoice >= 6.5 && this.landingChoice < 7.5) // spawn a military base
							{
							this.port = player.ship.spawnOne("planetFall_subSurface_militaryBase"); 
							this.$turnStation(this.port);
							} 
						if(this.landingChoice >= 7.5 && this.landingChoice < 8.9) // spawn seedy bar or leisure complex
							{	
							if((system.government == 0 || this.landingChoice < 8.05) && worldScripts["Random_Hits"])
								{
								this.port = player.ship.spawnOne("planetFall_subSurface_seedyBar");
								this.$turnStation(this.port);
								this.barName = expandDescription('[planetFall_barName]');
								missionVariables.random_hits_seedy_spacebar_header = worldScripts["Random_Hits"].barDescription(barName);
								this.port.displayName = this.barName;
								}
							else
								{
								this.port = player.ship.spawnOne("planetFall_subSurface_leisureComplex");
								this.$turnStation(this.port);
								}
							} 
						if(this.landingChoice >= 8.9 && this.landingChoice < 9.8) // spawn factory or farm
							{
							if(system.economy < 4)
								{
								this.port = player.ship.spawnOne("planetFall_subSurface_factory");
								this.$turnStation(this.port);
								}
							else
								{
								this.port = player.ship.spawnOne("planetFall_subSurface_farm");
								this.$turnStation(this.port);
								}
							} 
						if(this.landingChoice >= 9.8) // spawn open fields or waste dump
							{
							if(system.economy < 4)
								{
								this.port = player.ship.spawnOne("planetFall_subSurface_dump");
								this.$turnStation(this.port);
								}
							else
								{
								this.port = player.ship.spawnOne("planetFall_subSurface_fields");
								this.$turnStation(this.port);
								}
							} 
						}

					if(this.lastPlanet.name)
						{ this.port.displayName = this.lastPlanet.name + " - " + this.port.displayName; }
					else
						{ this.port.displayName = system.name + " Minor - " + this.port.displayName; } // set the name to just the surface, so we can identify easily the main planet
					}
				else
					{
					this.lastPlanetType = "Moon";
					this.landingChoice = (Math.random()*10);
					if(this.planetFallOverride)
						{
						if(this.overrideRole == "default") { this.overrideRole = "planetFall_moonSurface_externalOXP" };
						this.port = player.ship.spawnOne(this.overrideRole);
						this.$turnStation(this.port);
						this.overrideRole = "default";
						}
					else
						{
						if(this.landingChoice < 3) // spawn capital city
							{
							this.port = player.ship.spawnOne("planetFall_moonSurface_dome"); 
							this.$turnStation(this.port);
							} 
						if(this.landingChoice >= 3 && this.landingChoice < 4.5) // spawn external OXP location, or if none then a dome
							{
							if(this.overrideRole !== "default") 
								{ this.port = player.ship.spawnOne(this.overrideRole); }
								else
								{ this.port = player.ship.spawnOne("planetFall_moonSurface_externalOXP"); }
							if(!this.port)
								{
								log(this.name, "Moon external spawn failure");
								this.port = player.ship.spawnOne("planetFall_moonSurface_dome"); 
								}	
							this.$turnStation(this.port);
							this.overrideRole = "default";
							} 
						if(this.landingChoice >= 4.5 && this.landingChoice < 6.5) // spawn a mine
							{
							this.port = player.ship.spawnOne("planetFall_moonSurface_mine");
							this.$turnStation(this.port);
							} 
						if(this.landingChoice >= 6.5 && this.landingChoice < 8) // spawn a bar or leisure dome
							{	
							if((system.government == 0 || this.landingChoice < 7.5) && worldScripts["Random_Hits"])
								{
								this.port = player.ship.spawnOne("planetFall_moonSurface_seedyBar");
								this.$turnStation(this.port);
								this.barName = expandDescription('[planetFall_barName]');
								missionVariables.random_hits_seedy_spacebar_header = worldScripts["Random_Hits"].barDescription(barName);
								this.port.displayName = this.barName;
								}
							else
								{
								this.port = player.ship.spawnOne("planetFall_moonSurface_leisureDome");
								this.$turnStation(this.port);
								}
							} 
						if(this.landingChoice >= 8 && this.landingChoice < 8.9) // spawn a prison
							{
							this.port = player.ship.spawnOne("planetFall_moonSurface_prison"); 
							this.$turnStation(this.port);
							} 
						if(this.landingChoice >= 8.9 && this.landingChoice < 9.8) // spawn a research complex or factory
							{
							if(system.techLevel > 11)
								{
								this.port = player.ship.spawnOne("planetFall_moonSurface_researchComplex");
								this.$turnStation(this.port);
								}
							else
								{
								this.port = player.ship.spawnOne("planetFall_moonSurface_factory");
								this.$turnStation(this.port);
								}
							} 
						if(this.landingChoice >= 9.8) // spawn wasteland
							{
							this.port = player.ship.spawnOne("planetFall_moonSurface_wasteland"); 
							this.$turnStation(this.port);
							} 
						}

					if(this.lastPlanet.name)
						{ this.port.displayName = this.lastPlanet.name + " - " + this.port.displayName; }
					else
						{ this.port.displayName = "Moon of " + system.name + " - " + this.port.displayName; } // set the name to the moon, so we can identify it as a moon
					}
				}
			this.fx = system.addVisualEffect("planetFall_landingFX",player.ship.position.add(player.ship.vectorForward.multiply(170)));	
			this.port.dockPlayer();	
			}
		else
			{
			if(planet.hasOwnProperty("solarGasGiant") || planet.hasOwnProperty("isGasGiant"))
				{
				this.lastPlanetType = "GasGiant";
				}
			else
				{
				this.lastPlanetType = "Sun";
				}
			}
		}
	else
		{ // if the PF landing timer is still running
		player.commsMessage(system.name + " Planetary Control - Pull up, you have no landing clearance!", 6);
		player.commsMessage("Return to orbit and approach again.", 6);
		this.landingTimer.stop();
		delete this.landingTimer;
		}
	}

this.shipWillDockWithStation = function(station)
	{
	if(station.hasRole("planetFall_surface") || station.hasRole("planetFall_mainSurface_externalOXP") || station.hasRole("planetFall_subSurface_externalOXP") || station.hasRole("planetFall_moonSurface_externalOXP") )
		{
		if(!this.fx) { this.fx = system.addVisualEffect("planetFall_landingFX",player.ship.position.add(player.ship.vectorForward.multiply(170))); }
		this.selectTexture = 1 + (Math.floor(Math.random() * 9));
		if(station.hasRole("planetFall_moonSurface"))
			{ this.fx.setMaterials({"planetFall_planet1.png": {diffuse_map: "planetFall_moon" + this.selectTexture + ".png" }}); }
		else
			{ this.fx.setMaterials({"planetFall_planet1.png": {diffuse_map: "planetFall_planet" + this.selectTexture + ".png" }}); }
	}
		
	if((station.hasRole("planetFall_mainSurface_seedyBar") || station.hasRole("planetFall_subSurface_seedyBar") || station.hasRole("planetFall_moonSurface_seedyBar")) && worldScripts["Random_Hits"])
		{ // Player is docked at a planet-side seedy bar
		worldScripts["Random_Hits"].random_hits_docked = true;
		}
	}
	
this.shipWillLaunchFromStation = function(station)
	{
	if(station)
		{ 
		this.planetFallLaunch = true;
		if(station.hasRole("planetFall_surface"))
			{
			this.fx = system.addVisualEffect("planetFall_launchFX",player.ship.position.add(player.ship.vectorForward.multiply(150)));
			this.fx.orientation = player.ship.orientation;
			}
		} 
	}	
	
this.alertConditionChanged = function()
	{
	if(this.planetFallLaunch)
		{
		this.planetFallLaunch = false;
		return;
		}

	if(player.alertAltitude && !this.lastPlanet.isSun && !this.lastPlanet.hasOwnProperty("solarGasGiant") && !this.lastPlanet.hasOwnProperty("PFNoLand") && !this.lastPlanet.hasOwnProperty("PFNoLandQuiet") && !this.lastPlanet.hasOwnProperty("isGasGiant"))
		{
		if(player.ship.equipmentStatus("EQ_PLANETFALL") != "EQUIPMENT_OK")
			{
			player.commsMessage(system.name + " Planetary Control - Your ship is not equipped for planetfall.", 10);
			player.commsMessage("Do not attempt landing, your ship will be destroyed!", 10);
			}
		else
			{
			if(!this.messageBlock)
				{
				player.commsMessage(system.name + " Planetary Control - Landing clearance request received.", 6);
				player.commsMessage("Please await confirmation before beginning final approach.", 6);
				}
			this.clearanceDelay = 5 + (Math.ceil(Math.random()*15)); // delay between 6 and 20 seconds
			this.landingTimer = new Timer(this, this.$landingClearance, this.clearanceDelay);
			}
		}

	if(player.alertAltitude && (this.lastPlanet.hasOwnProperty("solarGasGiant") || this.lastPlanet.hasOwnProperty("isGasGiant")))
		{ player.consoleMessage("ALERT - You are approaching a Gas Giant. Landing here is not possible!", 10); 	}

	if(player.alertAltitude && this.lastPlanet.hasOwnProperty("PFNoLand"))
		{ 
		player.consoleMessage("ALERT - Landing here is not possible!", 10); 
		return;
		}
		
	if(!player.alertAltitude && this.landingTimer && this.landingTimer.isRunning && !player.ship.docked && EquipmentInfo.infoForKey("EQ_FRAME_SAVE") == null)
		{
		this.landingTimer.stop();
		delete this.landingTimer;
		missionVariables.planetFallBreak += 0.01; // 1% cumulative chance of equipment failure
		if(!this.messageBlock)
			{
			player.commsMessage(system.name + " Planetary Control - Landing clearance request cancelled.", 6);
			player.commsMessage("Goodbye Commander " + player.name + ".", 6);
			this.messageBlock = false;
			}
		}
	}

this.$landingClearance = function()
	{
	this.landingTimer.stop();
	delete this.landingTimer;
	player.commsMessage(system.name + " Planetary Control - Landing clearance granted.",6);
	player.commsMessage("Please approach the surface slowly.", 6);
	}

this.shipLeavingPlanetSurface = function(planet)
	{
	this.lastPlanet = planet;
	this.messageBlock = false;
	}

this.shipDied = function()
	{
	let ports = system.shipsWithRole("planetFall_surface"); // an array of any rogue "surface stations" in the system
	this.portCount = ports.length; // how many rogues we have that need to be removed
	if(this.portCount > 0) for (let i=0; i<this.portCount; i++) // if there are any, loop through and remove them
		{ this.$removePort(ports[i]); }
	if(this.landingTimer && this.landingTimer.isRunning)
		{
		this.landingTimer.stop();
		delete this.landingTimer;	
		}
	}

this.shipEnteredPlanetaryVicinity = function(planet)
	{
	if(!planet) { return; }

	this.lastPlanet = planet;
	if(!planet.isSun && !planet.hasOwnProperty("solarGasGiant") && !planet.hasOwnProperty("isGasGiant") && !planet.hasOwnProperty("PFNoLand") && !planet.hasOwnProperty("PFNoLandQuiet") && player.ship.equipmentStatus("EQ_PLANETFALL") == "EQUIPMENT_OK")
		{
		player.commsMessage(system.name + " Planetary Control - for planetfall please approach and request landing clearance.",5);
		}
	else
		{
		if(planet.isSun)
			{ player.consoleMessage("ALERT - Approaching the Sun. Temperature monitoring is critical!", 10); }
		if(planet.hasOwnProperty("solarGasGiant") || planet.hasOwnProperty("isGasGiant"))
			{ player.consoleMessage("ALERT - You are approaching a Gas Giant. Landing here is not possible!", 10); }
		if(planet.hasOwnProperty("PFNoLand"))
			{ player.commsMessage("ALERT - Landing is not possible here, please pull up!", 10); }
		}
	}

this.shipExitedPlanetaryVicinity = function()
	{ 
	this.messageBlock = false; 
	this.shipDied(); // clean-up of any unremoved surface stations.
	}

this.shipLaunchedFromStation = function(station)
	{
	if(EquipmentInfo.infoForKey("EQ_FRAME_SAVE") != null) // if launch is for Save Anywhere, don't want to move the player or nuke the station
		{ return; }

	if(station && station.hasRole("planetFall_surface"))
		{
		if(this.landingTimer) 
			{ delete this.landingTimer; }	
		player.commsMessage(system.name + " Planetary Control - orbital boost complete.",5);
		player.commsMessage("Farewell Commander " + player.name + ".",5);
		this.$removePort(station); // remove the surface-simulating station
		this.messageBlock = false;
		missionVariables.planetFallBreak += 0.02; // 2% cumulative chance of equipment failure 
		if(Math.random() < missionVariables.planetFallBreak) // landing equipment needs maintenance
			{
			player.ship.setEquipmentStatus("EQ_PLANETFALL", "EQUIPMENT_DAMAGED");
			player.consoleMessage("ALERT - Planetary landing modifications require urgent maintenance.", 10);
			player.consoleMessage("Do not attempt to land again before they are repaired!", 10);
			missionVariables.planetFallBreak = -0.04; // first two launches guaranteed not to break equipment
			}
		}

	this.$systemScan();
	}
	
this.playerBoughtEquipment = function(equipment)  // guarantee first two launches won't break equipment
	{
	if(equipment == "EQ_PLANETFALL")
		{ missionVariables.planetFallBreak = -0.04; }
	}

this.shipExitedWitchspace = function()
	{
	this.$checkForSpecialPlanets();
	this.overrideRole = "default";
	this.$systemScan();
	}

this.$systemScan = function()
	{
	function isMoon(entity) {return (entity.isPlanet && !entity.hasAtmosphere) };
	this.systemArray = system.planets;
	this.systemCount = this.systemArray.length;
	this.moonCount = system.filteredEntities(this.systemArray, isMoon).length;
	this.planetCount = this.systemCount - this.moonCount;
	}

this.$removePort = function(port)
	{	
	if(port.hasRole("planetFall_surface"))
		{ port.remove(); };
	}

this.$jailRelease = function()
	{
	if(player.credits > missionVariables.planetFallFine)
		{
		player.credits -= missionVariables.planetFallFine;
		player.ship.bounty -= (Math.ceil(missionVariables.planetFallFine * 0.05)); // lower bounty corresponding to fine.
		}
	else
		{ player.credits = 10; }
	player.ship.launch();
	this.jailTime = 21600 + (Math.random() * 43200); // between 6 and 18 hours in the cells
	clock.addSeconds(this.jailTime);	
	}
	
this.guiScreenChanged = function()
	{
	if(!player.ship.docked) // for GUI screen changes whilst in flight, which we can ignore
		{ return; }

	if(!player.ship.dockedStation.hasRole("planetFall_surface")) // if we're at a trunk or other OXP's station
		{ return; }

	 // Player is docked at a military base or penal colony - not somewhere a criminal should make himself known ;)
	if(player.ship.bounty > 25) // player is mid-level offender or fugitive
		{
			if(player.ship.dockedStation.hasRole("planetFall_mainSurface_militaryBase") || player.ship.dockedStation.hasRole("planetFall_subSurface_militaryBase") || player.ship.dockedStation.hasRole("planetFall_moonSurface_prison"))
			{
				if(guiScreen == "GUI_SCREEN_EQUIP_SHIP" || guiScreen == "GUI_SCREEN_MARKET" || guiScreen == "GUI_SCREEN_SHIPYARD")
				{
				missionVariables.planetFallFine = 20 + (Math.ceil(Math.random()*480)); // fine of 21-500 credits
				if(player.ship.bounty > 50) // if the player is a fugitive
					{ // raise fine by another 1-500 credits
					missionVariables.planetFallFine += (Math.ceil(Math.random()*500));  
					}
					
				if(worldScripts.Cabal_Common_Functions)
					{
					var t1 = expandMissionText("planetFall_prison");
					var t2 = t1.split(".");
					var obj = {
						role:"planetFall_scene_prison",
						absolutePos:[0,-5,150],
						briefing:[
							[1,"walk",[0,-1,6,10,0.15,2,0,0],t2[0].trim()+"."],
							[24,"rot",[0,-1,4.5,0.0015,0.0015,0,0,1,1],t2[1].trim()+"."],
							[25,"stopVelo",[0,-1]],
							[100,"mes",t2[2].trim()+"."],
							[101,"kill"],
							[102,0]
							],
						title:"Do not pass GO, do not collect 200cr",
						callback:this.name,
						callbackf:"$jailRelease"
						};
					worldScripts.Cabal_Common_Briefing.startBriefing(obj);
					return;	
					}
				else
				 { mission.runScreen({title:"Do not pass GO, do not collect 200cr", messageKey:"planetFall_prison", background:"planetFall_cell.png"}, this.$jailRelease); }
				}
			}
		}

	if(!player.ship.dockedStation.hasRole("planetFall_noTrade")) // if we're at a location where trading is possible
		{ return; }

	// no-one to trade with on the empty lunar surface
	if(player.ship.dockedStation.hasRole("planetFall_moonSurface_wasteLand") ) 
		{
		if(guiScreen == "GUI_SCREEN_EQUIP_SHIP" || guiScreen == "GUI_SCREEN_MARKET")
			{
			mission.runScreen({title:"Lonely on the moon", messageKey:"planetFall_noTrade", background:"planetFall_lunarScape.png"});
			}
		}

	 // no-one to trade with in empty fields
	if(player.ship.dockedStation.hasRole("planetFall_mainSurface_fields") || player.ship.dockedStation.hasRole("planetFall_subSurface_fields")) 
		{
		if(guiScreen == "GUI_SCREEN_EQUIP_SHIP" || guiScreen == "GUI_SCREEN_MARKET")
			{
			mission.runScreen({title:"Nothing but fields...", messageKey:"planetFall_noTrade", background:"planetFall_fields.png"});
			}
		}

	// no-one to trade with in refuse dump
	if(player.ship.dockedStation.hasRole("planetFall_mainSurface_dump") || player.ship.dockedStation.hasRole("planetFall_subSurface_dump")) 
		{
		if(guiScreen == "GUI_SCREEN_EQUIP_SHIP" || guiScreen == "GUI_SCREEN_MARKET" || guiScreen == "GUI_SCREEN_SHIPYARD")
			{
			mission.runScreen({title:"All muck, no brass!", messageKey:"planetFall_noTrade", background:"planetFall_dump.png"});
			}
		}
	}
	
this.$checkForSpecialPlanets = function()
	{ this.scriptDelay = new Timer(this, this.$setFlags, 0.25); }

this.$setFlags = function()
	{	
	if(galaxyNumber === 0 && system.ID === 246) // if we're at Tianve (G0, S227), set up the pulsar
		{
		for (let i=0; i<system.planets.length; i++) 
			{ 
			if(system.planets[i].texture === "tianve_pulsar.png") 
				{ system.planets[i].PFNoLand = true; } 
			}
		}
	}	
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Cholmondely
Archivist
Archivist
Posts: 4977
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Planetfall OXP

Post by Cholmondely »

On a different theme. This:
the Adder-class craft has dual atmospheric-spatial capability and is often used by smugglers. Pregg's 'wingfolding' system permits landing on planetary surfaces.
From the Classic Elite & Oolite wiki descriptions


Should not the cost of installing planetary landing capabilities be zero for adders? There is no equipment to be installed! There might be a small charge for "the relevant permits, permissions and registrations with authorities to allow landing" but the F3 cost for an adder should not be anywhere as expensive as the cost for the other ships.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply