From 34c8756f1e778723650a55d470fb2357172ea280 Mon Sep 17 00:00:00 2001
From: Pidgey <35320204+PidgeyThePirate@users.noreply.github.com>
Date: Tue, 20 Apr 2021 20:25:32 +1000
Subject: [PATCH 1/6] Added *spin to humans and cyborgs, gave the dog's tail
chase verb a 5 second cooldown.
---
code/modules/mob/living/carbon/human/emote.dm | 20 +++++++++++++++----
.../modules/mob/living/silicon/robot/emote.dm | 6 ++++++
.../mob/living/simple_animal/friendly/dog.dm | 7 +++++--
3 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm
index d80ab50e0b0..a5c78ed6766 100644
--- a/code/modules/mob/living/carbon/human/emote.dm
+++ b/code/modules/mob/living/carbon/human/emote.dm
@@ -128,12 +128,14 @@
on_CD = handle_emote_CD(50) //longer cooldown
if("fart", "farts", "flip", "flips", "snap", "snaps")
on_CD = handle_emote_CD() //proc located in code\modules\mob\emote.dm
- if("cough", "coughs", "highfive")
+ if("cough", "coughs", "slap", "slaps", "highfive")
on_CD = handle_emote_CD()
if("gasp", "gasps")
on_CD = handle_emote_CD()
if("deathgasp", "deathgasps")
on_CD = handle_emote_CD(50)
+ if("spin", "spins")
+ on_CD = handle_emote_CD(50)
if("sneeze", "sneezes")
on_CD = handle_emote_CD()
if("clap", "claps")
@@ -443,6 +445,17 @@
message = "[src] does a flip!"
SpinAnimation(5,1)
+ if("spin", "spins")
+ if(!restrained() && !lying)
+ if(prob(5))
+ INVOKE_ASYNC(src, .proc/spin, 30, 1)
+ message = "[src] spins too much!"
+ Dizzy(12)
+ Confused(12)
+ else
+ INVOKE_ASYNC(src, .proc/spin, 20, 1)
+ message = "[src] spins!"
+
if("aflap", "aflaps")
if(!restrained())
message = "[src] flaps [p_their()] wings ANGRILY!"
@@ -870,7 +883,7 @@
var/obj/item/slapper/N = new(src)
if(put_in_hands(N))
to_chat(src, "You ready your slapping hand.")
- else
+ else
qdel(N)
to_chat(src, "You're incapable of slapping in your current state.")
@@ -956,8 +969,7 @@
if("help")
var/emotelist = "aflap(s), airguitar, blink(s), blink(s)_r, blush(es), bow(s)-none/mob, burp(s), choke(s), chuckle(s), clap(s), collapse(s), cough(s), cry, cries, custom, dance, dap(s)-none/mob," \
+ " deathgasp(s), drool(s), eyebrow, fart(s), faint(s), flap(s), flip(s), frown(s), gasp(s), giggle(s), glare(s)-none/mob, grin(s), groan(s), grumble(s), grin(s)," \
- + " handshake-mob, hug(s)-none/mob, hem, highfive, johnny, jump, kiss(es), laugh(s), look(s)-none/mob, moan(s), mumble(s), nod(s), pale(s), point(s)-atom, quiver(s), raise(s), salute(s)-none/mob, scream(s), shake(s)," \
- + " shiver(s), shrug(s), sigh(s), signal(s)-#1-10, slap(s), smile(s),snap(s), sneeze(s), sniff(s), snore(s), stare(s)-none/mob, tremble(s), twitch(es), twitch(es)_s," \
+ + " shiver(s), shrug(s), sigh(s), signal(s)-#1-10,slap(s)-none/mob, smile(s),snap(s), sneeze(s), sniff(s), snore(s), spin(s) stare(s)-none/mob, tremble(s), twitch(es), twitch(es)_s," \
+ " wave(s), whimper(s), wink(s), yawn(s)"
switch(dna.species.name)
diff --git a/code/modules/mob/living/silicon/robot/emote.dm b/code/modules/mob/living/silicon/robot/emote.dm
index bec1e1ae668..5c066213978 100644
--- a/code/modules/mob/living/silicon/robot/emote.dm
+++ b/code/modules/mob/living/silicon/robot/emote.dm
@@ -13,6 +13,8 @@
//Cooldown-inducing emotes
if("law","flip","flips","halt") //halt is exempt because it's used to stop criminal scum //WHOEVER THOUGHT THAT WAS A GOOD IDEA IS GOING TO GET SHOT.
on_CD = handle_emote_CD() //proc located in code\modules\mob\emote.dm
+ if("spin","spins")
+ on_CD = handle_emote_CD(5 SECONDS)
//Everything else, including typos of the above emotes
else
on_CD = 0 //If it doesn't induce the cooldown, we won't check for the cooldown
@@ -157,6 +159,10 @@
message = "[src] does a flip!"
src.SpinAnimation(5,1)
+ if("spin","spins")
+ INVOKE_ASYNC(src, .proc/spin, 20, 1)
+ message = "[src] spins!"
+
if("help")
to_chat(src, "salute, bow-(none)/mob, clap, flap, aflap, twitch, twitches, nod, deathgasp, glare-(none)/mob, stare-(none)/mob, look,\n law, halt")
diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm
index 415d012b402..9092ffb8992 100644
--- a/code/modules/mob/living/simple_animal/friendly/dog.dm
+++ b/code/modules/mob/living/simple_animal/friendly/dog.dm
@@ -21,14 +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
/mob/living/simple_animal/pet/dog/verb/chasetail()
set name = "Chase your tail"
set desc = "d'awwww."
set category = "Dog"
- visible_message("[src] [pick("dances around", "chases [p_their()] tail")].", "[pick("You dance around", "You chase your tail")].")
- spin(20, 1)
+ if(next_spin <= 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
/mob/living/simple_animal/pet/dog/death(gibbed)
// Only execute the below if we successfully died
From d8e68cb445d332218e187e0eb0e690279f145595 Mon Sep 17 00:00:00 2001
From: Pidgey <35320204+PidgeyThePirate@users.noreply.github.com>
Date: Tue, 20 Apr 2021 20:28:37 +1000
Subject: [PATCH 2/6] forgot to add spin to robot *help
---
code/modules/mob/living/silicon/robot/emote.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/mob/living/silicon/robot/emote.dm b/code/modules/mob/living/silicon/robot/emote.dm
index 5c066213978..635783ee241 100644
--- a/code/modules/mob/living/silicon/robot/emote.dm
+++ b/code/modules/mob/living/silicon/robot/emote.dm
@@ -164,7 +164,7 @@
message = "[src] spins!"
if("help")
- to_chat(src, "salute, bow-(none)/mob, clap, flap, aflap, twitch, twitches, nod, deathgasp, glare-(none)/mob, stare-(none)/mob, look,\n law, halt")
+ to_chat(src, "salute, bow-(none)/mob, clap, flap, aflap, twitch, twitches, nod, deathgasp, glare-(none)/mob, stare-(none)/mob, look,\n law, halt, flip, spin")
..()
From ba3536a20c07d5a05191d6736c9c8b7695d4382f Mon Sep 17 00:00:00 2001
From: Pidgey <35320204+PidgeyThePirate@users.noreply.github.com>
Date: Tue, 20 Apr 2021 20:45:15 +1000
Subject: [PATCH 3/6] Okay, done being a dumbo now... I hope
---
code/modules/mob/living/carbon/human/emote.dm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm
index a5c78ed6766..3684014baa1 100644
--- a/code/modules/mob/living/carbon/human/emote.dm
+++ b/code/modules/mob/living/carbon/human/emote.dm
@@ -128,7 +128,7 @@
on_CD = handle_emote_CD(50) //longer cooldown
if("fart", "farts", "flip", "flips", "snap", "snaps")
on_CD = handle_emote_CD() //proc located in code\modules\mob\emote.dm
- if("cough", "coughs", "slap", "slaps", "highfive")
+ if("cough", "coughs", "highfive")
on_CD = handle_emote_CD()
if("gasp", "gasps")
on_CD = handle_emote_CD()
@@ -883,7 +883,7 @@
var/obj/item/slapper/N = new(src)
if(put_in_hands(N))
to_chat(src, "You ready your slapping hand.")
- else
+ else
qdel(N)
to_chat(src, "You're incapable of slapping in your current state.")
@@ -969,7 +969,8 @@
if("help")
var/emotelist = "aflap(s), airguitar, blink(s), blink(s)_r, blush(es), bow(s)-none/mob, burp(s), choke(s), chuckle(s), clap(s), collapse(s), cough(s), cry, cries, custom, dance, dap(s)-none/mob," \
+ " deathgasp(s), drool(s), eyebrow, fart(s), faint(s), flap(s), flip(s), frown(s), gasp(s), giggle(s), glare(s)-none/mob, grin(s), groan(s), grumble(s), grin(s)," \
- + " shiver(s), shrug(s), sigh(s), signal(s)-#1-10,slap(s)-none/mob, smile(s),snap(s), sneeze(s), sniff(s), snore(s), spin(s) stare(s)-none/mob, tremble(s), twitch(es), twitch(es)_s," \
+ + " handshake-mob, hug(s)-none/mob, hem, highfive, johnny, jump, kiss(es), laugh(s), look(s)-none/mob, moan(s), mumble(s), nod(s), pale(s), point(s)-atom, quiver(s), raise(s), salute(s)-none/mob, scream(s), shake(s)," \
+ + " shiver(s), shrug(s), sigh(s), signal(s)-#1-10, slap(s), smile(s),snap(s), sneeze(s), sniff(s), snore(s), spin(s) stare(s)-none/mob, tremble(s), twitch(es), twitch(es)_s," \
+ " wave(s), whimper(s), wink(s), yawn(s)"
switch(dna.species.name)
From a15a20b8e17616f1fe6cd3c8a2817d752d02de50 Mon Sep 17 00:00:00 2001
From: Pidgey <35320204+PidgeyThePirate@users.noreply.github.com>
Date: Tue, 20 Apr 2021 22:04:37 +1000
Subject: [PATCH 4/6] Now look what you've done. Hope I did this right.
---
code/modules/mob/living/carbon/human/emote.dm | 4 +-
.../modules/mob/living/silicon/robot/emote.dm | 2 +-
code/modules/mob/mob.dm | 56 ++++++++++++++-----
3 files changed, 45 insertions(+), 17 deletions(-)
diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm
index 3684014baa1..8881832eade 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))
- INVOKE_ASYNC(src, .proc/spin, 30, 1)
+ spin(30, 1, spin_direction = 2)
message = "[src] spins too much!"
Dizzy(12)
Confused(12)
else
- INVOKE_ASYNC(src, .proc/spin, 20, 1)
+ spin(20, 1, spin_direction = 2)
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 635783ee241..fc874889fc0 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")
- INVOKE_ASYNC(src, .proc/spin, 20, 1)
+ spin(20, 1, spin_direction = 2)
message = "[src] spins!"
if("help")
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 95538b18995..6907a2d26c8 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -1343,24 +1343,52 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
/mob/proc/can_resist()
return FALSE //overridden in living.dm
-/mob/proc/spin(spintime, speed)
+#define SPIN_DIRECTION_CLOCKWISE 0
+#define SPIN_DIRECTION_COUNTERCLOCKWISE 1
+#define SPIN_DIRECTION_RANDOM 2
+
+/mob/proc/spin(spintime, speed, spin_direction = SPIN_DIRECTION_CLOCKWISE)
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
- 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
+ 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
+
+#undef SPIN_DIRECTION_CLOCKWISE
+#undef SPIN_DIRECTION_COUNTERCLOCKWISE
+#undef SPIN_DIRECTION_RANDOM
/mob/proc/is_literate()
return FALSE
From 150d0e4f3b38e27703434a25afcb4022bc84e27c Mon Sep 17 00:00:00 2001
From: Pidgey <35320204+PidgeyThePirate@users.noreply.github.com>
Date: Tue, 20 Apr 2021 22:41:45 +1000
Subject: [PATCH 5/6] Implemented Flatty Patty's nicer spin() function. Works
great! Also makes the dog cooldown the message rather than the action.
---
code/modules/mob/living/carbon/human/emote.dm | 4 +-
.../modules/mob/living/silicon/robot/emote.dm | 2 +-
.../mob/living/simple_animal/friendly/dog.dm | 8 ++--
code/modules/mob/mob.dm | 44 ++++---------------
4 files changed, 16 insertions(+), 42 deletions(-)
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
From 5c7e8cc3a00bc5fda145b3501ba2a5a89c511d34 Mon Sep 17 00:00:00 2001
From: Pidgey <35320204+PidgeyThePirate@users.noreply.github.com>
Date: Wed, 21 Apr 2021 01:44:02 +1000
Subject: [PATCH 6/6] forgot to remove some unused defs
---
code/modules/mob/mob.dm | 8 --------
1 file changed, 8 deletions(-)
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 41d0d9aa8af..8eb59b8ad5a 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -1343,10 +1343,6 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
/mob/proc/can_resist()
return FALSE //overridden in living.dm
-#define SPIN_DIRECTION_CLOCKWISE 0
-#define SPIN_DIRECTION_COUNTERCLOCKWISE 1
-#define SPIN_DIRECTION_RANDOM 2
-
/mob/proc/spin(spintime, speed)
set waitfor = 0
if(!spintime || !speed || spintime > 100)
@@ -1360,10 +1356,6 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
else
dir = turn(dir, -90)
-#undef SPIN_DIRECTION_CLOCKWISE
-#undef SPIN_DIRECTION_COUNTERCLOCKWISE
-#undef SPIN_DIRECTION_RANDOM
-
/mob/proc/is_literate()
return FALSE