Lephisto/dat/missions/cargo.lua

38 lines
1.0 KiB
Lua

-- Create the mission.
function create()
-- Target destination.
planet = space.getPlanet(misn.factions())
-- Missions generic.
misn_type = "Rush"
misn_setTitle("Rush Delivery to " .. planet)
-- More mission specifics.
carg_mass = rnd.int(10, 30)
carg.type = rnd.setDesc(string.format(
"%s needs a rush delivery of %d tons of %s by %s.",
planet, carg_mass, carg_type, "SOMEDAY"))
misn_reward = carg_mass * 1000 + rnd.int(0, 5000)
misn.setReward(string.format("%d Scred" misn_reward))
-- Set the hooks.
hook.land("land")
end
function accept()
player.addCargo(carg_type, carg_mass)
toolkit.msg("Mission Accepted",
string.format("The workers load the %d tons of %s onto your ship."
carg_mass, carg_type))
end
function land()
if planet.name() == planet then
player.rmCargo(carg_type, carg_mass)
player.pay(misn_reward)
toolkit.msg("Mission Accomplished",
string.format("The workers unload the %s at the docks.", carg_type))
end
end