mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-26 01:22:03 +00:00
* Adds SIGNAL_HANDLER and SIGNAL_HANDLER_DOES_SLEEP to prevent signal callbacks from blocking (#52761) Adds SIGNAL_HANDLER, a macro that sets SHOULD_NOT_SLEEP(TRUE). This should ideally be required on all new signal callbacks. Adds BLOCKING_SIGNAL_HANDLER, a macro that does nothing except symbolize "this is an older signal that didn't necessitate a code rewrite". It should not be allowed for new work. This comes from discussion around #52735, which yields by calling input, and (though it sets the return type beforehand) will not properly return the flag to prevent attack from slapping. To fix 60% of the yielding cases, WrapAdminProcCall no longer waits for another admin's proc call to finish. I'm not an admin, so I don't know how many behinds this has saved, but if this is problematic for admins I can just make it so that it lets you do it anyway. I'm not sure what the point of this babysitting was anyway. Requested by @optimumtact. Changelog cl admin: Calling a proc while another admin is calling one will no longer wait for the first to finish. You will simply just have to call it again. /cl * Adds SIGNAL_HANDLER and SIGNAL_HANDLER_DOES_SLEEP to prevent signal callbacks from blocking Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
91 lines
3.3 KiB
Plaintext
91 lines
3.3 KiB
Plaintext
//Hulk turns your skin green, makes you strong, and allows you to shrug off stun effect.
|
|
/datum/mutation/human/hulk
|
|
name = "Hulk"
|
|
desc = "A poorly understood genome that causes the holder's muscles to expand, inhibit speech and gives the person a bad skin condition."
|
|
quality = POSITIVE
|
|
locked = TRUE
|
|
difficulty = 16
|
|
text_gain_indication = "<span class='notice'>Your muscles hurt!</span>"
|
|
species_allowed = list("human") //no skeleton/lizard hulk
|
|
health_req = 25
|
|
instability = 40
|
|
var/scream_delay = 50
|
|
var/last_scream = 0
|
|
|
|
|
|
/datum/mutation/human/hulk/on_acquiring(mob/living/carbon/human/owner)
|
|
if(..())
|
|
return
|
|
ADD_TRAIT(owner, TRAIT_STUNIMMUNE, GENETIC_MUTATION)
|
|
ADD_TRAIT(owner, TRAIT_PUSHIMMUNE, GENETIC_MUTATION)
|
|
ADD_TRAIT(owner, TRAIT_CHUNKYFINGERS, GENETIC_MUTATION)
|
|
ADD_TRAIT(owner, TRAIT_IGNOREDAMAGESLOWDOWN, GENETIC_MUTATION)
|
|
ADD_TRAIT(owner, TRAIT_HULK, GENETIC_MUTATION)
|
|
owner.update_body_parts()
|
|
SEND_SIGNAL(owner, COMSIG_ADD_MOOD_EVENT, "hulk", /datum/mood_event/hulk)
|
|
RegisterSignal(owner, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, .proc/on_attack_hand)
|
|
RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech)
|
|
|
|
/datum/mutation/human/hulk/proc/on_attack_hand(mob/living/carbon/human/source, atom/target, proximity)
|
|
SIGNAL_HANDLER_DOES_SLEEP
|
|
|
|
if(!proximity)
|
|
return
|
|
if(source.a_intent != INTENT_HARM)
|
|
return
|
|
if(target.attack_hulk(owner))
|
|
if(world.time > (last_scream + scream_delay))
|
|
last_scream = world.time
|
|
source.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ), forced="hulk")
|
|
log_combat(source, target, "punched", "hulk powers")
|
|
source.do_attack_animation(target, ATTACK_EFFECT_SMASH)
|
|
source.changeNext_move(CLICK_CD_MELEE)
|
|
|
|
return COMPONENT_NO_ATTACK_HAND
|
|
|
|
|
|
/**
|
|
*Checks damage of a hulk's arm and applies bone wounds as necessary.
|
|
*
|
|
*Called by specific atoms being attacked, such as walls. If an atom
|
|
*does not call this proc, than punching that atom will not cause
|
|
*arm breaking (even if the atom deals recoil damage to hulks).
|
|
*Arguments:
|
|
*arg1 is the arm to evaluate damage of and possibly break.
|
|
*/
|
|
/datum/mutation/human/hulk/proc/break_an_arm(obj/item/bodypart/arm)
|
|
switch(arm.brute_dam)
|
|
if(45 to 50)
|
|
arm.force_wound_upwards(/datum/wound/blunt/critical)
|
|
if(41 to 45)
|
|
arm.force_wound_upwards(/datum/wound/blunt/severe)
|
|
if(35 to 41)
|
|
arm.force_wound_upwards(/datum/wound/blunt/moderate)
|
|
|
|
/datum/mutation/human/hulk/on_life()
|
|
if(owner.health < 0)
|
|
on_losing(owner)
|
|
to_chat(owner, "<span class='danger'>You suddenly feel very weak.</span>")
|
|
|
|
/datum/mutation/human/hulk/on_losing(mob/living/carbon/human/owner)
|
|
if(..())
|
|
return
|
|
REMOVE_TRAIT(owner, TRAIT_STUNIMMUNE, GENETIC_MUTATION)
|
|
REMOVE_TRAIT(owner, TRAIT_PUSHIMMUNE, GENETIC_MUTATION)
|
|
REMOVE_TRAIT(owner, TRAIT_CHUNKYFINGERS, GENETIC_MUTATION)
|
|
REMOVE_TRAIT(owner, TRAIT_IGNOREDAMAGESLOWDOWN, GENETIC_MUTATION)
|
|
REMOVE_TRAIT(owner, TRAIT_HULK, GENETIC_MUTATION)
|
|
owner.update_body_parts()
|
|
SEND_SIGNAL(owner, COMSIG_CLEAR_MOOD_EVENT, "hulk")
|
|
UnregisterSignal(owner, COMSIG_HUMAN_EARLY_UNARMED_ATTACK)
|
|
UnregisterSignal(owner, COMSIG_MOB_SAY)
|
|
|
|
/datum/mutation/human/hulk/proc/handle_speech(original_message, wrapped_message)
|
|
SIGNAL_HANDLER
|
|
|
|
var/message = wrapped_message[1]
|
|
if(message)
|
|
message = "[replacetext(message, ".", "!")]!!"
|
|
wrapped_message[1] = message
|
|
return COMPONENT_UPPERCASE_SPEECH
|