From e2bab9f22b88e956a64f88682c5bac54eaa9373e Mon Sep 17 00:00:00 2001 From: Allanis Date: Sun, 5 May 2013 13:16:47 +0100 Subject: [PATCH] [Add] Empire Cargo missions are now always timed. --- dat/missions/cargo.lua | 11 +++++----- dat/missions/es_cargo.lua | 45 +++++++++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/dat/missions/cargo.lua b/dat/missions/cargo.lua index 388d584..0007a0c 100644 --- a/dat/missions/cargo.lua +++ b/dat/missions/cargo.lua @@ -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 diff --git a/dat/missions/es_cargo.lua b/dat/missions/es_cargo.lua index fcef080..836d7b9 100644 --- a/dat/missions/es_cargo.lua +++ b/dat/missions/es_cargo.lua @@ -2,23 +2,27 @@ 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_reward = "%d Scred" - title = {} - title[1] = "ES: Ship to %s" - title[2] = "ES: Delivery 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" - accept_msg = "The Empire workers load %d tons of %s onto your ship." + 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" + title[2] = "ES: Delivery 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" + accept_msg = "The Empire workers load %d tons of %s onto your ship." toomany_title = "Too many missions" - toomany_msg = "You have too many active missions." + toomany_msg = "You have too many active missions." finish_title = "Succesful Delivery" - 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!" + 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