2c656ec24f
* add digistuff * add digiterms * add missions * add morelights * add nixie_tubes * add mob_horse * change digiterms: add cyrillic letter, change recipes for scifi monitors * add missing recipe for decatron * add craft recipes for digistuff * Separate mod for missing craft recipes * new mod: bees * add advtrains_luaautomation with craft recipes * add ham_radio * add christmas_decor * jumpdrive: ham_radio compat * fix christmas decor
36 lines
801 B
Lua
36 lines
801 B
Lua
|
|
|
|
local cooldown_timers = {} -- playername -> mission-name -> number(finish time)
|
|
|
|
-- resets the cooldown timer
|
|
missions.cooldown_reset = function(mission_name, playername)
|
|
local now = os.time(os.date("!*t"))
|
|
local mission_data = cooldown_timers[playername]
|
|
if not mission_data then
|
|
mission_data = {}
|
|
cooldown_timers[playername] = mission_data
|
|
end
|
|
|
|
mission_data[mission_name] = now
|
|
end
|
|
|
|
-- returns the seconds since the mission was finished or zero if never finished
|
|
missions.cooldown_get = function(mission_name, playername)
|
|
local now = os.time(os.date("!*t"))
|
|
|
|
local mission_data = cooldown_timers[playername]
|
|
if not mission_data then
|
|
return 0
|
|
end
|
|
|
|
local last_time = mission_data[mission_name]
|
|
|
|
if not last_time then
|
|
return 0
|
|
end
|
|
|
|
local diff = now - last_time
|
|
|
|
return diff
|
|
end
|