[Add] Transport mission type, also increased missions displayed at computer.

This commit is contained in:
Allanis 2013-05-07 20:42:18 +01:00
parent 41e2174c64
commit 3a8a9028d3
2 changed files with 47 additions and 27 deletions

View File

@ -11,7 +11,7 @@
<mission name="Cargo">
<lua>cargo</lua>
<avail>
<chance>750</chance>
<chance>960</chance>
<location>Computer</location>
<alliance>Neutral</alliance>
<alliance>Empire United</alliance>

View File

@ -1,17 +1,20 @@
lang = lephisto.lang()
if lang == "es" then
-- Not translated atm
else -- Default english
-- Not translated atm.
else -- Default english.
misn_desc = {}
misn_desc[1] = "%s in the %s system needs a delivery of %d tons of %s."
misn_desc[2] = "%s in the %s system needs a rush delivery of %d tons of %s before %s (%s left)."
misn_desc[11] = "%s in the %s system needs a rush delivery of %d tons of %s before %s (%s left)."
misn_desc[21] = "A group of %s needs to travel to %s in the %s system."
misn_reward = "%d credits"
title = {}
title[1] = "Cargo delivery to %s"
title[2] = "Freight delivery to %s"
title[3] = "Transport to %s"
title[4] = "Delivery to %s"
title[5] = "Rush Delivery to %s"
title[11] = "Rush Delivery to %s"
title[21] = "Transport %s to %s"
title[22] = "Ferry %s to %s"
full_title = "Ship is full"
full_msg = "Your ship is too full. You need to make room for %d more tons if you want to be able to accept the mission."
accept_title = "Mission Accepted"
@ -25,35 +28,48 @@ else -- Default english
misn_time_msg = "MISSION FAILED: You have failed to delivery the goods on time!"
end
-- Create the mission
-- Create the mission.
function create()
-- Target destination
-- Target destination.
local i = 0
repeat
planet = space.getPlanet( misn.factions() )
i = i + 1
until planet ~= space.landName() or i > 10
-- Infinite loop protection
-- Infinite loop protection.
if i > 10 then
misn.finish(false)
end
system = space.getSystem( planet )
misn_dist = space.jumpDist( system )
-- Mission generics
i = rnd.int(4)
if i < 3 then -- Cargo delivery
-- Mission generics.
i = rnd.int(6)
if i < 4 then -- Cargo delivery.
misn_type = "Cargo"
i = rnd.int(3)
misn.setTitle(string.format(title[i+1], planet))
else -- Rush delivery
elseif i < 6 then-- Rush delivery.
misn_type = "Rush"
misn.setTitle( string.format(title[5], planet) )
misn.setTitle(string.format(title[11], planet))
else -- People delivery :P
misn_type = "People"
i = rnd.int(5)
if i < 2 then
carg_type = "Colonists"
elseif i < 4 then
carg_type = "Tourists"
else
carg_type = "Pilgrims"
end
i = rnd.int(1)
misn_setTitle(string.format(title[i+21], carg_type, planet))
end
-- More mission specifics
if misn_type == "Cargo" or misn_type == "Rush" then
carg_mass = rnd.int(10, 30)
i = rnd.int(12) -- Set the goods
i = rnd.int(12) -- Set the goods.
if i < 5 then
carg_type = "Food"
elseif i < 8 then
@ -65,6 +81,7 @@ function create()
else
carg_type = "Medicine"
end
end
if misn_type == "Cargo" then
misn.setDesc( string.format( misn_desc[1], planet, system, carg_mass, carg_type ) )
@ -74,12 +91,15 @@ function create()
elseif misn_type == "Rush" then
misn_time = time.get() + time.units(2) +
rnd.int(time.units(2), time.units(4)) * misn_dist
misn.setDesc( string.format( misn_desc[2], planet, system,
misn.setDesc( string.format( misn_desc[11], planet, system,
carg_mass, carg_type,
time.str(misn_time), time.str(misn_time-time.get()) ) )
reward = misn_dist * carg_mass * (450+rnd.int(250)) +
carg_mass * (250+rnd.int(125)) +
rnd.int(2500)
else -- People.
misn.setDesc(string.format(misn_desc[21], carg_type, planet, system))
reward = misn_dist * (1000 + rnd.int(500)) + rnd.int(2000)
end
misn.setReward( string.format( misn_reward, reward ) )
end