mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 01:57:01 +00:00
* September TGU: Initial commit * September TGU: Updates wounds * some mob changes * September TGU: Removed infil tool parcel * September TGU: Spider path change * September TGU: Updated m_intent to move_intent * September TGU: Refactor of no_transform to trait * September TGU: Removes BEPIS machines o7 * September TGU: Vomit refactor * September TGU: Fixs typo * September TGU: FULP EDIT Adds our greyscales folder to a sanity check * September TGU: Implemented icon_for for beefmen * September TGU: Occupancy limits for shuttles * September TGU: Added bitrunning to helio * September TGU: Added bitrunning to selene * September TGU: Pubbystation bitrunning * September TGU: Added cams to bitrunner rooms * September TGU: Appeasing linter * September TGU: More linter appeasment * More linter * i love unit testing !!! * more unit test fixes * Maybe fixes screenshot test * Removes bitrunning unit test. This exact change has already been made on TG's master, right after i copied stuff over from there * Nah we just ignore it whatever * Accidentally updated maps.txt oopsie * Removes bitrunning unit tests This has already been done on TG * Fixed TGUI (missed a tg edit) * Made a TG edit more visible * Removing self-assigning objectives until we have a policy on that * Maps now use proper MOD crate * Ports chaplain offering fixes * Ported #78622 from TG * Merges helio rewiring * oooooh spooky Ports #79062 from upstream * Fixing mapping issues
57 lines
2.1 KiB
Plaintext
57 lines
2.1 KiB
Plaintext
///Returns an angle in degrees relative to the position of the mouse and that of the client eye.
|
|
/proc/mouse_angle_from_client(client/client, params)
|
|
if(!client)
|
|
return
|
|
var/list/modifiers = params2list(params)
|
|
if(!LAZYACCESS(modifiers, SCREEN_LOC))
|
|
return
|
|
var/list/screen_loc_params = splittext(LAZYACCESS(modifiers, SCREEN_LOC), ",")
|
|
var/list/screen_loc_X = splittext(screen_loc_params[1],":")
|
|
var/list/screen_loc_Y = splittext(screen_loc_params[2],":")
|
|
var/x = (text2num(screen_loc_X[1]) * 32 + text2num(screen_loc_X[2]) - 32)
|
|
var/y = (text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32)
|
|
var/list/screenview = getviewsize(client.view)
|
|
var/screenviewX = screenview[1] * world.icon_size
|
|
var/screenviewY = screenview[2] * world.icon_size
|
|
var/ox = round(screenviewX/2) - client.pixel_x //"origin" x
|
|
var/oy = round(screenviewY/2) - client.pixel_y //"origin" y
|
|
var/angle = SIMPLIFY_DEGREES(ATAN2(y - oy, x - ox))
|
|
return angle
|
|
|
|
//Wow, specific name!
|
|
/proc/mouse_absolute_datum_map_position_from_client(client/client)
|
|
if(!isloc(client.mob.loc))
|
|
return
|
|
var/list/modifiers = params2list(client.mouseParams)
|
|
var/atom/A = client.eye
|
|
var/turf/T = get_turf(A)
|
|
var/cx = T.x
|
|
var/cy = T.y
|
|
var/cz = T.z
|
|
if(LAZYACCESS(modifiers, SCREEN_LOC))
|
|
var/x = 0
|
|
var/y = 0
|
|
var/z = 0
|
|
var/p_x = 0
|
|
var/p_y = 0
|
|
//Split screen-loc up into X+Pixel_X and Y+Pixel_Y
|
|
var/list/screen_loc_params = splittext(LAZYACCESS(modifiers, SCREEN_LOC), ",")
|
|
//Split X+Pixel_X up into list(X, Pixel_X)
|
|
var/list/screen_loc_X = splittext(screen_loc_params[1],":")
|
|
//Split Y+Pixel_Y up into list(Y, Pixel_Y)
|
|
var/list/screen_loc_Y = splittext(screen_loc_params[2],":")
|
|
var/sx = text2num(screen_loc_X[1])
|
|
var/sy = text2num(screen_loc_Y[1])
|
|
//Get the resolution of the client's current screen size.
|
|
var/list/screenview = getviewsize(client.view)
|
|
var/svx = screenview[1]
|
|
var/svy = screenview[2]
|
|
var/cox = round((svx - 1) / 2)
|
|
var/coy = round((svy - 1) / 2)
|
|
x = cx + (sx - 1 - cox)
|
|
y = cy + (sy - 1 - coy)
|
|
z = cz
|
|
p_x = text2num(screen_loc_X[2])
|
|
p_y = text2num(screen_loc_Y[2])
|
|
return new /datum/position(x, y, z, p_x, p_y)
|