Cargo Handling and Mining
This is a proposal that deals with transporting, dropping and collecting cargo in space. I'm also piggybacking a second proposal for asteroid mining onto this proposal, since it's more or less an extension.
- Provide basic support for in-space cargo handling other than through boarding ships
- Allow jettisoning or collecting cargo to be part of missions
Cargo and properties thereof
Cargo is stuff. It sits in the cargo holds of ships, and those ships fly from one place to another. Proposed is a somewhat more complex way of handling cargo. Each cargo type should have the following properties:
- Name: The name of the cargo. This property already exists.
- Description: A short description of this cargo. This property also already exists.
- Value: The mean value for one unit of this cargo. Used in the economy proposal. This property also already exists.
- Size: The amount of tons one unit of cargo takes up. This will usually be 1 ton per unit, but some cargo, especially mission related or expensive cargo might require more tons for each unit of cargo. The main purpose for this is to allow one-unit cargo that nevertheless takes up more than 1 ton of space. See the section about jettisoning cargo. It also means that expensive cargo requires relatively big cargo ships to be profitable.
- Alive: A flag that determines whether the cargo is alive. Human passengers, animals and plants are considered alive. Cargo that is alive cannot survive exposure to the vacuum of space.
- Image: The sprite sheet (or model) for this cargo. Used when the cargo is displayed in space. For most cargo types this will be the existing gfx/spfx/cargo.png, but some cargo types will have different graphics.
When the player presses the jettison button, he is presented with an interface to specify how many units (not tons) of the cargo to jettison. The preferred widget for this is a horizontal slider. The player may then confirm the jettison process or cancel it. Once the player confirms, one of two things happens. Firstly, if the cargo is part of a script or mission, the game will call the jettison() function in the relevant lua script. This function takes the amount of cargo to be jettisoned as its argument. It will perform the actual jettison (by means of a lua binding that jettisons cargo from a ship) and handle any other consequences of the jettison. Secondly, if the cargo is not part of a script or mission, or if the jettison() function is not found in the script, the game will simply jettison the cargo with default parameters.
Cargo that is alive will die once jettisoned, and cannot be recovered.
Cargo floating in space may be collected by ships. To collect cargo, a ship must fly close to the container graphic. When within a certain range, the container will start moving towards the ship (through tractor beam technology or some other convenient excuse), and once it reaches the ship it will be collected into the cargo hold. However, the difference in velocities between the ship and the cargo must be sufficiently low for this to happen. Ships flying over cargo containers at high speeds will not be able to collect them.
When two or more ships attempt to collect the same container, the ship that came in collection range first takes priority.
- Allow the player to earn money from mining asteroids.
- Add more life to the universe
The purpose of mining is to increase the avenues the player has to make money first, and to add AI controlled mining operations for more immersion second. Asteroid mining is fairly straightforward. The universe should contain a large number of asteroids, asteroid fields and asteroid belts (these should be generated semi-randomly to reduce overhead). A ship equipped with mining lasers may then destroy any asteroid by firing the lasers at it. On destruction, the asteroid will release zero or more chunks of raw materials. Mostly, asteroids will yield a small quantity of base ore, but some asteroids will contain large amounts of ore and in rare cases an asteroid may even contain rare and precious materials that sell for a lot of money. Once the materials are floating around in space, the mining ship may collect them as outlined in the cargo proposal.