pioneerspacesim/pioneer — pull request #872 by Luomu (2011-12-20 16:03:50+00:00)
Title: Allow jettisoning cargo while landed/docked

This is rather quickly put together. It adds a new lua event for when cargo is dumped while landed or docked. This allows some mission script possibilities, more if combined with a custom cargo type. For example it would be possible to script a mining prototype with this: dump 1 ton of mining machinery, get a random amount of minerals back.

When unloading on a station, it would be possible to put the cargo to a temporary storage (serialized, but destroyed when leaving the system), but it would require a GUI to view and recover the cargo, so now the stuff is lost (confiscated!).
When unloading on a planet, the cargo is lost, since there are no facilities to move the containers.

```lua
--testmodule.lua
local Dumpo = function (body, cargotype)
if body.type == 'ROCKY_PLANET' then
print("Dumped on a planet")
elseif body.type == 'STARPORT' then
print("Dumped on a starport")
end
local msg = body.label .. ": Don't dump your " .. cargotype .. " here!"
print(msg)
UI.Message(cargotype, body.label)
end

EventQueue.onCargoUnload:Connect(Dumpo)
```