Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define DEBUG
- #define FONT_ICON 'font_icon.dmi'
- #define grid_MaxX world.view * 2
- #define grid_MaxY world.view * 2
- #define grid_MinX 0
- #define grid_MinY 1
- #define textLength 60
- obj
- screenGrid
- box
- icon = FONT_ICON
- layer = MOB_LAYER + 10
- var
- y_loc = 0
- loc_on_screen = ""
- mob
- verb
- say_something(msg as text)
- src.client.configureBox(msg, 10, 1, 1, FONT_ICON)
- client
- New()
- src.generateGrid()
- ..()
- client
- var
- last_line
- next_line
- tile_size = 16
- list/screen_grid[]
- //list/grid_lines[]
- chat_delay
- past_text_list
- proc
- generateGrid()
- var/width_limit = grid_MaxX * 2 - 2, height_limit = grid_MaxY * 2 - 2
- var/x_offset = 0, y_offset = 0, x_loc = 1, y_loc = 1, grid_x_loc = 1, grid_y_loc = 1
- for(var/x_value = 1, x_value <= width_limit, x_value++)
- spawn(1) src.newBox(x_loc, y_loc, x_offset+src.tile_size, y_offset, grid_x_loc, grid_y_loc)
- x_offset += src.tile_size
- grid_x_loc++
- if(x_offset > src.tile_size)
- x_offset = 0
- x_loc++
- spawn(1)
- grid_y_loc++
- y_offset += src.tile_size
- for(var/y_value = 1, y_value <= height_limit, y_value++)
- spawn(1) src.newBox(x_loc, y_loc, x_offset, y_offset, grid_x_loc-1, grid_y_loc)
- y_offset += src.tile_size
- grid_y_loc++
- if(y_offset > src.tile_size)
- y_offset = 0
- y_loc++
- newBox(x_loc, y_loc, x_offset, y_offset, grid_x_loc, grid_y_loc)
- var/obj/screenGrid/box/new_box = new(src)
- new_box.screen_loc = "[x_loc]:[x_offset],[y_loc]:[y_offset]"
- new_box.y_loc = y_loc
- new_box.name = "[grid_x_loc],[grid_y_loc]"
- new_box.loc_on_screen = "[grid_x_loc],[grid_y_loc]"
- //src.screen_grid["[grid_x_loc],[grid_y_loc]"] = new_box
- src.screen += new_box
- configureBox(data, x_position = 1, y_position = 1, spacing = 1, icon_color = FONT_ICON)
- if(length(data) > textLength) data = "[copytext(data, 1, textLength)]"
- var/data_list = list(), x_pos = grid_MaxX, y_pos = grid_MaxY
- if(y_position) y_pos = y_position
- if(y_position <= grid_MinY)
- for(var/obj/screenGrid/box/target_box in src.screen) target_box.icon_state = null
- y_pos = grid_MaxX
- src.last_line = grid_MaxY
- var/new_icon_state = ""
- for(var/loop = 0, loop < length(data) + 1, )
- new_icon_state = copytext(data, loop, ++loop)
- data_list["[x_pos],[y_pos]"] = new_icon_state
- if(y_pos <= grid_MinY)
- y_pos = grid_MaxY
- src.last_line = grid_MaxY
- src.clearScreen()
- x_pos++
- if(x_pos >= grid_MaxX)
- x_pos = grid_MinX
- src.last_line -= spacing
- y_pos--
- y_pos--
- x_pos++
- src.last_line -= spacing
- src.changeStates(data_list, icon_color)
- clearScreen()
- for(var/obj/screenGrid/box/target_box in src.screen)
- target_box.icon_state = null
- changeStates(list/data, icon_color = FONT_ICON)
- for(var/obj/screenGrid/box/target_box in src.screen)
- if(target_box.loc_on_screen in data)
- target_box.icon = icon_color
- target_box.icon_state = data[target_box.loc_on_screen]
- clearText(list/data)
- for(var/obj/screenGrid/box/target_box in src.screen)
- if(target_box.loc_on_screen == src.past_text_list[target_box.loc_on_screen])
- target_box.icon_state = ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement