diff --git a/dat/mission.xml b/dat/mission.xml index 2ab2d06..957c8e6 100644 --- a/dat/mission.xml +++ b/dat/mission.xml @@ -11,7 +11,7 @@ cargo - 750 + 960 Computer Neutral Empire United diff --git a/dat/missions/cargo.lua b/dat/missions/cargo.lua index 29e50e7..e95afa9 100644 --- a/dat/missions/cargo.lua +++ b/dat/missions/cargo.lua @@ -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,45 +28,59 @@ 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 + misn.setTitle(string.format(title[i+1], planet)) + 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 - carg_mass = rnd.int( 10, 30 ) - i = rnd.int(12) -- Set the goods - if i < 5 then - carg_type = "Food" - elseif i < 8 then - carg_type = "Ore" - elseif i < 10 then - carg_type = "Industrial Goods" - elseif i < 12 then - carg_type = "Luxury Goods" - else - carg_type = "Medicine" + if misn_type == "Cargo" or misn_type == "Rush" then + carg_mass = rnd.int(10, 30) + i = rnd.int(12) -- Set the goods. + if i < 5 then + carg_type = "Food" + elseif i < 8 then + carg_type = "Ore" + elseif i < 10 then + carg_type = "Industrial Goods" + elseif i < 12 then + carg_type = "Luxury Goods" + else + carg_type = "Medicine" + end end if misn_type == "Cargo" then @@ -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