Implemented Flatty Patty's nicer spin() function. Works great! Also makes the dog cooldown the message rather than the action.

This commit is contained in:
Pidgey
2021-04-20 22:41:45 +10:00
parent a15a20b8e1
commit 150d0e4f3b
4 changed files with 16 additions and 42 deletions
@@ -448,12 +448,12 @@
if("spin", "spins")
if(!restrained() && !lying)
if(prob(5))
spin(30, 1, spin_direction = 2)
spin(30, 1)
message = "<B>[src]</B> spins too much!"
Dizzy(12)
Confused(12)
else
spin(20, 1, spin_direction = 2)
spin(20, 1)
message = "<B>[src]</B> spins!"
if("aflap", "aflaps")
@@ -160,7 +160,7 @@
src.SpinAnimation(5,1)
if("spin","spins")
spin(20, 1, spin_direction = 2)
spin(20, 1)
message = "<B>[src]</B> spins!"
if("help")
@@ -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
+9 -35
View File
@@ -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