diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 79c7b682a38..141ad4d5405 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -324,8 +324,11 @@ I.Move(loc) var/list/click_params = params2list(params) //Center the icon where the user clicked. - I.pixel_x = (text2num(click_params["icon-x"]) - 16) - I.pixel_y = (text2num(click_params["icon-y"]) - 16) + if(!click_params || !click_params["icon-x"] || !click_params["icon-y"]) + return + //Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf) + I.pixel_x = Clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2) + I.pixel_y = Clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2) /*