mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com> Co-authored-by: Kashargul <KashL@t-online.de>
26 lines
802 B
Plaintext
26 lines
802 B
Plaintext
/proc/getviewsize(view)
|
|
var/viewX
|
|
var/viewY
|
|
if(isnum(view))
|
|
var/totalviewrange = 1 + 2 * view
|
|
viewX = totalviewrange
|
|
viewY = totalviewrange
|
|
else
|
|
var/list/viewrangelist = splittext(view,"x")
|
|
viewX = text2num(viewrangelist[1])
|
|
viewY = text2num(viewrangelist[2])
|
|
return list(viewX, viewY)
|
|
|
|
/// Takes a string or num view, and converts it to pixel width/height in a list(pixel_width, pixel_height)
|
|
/proc/view_to_pixels(view)
|
|
if(!view)
|
|
return list(0, 0)
|
|
var/list/view_info = getviewsize(view)
|
|
view_info[1] *= ICON_SIZE_X
|
|
view_info[2] *= ICON_SIZE_Y
|
|
return view_info
|
|
|
|
// Used to get `atom/O as obj|mob|turf in view()` to match against strings containing apostrophes immediately after substrings that match to other objects. Somehow. - Ater
|
|
/proc/_validate_atom(atom/A)
|
|
return view()
|