Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2017
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. -- Sky switcher, version 1.0
  2. -- idea: Ethan2
  3. -- module written by: juce
  4.  
  5.  
  6. local skyroot = ".\\content\\sky-mod\\"
  7. local sky = 0
  8.  
  9. local sky_map = {
  10. [1] = "st099",
  11. [2] = "st100",
  12. [3] = "st101",
  13. [4] = "st102",
  14. [5] = "st103",
  15. [6] = "st104",
  16. [7] = "st105",
  17. [8] = "st106",
  18. [9] = "st107",
  19. [10] = "st108",
  20. [11] = "st109",
  21. [12] = "st110",
  22. [13] = "st111",
  23. [14] = "st112",
  24. [15] = "st113",
  25. }
  26.  
  27. function make_key(ctx, filename)
  28. if sky > 0 then
  29. return string.gsub(filename, "st%d%d%d", sky_map[sky])
  30. end
  31. end
  32.  
  33. function get_filepath(ctx, filename, key)
  34. if key then
  35. return skyroot .. key
  36. end
  37. end
  38.  
  39. function set_conditions(ctx, options)
  40. sky = math.random(1,15)
  41. log("sky selected: " .. sky)
  42. end
  43.  
  44. function init(ctx)
  45. if skyroot:sub(1,1) == "." then
  46. skyroot = ctx.sider_dir .. skyroot
  47. end
  48. math.randomseed(os.time()) -- seed random generator
  49. ctx.register("set_conditions", set_conditions)
  50. ctx.register("set_conditions_for_replay", set_conditions)
  51. ctx.register("livecpk_make_key", make_key)
  52. ctx.register("livecpk_get_filepath", get_filepath)
  53. end
  54.  
  55. return { init = init }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement