[Add] Empire Cargo missions are now always timed.

This commit is contained in:
Allanis 2013-05-05 13:16:47 +01:00
parent 8e1745bd7a
commit e2bab9f22b
2 changed files with 37 additions and 19 deletions

View File

@ -22,6 +22,7 @@ else -- Default English.
finish_msg = "The workers unload the %s at the docks."
miss_title = "Cargo missing"
miss_msg = "You are missing the %d tons of %s!"
misn_time_msg = "You have failed to deliver the goods on time!"
end
-- Create the mission.
@ -76,7 +77,7 @@ function create()
misn.setDesc(string.format(misn_desc[2], planet, system,
carg_mass, carg_type, time.str(misn_time),
time.str(misn_time), time.str(misn_time-time.get())))
reward = misn_dist * carg_mass * (450+rnd.int(250)) + rnd.int(3500)
reward = misn_dist * carg_mass * (450+rnd.int(250)) + rnd.int(2500)
end
misn.setReward(string.format(misn_reward, reward))
@ -114,12 +115,12 @@ end
-- Time hook.
function timeup()
misn.setDesc(string.format(misn_desc[2], planet, system,
carg_mass, carg_type,
time.str(misn_time), time.str(misn_time-time.get())))
if time.get() > misn_time then
player.msg("You have failed to deliver the goods on time!")
player.msg(misn_time_msg)
misn.finish(false)
end
misn_setDesc(string.format(main_desc[2], planet, system,
carg_mass, carg_type,
time.str(misn_time), time.str(misn_time.get())))
end

View File

@ -2,7 +2,7 @@ lang = lephisto.lang()
if lang == "es" then
-- Not translated yet.
else -- Default English.
misn_desc = "The Empire needs to ship %d tons of %s to %s in the %s system."
misn_desc = "The Empire needs to ship %d tons of %s to %s in the %s system by %s (%s left)."
misn_reward = "%d Scred"
title = {}
title[1] = "ES: Ship to %s"
@ -17,8 +17,12 @@ else -- Default English.
finish_msg = "The Empire workers unload the %s at the docks."
miss_title = "Cargo Missing"
miss_msg = "You are missing the %d tons of %s!"
miss_timeup = "You have failed to deliver the goods to the empire on time!"
end
-- Empire shipping missions are always timed, but quite lax on the schedules.
-- Pays a bit more then rush missiosn.
-- Create the mission.
function create()
-- Target destination.
@ -55,7 +59,10 @@ function create()
carg_type = "Medicine"
end
misn.setDesc(string.format(misn_desc, carg_mass, carg_type, planet, system))
misn_time = time.get() + time.units(5) +
rnd.int(time.units(5), time.units(8)) * misn_dist
misn.setDesc(string.format(misn_desc, carg_mass, carg_type, planet, system,
time.str(misn_time), time.str(misn_time-time.get())))
reward = misn_dist * carg_mass * (500+rnd.int(250)) +
carg_mass * (250+rnd.int(150)) +
rnd.int(2500)
@ -69,6 +76,7 @@ function accept()
elseif misn.accept() then -- Able to accept the mission, hoos BREAK after accepting.
tk.msg(accept_title, string.format(accept_msg, carg_mass, carg_type))
hook.lnad("land") -- Only hook after accepting.
hook.time("timeup")
else
tk.msg(toomany_title, toomany_msg)
end
@ -96,3 +104,12 @@ function land()
end
end
-- Time hook.
function timeup()
if time.get() > misn_time then
player.msg(miss_timeup)
misn.finish(false)
end
misn.setDesc(string.format(misn_desc, carg_mass, carg_type, planet, system,
time.str(misn_time), time.str(misn_time-time.get())))
end