<commit_before>/*
All shuttleRotate procs go here
*/

/************************************Base proc************************************/

/atom/proc/shuttleRotate(rotation)
	//rotate our direction
	setDir(angle2dir(rotation+dir2angle(dir)))

	//resmooth if need be.
	if(smooth)
		queue_smooth(src)

	//rotate the pixel offsets too.
	if (pixel_x || pixel_y)
		if (rotation < 0)
			rotation += 360
		for (var/turntimes=rotation/90;turntimes>0;turntimes--)
			var/oldPX = pixel_x
			var/oldPY = pixel_y
			pixel_x = oldPY
			pixel_y = (oldPX*(-1))

/************************************Turf rotate procs************************************/

/turf/closed/mineral/shuttleRotate(rotation)
	setDir(angle2dir(rotation+dir2angle(dir)))
	queue_smooth(src)

/************************************Mob rotate procs************************************/

//override to avoid rotating pixel_xy on mobs
/mob/shuttleRotate(rotation)
	setDir(angle2dir(rotation+dir2angle(dir)))

/************************************Structure rotate procs************************************/

/obj/structure/door_assembly/door_assembly_pod/shuttleRotate(rotation)
	. = ..()
	expected_dir = angle2dir(rotation+dir2angle(dir))

/obj/structure/cable/shuttleRotate(rotation)
	//..() is not called because wires are not supposed to have a non-default direction
	//Rotate connections
	if(d1)
		d1 = angle2dir(rotation+dir2angle(d1))
	if(d2)
		d2 = angle2dir(rotation+dir2angle(d2))

	//d1 should be less than d2 for cable icons to work
	if(d1 > d2)
		var/temp = d1
		d1 = d2
		d2 = temp
	update_icon()<commit_msg>fixes directionless ghosts having direction (#31405)<commit_after>/*
All shuttleRotate procs go here

If ever any of these procs are useful for non-shuttles, rename it to proc/rotate and move it to be a generic atom proc
*/

/************************************Base proc************************************/

/atom/proc/shuttleRotate(rotation)
	//rotate our direction
	setDir(angle2dir(rotation+dir2angle(dir)))

	//resmooth if need be.
	if(smooth)
		queue_smooth(src)

	//rotate the pixel offsets too.
	if (pixel_x || pixel_y)
		if (rotation < 0)
			rotation += 360
		for (var/turntimes=rotation/90;turntimes>0;turntimes--)
			var/oldPX = pixel_x
			var/oldPY = pixel_y
			pixel_x = oldPY
			pixel_y = (oldPX*(-1))

/************************************Turf rotate procs************************************/

/turf/closed/mineral/shuttleRotate(rotation)
	setDir(angle2dir(rotation+dir2angle(dir)))
	queue_smooth(src)

/************************************Mob rotate procs************************************/

//override to avoid rotating pixel_xy on mobs
/mob/shuttleRotate(rotation)
	setDir(angle2dir(rotation+dir2angle(dir)))

/mob/dead/observer/shuttleRotate(rotation)
	. = ..()
	update_icon()

/************************************Structure rotate procs************************************/

/obj/structure/door_assembly/door_assembly_pod/shuttleRotate(rotation)
	. = ..()
	expected_dir = angle2dir(rotation+dir2angle(dir))

/obj/structure/cable/shuttleRotate(rotation)
	//..() is not called because wires are not supposed to have a non-default direction
	//Rotate connections
	if(d1)
		d1 = angle2dir(rotation+dir2angle(d1))
	if(d2)
		d2 = angle2dir(rotation+dir2angle(d2))

	//d1 should be less than d2 for cable icons to work
	if(d1 > d2)
		var/temp = d1
		d1 = d2
		d2 = temp
	update_icon()
{'fraction_non_alphanumeric': 0.2708950800237107, 'fraction_numerical': 0.021636040308239478, 'mean_word_length': 5.284916201117318, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2218139', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1080, 'n_words': 245}