[Change] Improved ltime_pretty and increased time to do rush deliveries.
This commit is contained in:
parent
2a502f5426
commit
2a76ee4d42
@ -4,7 +4,7 @@ if lang == "es" then
|
|||||||
else -- Default English.
|
else -- Default English.
|
||||||
misn_desc = {}
|
misn_desc = {}
|
||||||
misn_desc[1] = "%s in the %s system needs a delivery of %d tons of %s."
|
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."
|
misn_desc[2] = "%s in the %s system needs a rush delivery of %d tons of %s before %s (%s left)."
|
||||||
misn_reward = "%d Scred."
|
misn_reward = "%d Scred."
|
||||||
title = {}
|
title = {}
|
||||||
title[1] = "Cargo delivery to %s"
|
title[1] = "Cargo delivery to %s"
|
||||||
@ -41,7 +41,7 @@ function create()
|
|||||||
|
|
||||||
-- Missions generic.
|
-- Missions generic.
|
||||||
i = rnd.int(4)
|
i = rnd.int(4)
|
||||||
if i < 4 then -- Cargo delivery.
|
if i < 3 then -- Cargo delivery.
|
||||||
misn_type = "Cargo"
|
misn_type = "Cargo"
|
||||||
i = rnd.int(3)
|
i = rnd.int(3)
|
||||||
misn.setTitle(string.format(title[i+1], planet))
|
misn.setTitle(string.format(title[i+1], planet))
|
||||||
@ -71,9 +71,11 @@ function create()
|
|||||||
carg_mass * (150+rnd.int(75)) +
|
carg_mass * (150+rnd.int(75)) +
|
||||||
rnd.int(1500)
|
rnd.int(1500)
|
||||||
elseif misn_type == "Rush" then
|
elseif misn_type == "Rush" then
|
||||||
misn_time = time.get() + rnd.int(time.units(2), time.units(4)) * misn_dist
|
misn_time = time.get() + time.units(2) +
|
||||||
|
rnd.int(time.units(2), time.units(4)) * misn_dest
|
||||||
misn.setDesc(string.format(misn_desc[2], planet, system,
|
misn.setDesc(string.format(misn_desc[2], planet, system,
|
||||||
carg_mass, carg_type, time.str(misn_time)))
|
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(3500)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -112,6 +114,9 @@ end
|
|||||||
|
|
||||||
-- Time hook.
|
-- Time hook.
|
||||||
function timeup()
|
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
|
if time.get() > misn_time then
|
||||||
player.msg("You have failed to deliver the goods on time!")
|
player.msg("You have failed to deliver the goods on time!")
|
||||||
misn.finish(false)
|
misn.finish(false)
|
||||||
|
11
src/ltime.c
11
src/ltime.c
@ -15,16 +15,19 @@ unsigned int ltime_get(void) {
|
|||||||
// Return the time in pretty text.
|
// Return the time in pretty text.
|
||||||
char* ltime_pretty(unsigned int t) {
|
char* ltime_pretty(unsigned int t) {
|
||||||
unsigned int lt;
|
unsigned int lt;
|
||||||
|
int maj, stu;
|
||||||
char str[128], *ret;
|
char str[128], *ret;
|
||||||
|
|
||||||
if(t == 0) lt = lephisto_time;
|
if(t == 0) lt = lephisto_time;
|
||||||
else lt = t;
|
else lt = t;
|
||||||
|
|
||||||
// UST (Universal Synchronized Time) - unit is STU (Syncronized Time Unit).
|
// UST (Universal Synchronized Time) - unit is STU (Syncronized Time Unit).
|
||||||
snprintf(str, 128, "UST %d.%03d",
|
maj = lt / (1000*LTIME_UNIT_LENGTH);
|
||||||
lt / (1000*LTIME_UNIT_LENGTH),
|
stu = (lt / (LTIME_UNIT_LENGTH)) % 1000;
|
||||||
(lt / (LTIME_UNIT_LENGTH)) % 1000);
|
if(maj == 0) // Only STU.
|
||||||
|
snprintf(str, 128, "%03d STU", stu);
|
||||||
|
else // Full format.
|
||||||
|
snprintf(str, 128, "UST %d.%03d", maj, stu);
|
||||||
ret = strdup(str);
|
ret = strdup(str);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user