Merge pull request #15848 from shellspeed1/full-auto-port-from-tg-Credit-to-Fikou
Port of a bunch of stuff to update guns at this point because we have a bunch of stuff we are missing.
This commit is contained in:
@@ -673,6 +673,27 @@ Turf and target are separate in case you want to teleport some distance from a t
|
||||
if(final_x || final_y)
|
||||
return locate(final_x, final_y, T.z)
|
||||
|
||||
///Returns a turf based on text inputs, original turf and viewing client
|
||||
/proc/parse_caught_click_modifiers(list/modifiers, turf/origin, client/viewing_client)
|
||||
if(!modifiers)
|
||||
return null
|
||||
|
||||
var/screen_loc = splittext(LAZYACCESS(modifiers, SCREEN_LOC), ",")
|
||||
var/list/actual_view = getviewsize(viewing_client ? viewing_client.view : world.view)
|
||||
var/click_turf_x = splittext(screen_loc[1], ":")
|
||||
var/click_turf_y = splittext(screen_loc[2], ":")
|
||||
var/click_turf_z = origin.z
|
||||
|
||||
var/click_turf_px = text2num(click_turf_x[2])
|
||||
var/click_turf_py = text2num(click_turf_y[2])
|
||||
click_turf_x = origin.x + text2num(click_turf_x[1]) - round(actual_view[1] / 2) - 1
|
||||
click_turf_y = origin.y + text2num(click_turf_y[1]) - round(actual_view[2] / 2) - 1
|
||||
|
||||
var/turf/click_turf = locate(clamp(click_turf_x, 1, world.maxx), clamp(click_turf_y, 1, world.maxy), click_turf_z)
|
||||
LAZYSET(modifiers, ICON_X, "[(click_turf_px - click_turf.pixel_x) + ((click_turf_x - click_turf.x) * world.icon_size)]")
|
||||
LAZYSET(modifiers, ICON_Y, "[(click_turf_py - click_turf.pixel_y) + ((click_turf_y - click_turf.y) * world.icon_size)]")
|
||||
return click_turf
|
||||
|
||||
//Finds the distance between two atoms, in pixels
|
||||
//centered = FALSE counts from turf edge to edge
|
||||
//centered = TRUE counts from turf center to turf center
|
||||
|
||||
Reference in New Issue
Block a user