StatHud1 parent_type = /HudGroup icon = 'chatboxicons.dmi' layer = MOB_LAYER + 50 font = new /Font/TrebuchetMS() var/width = 6 var/height = 14
var/width_limit var list/lines = list() next_line =1 New(mob/m, line_count) ..(m)
add(2, 2, icon_state = "center", width = width, height = height, layer = MOB_LAYER + 59) width_limit = (width*32)
for(var/tmp/i = 1 to line_count)
var/py = (line_count - i) * 16
lines += add(0, py)
add(-30, 2, "L", width = 1, height = height, layer = MOB_LAYER + 59)
add(2, -30, "B", width = width, height = 1, layer = MOB_LAYER + 59)
add(2,height*32+2, "T", width = width, height = 1, layer = MOB_LAYER + 59)
add(width*32+2, 2, "R", width = 1, height = height, layer = MOB_LAYER + 59)
add(-30, -30, "BL", layer = MOB_LAYER + 59)
add(width*32+2, -30, "BR", layer = MOB_LAYER + 59)
add(-30, height*32+2, "TL", layer = MOB_LAYER + 59)
add(width*32+2, height*32+2, "TR", layer = MOB_LAYER + 59)
pos(45, 40)
hide()
StatHud2 parent_type = /HudGroup icon = 'chatboxicons.dmi' layer = MOB_LAYER + 50 font = new /Font/TrebuchetMS() var/width = 6 var/height = 14
var/width_limit var list/lines = list() next_line =1 New(mob/m, line_count) ..(m)
add(2, 2, icon_state = "center", width = width, height = height, layer = MOB_LAYER + 59) width_limit = (width*32)
for(var/tmp/i = 1 to line_count)
var/py = (line_count - i) * 16
lines += add(0, py)
add(-30, 2, "L", width = 1, height = height, layer = MOB_LAYER + 59)
add(2, -30, "B", width = width, height = 1, layer = MOB_LAYER + 59)
add(2,height*32+2, "T", width = width, height = 1, layer = MOB_LAYER + 59)
add(width*32+2, 2, "R", width = 1, height = height, layer = MOB_LAYER + 59)
add(-30, -30, "BL", layer = MOB_LAYER + 59)
add(width*32+2, -30, "BR", layer = MOB_LAYER + 59)
add(-30, height*32+2, "TL", layer = MOB_LAYER + 59)
add(width*32+2, height*32+2, "TR", layer = MOB_LAYER + 59)
pos(270, 40)
hide()
StatHud3 parent_type = /HudGroup icon = 'chatboxicons.dmi' layer = MOB_LAYER + 50 font = new /Font/TrebuchetMS() var/width = 6 var/height = 14
var/width_limit var list/lines = list() next_line =1 New(mob/m, line_count) ..(m)
add(2, 2, icon_state = "center", width = width, height = height, layer = MOB_LAYER + 59) width_limit = (width*32)
for(var/tmp/i = 1 to line_count)
var/py = (line_count - i) * 16
lines += add(0, py)
add(-30, 2, "L", width = 1, height = height, layer = MOB_LAYER + 59)
add(2, -30, "B", width = width, height = 1, layer = MOB_LAYER + 59)
add(2,height*32+2, "T", width = width, height = 1, layer = MOB_LAYER + 59)
add(width*32+2, 2, "R", width = 1, height = height, layer = MOB_LAYER + 59)
add(-30, -30, "BL", layer = MOB_LAYER + 59)
add(width*32+2, -30, "BR", layer = MOB_LAYER + 59)
add(-30, height*32+2, "TL", layer = MOB_LAYER + 59)
add(width*32+2, height*32+2, "TR", layer = MOB_LAYER + 59)
pos(495, 40)
hide()
|
The first thing I noticed is that the only difference between StatHud1, StatHud2, and StatHud3 appears to be their position. You can make them all inherit from the same base object:
This won't improve performance, but it makes it a lot easier to work with the code. Also, if there is a performace change you make, it'll automatically be applied to StatHud1, StatHud2, and StatHud3.
Also, it looks like your update procs (mob.StatHolderUpdate, mob.EquipAndSkillholderUpdate, and mob.QuestandInfoHolderUpdate) are updating all of the text - if your level changes, in StatHolderUpdate, you're regenerating all of the text. I'd do something like this:
This way you're only updating values when they change. But, since the StatHud object is specific to displaying stats, you have to create similar objects for displaying quest and equipment info.
I do plan to look into maptext to see if it's possible to make the library use that. There are reasons to not use it, but it should certainly be an option available to developers. My biggest concern is how it positions text - if the library does add maptext support you may have to change the positions of the screen objects you're attaching text to to have the text appear in the same place.