Minor deadchat control improvements (#21162)

* Add resist, improves attack

* Make emotes intentional too

* fix a qdel loop

* Add "help" command, start deadchat control with existing followers as well

* Minor messaging improvements
This commit is contained in:
Luc
2023-06-02 12:12:10 -07:00
committed by GitHub
parent 09132de5a6
commit b4cba9f981
4 changed files with 53 additions and 17 deletions
@@ -36,7 +36,7 @@
/datum/emote/living/carbon/clap/get_sound(mob/living/user)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(!H?.mind.miming)
if(!H?.mind?.miming)
return pick(
'sound/misc/clap1.ogg',
'sound/misc/clap2.ogg',
@@ -2070,22 +2070,44 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
/mob/living/carbon/human/proc/dchat_emote()
var/list/possible_emotes = list("scream", "clap", "snap", "crack", "dap", "burp")
emote(pick(possible_emotes))
emote(pick(possible_emotes), intentional = TRUE)
/mob/living/carbon/human/proc/dchat_attack()
/mob/living/carbon/human/proc/dchat_attack(intent)
var/turf/ahead = get_turf(get_step(src, dir))
var/mob/living/victim = locate(/mob/living) in ahead
var/in_hand = get_active_hand()
if(victim)
victim.attacked_by(in_hand, src, BODY_ZONE_CHEST)
var/atom/victim = locate(/mob/living) in ahead
var/obj/item/in_hand = get_active_hand()
var/implement = "[isnull(in_hand) ? "[p_their()] fists" : in_hand]"
if(!victim)
victim = locate(/obj/structure) in ahead
if(!victim)
switch(intent)
if(INTENT_HARM)
visible_message("<span class='warning'>[src] swings [implement] wildly!</span>")
if(INTENT_HELP)
visible_message("<span class='notice'>[src] seems to take a deep breath.</span>")
return
var/obj/structure/other_victim = locate(/obj/structure) in ahead
if(other_victim)
do_attack_animation(other_victim, used_item = in_hand)
other_victim.attacked_by(in_hand, src)
if(isLivingSSD(victim))
visible_message("<span class='notice'>[src] [intent == INTENT_HARM ? "reluctantly " : ""]lowers [p_their()] [implement].</span>")
return
visible_message("<span class='warning'>[src] swings [isnull(in_hand) ? "[p_their()] fists" : in_hand] wildly!")
var/original_intent = a_intent
a_intent = intent
if(in_hand)
in_hand.melee_attack_chain(src, victim)
else
UnarmedAttack(victim, TRUE)
a_intent = original_intent
/mob/living/carbon/human/proc/dchat_resist()
if(!can_resist())
visible_message("<span class='warning'>[src] seems to be unable to do anything!</span>")
return
if(!restrained())
visible_message("<span class='notice'>[src] seems to be doing nothing in particular.</span>")
return
visible_message("<span class='warning'>[src] is trying to break free!</span>")
resist()
/mob/living/carbon/human/proc/dchat_pickup()
var/turf/ahead = get_step(src, dir)
@@ -2138,10 +2160,12 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
/mob/living/carbon/human/deadchat_plays(mode = DEADCHAT_DEMOCRACY_MODE, cooldown = 7 SECONDS)
var/list/inputs = list(
"emote" = CALLBACK(src, PROC_REF(dchat_emote)),
"attack" = CALLBACK(src, PROC_REF(dchat_attack)),
"attack" = CALLBACK(src, PROC_REF(dchat_attack), INTENT_HARM),
"help" = CALLBACK(src, PROC_REF(dchat_attack), INTENT_HELP),
"pickup" = CALLBACK(src, PROC_REF(dchat_pickup)),
"throw" = CALLBACK(src, PROC_REF(dchat_throw)),
"disarm" = CALLBACK(src, PROC_REF(dchat_shove)),
"resist" = CALLBACK(src, PROC_REF(dchat_resist)),
)
AddComponent(/datum/component/deadchat_control/cardinal_movement, mode, inputs, cooldown)