Station Validator OXP ver 1.0 (29.1.2014)

Author: spara (Mika Spåra)

_Overview_

In the core game, when a station is destroyed, it magically resurrects after save/load or witchjump. This oxp aim's to make a change to that. When a stationary station is destroyed, this oxp stores it's primary role, the system it died in, the place it died at and the time it died. When that destroyed station is to be spawned next, it can query this oxp, if there has been any destructions of that kind of stations in the current system. Then it's up to the station oxp to decide whether to spawn or not.

Main stations and rock hermits are also handled.

_In_detail_

For oxp creators this oxp has two uses

1. Hold the spawning of a destroyed station until it has been rebuild.
2. Create a set of unfinished station models and let it show that the station is being rebuilt

_Usage_

Call worldScripts.station_validator.$deathTime("your_station_role", rebuildTime) and you'll receive an array of objects. Each object is a death of "your_station_role"-station that has not met the rebuildTime yet in the current system . Each object has two properties: time (integer) and place (Vector3D). RebuildTime parameter is optional and defaults to 30.

Scenarios:

1. There is only one station with "your_station_role" in system

Call worldScripts.station_validator.$deathTime("your_station_role", rebuildTime) and check the array's length. If it's 0, then the station can be built.

2. There are multiple station with "your_station_role" in system 

Call worldScripts.station_validator.$deathTime("your_station_role", rebuildTime), iterate through the array and act accordingly

3. Show station in it's construction phase

Call worldScripts.station_validator.$deathTime("your_station_role", rebuildTime) and find the station from the list. Use time-property to decide which phase to show and spawn the unfinished model to the position of the place property.

If the unfinished construct is destroyed, the deathTime of the original station should be resetted. For that construct must have "construct" in it's roles and there must be constructRole = "role_of_the_station_to_be_built" in it's script_info.

_Stations_supporting_

* SothisTC
* RandomHits 1.5.3 ->
* AstroFactory 2.0
* Stations for Extra Planets
* Rescue Stations 1.3

Install the OXP by copying station_validator.oxp to your AddOns-folder.

------

This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

Version 1.1
Fixed issue with overriding of shipDied events, where parameters were not being correctly passed to pre-existing functions.