diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index 8881832eade..875d184775c 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -448,12 +448,12 @@ if("spin", "spins") if(!restrained() && !lying) if(prob(5)) - spin(30, 1, spin_direction = 2) + spin(30, 1) message = "[src] spins too much!" Dizzy(12) Confused(12) else - spin(20, 1, spin_direction = 2) + spin(20, 1) message = "[src] spins!" if("aflap", "aflaps") diff --git a/code/modules/mob/living/silicon/robot/emote.dm b/code/modules/mob/living/silicon/robot/emote.dm index fc874889fc0..36dea666cc5 100644 --- a/code/modules/mob/living/silicon/robot/emote.dm +++ b/code/modules/mob/living/silicon/robot/emote.dm @@ -160,7 +160,7 @@ src.SpinAnimation(5,1) if("spin","spins") - spin(20, 1, spin_direction = 2) + spin(20, 1) message = "[src] spins!" if("help") diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 9092ffb8992..726798c0392 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -21,17 +21,17 @@ var/yelp_sound = 'sound/creatures/dog_yelp.ogg' //Used on death. var/last_eaten = 0 footstep_type = FOOTSTEP_MOB_CLAW - var/next_spin = 0 + var/next_spin_message = 0 /mob/living/simple_animal/pet/dog/verb/chasetail() set name = "Chase your tail" set desc = "d'awwww." set category = "Dog" - if(next_spin <= world.time) + if(next_spin_message <= world.time) visible_message("[src] [pick("dances around", "chases [p_their()] tail")].", "[pick("You dance around", "You chase your tail")].") - spin(20, 1) - next_spin = world.time + 5 SECONDS + next_spin_message = world.time + 5 SECONDS + spin(20, 1) /mob/living/simple_animal/pet/dog/death(gibbed) // Only execute the below if we successfully died diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 6907a2d26c8..41d0d9aa8af 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1347,44 +1347,18 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \ #define SPIN_DIRECTION_COUNTERCLOCKWISE 1 #define SPIN_DIRECTION_RANDOM 2 -/mob/proc/spin(spintime, speed, spin_direction = SPIN_DIRECTION_CLOCKWISE) +/mob/proc/spin(spintime, speed) set waitfor = 0 if(!spintime || !speed || spintime > 100) CRASH("Aborted attempted call of /mob/proc/spin with invalid args ([spintime],[speed]) which could have frozen the server.") - var/D = dir - var/S - if(spin_direction == SPIN_DIRECTION_CLOCKWISE || spin_direction == SPIN_DIRECTION_COUNTERCLOCKWISE) - S = spin_direction - else - S = pick(SPIN_DIRECTION_CLOCKWISE,SPIN_DIRECTION_COUNTERCLOCKWISE) - if(S == SPIN_DIRECTION_CLOCKWISE) - while(spintime >= speed) - sleep(speed) - switch(D) - if(NORTH) - D = EAST - if(SOUTH) - D = WEST - if(EAST) - D = SOUTH - if(WEST) - D = NORTH - setDir(D) - spintime -= speed - else - while(spintime >= speed) - sleep(speed) - switch(D) - if(NORTH) - D = WEST - if(SOUTH) - D = EAST - if(EAST) - D = NORTH - if(WEST) - D = SOUTH - setDir(D) - spintime -= speed + var/end_time = world.time + spintime + var/spin_dir = prob(50) + while(world.time <= end_time) + sleep(speed) + if(spin_dir) + dir = turn(dir, 90) + else + dir = turn(dir, -90) #undef SPIN_DIRECTION_CLOCKWISE #undef SPIN_DIRECTION_COUNTERCLOCKWISE