From eebd8d782f9cb905d3165b06850ec83d1786ed15 Mon Sep 17 00:00:00 2001 From: Citinited Date: Sat, 5 Jan 2019 16:50:11 +0000 Subject: [PATCH] Uses squeak component to do this, fixes broken stuff & Travis --- code/__DEFINES/components.dm | 4 -- code/_onclick/item_attack.dm | 2 +- code/datums/components/jestosterone.dm | 44 +------------- code/datums/components/squeak.dm | 17 ++++-- code/modules/mob/living/carbon/human/say.dm | 3 +- .../living/carbon/human/species/_species.dm | 2 +- code/modules/mob/living/living.dm | 4 +- code/modules/mob/living/living_defense.dm | 1 - code/modules/reagents/chemistry/holder.dm | 2 +- .../reagents/chemistry/reagents/misc.dm | 60 +++++++++++++++---- 10 files changed, 70 insertions(+), 69 deletions(-) diff --git a/code/__DEFINES/components.dm b/code/__DEFINES/components.dm index 8bf1fa25429..87b9094b47e 100644 --- a/code/__DEFINES/components.dm +++ b/code/__DEFINES/components.dm @@ -55,7 +55,6 @@ #define COMSIG_ATOM_FIRE_ACT "atom_fire_act" //from base of atom/fire_act(): (exposed_temperature, exposed_volume) #define COMSIG_ATOM_BULLET_ACT "atom_bullet_act" //from base of atom/bullet_act(): (/obj/item/projectile, def_zone) #define COMSIG_ATOM_BLOB_ACT "atom_blob_act" //from base of atom/blob_act(): (/obj/structure/blob) -#define COMSIG_ATOM_ATTACK_ALIEN "atom_attack_alien" //from base of atom/attack_alien() #define COMSIG_ATOM_ACID_ACT "atom_acid_act" //from base of atom/acid_act(): (acidpwr, acid_volume) #define COMSIG_ATOM_EMAG_ACT "atom_emag_act" //from base of atom/emag_act(): () #define COMSIG_ATOM_RAD_ACT "atom_rad_act" //from base of atom/rad_act(intensity) @@ -221,9 +220,6 @@ //Food #define COMSIG_FOOD_EATEN "food_eaten" //from base of obj/item/reagent_containers/food/snacks/attack(): (mob/living/eater, mob/feeder) -//Reagents -#define COMSIG_ON_MOB_LIFE "on_mob_life" //Called when a reagent calls on_mob_life - //Mood #define COMSIG_ADD_MOOD_EVENT "add_mood" //Called when you send a mood event from anywhere in the code. #define COMSIG_CLEAR_MOOD_EVENT "clear_mood" //Called when you clear a mood event from anywhere in the code. diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index da462cb97ed..87d0a3e93b1 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -64,7 +64,7 @@ if(!force) playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), 1, -1) else - M.SendSignal(COMSIG_ITEM_ATTACK, M) + SEND_SIGNAL(M, COMSIG_ITEM_ATTACK) if(hitsound) playsound(loc, hitsound, get_clamped_volume(), 1, -1) diff --git a/code/datums/components/jestosterone.dm b/code/datums/components/jestosterone.dm index 82ad7e57436..f37f1f03efb 100644 --- a/code/datums/components/jestosterone.dm +++ b/code/datums/components/jestosterone.dm @@ -1,43 +1,5 @@ /datum/component/jestosterone - var/mob_is_clown //Is the affected mob a clown? + var/mind_type //Is the affected mob a clown / mime? -/datum/component/jestosterone/Initialize(mob/user, is_this_mob_a_clown) - mob_is_clown = is_this_mob_a_clown - if(mob_is_clown) - to_chat(user, "Whatever that was, it feels great!") - else - to_chat(user, "Something doesn't feel right...") - RegisterSignal(COMSIG_MOVABLE_MOVED, .proc/on_move) - RegisterSignal(COMSIG_PARENT_ATTACKBY, .proc/mob_was_attacked) - RegisterSignal(COMSIG_ITEM_ATTACK, .proc/mob_was_attacked) - RegisterSignal(COMSIG_ATOM_ATTACK_ALIEN, .proc/mob_was_attacked) - RegisterSignal(COMSIG_ON_MOB_LIFE, .proc/process_jestosterone) - -/datum/component/jestosterone/proc/on_move(mob/user) - playsound(user.loc, "clownstep", 25, 1) - -/datum/component/jestosterone/proc/mob_was_attacked(mob/user) - playsound(user.loc, 'sound/items/bikehorn.ogg', 50, 1) - -/datum/component/jestosterone/proc/process_jestosterone(mob/living/user) - if(prob(10)) - user.emote("giggle") - if(mob_is_clown) - user.adjustBruteLoss(-1.5 * REAGENTS_EFFECT_MULTIPLIER) //Screw those pesky clown beatings! - else - user.AdjustDizzy(10, 0, 500) - user.Druggy(15) - if(prob(10)) - user.EyeBlurry(5) - if(prob(6)) - var/list/clown_message = list("You feel light-headed.", - "You can't see straight.", - "You feel about as funny as the station clown.", - "Bright colours and rainbows cloud your vision.", - "Your funny bone aches.", - "You can hear bike horns in the distance.", - "You feel like SHOUTING!", - "Sinister laughter echoes in your ears.", - "Your legs feel like jelly.", - "You feel like telling a pun.") - to_chat(user, "[pick(clown_message)]") +/datum/component/jestosterone/Initialize(mind_type_arg) + mind_type = mind_type_arg diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index e9b6bb6e42a..3fe88f7d0e9 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -14,7 +14,7 @@ var/last_use = 0 var/use_delay = 20 -/datum/component/squeak/Initialize(custom_sounds, volume_override, chance_override, step_delay_override, use_delay_override) +/datum/component/squeak/Initialize(custom_sounds, volume_override, chance_override, step_delay_override, use_delay_override, squeak_on_move) if(!isatom(parent)) return COMPONENT_INCOMPATIBLE RegisterSignal(parent, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_BLOB_ACT, COMSIG_ATOM_HULK_ATTACK, COMSIG_PARENT_ATTACKBY), .proc/play_squeak) @@ -22,6 +22,8 @@ RegisterSignal(parent, list(COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_IMPACT), .proc/play_squeak) RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/play_squeak_crossed) RegisterSignal(parent, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react) + if(squeak_on_move) + RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/play_squeak) if(isitem(parent)) RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_HIT_REACT), .proc/play_squeak) RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, .proc/use_squeak) @@ -47,12 +49,15 @@ else playsound(parent, pickweight(override_squeak_sounds), volume, 1, -1) -/datum/component/squeak/proc/step_squeak() - if(steps > step_delay) - play_squeak() - steps = 0 +/datum/component/squeak/proc/step_squeak(datum/source, mob/living/carbon/human/H) + if(H.m_intent == MOVE_INTENT_RUN) + if(steps > step_delay) + play_squeak() + steps = 0 + else + steps++ else - steps++ + play_squeak() /datum/component/squeak/proc/on_equip(datum/source, mob/equipper, slot) RegisterSignal(equipper, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react, TRUE) diff --git a/code/modules/mob/living/carbon/human/say.dm b/code/modules/mob/living/carbon/human/say.dm index 0410a179cc9..2ea891d04f9 100644 --- a/code/modules/mob/living/carbon/human/say.dm +++ b/code/modules/mob/living/carbon/human/say.dm @@ -121,7 +121,8 @@ span = mind.speech_span if((COMIC in mutations) \ || (locate(/obj/item/organ/internal/cyberimp/brain/clown_voice) in internal_organs) \ - || istype(get_item_by_slot(slot_wear_mask), /obj/item/clothing/mask/gas/voice/clown)) + || istype(get_item_by_slot(slot_wear_mask), /obj/item/clothing/mask/gas/voice/clown) \ + || GetComponent(/datum/component/jestosterone)) span = "sans" var/list/parent = ..() diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm index fc5d3156b01..d07ef2b9f32 100644 --- a/code/modules/mob/living/carbon/human/species/_species.dm +++ b/code/modules/mob/living/carbon/human/species/_species.dm @@ -389,7 +389,7 @@ target.forcesay(GLOB.hit_appends) else if(target.lying) target.forcesay(GLOB.hit_appends) - target.SendSignal(COMSIG_PARENT_ATTACKBY, target) + SEND_SIGNAL(target, COMSIG_PARENT_ATTACKBY) /datum/species/proc/disarm(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) if(target.check_block()) //cqc diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index f045b54b8d8..cfb16c0f04a 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -508,7 +508,7 @@ var/turf/T = loc . = ..() if(.) - SendSignal(COMSIG_MOVABLE_MOVED, src) + SEND_SIGNAL(src, COMSIG_MOVABLE_MOVED) handle_footstep(loc) step_count++ @@ -883,7 +883,7 @@ // If we're pulling something then drop what we're currently pulling and pull this instead. AM.add_fingerprint(src) if(pulling) - if(AM == pulling)// Are we trying to pull something we are already pulling? Then just stop here, no need to continue. + if(AM == pulling)// Are we trying to pull something we are already pulling? Then just stop here, no need to continue. return stop_pulling() if(AM.pulledby) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 2677b5a0f9e..cfe35b58983 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -333,7 +333,6 @@ return FALSE if(INTENT_HARM) M.do_attack_animation(src) - SendSignal(COMSIG_ATOM_ATTACK_ALIEN, src) return TRUE if(INTENT_DISARM) M.do_attack_animation(src, ATTACK_EFFECT_DISARM) diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm index cbe8c43b936..b04cbd9494f 100644 --- a/code/modules/reagents/chemistry/holder.dm +++ b/code/modules/reagents/chemistry/holder.dm @@ -577,9 +577,9 @@ var/const/INGEST = 2 reagent_list += R R.holder = src R.volume = amount + R.on_new(data) if(data) R.data = data - R.on_new(data) update_total() if(my_atom) diff --git a/code/modules/reagents/chemistry/reagents/misc.dm b/code/modules/reagents/chemistry/reagents/misc.dm index 993edd5ec44..f86f463e08e 100644 --- a/code/modules/reagents/chemistry/reagents/misc.dm +++ b/code/modules/reagents/chemistry/reagents/misc.dm @@ -426,25 +426,63 @@ color = "#ff00ff" //Fuchsia, pity we can't do rainbow here taste_message = "a funny flavour" -/datum/reagent/jestosterone/reaction_mob(mob/living/M, method, volume) +/datum/reagent/jestosterone/on_new() ..() - if(istype(M, /mob/living/carbon)) + var/mob/living/carbon/C = holder.my_atom + if(!istype(C)) return - var/is_a_clown = FALSE - if(M.mind && (M.mind.assigned_role == "Clown" || M.mind.assigned_role == SPECIAL_ROLE_HONKSQUAD)) - is_a_clown = TRUE - if(!is_a_clown) - M.AdjustDizzy(volume) - M.AddComponent(/datum/component/jestosterone, M, is_a_clown) + var/mind_type = FALSE + if(C.mind) + if(C.mind.assigned_role == "Clown" || C.mind.assigned_role == SPECIAL_ROLE_HONKSQUAD) + mind_type = "Clown" + to_chat(C, "Whatever that was, it feels great!") + else if(C.mind.assigned_role == "Mime") + mind_type = "Mime" + to_chat(C, "You feel nauseous.") + C.AdjustDizzy(volume) + else + to_chat(C, "Something doesn't feel right...") + C.AdjustDizzy(volume) + C.AddComponent(/datum/component/jestosterone, mind_type) + C.AddComponent(/datum/component/squeak, null, null, null, null, null, TRUE) -/datum/reagent/jestosterone/on_mob_life(mob/living/M) - M.SendSignal(COMSIG_ON_MOB_LIFE, M) - ..() +/datum/reagent/jestosterone/on_mob_life(mob/living/carbon/M) + if(!istype(M)) + return ..() + var/update_flags = STATUS_UPDATE_NONE + if(prob(10)) + M.emote("giggle") + GET_COMPONENT_FROM(jestosterone_component, /datum/component/jestosterone, M) + if(jestosterone_component.mind_type == "Clown") + update_flags |= M.adjustBruteLoss(-1.5 * REAGENTS_EFFECT_MULTIPLIER) //Screw those pesky clown beatings! + else + M.AdjustDizzy(10, 0, 500) + M.Druggy(15) + if(prob(10)) + M.EyeBlurry(5) + if(prob(6)) + var/list/clown_message = list("You feel light-headed.", + "You can't see straight.", + "You feel about as funny as the station clown.", + "Bright colours and rainbows cloud your vision.", + "Your funny bone aches.", + "What was that?!", + "You can hear bike horns in the distance.", + "You feel like SHOUTING!", + "Sinister laughter echoes in your ears.", + "Your legs feel like jelly.", + "You feel like telling a pun.") + to_chat(M, "[pick(clown_message)]") + if(jestosterone_component.mind_type == "Mime") + update_flags |= M.adjustToxLoss(1.5 * REAGENTS_EFFECT_MULTIPLIER) + return ..() | update_flags /datum/reagent/jestosterone/on_mob_delete(mob/living/M) ..() GET_COMPONENT_FROM(remove_fun, /datum/component/jestosterone, M) + GET_COMPONENT_FROM(squeaking, /datum/component/squeak, M) remove_fun.Destroy() + squeaking.Destroy() /datum/reagent/royal_bee_jelly name = "royal bee jelly"