Advertisement
Guest User

Untitled

a guest
May 17th, 2015
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. #define DEBUG
  2. #define FONT_ICON 'font_icon.dmi'
  3. #define grid_MaxX world.view * 2
  4. #define grid_MaxY world.view * 2
  5. #define grid_MinX 0
  6. #define grid_MinY 1
  7. #define textLength 60
  8. obj
  9. screenGrid
  10. box
  11. icon = FONT_ICON
  12. layer = MOB_LAYER + 10
  13. var
  14. y_loc = 0
  15. loc_on_screen = ""
  16. mob
  17. verb
  18. say_something(msg as text)
  19. src.client.configureBox(msg, 10, 1, 1, FONT_ICON)
  20. client
  21. New()
  22. src.generateGrid()
  23. ..()
  24. client
  25. var
  26. last_line
  27. next_line
  28. tile_size = 16
  29. list/screen_grid[]
  30. //list/grid_lines[]
  31. chat_delay
  32. past_text_list
  33. proc
  34. generateGrid()
  35. var/width_limit = grid_MaxX * 2 - 2, height_limit = grid_MaxY * 2 - 2
  36. var/x_offset = 0, y_offset = 0, x_loc = 1, y_loc = 1, grid_x_loc = 1, grid_y_loc = 1
  37. for(var/x_value = 1, x_value <= width_limit, x_value++)
  38. spawn(1) src.newBox(x_loc, y_loc, x_offset+src.tile_size, y_offset, grid_x_loc, grid_y_loc)
  39. x_offset += src.tile_size
  40. grid_x_loc++
  41. if(x_offset > src.tile_size)
  42. x_offset = 0
  43. x_loc++
  44. spawn(1)
  45. grid_y_loc++
  46. y_offset += src.tile_size
  47. for(var/y_value = 1, y_value <= height_limit, y_value++)
  48. spawn(1) src.newBox(x_loc, y_loc, x_offset, y_offset, grid_x_loc-1, grid_y_loc)
  49. y_offset += src.tile_size
  50. grid_y_loc++
  51. if(y_offset > src.tile_size)
  52. y_offset = 0
  53. y_loc++
  54.  
  55. newBox(x_loc, y_loc, x_offset, y_offset, grid_x_loc, grid_y_loc)
  56. var/obj/screenGrid/box/new_box = new(src)
  57. new_box.screen_loc = "[x_loc]:[x_offset],[y_loc]:[y_offset]"
  58. new_box.y_loc = y_loc
  59. new_box.name = "[grid_x_loc],[grid_y_loc]"
  60. new_box.loc_on_screen = "[grid_x_loc],[grid_y_loc]"
  61. //src.screen_grid["[grid_x_loc],[grid_y_loc]"] = new_box
  62. src.screen += new_box
  63.  
  64. configureBox(data, x_position = 1, y_position = 1, spacing = 1, icon_color = FONT_ICON)
  65. if(length(data) > textLength) data = "[copytext(data, 1, textLength)]"
  66. var/data_list = list(), x_pos = grid_MaxX, y_pos = grid_MaxY
  67. if(y_position) y_pos = y_position
  68. if(y_position <= grid_MinY)
  69. for(var/obj/screenGrid/box/target_box in src.screen) target_box.icon_state = null
  70. y_pos = grid_MaxX
  71. src.last_line = grid_MaxY
  72. var/new_icon_state = ""
  73. for(var/loop = 0, loop < length(data) + 1, )
  74. new_icon_state = copytext(data, loop, ++loop)
  75. data_list["[x_pos],[y_pos]"] = new_icon_state
  76. if(y_pos <= grid_MinY)
  77. y_pos = grid_MaxY
  78. src.last_line = grid_MaxY
  79. src.clearScreen()
  80. x_pos++
  81. if(x_pos >= grid_MaxX)
  82. x_pos = grid_MinX
  83. src.last_line -= spacing
  84. y_pos--
  85. y_pos--
  86. x_pos++
  87. src.last_line -= spacing
  88. src.changeStates(data_list, icon_color)
  89.  
  90. clearScreen()
  91. for(var/obj/screenGrid/box/target_box in src.screen)
  92. target_box.icon_state = null
  93.  
  94. changeStates(list/data, icon_color = FONT_ICON)
  95. for(var/obj/screenGrid/box/target_box in src.screen)
  96. if(target_box.loc_on_screen in data)
  97. target_box.icon = icon_color
  98. target_box.icon_state = data[target_box.loc_on_screen]
  99.  
  100. clearText(list/data)
  101. for(var/obj/screenGrid/box/target_box in src.screen)
  102. if(target_box.loc_on_screen == src.past_text_list[target_box.loc_on_screen])
  103. target_box.icon_state = ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement