From 0a942bf23a98604cf9e7d5ab00788aad576bfa1f Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Sun, 25 Mar 2018 17:48:38 +0400 Subject: [PATCH 1/6] moved some mob is helpers to is_helpers.dm attack_slime(), attack_animal(), attack_larva(), attack_alien(), attack_larva() handled at /mob/living level, overridden in children changes to attack_hand() and attackby() for some mobs changed span in a bot message, added missing logging and attack animations new mob defense files, renamed some files, general code cleanup --- code/__DEFINES/is_helpers.dm | 23 +++ code/__DEFINES/mobs.dm | 9 -- .../{alien_defenses.dm => alien_defense.dm} | 13 +- .../living/carbon/alien/humanoid/humanoid.dm | 140 +----------------- .../carbon/alien/humanoid/humanoid_defense.dm | 45 ++++++ .../mob/living/carbon/alien/larva/larva.dm | 92 +----------- .../carbon/alien/larva/larva_defense.dm | 24 +++ .../{carbon_defenses.dm => carbon_defense.dm} | 23 ++- code/modules/mob/living/carbon/human/human.dm | 106 ------------- .../living/carbon/human/human_attackalien.dm | 50 ------- .../living/carbon/human/human_attackhand.dm | 10 +- .../mob/living/carbon/human/human_defense.dm | 91 ++++++++++++ code/modules/mob/living/carbon/slime/slime.dm | 108 ++++---------- code/modules/mob/living/living_defense.dm | 80 +++++++++- code/modules/mob/living/silicon/ai/ai.dm | 56 ------- .../mob/living/silicon/ai/ai_defense.dm | 8 + code/modules/mob/living/silicon/pai/pai.dm | 35 ----- .../silicon/robot/drone/drone_abilities.dm | 6 +- .../modules/mob/living/silicon/robot/robot.dm | 116 --------------- .../mob/living/silicon/robot/robot_defense.dm | 59 ++++++++ .../mob/living/silicon/silicon_defense.dm | 66 +++++++++ .../living/simple_animal/animal_defense.dm | 60 ++++++++ .../mob/living/simple_animal/bot/bot.dm | 8 +- .../mob/living/simple_animal/simple_animal.dm | 117 --------------- paradise.dme | 11 +- 25 files changed, 535 insertions(+), 821 deletions(-) rename code/modules/mob/living/carbon/alien/{alien_defenses.dm => alien_defense.dm} (88%) create mode 100644 code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm create mode 100644 code/modules/mob/living/carbon/alien/larva/larva_defense.dm rename code/modules/mob/living/carbon/{carbon_defenses.dm => carbon_defense.dm} (71%) delete mode 100644 code/modules/mob/living/carbon/human/human_attackalien.dm create mode 100644 code/modules/mob/living/silicon/ai/ai_defense.dm create mode 100644 code/modules/mob/living/silicon/robot/robot_defense.dm create mode 100644 code/modules/mob/living/silicon/silicon_defense.dm create mode 100644 code/modules/mob/living/simple_animal/animal_defense.dm diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index 3014b1dfebe..34668062a89 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -41,6 +41,29 @@ var/list/static/global/pointed_types = typecacheof(list( #define ismineralturf(A) istype(A, /turf/simulated/mineral) +//Mobs +#define isliving(A) (istype(A, /mob/living)) + +#define isbrain(A) (istype(A, /mob/living/carbon/brain)) + +//Carbon mobs +#define iscarbon(A) (istype(A, /mob/living/carbon)) + +#define ishuman(A) (istype(A, /mob/living/carbon/human)) + +//more carbon mobs +#define isalien(A) (istype(A, /mob/living/carbon/alien)) + +#define islarva(A) (istype(A, /mob/living/carbon/alien/larva)) + +#define isalienadult(A) (istype(A, /mob/living/carbon/alien/humanoid)) + +#define isalienhunter(A) (istype(A, /mob/living/carbon/alien/humanoid/hunter)) + +#define isaliensentinel(A) (istype(A, /mob/living/carbon/alien/humanoid/sentinel)) + +#define isslime(A) (istype((A), /mob/living/carbon/slime)) + // Misc #define isclient(A) istype(A, /client) #define isradio(A) istype(A, /obj/item/device/radio) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 5bf38e54ad8..efe8a4aac86 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -128,15 +128,6 @@ #define TINT_BLIND 3 //Threshold of tint level to obscure vision fully #define EYE_SHINE_THRESHOLD 6 //dark_view threshold past which a humanoid's eyes will 'shine' in the dark. -#define isliving(A) (istype((A), /mob/living)) -#define iscarbon(A) (istype((A), /mob/living/carbon)) -#define ishuman(A) (istype((A), /mob/living/carbon/human)) -#define isbrain(A) (istype((A), /mob/living/carbon/brain)) -#define isalien(A) (istype((A), /mob/living/carbon/alien)) -#define isalienadult(A) (istype((A), /mob/living/carbon/alien/humanoid)) -#define islarva(A) (istype((A), /mob/living/carbon/alien/larva)) -#define isslime(A) (istype((A), /mob/living/carbon/slime)) - //Human sub-species #define isabductor(A) (is_species(A, "Abductor")) diff --git a/code/modules/mob/living/carbon/alien/alien_defenses.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm similarity index 88% rename from code/modules/mob/living/carbon/alien/alien_defenses.dm rename to code/modules/mob/living/carbon/alien/alien_defense.dm index 5934987f8a4..22954451834 100644 --- a/code/modules/mob/living/carbon/alien/alien_defenses.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -5,7 +5,7 @@ As such, they can either help or harm other aliens. Help works like the human help command while harm is a simple nibble. In all, this is a lot like the monkey code. /N */ -/mob/living/carbon/alien/attack_alien(mob/living/carbon/alien/M as mob) +/mob/living/carbon/alien/attack_alien(mob/living/carbon/alien/M) if(!ticker) to_chat(M, "You cannot attack people before the game has started.") return @@ -40,14 +40,12 @@ In all, this is a lot like the monkey code. /N else to_chat(M, "[name] is too injured for that.") -/mob/living/carbon/alien/attack_larva(mob/living/carbon/alien/larva/L as mob) +/mob/living/carbon/alien/attack_larva(mob/living/carbon/alien/larva/L) return attack_alien(L) -/mob/living/carbon/alien/attack_hand(mob/living/carbon/human/M as mob) +/mob/living/carbon/alien/attack_hand(mob/living/carbon/human/M) if(..()) //to allow surgery to return properly. return 0 - if(istype(src,/mob/living/carbon/alien/humanoid)) - return 0 //this is horrible but 100% necessary switch(M.a_intent) if(INTENT_HELP) @@ -55,12 +53,11 @@ In all, this is a lot like the monkey code. /N if(INTENT_GRAB) grabbedby(M) if(INTENT_HARM, INTENT_DISARM) + M.do_attack_animation(src) return 1 return 0 - - -/mob/living/carbon/alien/attack_animal(mob/living/simple_animal/M as mob) +/mob/living/carbon/alien/attack_animal(mob/living/simple_animal/M) if(..()) var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) switch(M.melee_damage_type) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 182bc0bd9eb..61e3aef5b31 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -78,138 +78,14 @@ updatehealth() -/mob/living/carbon/alien/humanoid/attack_slime(mob/living/carbon/slime/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(M.Victim) return // can't attack while eating! - - if(stat > -100) - - M.do_attack_animation(src) - visible_message("The [M.name] glomps [src]!", \ - "The [M.name] glomps [src]!") - var/damage = rand(1, 3) - - if(M.is_adult) - damage = rand(10, 40) - else - damage = rand(5, 35) - - adjustBruteLoss(damage) - - if(M.powerlevel > 0) - var/stunprob = 10 - var/power = M.powerlevel + rand(0,3) - - switch(M.powerlevel) - if(1 to 2) stunprob = 20 - if(3 to 4) stunprob = 30 - if(5 to 6) stunprob = 40 - if(7 to 8) stunprob = 60 - if(9) stunprob = 70 - if(10) stunprob = 95 - - if(prob(stunprob)) - M.powerlevel -= 3 - if(M.powerlevel < 0) - M.powerlevel = 0 - - visible_message("The [M.name] has shocked [src]!", \ - "The [M.name] has shocked [src]!") - - Weaken(power) - if(stuttering < power) - stuttering = power - Stun(power) - - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(5, 1, src) - s.start() - - if(prob(stunprob) && M.powerlevel >= 8) - adjustFireLoss(M.powerlevel * rand(6,10)) - - - updatehealth() - - return - -/mob/living/carbon/alien/humanoid/attack_animal(mob/living/simple_animal/M as mob) - if(M.melee_damage_upper == 0) - M.custom_emote(1, "[M.friendly] [src]") - else - M.do_attack_animation(src) - if(M.attack_sound) - playsound(loc, M.attack_sound, 50, 1, 1) - visible_message("[M] [M.attacktext] [src]!", \ - "[M] [M.attacktext] [src]!") - var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - adjustBruteLoss(damage) - updatehealth() - -/mob/living/carbon/alien/humanoid/attack_hand(mob/living/carbon/human/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(istype(loc, /turf) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return - - if(..()) //to allow surgery to return properly. - return - - switch(M.a_intent) - - if(INTENT_HELP) - help_shake_act(M) - - if(INTENT_GRAB) - grabbedby(M) - - if(INTENT_HARM) - M.do_attack_animation(src) - var/damage = rand(1, 9) - if(prob(90)) - if(HULK in M.mutations)//HULK SMASH - damage = 15 - spawn(0) - Paralyse(1) - step_away(src,M,15) - sleep(3) - step_away(src,M,15) - playsound(loc, "punch", 25, 1, -1) - visible_message("[M] has punched [src]!", \ - "[M] has punched [src]!") - if((stat != DEAD) && (damage > 9||prob(5)))//Regular humans have a very small chance of weakening an alien. - Paralyse(2) - visible_message("[M] has weakened [src]!", \ - "[M] has weakened [src]!", \ - "You hear someone fall.") - adjustBruteLoss(damage) - updatehealth() - else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to punch [src]!") - - if(INTENT_DISARM) - if(!lying) - if(prob(5))//Very small chance to push an alien down. - Paralyse(2) - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - visible_message("[M] has pushed down [src]!", \ - "[M] has pushed down [src]!") - else - if(prob(50)) - drop_item() - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - visible_message("[M] has disarmed [src]!", \ - "[M] has disarmed [src]!") - else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to disarm [src]!") +/mob/living/carbon/alien/humanoid/attack_slime(mob/living/carbon/slime/M) + ..() + var/damage = rand(5, 35) + if(M.is_adult) + damage = rand(10, 40) + adjustBruteLoss(damage) + add_logs(M, src, "attacked", admin=0) + updatehealth() return /mob/living/carbon/alien/humanoid/restrained() diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm new file mode 100644 index 00000000000..1027c0a4245 --- /dev/null +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -0,0 +1,45 @@ +/mob/living/carbon/alien/humanoid/attack_hand(mob/living/carbon/human/M) + if(..()) + switch(M.a_intent) + if(INTENT_HARM) + var/damage = rand(1, 9) + if(prob(90)) + if(HULK in M.mutations)//HULK SMASH + damage = 15 + spawn(0) + Paralyse(1) + step_away(src, M, 15) + sleep(3) + step_away(src, M, 15) + playsound(loc, "punch", 25, 1, -1) + visible_message("[M] has punched [src]!", \ + "[M] has punched [src]!") + if((stat != DEAD) && (damage > 9||prob(5)))//Regular humans have a very small chance of weakening an alien. + Paralyse(2) + visible_message("[M] has weakened [src]!", \ + "[M] has weakened [src]!", \ + "You hear someone fall.") + adjustBruteLoss(damage) + add_logs(M, src, "attacked", admin=0) + updatehealth() + else + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to punch [src]!") + + if(INTENT_DISARM) + if(!lying) + if(prob(5))//Very small chance to push an alien down. + Paralyse(2) + playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + add_logs(M, src, "pushed", admin=0) + visible_message("[M] has pushed down [src]!", \ + "[M] has pushed down [src]!") + else + if(prob(50)) + drop_item() + playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + visible_message("[M] has disarmed [src]!", \ + "[M] has disarmed [src]!") + else + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to disarm [src]!") diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 2d638dd0db1..e1fbd04a60f 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -73,91 +73,15 @@ /mob/living/carbon/alien/larva/attack_ui(slot_id) return -/mob/living/carbon/alien/larva/attack_animal(mob/living/simple_animal/M as mob) - if(M.melee_damage_upper == 0) - M.custom_emote(1, "[M.friendly] [src]") - else - M.do_attack_animation(src) - if(M.attack_sound) - playsound(loc, M.attack_sound, 50, 1, 1) - visible_message("[M] [M.attacktext] [src]!", \ - "[M] [M.attacktext] [src]!") - var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - adjustBruteLoss(damage) - add_attack_logs(M, src, "Animal attacked", FALSE) - updatehealth() - - - -/mob/living/carbon/alien/larva/attack_slime(mob/living/carbon/slime/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(M.Victim) - return // can't attack while eating! - - if(stat != DEAD) - M.do_attack_animation(src) - visible_message("The [M.name] glomps [src]!", \ - "The [M.name] glomps [src]!") - var/damage = rand(1, 3) - - if(M.is_adult) - damage = rand(20, 40) - else - damage = rand(5, 35) - - - adjustBruteLoss(damage) - updatehealth() - - return - -/mob/living/carbon/alien/larva/attack_hand(mob/living/carbon/human/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(istype(loc, /turf) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return - +/mob/living/carbon/alien/larva/attack_slime(mob/living/carbon/slime/M) ..() - - switch(M.a_intent) - - if(INTENT_HELP) - help_shake_act(M) - - if(INTENT_GRAB) - grabbedby(M) - - else - M.do_attack_animation(src) - var/damage = rand(1, 9) - if(prob(90)) - if(HULK in M.mutations) - damage += 5 - spawn(0) - Paralyse(1) - step_away(src,M,15) - sleep(3) - step_away(src,M,15) - playsound(loc, "punch", 25, 1, -1) - visible_message("[M] has kicked [src]!", \ - "[M] has kicked [src]!") - if((stat != DEAD) && (damage > 4.9)) - Paralyse(rand(5,10)) - visible_message("[M] has weakened [src]!", \ - "[M] has weakened [src]!", \ - "You hear someone fall.") - adjustBruteLoss(damage) - updatehealth() - else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to kick [src]!", \ - "[M] has attempted to kick [src]!") + var/damage = rand(5, 35) + if(M.is_adult) + damage = rand(20, 40) + adjustBruteLoss(damage) + add_attack_logs(M, src, "Slime attacked") + updatehealth() + return /mob/living/carbon/alien/larva/restrained() return 0 diff --git a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm new file mode 100644 index 00000000000..029ea07da4f --- /dev/null +++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm @@ -0,0 +1,24 @@ +/mob/living/carbon/alien/larva/attack_hand(mob/living/carbon/human/M) + if(..()) + var/damage = rand(1, 9) + if(prob(90)) + if(HULK in M.mutations) + damage += 5 + spawn(0) + Paralyse(1) + step_away(src, M, 15) + sleep(3) + step_away(src, M, 15) + playsound(loc, "punch", 25, 1, -1) + add_logs(M, src, "attacked", admin=0) + visible_message("[M] has kicked [src]!", \ + "[M] has kicked [src]!") + if((stat != DEAD) && (damage > 4.9)) + Paralyse(rand(5,10)) + + adjustBruteLoss(damage) + updatehealth() + else + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to kick [src]!", \ + "[M] has attempted to kick [src]!") diff --git a/code/modules/mob/living/carbon/carbon_defenses.dm b/code/modules/mob/living/carbon/carbon_defense.dm similarity index 71% rename from code/modules/mob/living/carbon/carbon_defenses.dm rename to code/modules/mob/living/carbon/carbon_defense.dm index eb6517e5f1d..140e868dddf 100644 --- a/code/modules/mob/living/carbon/carbon_defenses.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -18,12 +18,11 @@ /mob/living/carbon/attackby(obj/item/I, mob/user, params) - if(lying) - if(surgeries.len) - if(user != src && user.a_intent == INTENT_HELP) - for(var/datum/surgery/S in surgeries) - if(S.next_step(user, src)) - return 1 + if(lying && surgeries.len) + if(user != src && user.a_intent == INTENT_HELP) + for(var/datum/surgery/S in surgeries) + if(S.next_step(user, src)) + return 1 return ..() /mob/living/carbon/attack_hand(mob/living/carbon/human/user) @@ -41,6 +40,18 @@ ContractDisease(D) return 0 +/mob/living/carbon/attack_slime(mob/living/carbon/slime/M) + if(..()) + var/power = M.powerlevel + rand(0,3) + Weaken(power) + Stuttering(power) + Stun(power) + var/stunprob = M.powerlevel * 7 + 10 + if(prob(stunprob) && M.powerlevel >= 8) + adjustFireLoss(M.powerlevel * rand(6,10)) + updatehealth() + return 1 + /mob/living/carbon/is_mouth_covered(head_only = FALSE, mask_only = FALSE) if((!mask_only && head && (head.flags_cover & HEADCOVERSMOUTH)) || (!head_only && wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH))) return TRUE \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f41479cd392..2cb8bbb396e 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -306,112 +306,6 @@ return 0 ..() -/mob/living/carbon/human/attack_animal(mob/living/simple_animal/M as mob) - if(M.melee_damage_upper == 0) - M.custom_emote(1, "[M.friendly] [src]") - else - if(M.attack_sound) - playsound(loc, M.attack_sound, 50, 1, 1) - M.do_attack_animation(src) - visible_message("[M] [M.attacktext] [src]!", \ - "[M] [M.attacktext] [src]!") - add_attack_logs(M, src, "Animal attacked") - var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - if(check_shields(damage, "the [M.name]", null, MELEE_ATTACK, M.armour_penetration)) - return 0 - var/dam_zone = pick("head", "chest", "groin", "l_arm", "l_hand", "r_arm", "r_hand", "l_leg", "l_foot", "r_leg", "r_foot") - var/obj/item/organ/external/affecting = get_organ(ran_zone(dam_zone)) - var/armor = run_armor_check(affecting, "melee", armour_penetration = M.armour_penetration) - - var/obj/item/organ/external/affected = src.get_organ(dam_zone) - if(affected) - affected.add_autopsy_data(M.name, damage) // Add the mob's name to the autopsy data - apply_damage(damage, M.melee_damage_type, affecting, armor) - updatehealth() - -/mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/L as mob) - - switch(L.a_intent) - if(INTENT_HELP) - visible_message("[L] rubs its head against [src].") - - - else - L.do_attack_animation(src) - var/damage = rand(1, 3) - visible_message("[L] bites [src]!", \ - "[L] bites [src]!") - playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) - - if(stat != DEAD) - L.amount_grown = min(L.amount_grown + damage, L.max_grown) - var/obj/item/organ/external/affecting = get_organ(ran_zone(L.zone_sel.selecting)) - var/armor_block = run_armor_check(affecting, "melee") - apply_damage(damage, BRUTE, affecting, armor_block) - -/mob/living/carbon/human/attack_slime(mob/living/carbon/slime/M as mob) - if(M.Victim) return // can't attack while eating! - - if(stat != DEAD) - M.do_attack_animation(src) - visible_message("The [M.name] glomps [src]!", \ - "The [M.name] glomps [src]!") - - var/damage = rand(1, 3) - - if(M.is_adult) - damage = rand(10, 35) - else - damage = rand(5, 25) - - if(check_shields(damage, "the [M.name]", null, MELEE_ATTACK)) - return 0 - - var/dam_zone = pick("head", "chest", "groin", "l_arm", "l_hand", "r_arm", "r_hand", "l_leg", "l_foot", "r_leg", "r_foot") - - var/obj/item/organ/external/affecting = get_organ(ran_zone(dam_zone)) - var/armor_block = run_armor_check(affecting, "melee") - apply_damage(damage, BRUTE, affecting, armor_block) - - - if(M.powerlevel > 0) - var/stunprob = 10 - var/power = M.powerlevel + rand(0,3) - - switch(M.powerlevel) - if(1 to 2) stunprob = 20 - if(3 to 4) stunprob = 30 - if(5 to 6) stunprob = 40 - if(7 to 8) stunprob = 60 - if(9) stunprob = 70 - if(10) stunprob = 95 - - if(prob(stunprob)) - M.powerlevel -= 3 - if(M.powerlevel < 0) - M.powerlevel = 0 - - for(var/mob/O in viewers(src, null)) - if((O.client && !( O.blinded ))) - O.show_message(text("The [M.name] has shocked []!", src), 1) - - Weaken(power) - Stuttering(power) - Stun(power) - - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(5, 1, src) - s.start() - - if(prob(stunprob) && M.powerlevel >= 8) - adjustFireLoss(M.powerlevel * rand(6,10)) - - - updatehealth() - - return - - /mob/living/carbon/human/restrained() if(handcuffed) return 1 diff --git a/code/modules/mob/living/carbon/human/human_attackalien.dm b/code/modules/mob/living/carbon/human/human_attackalien.dm deleted file mode 100644 index 7c4039789a9..00000000000 --- a/code/modules/mob/living/carbon/human/human_attackalien.dm +++ /dev/null @@ -1,50 +0,0 @@ -/mob/living/carbon/human/attack_alien(mob/living/carbon/alien/humanoid/M as mob) - if(check_shields(0, M.name)) - visible_message("[M] attempted to touch [src]!") - return 0 - - switch(M.a_intent) - if(INTENT_HELP) - visible_message("[M] caresses [src] with its scythe like arm.") - - if(INTENT_GRAB) - grabbedby(M) - - if(INTENT_HARM) - M.do_attack_animation(src) - if(w_uniform) - w_uniform.add_fingerprint(M) - - var/damage = rand(15, 30) - if(!damage) - playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1) - visible_message("[M] has lunged at [src]!") - return 0 - - var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) - var/armor_block = run_armor_check(affecting, "melee") - - playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - visible_message("[M] has slashed at [src]!") - - apply_damage(damage, BRUTE, affecting, armor_block) - if(damage >= 25) - visible_message("[M] has wounded [src]!") - apply_effect(4, WEAKEN, armor_block) - updatehealth() - - if(INTENT_DISARM) - M.do_attack_animation(src) - if(prob(80)) - var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) - playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) - apply_effect(5, WEAKEN, run_armor_check(affecting, "melee")) - visible_message("[M] has tackled down [src]!") - else - if(prob(99)) //this looks fucking stupid but it was previously 'var/randn = rand(1, 100); if(randn <= 99)' - playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) - drop_item() - visible_message("[M] disarmed [src]!") - else - playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1) - visible_message("[M] has tried to disarm [src]!") \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index 57be152295b..eedc6c1ea0c 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -1,8 +1,4 @@ -/mob/living/carbon/human/attack_hand(mob/living/carbon/human/M as mob) - if(istype(loc, /turf) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return - +/mob/living/carbon/human/attack_hand(mob/living/carbon/human/M) if(frozen) to_chat(M, "Do not touch Admin-Frozen people.") return @@ -78,7 +74,7 @@ if(attacker_style && attacker_style.grab_act(H, src)) return 1 else - src.grabbedby(M) + grabbedby(M) return 1 if(INTENT_HARM) @@ -147,7 +143,7 @@ return 1 else add_attack_logs(M, src, "Disarmed") - + M.do_attack_animation(src) if(w_uniform) w_uniform.add_fingerprint(M) var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index f01ab117448..1d4dc544667 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -175,6 +175,11 @@ emp_act affecting.sabotaged = 1 return 1 +/mob/living/carbon/human/grabbedby(mob/living/user) + if(w_uniform) + w_uniform.add_fingerprint(user) + ..() + //Returns 1 if the attack hit, 0 if it missed. /mob/living/carbon/human/attacked_by(obj/item/I, mob/living/user, def_zone) if(!I || !user) @@ -343,6 +348,92 @@ emp_act if(penetrated_dam) SS.create_breaches(damtype, penetrated_dam) +/mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/L) + if(..()) //successful larva bite. + var/damage = rand(1, 3) + if(stat != DEAD) + L.amount_grown = min(L.amount_grown + damage, L.max_grown) + var/obj/item/organ/external/affecting = get_organ(ran_zone(L.zone_sel.selecting)) + var/armor_block = run_armor_check(affecting, "melee") + apply_damage(damage, BRUTE, affecting, armor_block) + updatehealth() + +/mob/living/carbon/human/attack_alien(mob/living/carbon/alien/humanoid/M) + if(check_shields(0, M.name)) + visible_message("[M] attempted to touch [src]!") + return 0 + + if(..()) + if(M.a_intent == INTENT_HARM) + if(w_uniform) + w_uniform.add_fingerprint(M) + var/damage = rand(15, 30) + if(!damage) + playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1) + visible_message("[M] has lunged at [src]!") + return 0 + var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) + var/armor_block = run_armor_check(affecting, "melee") + + playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) + visible_message("[M] has slashed at [src]!", \ + "[M] has slashed at [src]!") + + apply_damage(damage, BRUTE, affecting, armor_block) + if(damage >= 25) + visible_message("[M] has wounded [src]!", \ + "[M] has wounded [src]!") + apply_effect(4, WEAKEN, armor_block) + add_logs(M, src, "attacked", admin=0) + updatehealth() + + if(M.a_intent == INTENT_DISARM) + if(prob(80)) + var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) + playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) + apply_effect(5, WEAKEN, run_armor_check(affecting, "melee")) + add_logs(M, src, "tackled", admin=0) + visible_message("[M] has tackled down [src]!") + else + if(prob(99)) //this looks fucking stupid but it was previously 'var/randn = rand(1, 100); if(randn <= 99)' + playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) + drop_item() + visible_message("[M] disarmed [src]!") + else + playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1) + visible_message("[M] has tried to disarm [src]!") + +/mob/living/carbon/human/attack_animal(mob/living/simple_animal/M) + if(..()) + var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) + if(check_shields(damage, "the [M.name]", null, MELEE_ATTACK, M.armour_penetration)) + return 0 + var/dam_zone = pick("head", "chest", "groin", "l_arm", "l_hand", "r_arm", "r_hand", "l_leg", "l_foot", "r_leg", "r_foot") + var/obj/item/organ/external/affecting = get_organ(ran_zone(dam_zone)) + var/armor = run_armor_check(affecting, "melee", armour_penetration = M.armour_penetration) + var/obj/item/organ/external/affected = src.get_organ(dam_zone) + if(affected) + affected.add_autopsy_data(M.name, damage) // Add the mob's name to the autopsy data + apply_damage(damage, M.melee_damage_type, affecting, armor) + updatehealth() + +/mob/living/carbon/human/attack_slime(mob/living/carbon/slime/M) + ..() + var/damage = rand(1, 3) + + if(M.is_adult) + damage = rand(10, 35) + else + damage = rand(5, 25) + + var/dam_zone = pick("head", "chest", "groin", "l_arm", "l_hand", "r_arm", "r_hand", "l_leg", "l_foot", "r_leg", "r_foot") + + var/obj/item/organ/external/affecting = get_organ(ran_zone(dam_zone)) + var/armor_block = run_armor_check(affecting, "melee") + apply_damage(damage, BRUTE, affecting, armor_block) + + return + /mob/living/carbon/human/mech_melee_attack(obj/mecha/M) if(M.occupant.a_intent == INTENT_HARM) if(M.damtype == "brute") diff --git a/code/modules/mob/living/carbon/slime/slime.dm b/code/modules/mob/living/carbon/slime/slime.dm index 5fa5a09c441..f66225d007c 100644 --- a/code/modules/mob/living/carbon/slime/slime.dm +++ b/code/modules/mob/living/carbon/slime/slime.dm @@ -207,73 +207,32 @@ return /mob/living/carbon/slime/attack_slime(mob/living/carbon/slime/M) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(Victim) - return // can't attack while eating! - - M.do_attack_animation(src) - visible_message("[M.name] has glomped [src]!", \ - "[M.name] has glomped [src]!") + ..() var/damage = rand(1, 3) attacked += 5 if(M.is_adult) damage = rand(1, 6) else damage = rand(1, 3) - if(health > -100) - adjustBruteLoss(damage) - updatehealth() - return + adjustBruteLoss(damage) + updatehealth() -/mob/living/carbon/slime/attack_animal(mob/living/simple_animal/M as mob) - if(M.melee_damage_upper == 0) - M.custom_emote(1, "[M.friendly] [src]") - else - M.do_attack_animation(src) - if(M.attack_sound) - playsound(loc, M.attack_sound, 50, 1, 1) - visible_message("[M] [M.attacktext] [src]!", \ - "[M] [M.attacktext] [src]!") +/mob/living/carbon/slime/attack_animal(mob/living/simple_animal/M) + if(..()) var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - add_attack_logs(src, M, "Slime'd for [damage] damage") attacked += 10 adjustBruteLoss(damage) updatehealth() -/mob/living/carbon/slime/attack_larva(mob/living/carbon/alien/larva/L as mob) - - switch(L.a_intent) - - if(INTENT_HELP) - visible_message("[L] rubs its head against [src].") - - - else - L.do_attack_animation(src) - attacked += 10 - visible_message("[L] bites [src]!", \ - "[L] bites [src]!") - playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) - - if(stat != DEAD) - var/damage = rand(1, 3) - L.amount_grown = min(L.amount_grown + damage, L.max_grown) - adjustBruteLoss(damage) - -/mob/living/carbon/slime/attack_hand(mob/living/carbon/human/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(istype(loc, /turf) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return - - ..() +/mob/living/carbon/slime/attack_larva(mob/living/carbon/alien/larva/L) + if(..()) //successful larva bite. + var/damage = rand(1, 3) + if(stat != DEAD) + L.amount_grown = min(L.amount_grown + damage, L.max_grown) + adjustBruteLoss(damage) + updatehealth() +/mob/living/carbon/slime/attack_hand(mob/living/carbon/human/M) if(Victim) if(Victim == M) if(prob(60)) @@ -298,6 +257,7 @@ return else + M.do_attack_animation(src) if(prob(30)) visible_message("[M] attempts to wrestle \the [name] off of [Victim]!") playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) @@ -340,7 +300,6 @@ else M.do_attack_animation(src) var/damage = rand(1, 9) - attacked += 10 if(prob(90)) if(HULK in M.mutations) @@ -352,16 +311,16 @@ if(prob(80) && !client) Discipline++ spawn(0) - step_away(src,M,15) sleep(3) step_away(src,M,15) playsound(loc, "punch", 25, 1, -1) + add_attack_logs(M, src, "Melee attacked with fists") visible_message("[M] has punched [src]!", \ "[M] has punched [src]!") - if(health > -100) + if(stat != DEAD) adjustBruteLoss(damage) updatehealth() else @@ -369,23 +328,9 @@ visible_message("[M] has attempted to punch [src]!") return - - -/mob/living/carbon/slime/attack_alien(mob/living/carbon/alien/humanoid/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(istype(loc, /turf) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return - - switch(M.a_intent) - if(INTENT_HELP) - visible_message("[M] caresses [src] with its scythe like arm.") - - if(INTENT_HARM) - M.do_attack_animation(src) +/mob/living/carbon/slime/attack_alien(mob/living/carbon/alien/humanoid/M) + if(..()) //if harm or disarm intent. + if(M.a_intent == INTENT_HARM) if(prob(95)) attacked += 10 playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) @@ -397,7 +342,8 @@ else visible_message("[M] has wounded [name]!", \ ")[M] has wounded [name]!") - if(health > -100) + add_attack_logs(M, src, "Alien attacked") + if(stat != DEAD) adjustBruteLoss(damage) updatehealth() else @@ -405,11 +351,7 @@ visible_message("[M] has attempted to lunge at [name]!", \ "[M] has attempted to lunge at [name]!") - if(INTENT_GRAB) - grabbedby(M) - - if(INTENT_DISARM) - M.do_attack_animation(src) + if(M.a_intent == INTENT_DISARM) playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) var/damage = 5 attacked += 10 @@ -424,7 +366,7 @@ anchored = 0 if(prob(80) && !client) Discipline++ - if(!istype(src, /mob/living/carbon/slime)) + if(!isslime(src)) if(Discipline == 1) attacked = 0 @@ -442,11 +384,12 @@ drop_item() visible_message("[M] has disarmed [name]!", "[M] has disarmed [name]!") + add_attack_logs(M, src, "Alien disarmed") adjustBruteLoss(damage) updatehealth() return -/mob/living/carbon/slime/attackby(obj/item/W, mob/user, params) +/mob/living/carbon/slime/attackby(obj/item/W, mob/living/user, params) if(stat == DEAD && surgeries.len) if(user.a_intent == INTENT_HELP) for(var/datum/surgery/S in surgeries) @@ -464,6 +407,7 @@ else if(W.force > 0) attacked += 10 if(prob(25)) + user.do_attack_animation(src) to_chat(user, "[W] passes right through [src]!") return if(Discipline && prob(50)) // wow, buddy, why am I getting attacked?? diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index d1eeafa6b19..0039284a6a0 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -229,13 +229,13 @@ // End BS12 momentum-transfer code. -/mob/living/proc/grabbedby(mob/living/carbon/user,var/supress_message = 0) +/mob/living/proc/grabbedby(mob/living/carbon/user, supress_message = 0) if(user == src || anchored) return 0 if(!(status_flags & CANPUSH)) return 0 - for(var/obj/item/grab/G in src.grabbed_by) + for(var/obj/item/grab/G in grabbed_by) if(G.assailant == user) to_chat(user, "You already grabbed [src].") return @@ -261,4 +261,78 @@ if(!supress_message) visible_message("[user] has grabbed [src] passively!") - return G \ No newline at end of file + return G + +/mob/living/attack_slime(mob/living/carbon/slime/M) + if(!ticker) + to_chat(M, "You cannot attack people before the game has started.") + return + + if(M.Victim) + return // can't attack while eating! + + if(stat != DEAD) + M.do_attack_animation(src) + visible_message("The [M.name] glomps [src]!", \ + "The [M.name] glomps [src]!") + + if(M.powerlevel > 0) + var/stunprob = M.powerlevel * 7 + 10 // 17 at level 1, 80 at level 10 + if(prob(stunprob)) + M.powerlevel -= 3 + if(M.powerlevel < 0) + M.powerlevel = 0 + + visible_message("The [M.name] has shocked [src]!", \ + "The [M.name] has shocked [src]!") + + var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread + s.set_up(5, 1, src) + s.start() + return 1 + add_logs(M, src, "attacked", admin=0) + return + +/mob/living/attack_animal(mob/living/simple_animal/M) + if(M.melee_damage_upper == 0) + M.custom_emote(1, "[M.friendly] [src]") + return 0 + else + if(M.attack_sound) + playsound(loc, M.attack_sound, 50, 1, 1) + M.do_attack_animation(src) + visible_message("\The [M] [M.attacktext] [src]!", \ + "\The [M] [M.attacktext] [src]!") + add_logs(M, src, "attacked", admin=0) + return 1 + +/mob/living/attack_larva(mob/living/carbon/alien/larva/L) + switch(L.a_intent) + if(INTENT_HELP) + visible_message("[L.name] rubs its head against [src].") + return 0 + + else + L.do_attack_animation(src) + if(prob(90)) + add_logs(L, src, "attacked", admin=0) + visible_message("[L.name] bites [src]!", \ + "[L.name] bites [src]!") + playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) + return 1 + else + visible_message("[L.name] has attempted to bite [src]!", \ + "[L.name] has attempted to bite [src]!") + return 0 + +/mob/living/attack_alien(mob/living/carbon/alien/humanoid/M) + switch(M.a_intent) + if(INTENT_HELP) + visible_message("[M] caresses [src] with its scythe like arm.") + return FALSE + if(INTENT_GRAB) + grabbedby(M) + return FALSE + else + M.do_attack_animation(src) + return TRUE diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 1579085c6ad..48b01e800c6 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -686,62 +686,6 @@ var/list/ai_verbs_default = list( updatehealth() return 2 - -/mob/living/silicon/ai/attack_alien(mob/living/carbon/alien/humanoid/M) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(isturf(loc) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return - - switch(M.a_intent) - - if(INTENT_HELP) - visible_message("[M] caresses [src]'s plating with its scythe like arm.") - - else //harm - M.do_attack_animation(src) - var/damage = rand(10, 20) - if(prob(90)) - playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) - visible_message("[M] has slashed at [src]!",\ - "[M] has slashed at [src]!") - adjustBruteLoss(damage) - updatehealth() - else - playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) - visible_message("[M] took a swipe at [src]!", \ - "[M] took a swipe at [src]!") - - return - -/mob/living/silicon/ai/attack_animal(mob/living/simple_animal/M) - if(M.melee_damage_upper == 0) - M.custom_emote(1, "[M.friendly] [src]") - else - M.do_attack_animation(src) - if(M.attack_sound) - playsound(loc, M.attack_sound, 50, 1, 1) - visible_message("[M] [M.attacktext] [src]!") - add_attack_logs(M, src, "Animal attacked", FALSE) - var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - switch(M.melee_damage_type) - if(BRUTE) - adjustBruteLoss(damage) - if(BURN) - adjustFireLoss(damage) - if(TOX) - adjustToxLoss(damage) - if(OXY) - adjustOxyLoss(damage) - if(CLONE) - adjustCloneLoss(damage) - if(STAMINA) - adjustStaminaLoss(damage) - updatehealth() - /mob/living/silicon/ai/reset_perspective(atom/A) if(camera_light_on) light_cameras() diff --git a/code/modules/mob/living/silicon/ai/ai_defense.dm b/code/modules/mob/living/silicon/ai/ai_defense.dm new file mode 100644 index 00000000000..6d32c24bb0a --- /dev/null +++ b/code/modules/mob/living/silicon/ai/ai_defense.dm @@ -0,0 +1,8 @@ +/mob/living/silicon/ai/attack_alien(mob/living/carbon/alien/humanoid/M) + if(!ticker) + to_chat(M, "You cannot attack people before the game has started.") + return + ..() + +/mob/living/silicon/ai/attack_slime(mob/living/carbon/slime/user) + return //immune to slimes diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 25781717e08..5a949d8eaba 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -242,41 +242,6 @@ adjustBruteLoss(damage) updatehealth() -/mob/living/silicon/pai/attack_alien(mob/living/carbon/alien/humanoid/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(istype(loc, /turf) && istype(loc.loc, /area/start)) - to_chat(M, "You cannot attack someone in the spawn area.") - return - - switch(M.a_intent) - - if(INTENT_HELP) - for(var/mob/O in viewers(src, null)) - if((O.client && !( O.blinded ))) - O.show_message(text("[M] caresses [src]'s casing with its scythe like arm."), 1) - - else //harm - M.do_attack_animation(src) - var/damage = rand(10, 20) - if(prob(90)) - playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) - for(var/mob/O in viewers(src, null)) - if((O.client && !( O.blinded ))) - O.show_message(text("[] has slashed at []!", M, src), 1) - if(prob(8)) - flash_eyes(affect_silicon = 1) - adjustBruteLoss(damage) - updatehealth() - else - playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) - for(var/mob/O in viewers(src, null)) - if((O.client && !( O.blinded ))) - O.show_message(text("[] took a swipe at []!", M, src), 1) - return - /mob/living/silicon/pai/proc/switchCamera(var/obj/machinery/camera/C) usr:cameraFollow = null if(!C) diff --git a/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm b/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm index 48b9d558979..b3e6a62cb2e 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm @@ -43,11 +43,11 @@ control_headlamp() //Actual picking-up event. -/mob/living/silicon/robot/drone/attack_hand(mob/living/carbon/human/M as mob) +/mob/living/silicon/robot/drone/attack_hand(mob/living/carbon/human/M) if(M.a_intent == INTENT_HELP) get_scooped(M) - - ..() + else + ..() /mob/living/silicon/robot/drone/verb/customize() set name = "Customize Chassis" diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 0b0872e663b..ffc5afe6184 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -832,126 +832,10 @@ var/list/robot_verbs_default = list( update_icons() to_chat(usr, "You unlock your cover.") -/mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(istype(loc, /turf) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return - - switch(M.a_intent) - - if(INTENT_HELP) - for(var/mob/O in viewers(src, null)) - if((O.client && !( O.blinded ))) - O.show_message(text("[M] caresses [src]'s plating with its scythe like arm."), 1) - - if(INTENT_GRAB) - grabbedby(M) - - if(INTENT_HARM) - M.do_attack_animation(src) - var/damage = rand(10, 20) - if(prob(90)) - playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) - visible_message("[M] has slashed at [src]!",\ - "[M] has slashed at [src]!") - if(prob(8)) - flash_eyes(affect_silicon = 1) - adjustBruteLoss(damage) - updatehealth() - else - playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) - visible_message("[M] took a swipe at [src]!", \ - "[M] took a swipe at [src]!") - - if(INTENT_DISARM) - if(!(lying)) - M.do_attack_animation(src) - if(prob(85)) - Stun(7) - step(src,get_dir(M,src)) - spawn(5) - step(src,get_dir(M,src)) - playsound(loc, 'sound/weapons/pierce.ogg', 50, 1, -1) - visible_message("[M] has forced back [src]!",\ - "[M] has forced back [src]!") - else - playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) - visible_message("[M] attempted to force back [src]!",\ - "[M] attempted to force back [src]!") - return - - - -/mob/living/silicon/robot/attack_slime(mob/living/carbon/slime/M as mob) - if(..()) //successful slime shock - flash_eyes(affect_silicon = 1) - var/stunprob = M.powerlevel * 7 + 10 - if(prob(stunprob) && M.powerlevel >= 8) - adjustBruteLoss(M.powerlevel * rand(6,10)) - - var/damage = rand(1, 3) - - if(M.is_adult) - damage = rand(20, 40) - else - damage = rand(5, 35) - damage = round(damage / 2) // borgs recieve half damage - adjustBruteLoss(damage) - updatehealth() - - return - -/mob/living/silicon/robot/attack_animal(mob/living/simple_animal/M as mob) - if(M.melee_damage_upper == 0) - M.custom_emote(1, "[M.friendly] [src]") - else - M.do_attack_animation(src) - if(M.attack_sound) - playsound(loc, M.attack_sound, 50, 1, 1) - visible_message("[M] [M.attacktext] [src]!") - add_attack_logs(M, src, "Animal attacked", FALSE) - var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - switch(M.melee_damage_type) - if(BRUTE) - adjustBruteLoss(damage) - if(BURN) - adjustFireLoss(damage) - if(TOX) - adjustToxLoss(damage) - if(OXY) - adjustOxyLoss(damage) - if(CLONE) - adjustCloneLoss(damage) - if(STAMINA) - adjustStaminaLoss(damage) - updatehealth() - /mob/living/silicon/robot/attack_ghost(mob/user) if(wiresexposed) wires.Interact(user) -/mob/living/silicon/robot/attack_hand(mob/user) - add_fingerprint(user) - - if(opened && !wiresexposed && (!istype(user, /mob/living/silicon))) - if(cell) - cell.updateicon() - cell.add_fingerprint(user) - user.put_in_active_hand(cell) - to_chat(user, "You remove \the [cell].") - cell = null - update_icons() - diag_hud_set_borgcell() - - if(!opened && (!istype(user, /mob/living/silicon))) - if(user.a_intent == INTENT_HELP) - user.visible_message("[user] pets [src]!", \ - "You pet [src]!") - /mob/living/silicon/robot/proc/allowed(obj/item/I) var/obj/dummy = new /obj(null) // Create a dummy object to check access on as to avoid having to snowflake check_access on every mob dummy.req_access = req_access diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm new file mode 100644 index 00000000000..ca240058e58 --- /dev/null +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -0,0 +1,59 @@ +/mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M) + if(M.a_intent == INTENT_DISARM) + if(!lying) + M.do_attack_animation(src) + if(prob(85)) + Stun(7) + step(src, get_dir(M,src)) + spawn(5) + step(src, get_dir(M,src)) + add_logs(M, src, "pushed", admin=0) + playsound(loc, 'sound/weapons/pierce.ogg', 50, 1, -1) + visible_message("[M] has forced back [src]!",\ + "[M] has forced back [src]!") + else + playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) + visible_message("[M] took a swipe at [src]!",\ + "[M] took a swipe at [src]!") + else + ..() + return + +/mob/living/silicon/robot/attack_slime(mob/living/carbon/slime/M) + if(..()) //successful slime shock + flash_eyes(affect_silicon = 1) + var/stunprob = M.powerlevel * 7 + 10 + if(prob(stunprob) && M.powerlevel >= 8) + adjustBruteLoss(M.powerlevel * rand(6,10)) + + var/damage = rand(1, 3) + + if(M.is_adult) + damage = rand(20, 40) + else + damage = rand(5, 35) + damage = round(damage / 2) // borgs recieve half damage + adjustBruteLoss(damage) + updatehealth() + return + +/mob/living/silicon/robot/attack_hand(mob/living/carbon/human/user) + add_fingerprint(user) + + if(opened && !wiresexposed && !issilicon(user)) + if(cell) + cell.updateicon() + cell.add_fingerprint(user) + user.put_in_active_hand(cell) + to_chat(user, "You remove \the [cell].") + cell = null + update_icons() + diag_hud_set_borgcell() + + if(!opened) + if(..()) // hulk attack + spark_system.start() + spawn(0) + step_away(src, user, 15) + sleep(3) + step_away(src, user, 15) diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm new file mode 100644 index 00000000000..5659eecc4dc --- /dev/null +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -0,0 +1,66 @@ +/mob/living/silicon/grabbedby(mob/living/user) + return + +/mob/living/silicon/attack_alien(mob/living/carbon/alien/humanoid/M) + if(..()) //if harm or disarm intent + var/damage = rand(10, 20) + if(prob(90)) + add_logs(M, src, "attacked", admin=0) + playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) + visible_message("[M] has slashed at [src]!", \ + "[M] has slashed at [src]!") + if(prob(8)) + flash_eyes(affect_silicon = 1) + add_logs(M, src, "attacked", admin=0) + adjustBruteLoss(damage) + updatehealth() + else + playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) + visible_message("[M] took a swipe at [src]!", \ + "[M] took a swipe at [src]!") + return + +/mob/living/silicon/attack_animal(mob/living/simple_animal/M) + if(..()) + var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) + switch(M.melee_damage_type) + if(BRUTE) + adjustBruteLoss(damage) + if(BURN) + adjustFireLoss(damage) + if(TOX) + adjustToxLoss(damage) + if(OXY) + adjustOxyLoss(damage) + if(CLONE) + adjustCloneLoss(damage) + if(STAMINA) + adjustStaminaLoss(damage) + updatehealth() + +/mob/living/silicon/attack_larva(mob/living/carbon/alien/larva/L) + if(L.a_intent == INTENT_HELP) + visible_message("[L.name] rubs its head against [src].") + +/mob/living/silicon/attack_hand(mob/living/carbon/human/M) + switch(M.a_intent) + if(INTENT_HELP) + M.visible_message("[M] pets [src]!", \ + "You pet [src]!") + if("grab") + grabbedby(M) + else + M.do_attack_animation(src) + playsound(loc, 'sound/effects/bang.ogg', 10, 1) + if(HULK in M.mutations) + var/damage = rand(10,15) + adjustBruteLoss(damage) + add_logs(M, src, "attacked", admin=0) + playsound(loc, "punch", 25, 1, -1) + visible_message("[M] has punched [src]!", \ + "[M] has punched [src]!") + return 1 + else + visible_message("[M] punches [src], but doesn't leave a dent.", \ + "[M] punches [src], but doesn't leave a dent.!") + return 0 diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm new file mode 100644 index 00000000000..acf22ed69f7 --- /dev/null +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -0,0 +1,60 @@ +/mob/living/simple_animal/attack_hand(mob/living/carbon/human/M) + ..() + switch(M.a_intent) + + if(INTENT_HELP) + if(health > 0) + visible_message("[M] [response_help] [src].") + playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + + if(INTENT_GRAB) + grabbedby(M) + + if(INTENT_HARM, INTENT_DISARM) + M.do_attack_animation(src) + visible_message("[M] [response_harm] [src]!") + playsound(loc, "punch", 25, 1, -1) + attack_threshold_check(harm_intent_damage) + add_logs(M, src, "attacked", admin=0) + updatehealth() + return 1 + +/mob/living/simple_animal/attack_alien(mob/living/carbon/alien/humanoid/M) + if(..()) //if harm or disarm intent. + var/damage = rand(15, 30) + visible_message("[M] has slashed at [src]!", \ + "[M] has slashed at [src]!") + playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) + add_logs(M, src, "attacked", admin=0) + attack_threshold_check(damage) + return + +/mob/living/simple_animal/attack_larva(mob/living/carbon/alien/larva/L) + if(..()) //successful larva bite + var/damage = rand(5, 10) + if(stat != DEAD) + L.amount_grown = min(L.amount_grown + damage, L.max_grown) + attack_threshold_check(damage) + +/mob/living/simple_animal/attack_animal(mob/living/simple_animal/M) + if(..()) + var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) + attack_threshold_check(damage, M.melee_damage_type) + +/mob/living/simple_animal/attack_slime(mob/living/carbon/slime/M) + ..() + var/damage = rand(1, 3) + + if(M.is_adult) + damage = rand(20, 40) + else + damage = rand(5, 35) + + attack_threshold_check(damage) + return + +/mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE) + if(damage <= force_threshold || !damage_coeff[damagetype]) + visible_message("[src] looks unharmed.") + else + apply_damage(damage, damagetype) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index ae8cecb8eb2..8d9d07c00e7 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -258,21 +258,21 @@ return return 1 //Successful completion. Used to prevent child process() continuing if this one is ended early. -/mob/living/simple_animal/bot/attack_alien(var/mob/living/carbon/alien/user as mob) +/mob/living/simple_animal/bot/attack_alien(mob/living/carbon/alien/user) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) apply_damage(rand(15,30), BRUTE) - visible_message("[user] has slashed [src]!") + visible_message("[user] has slashed [src]!") playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) if(prob(10)) new /obj/effect/decal/cleanable/blood/oil(loc) -/mob/living/simple_animal/bot/attack_animal(var/mob/living/simple_animal/M as mob) +/mob/living/simple_animal/bot/attack_animal(mob/living/simple_animal/M) M.do_attack_animation(src) if(M.melee_damage_upper == 0) return apply_damage(M.melee_damage_upper, BRUTE) - visible_message("[M] has [M.attacktext] [src]!") + visible_message("[M] has [M.attacktext] [src]!") add_attack_logs(M, src, "Animal attacked", FALSE) if(prob(10)) new /obj/effect/decal/cleanable/blood/oil(loc) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index a4eba013f94..c7b82dc44b8 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -264,19 +264,6 @@ ..(act, m_type, message) -/mob/living/simple_animal/attack_animal(mob/living/simple_animal/M as mob) - if(M.melee_damage_upper == 0) - M.custom_emote(1, "[M.friendly] [src]") - else - M.do_attack_animation(src) - if(M.attack_sound) - playsound(loc, M.attack_sound, 50, 1, 1) - visible_message("\The [M] [M.attacktext] [src]!", \ - "\The [M] [M.attacktext] [src]!") - add_attack_logs(M, src, "Animal attacked") - var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) - attack_threshold_check(damage,M.melee_damage_type) - /mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) if(!Proj) return @@ -285,104 +272,6 @@ Proj.on_hit(src, 0) return 0 -/mob/living/simple_animal/attack_hand(mob/living/carbon/human/M as mob) - ..() - - switch(M.a_intent) - - if(INTENT_HELP) - if(health > 0) - visible_message(" [M] [response_help] [src].") - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - - if(INTENT_GRAB) - if(M == src || anchored) - return - if(!(status_flags & CANPUSH)) - return - - var/obj/item/grab/G = new /obj/item/grab(M, src ) - - M.put_in_active_hand(G) - - G.synch() - - LAssailant = M - - visible_message("[M] has grabbed [src] passively!") - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - - if(INTENT_HARM, INTENT_DISARM) - M.do_attack_animation(src) - visible_message("[M] [response_harm] [src]!") - playsound(loc, "punch", 25, 1, -1) - attack_threshold_check(harm_intent_damage) - - return - -/mob/living/simple_animal/attack_alien(mob/living/carbon/alien/humanoid/M as mob) - - switch(M.a_intent) - - if(INTENT_HELP) - - visible_message("[M] caresses [src] with its scythe like arm.") - if(INTENT_GRAB) - grabbedby(M) - - if(INTENT_HARM, INTENT_DISARM) - M.do_attack_animation(src) - var/damage = rand(15, 30) - visible_message("[M] has slashed at [src]!", \ - "[M] has slashed at [src]!") - playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - attack_threshold_check(damage) - - return - -/mob/living/simple_animal/attack_larva(mob/living/carbon/alien/larva/L as mob) - - switch(L.a_intent) - if(INTENT_HELP) - visible_message("[L] rubs its head against [src].") - - - else - L.do_attack_animation(src) - var/damage = rand(5, 10) - visible_message("[L] bites [src]!", \ - "[L] bites [src]!") - playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) - - if(stat != DEAD) - L.amount_grown = min(L.amount_grown + damage, L.max_grown) - attack_threshold_check(damage) - - -/mob/living/simple_animal/attack_slime(mob/living/carbon/slime/M as mob) - if(!ticker) - to_chat(M, "You cannot attack people before the game has started.") - return - - if(M.Victim) return // can't attack while eating! - - if(health > 0) - M.do_attack_animation(src) - visible_message("[M.name] glomps [src]!", \ - "[M.name] glomps [src]!") - - var/damage = rand(1, 3) - - if(M.is_adult) - damage = rand(20, 40) - else - damage = rand(5, 35) - - attack_threshold_check(damage) - - - return - /mob/living/simple_animal/attackby(obj/item/O, mob/living/user) if(can_collar && !collar && istype(O, /obj/item/clothing/accessory/petcollar)) var/obj/item/clothing/accessory/petcollar/C = O @@ -510,12 +399,6 @@ /mob/living/simple_animal/ExtinguishMob() return -/mob/living/simple_animal/proc/attack_threshold_check(damage, damagetype = BRUTE) - if(damage <= force_threshold || !damage_coeff[damagetype]) - visible_message("[src] looks unharmed from the damage.") - else - apply_damage(damage, damagetype) - /mob/living/simple_animal/update_transform() var/matrix/ntransform = matrix(transform) //aka transform.Copy() var/changed = 0 diff --git a/paradise.dme b/paradise.dme index ba1e6d19a10..1d329f9aec5 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1570,7 +1570,7 @@ #include "code\modules\mob\living\update_status.dm" #include "code\modules\mob\living\carbon\_defines.dm" #include "code\modules\mob\living\carbon\carbon.dm" -#include "code\modules\mob\living\carbon\carbon_defenses.dm" +#include "code\modules\mob\living\carbon\carbon_defense.dm" #include "code\modules\mob\living\carbon\carbon_defines.dm" #include "code\modules\mob\living\carbon\death.dm" #include "code\modules\mob\living\carbon\give.dm" @@ -1579,7 +1579,7 @@ #include "code\modules\mob\living\carbon\update_icons.dm" #include "code\modules\mob\living\carbon\update_status.dm" #include "code\modules\mob\living\carbon\alien\alien.dm" -#include "code\modules\mob\living\carbon\alien\alien_defenses.dm" +#include "code\modules\mob\living\carbon\alien\alien_defense.dm" #include "code\modules\mob\living\carbon\alien\death.dm" #include "code\modules\mob\living\carbon\alien\life.dm" #include "code\modules\mob\living\carbon\alien\login.dm" @@ -1588,6 +1588,7 @@ #include "code\modules\mob\living\carbon\alien\humanoid\emote.dm" #include "code\modules\mob\living\carbon\alien\humanoid\empress.dm" #include "code\modules\mob\living\carbon\alien\humanoid\humanoid.dm" +#include "code\modules\mob\living\carbon\alien\humanoid\humanoid_defense.dm" #include "code\modules\mob\living\carbon\alien\humanoid\inventory.dm" #include "code\modules\mob\living\carbon\alien\humanoid\life.dm" #include "code\modules\mob\living\carbon\alien\humanoid\queen.dm" @@ -1599,6 +1600,7 @@ #include "code\modules\mob\living\carbon\alien\larva\emote.dm" #include "code\modules\mob\living\carbon\alien\larva\inventory.dm" #include "code\modules\mob\living\carbon\alien\larva\larva.dm" +#include "code\modules\mob\living\carbon\alien\larva\larva_defense.dm" #include "code\modules\mob\living\carbon\alien\larva\life.dm" #include "code\modules\mob\living\carbon\alien\larva\powers.dm" #include "code\modules\mob\living\carbon\alien\larva\update_icons.dm" @@ -1620,7 +1622,6 @@ #include "code\modules\mob\living\carbon\human\emote.dm" #include "code\modules\mob\living\carbon\human\examine.dm" #include "code\modules\mob\living\carbon\human\human.dm" -#include "code\modules\mob\living\carbon\human\human_attackalien.dm" #include "code\modules\mob\living\carbon\human\human_attackhand.dm" #include "code\modules\mob\living\carbon\human\human_damage.dm" #include "code\modules\mob\living\carbon\human\human_defense.dm" @@ -1663,8 +1664,10 @@ #include "code\modules\mob\living\silicon\login.dm" #include "code\modules\mob\living\silicon\say.dm" #include "code\modules\mob\living\silicon\silicon.dm" +#include "code\modules\mob\living\silicon\silicon_defense.dm" #include "code\modules\mob\living\silicon\subsystems.dm" #include "code\modules\mob\living\silicon\ai\ai.dm" +#include "code\modules\mob\living\silicon\ai\ai_defense.dm" #include "code\modules\mob\living\silicon\ai\death.dm" #include "code\modules\mob\living\silicon\ai\examine.dm" #include "code\modules\mob\living\silicon\ai\latejoin.dm" @@ -1702,6 +1705,7 @@ #include "code\modules\mob\living\silicon\robot\photos.dm" #include "code\modules\mob\living\silicon\robot\robot.dm" #include "code\modules\mob\living\silicon\robot\robot_damage.dm" +#include "code\modules\mob\living\silicon\robot\robot_defense.dm" #include "code\modules\mob\living\silicon\robot\robot_items.dm" #include "code\modules\mob\living\silicon\robot\robot_module_actions.dm" #include "code\modules\mob\living\silicon\robot\robot_modules.dm" @@ -1715,6 +1719,7 @@ #include "code\modules\mob\living\silicon\robot\drone\drone_manufacturer.dm" #include "code\modules\mob\living\silicon\robot\drone\drone_say.dm" #include "code\modules\mob\living\silicon\robot\drone\update_status.dm" +#include "code\modules\mob\living\simple_animal\animal_defense.dm" #include "code\modules\mob\living\simple_animal\constructs.dm" #include "code\modules\mob\living\simple_animal\corpse.dm" #include "code\modules\mob\living\simple_animal\parrot.dm" From 20670489214c4b5d2de5b88746479feef5e9402d Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Wed, 28 Mar 2018 23:42:37 +0400 Subject: [PATCH 2/6] changes human/attack_hand() to be species-based splits attack_hand() intents into their own species procs --- .../mob/living/carbon/carbon_defense.dm | 6 + .../living/carbon/human/human_attackhand.dm | 197 ------------------ .../mob/living/carbon/human/human_defense.dm | 7 + .../mob/living/carbon/human/species/apollo.dm | 43 ++-- .../living/carbon/human/species/species.dm | 195 ++++++++++++++++- paradise.dme | 1 - 6 files changed, 227 insertions(+), 222 deletions(-) delete mode 100644 code/modules/mob/living/carbon/human/human_attackhand.dm diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 140e868dddf..7e6f427e069 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -38,6 +38,12 @@ var/datum/disease/D = thing if(D.IsSpreadByTouch()) ContractDisease(D) + + if(lying && surgeries.len) + if(user.a_intent == INTENT_HELP) + for(var/datum/surgery/S in surgeries) + if(S.next_step(user, user.a_intent)) + return 1 return 0 /mob/living/carbon/attack_slime(mob/living/carbon/slime/M) diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm deleted file mode 100644 index eedc6c1ea0c..00000000000 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ /dev/null @@ -1,197 +0,0 @@ -/mob/living/carbon/human/attack_hand(mob/living/carbon/human/M) - if(frozen) - to_chat(M, "Do not touch Admin-Frozen people.") - return - - var/mob/living/carbon/human/H = M - if(istype(H)) - var/obj/item/organ/external/temp = H.bodyparts_by_name["r_hand"] - if(H.hand) - temp = H.bodyparts_by_name["l_hand"] - if(!temp || !temp.is_usable()) - to_chat(H, "You can't use your hand.") - return - - ..() - - if((M != src) && M.a_intent != INTENT_HELP && check_shields(0, M.name, attack_type = UNARMED_ATTACK)) - add_attack_logs(M, src, "Melee attacked with fists (miss/block)") - visible_message("[M] attempted to touch [src]!") - return 0 - - var/datum/martial_art/attacker_style = M.martial_art - - species.handle_attack_hand(src, M) - - switch(M.a_intent) - if(INTENT_HELP) - if(attacker_style && attacker_style.help_act(H, src))//adminfu only... - return 1 - if(can_operate(src)) - if(health >= config.health_threshold_crit) - if(src.surgeries.len) - for(var/datum/surgery/S in src.surgeries) - if(S.next_step(M, src)) - return 1 - help_shake_act(M) - add_attack_logs(M, src, "Shaked") - return 1 - if(health >= config.health_threshold_crit) - help_shake_act(M) - add_attack_logs(M, src, "Shaked") - return 1 - if(!H.check_has_mouth()) - to_chat(H, "You don't have a mouth, you cannot perform CPR!") - return - if(!check_has_mouth()) - to_chat(H, "They don't have a mouth, you cannot perform CPR!") - return - if((M.head && (M.head.flags_cover & HEADCOVERSMOUTH)) || (M.wear_mask && (M.wear_mask.flags_cover & MASKCOVERSMOUTH) && !M.wear_mask.mask_adjusted)) - to_chat(M, "Remove your mask!") - return 0 - if((head && (head.flags_cover & HEADCOVERSMOUTH)) || (wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH) && !wear_mask.mask_adjusted)) - to_chat(M, "Remove his mask!") - return 0 - - M.visible_message("\The [M] is trying to perform CPR on \the [src]!", \ - "You try to perform CPR on \the [src]!") - if(do_mob(M, src, 40)) - if(health > config.health_threshold_dead && health <= config.health_threshold_crit) - var/suff = min(getOxyLoss(), 7) - adjustOxyLoss(-suff) - updatehealth() - M.visible_message("\The [M] performs CPR on \the [src]!", \ - "You perform CPR on \the [src].") - - to_chat(src, "You feel a breath of fresh air enter your lungs. It feels good.") - to_chat(M, "Repeat at least every 7 seconds.") - add_attack_logs(M, src, "CPRed", FALSE) - return 1 - else - to_chat(M, "You need to stay still while performing CPR!") - - if(INTENT_GRAB) - if(attacker_style && attacker_style.grab_act(H, src)) - return 1 - else - grabbedby(M) - return 1 - - if(INTENT_HARM) - //Vampire code - if(M.mind && M.mind.vampire && (M.mind in ticker.mode.vampires) && !M.mind.vampire.draining && M.zone_sel && M.zone_sel.selecting == "head" && src != M) - if((NO_BLOOD in species.species_traits) || species.exotic_blood || !blood_volume) - to_chat(M, "They have no blood!") - return - if(mind && mind.vampire && (mind in ticker.mode.vampires)) - to_chat(M, "Your fangs fail to pierce [name]'s cold flesh") - return - if(SKELETON in mutations) - to_chat(M, "There is no blood in a skeleton!") - return - if(issmall(src) && !ckey) //Monkeyized humans are okay, humanized monkeys are okay, NPC monkeys are not. - to_chat(M, "Blood from a monkey is useless!") - return - //we're good to suck the blood, blaah - M.mind.vampire.handle_bloodsucking(src) - add_attack_logs(M, src, "vampirebit") - return - //end vampire codes - if(attacker_style && attacker_style.harm_act(H, src)) - return 1 - else - var/datum/unarmed_attack/attack = M.species.unarmed - - M.do_attack_animation(src) - add_attack_logs(M, src, "Melee attacked with fists") - - if(!iscarbon(M)) - LAssailant = null - else - LAssailant = M - - var/damage = rand(M.species.punchdamagelow, M.species.punchdamagehigh) - damage += attack.damage - if(!damage) - playsound(loc, attack.miss_sound, 25, 1, -1) - visible_message("[M] tried to [pick(attack.attack_verb)] [src]!") - return 0 - - - var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) - var/armor_block = run_armor_check(affecting, "melee") - - if(HULK in M.mutations) - adjustBruteLoss(15) - - playsound(loc, attack.attack_sound, 25, 1, -1) - - visible_message("[M] [pick(attack.attack_verb)]ed [src]!") - - apply_damage(damage, BRUTE, affecting, armor_block, sharp = attack.sharp) //moving this back here means Armalis are going to knock you down 70% of the time, but they're pure adminbus anyway. - if((stat != DEAD) && damage >= M.species.punchstunthreshold) - visible_message("[M] has weakened [src]!", \ - "[M] has weakened [src]!") - apply_effect(4, WEAKEN, armor_block) - forcesay(hit_appends) - else if(lying) - forcesay(hit_appends) - - - if(INTENT_DISARM) - if(attacker_style && attacker_style.disarm_act(H, src)) - return 1 - else - add_attack_logs(M, src, "Disarmed") - M.do_attack_animation(src) - if(w_uniform) - w_uniform.add_fingerprint(M) - var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) - var/randn = rand(1, 100) - if(randn <= 25) - apply_effect(2, WEAKEN, run_armor_check(affecting, "melee")) - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - visible_message("[M] has pushed [src]!") - add_attack_logs(M, src, "Pushed over") - if(!iscarbon(M)) - LAssailant = null - else - LAssailant = M - return - - var/talked = 0 // BubbleWrap - - if(randn <= 60) - //BubbleWrap: Disarming breaks a pull - if(pulling) - visible_message("[M] has broken [src]'s grip on [pulling]!") - talked = 1 - stop_pulling() - - //BubbleWrap: Disarming also breaks a grab - this will also stop someone being choked, won't it? - if(istype(l_hand, /obj/item/grab)) - var/obj/item/grab/lgrab = l_hand - if(lgrab.affecting) - visible_message("[M] has broken [src]'s grip on [lgrab.affecting]!") - talked = 1 - spawn(1) - qdel(lgrab) - if(istype(r_hand, /obj/item/grab)) - var/obj/item/grab/rgrab = r_hand - if(rgrab.affecting) - visible_message("[M] has broken [src]'s grip on [rgrab.affecting]!") - talked = 1 - spawn(1) - qdel(rgrab) - //End BubbleWrap - - if(!talked) //BubbleWrap - if(drop_item()) - visible_message("[M] has disarmed [src]!") - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - return - - - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] attempted to disarm [src]!") - return diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 1d4dc544667..d6545d9bff6 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -348,6 +348,13 @@ emp_act if(penetrated_dam) SS.create_breaches(damtype, penetrated_dam) +/mob/living/carbon/human/attack_hand(mob/user) + if(..()) //to allow surgery to return properly. + return + if(ishuman(user)) + var/mob/living/carbon/human/H = user + species.spec_attack_hand(H, src) + /mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/L) if(..()) //successful larva bite. var/damage = rand(1, 3) diff --git a/code/modules/mob/living/carbon/human/species/apollo.dm b/code/modules/mob/living/carbon/human/species/apollo.dm index f1ca3294017..0b38b57c786 100644 --- a/code/modules/mob/living/carbon/human/species/apollo.dm +++ b/code/modules/mob/living/carbon/human/species/apollo.dm @@ -56,30 +56,29 @@ to_chat(C, "Your antennae tingle as you are overcome with pain...") to_chat(C, "It feels like part of you has died.") -/datum/species/wryn/handle_attack_hand(var/mob/living/carbon/human/H, var/mob/living/carbon/human/M) - var/obj/item/organ/external/head/head_organ = H.get_organ("head") - if(M.a_intent == INTENT_HARM) - if(H.handcuffed) - if(!H.get_int_organ(/obj/item/organ/internal/wryn/hivenode)) return - var/turf/p_loc = M.loc - var/turf/p_loc_m = H.loc +/datum/species/wryn/harm(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) + if(target.handcuffed) + if(!target.get_int_organ(/obj/item/organ/internal/wryn/hivenode)) + return - M.visible_message("[M] begins to violently pull off [H]'s antennae.") - to_chat(H, "[M] grips your antennae and starts violently pulling!") - if(do_after(H, 250, target = src)) - if(p_loc == M.loc && p_loc_m == H.loc) - var/obj/item/organ/internal/wryn/hivenode/node = new /obj/item/organ/internal/wryn/hivenode - H.remove_language("Wryn Hivemind") - node.remove(H) - node.loc = M.loc - to_chat(M, "You hear a loud crunch as you mercilessly pull off [H]'s antennae.") - to_chat(H, "You hear a loud crunch as your antennae is ripped off your head by [M].") - to_chat(H, "It's so quiet...") - head_organ.h_style = "Bald" - H.update_hair() + user.visible_message("[user] begins to violently pull off [target]'s antennae.") + to_chat(target, "[user] grips your antennae and starts violently pulling!") + if(do_mob(user, target, 250)) + var/obj/item/organ/internal/wryn/hivenode/node = new /obj/item/organ/internal/wryn/hivenode + target.remove_language("Wryn Hivemind") + node.remove(target) + node.forceMove(user.loc) + to_chat(user, "You hear a loud crunch as you mercilessly pull off [target]'s antennae.") + to_chat(target, "You hear a loud crunch as your antennae is ripped off your head by [user].") + to_chat(target, "It's so quiet...") + var/obj/item/organ/external/head/head_organ = target.get_organ("head") + head_organ.h_style = "Bald" + target.update_hair() - add_attack_logs(M, H, "Antennae removed") - return 0 + add_attack_logs(user, target, "Antennae removed") + return 0 + else + ..() /datum/species/nucleation name = "Nucleation" diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 901d221a8b3..8bc5ccfd6b4 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -315,8 +315,199 @@ /datum/species/proc/handle_death(var/mob/living/carbon/human/H) //Handles any species-specific death events (such as dionaea nymph spawns). return -/datum/species/proc/handle_attack_hand(var/mob/living/carbon/human/H, var/mob/living/carbon/human/M) //Handles any species-specific attackhand events. - return +/datum/species/proc/help(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) + if(attacker_style && attacker_style.help_act(user, target))//adminfu only... + return 1 + if(target.health >= config.health_threshold_crit) + target.help_shake_act(user) + add_attack_logs(user, target, "Shaked") + return 1 + if(!user.check_has_mouth()) + to_chat(user, "You don't have a mouth, you cannot perform CPR!") + return + if(!target.check_has_mouth()) + to_chat(user, "They don't have a mouth, you cannot perform CPR!") + return + if((user.head && (user.head.flags_cover & HEADCOVERSMOUTH)) || (user.wear_mask && (user.wear_mask.flags_cover & MASKCOVERSMOUTH) && !user.wear_mask.mask_adjusted)) + to_chat(user, "Remove your mask!") + return 0 + if((target.head && (target.head.flags_cover & HEADCOVERSMOUTH)) || (target.wear_mask && (target.wear_mask.flags_cover & MASKCOVERSMOUTH) && !target.wear_mask.mask_adjusted)) + to_chat(user, "Remove his mask!") + return 0 + + user.visible_message("\The [user] is trying to perform CPR on \the [target]!", \ + "You try to perform CPR on \the [target]!") + if(do_mob(user, target, 40)) + if(target.health > config.health_threshold_dead && target.health <= config.health_threshold_crit) + var/suff = min(target.getOxyLoss(), 7) + target.adjustOxyLoss(-suff) + target.updatehealth() + user.visible_message("\The [user] performs CPR on \the [target]!", \ + "You perform CPR on \the [target].") + + to_chat(target, "You feel a breath of fresh air enter your lungs. It feels good.") + to_chat(user, "Repeat at least every 7 seconds.") + add_attack_logs(user, target, "CPRed", FALSE) + return 1 + else + to_chat(user, "You need to stay still while performing CPR!") + +/datum/species/proc/grab(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) + if(attacker_style && attacker_style.grab_act(user, target)) + return 1 + else + target.grabbedby(user) + return 1 + +/datum/species/proc/harm(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) + //Vampire code + if(user.mind && user.mind.vampire && (user.mind in ticker.mode.vampires) && !user.mind.vampire.draining && user.zone_sel && user.zone_sel.selecting == "head" && target != user) + if((NO_BLOOD in target.species.species_traits) || target.species.exotic_blood || !target.blood_volume) + to_chat(user, "They have no blood!") + return + if(target.mind && target.mind.vampire && (target.mind in ticker.mode.vampires)) + to_chat(user, "Your fangs fail to pierce [target.name]'s cold flesh") + return + if(SKELETON in target.mutations) + to_chat(user, "There is no blood in a skeleton!") + return + if(issmall(target) && !target.ckey) //Monkeyized humans are okay, humanized monkeys are okay, NPC monkeys are not. + to_chat(user, "Blood from a monkey is useless!") + return + //we're good to suck the blood, blaah + user.mind.vampire.handle_bloodsucking(target) + add_attack_logs(user, target, "vampirebit") + return + //end vampire codes + if(attacker_style && attacker_style.harm_act(user, target)) + return 1 + else + var/datum/unarmed_attack/attack = user.species.unarmed + + user.do_attack_animation(target) + add_attack_logs(user, target, "Melee attacked with fists") + + if(!iscarbon(user)) + target.LAssailant = null + else + target.LAssailant = user + + var/damage = rand(user.species.punchdamagelow, user.species.punchdamagehigh) + damage += attack.damage + if(!damage) + playsound(target.loc, attack.miss_sound, 25, 1, -1) + target.visible_message("[user] tried to [pick(attack.attack_verb)] [target]!") + return 0 + + + var/obj/item/organ/external/affecting = target.get_organ(ran_zone(user.zone_sel.selecting)) + var/armor_block = target.run_armor_check(affecting, "melee") + + if(HULK in user.mutations) + target.adjustBruteLoss(15) + + playsound(target.loc, attack.attack_sound, 25, 1, -1) + + target.visible_message("[user] [pick(attack.attack_verb)]ed [target]!") + + target.apply_damage(damage, BRUTE, affecting, armor_block, sharp = attack.sharp) //moving this back here means Armalis are going to knock you down 70% of the time, but they're pure adminbus anyway. + if((target.stat != DEAD) && damage >= user.species.punchstunthreshold) + target.visible_message("[user] has weakened [target]!", \ + "[user] has weakened [target]!") + target.apply_effect(4, WEAKEN, armor_block) + target.forcesay(hit_appends) + else if(target.lying) + target.forcesay(hit_appends) + +/datum/species/proc/disarm(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) + if(attacker_style && attacker_style.disarm_act(user, target)) + return 1 + else + add_attack_logs(user, target, "Disarmed") + user.do_attack_animation(target) + if(target.w_uniform) + target.w_uniform.add_fingerprint(user) + var/obj/item/organ/external/affecting = target.get_organ(ran_zone(user.zone_sel.selecting)) + var/randn = rand(1, 100) + if(randn <= 25) + target.apply_effect(2, WEAKEN, target.run_armor_check(affecting, "melee")) + playsound(target.loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + target.visible_message("[user] has pushed [target]!") + add_attack_logs(user, target, "Pushed over") + if(!iscarbon(user)) + target.LAssailant = null + else + target.LAssailant = user + return + + var/talked = 0 // BubbleWrap + + if(randn <= 60) + //BubbleWrap: Disarming breaks a pull + if(target.pulling) + target.visible_message("[user] has broken [target]'s grip on [target.pulling]!") + talked = 1 + target.stop_pulling() + + //BubbleWrap: Disarming also breaks a grab - this will also stop someone being choked, won't it? + if(istype(target.l_hand, /obj/item/weapon/grab)) + var/obj/item/weapon/grab/lgrab = target.l_hand + if(lgrab.affecting) + target.visible_message("[user] has broken [target]'s grip on [lgrab.affecting]!") + talked = 1 + spawn(1) + qdel(lgrab) + if(istype(target.r_hand, /obj/item/weapon/grab)) + var/obj/item/weapon/grab/rgrab = target.r_hand + if(rgrab.affecting) + target.visible_message("[user] has broken [target]'s grip on [rgrab.affecting]!") + talked = 1 + spawn(1) + qdel(rgrab) + //End BubbleWrap + + if(!talked) //BubbleWrap + if(target.drop_item()) + target.visible_message("[user] has disarmed [target]!") + playsound(target.loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + return + + + playsound(target.loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + target.visible_message("[user] attempted to disarm [target]!") + +/datum/species/proc/spec_attack_hand(mob/living/carbon/human/M, mob/living/carbon/human/H, datum/martial_art/attacker_style = M.martial_art) //Handles any species-specific attackhand events. + if(!istype(M)) + return + if(H.frozen) + to_chat(M, "Do not touch Admin-Frozen people.") + return + + if(istype(M)) + var/obj/item/organ/external/temp = M.bodyparts_by_name["r_hand"] + if(M.hand) + temp = M.bodyparts_by_name["l_hand"] + if(!temp || !temp.is_usable()) + to_chat(M, "You can't use your hand.") + return + + if((M != H) && M.a_intent != INTENT_HELP && H.check_shields(0, M.name, attack_type = UNARMED_ATTACK)) + add_attack_logs(M, H, "Melee attacked with fists (miss/block)") + H.visible_message("[M] attempted to touch [H]!") + return 0 + + switch(M.a_intent) + if(INTENT_HELP) + help(M, H, attacker_style) + + if(INTENT_GRAB) + grab(M, H, attacker_style) + + if(INTENT_HARM) + harm(M, H, attacker_style) + + if(INTENT_DISARM) + disarm(M, H, attacker_style) /datum/species/proc/say_filter(mob/M, message, datum/language/speaking) return message diff --git a/paradise.dme b/paradise.dme index 1d329f9aec5..716baebdf05 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1622,7 +1622,6 @@ #include "code\modules\mob\living\carbon\human\emote.dm" #include "code\modules\mob\living\carbon\human\examine.dm" #include "code\modules\mob\living\carbon\human\human.dm" -#include "code\modules\mob\living\carbon\human\human_attackhand.dm" #include "code\modules\mob\living\carbon\human\human_damage.dm" #include "code\modules\mob\living\carbon\human\human_defense.dm" #include "code\modules\mob\living\carbon\human\human_defines.dm" From d873cf93fa3cfe94dfe19aa7efad92cdeeba97b7 Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Fri, 30 Mar 2018 19:24:02 +0400 Subject: [PATCH 3/6] do_cpr() proc for humans --- code/modules/mob/living/carbon/human/human.dm | 33 +++++++++++++++++++ .../living/carbon/human/species/species.dm | 29 +--------------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2cb8bbb396e..6f5e692c311 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1728,6 +1728,39 @@ Eyes need to have significantly high darksight to shine unless the mob has the X return ..() +/mob/living/carbon/human/proc/do_cpr(mob/living/carbon/human/H) + if(H.stat == DEAD || (H.status_flags & FAKEDEATH)) + to_chat(src, "[H.name] is dead!") + return + if(!check_has_mouth()) + to_chat(src, "You don't have a mouth, you cannot perform CPR!") + return + if(!H.check_has_mouth()) + to_chat(src, "They don't have a mouth, you cannot perform CPR!") + return + if((head && (head.flags_cover & HEADCOVERSMOUTH)) || (wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH) && !wear_mask.mask_adjusted)) + to_chat(src, "Remove your mask first!") + return 0 + if((H.head && (H.head.flags_cover & HEADCOVERSMOUTH)) || (H.wear_mask && (H.wear_mask.flags_cover & MASKCOVERSMOUTH) && !H.wear_mask.mask_adjusted)) + to_chat(src, "Remove their mask first!") + return 0 + visible_message("[src] is trying to perform CPR on [H.name]!", \ + "You try to perform CPR on [H.name]!") + if(do_mob(src, H, 40)) + if(H.health > config.health_threshold_dead && H.health <= config.health_threshold_crit) + var/suff = min(H.getOxyLoss(), 7) + H.adjustOxyLoss(-suff) + H.updatehealth() + visible_message("[src] performs CPR on [H.name]!", \ + "You perform CPR on [H.name].") + + to_chat(H, "You feel a breath of fresh air enter your lungs. It feels good.") + to_chat(src, "Repeat at least every 7 seconds.") + add_logs(src, H, "CPRed") + return 1 + else + to_chat(src, "You need to stay still while performing CPR!") + /mob/living/carbon/human/canBeHandcuffed() if(get_num_arms() >= 2) return TRUE diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 8bc5ccfd6b4..cd10e5b3e60 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -322,35 +322,8 @@ target.help_shake_act(user) add_attack_logs(user, target, "Shaked") return 1 - if(!user.check_has_mouth()) - to_chat(user, "You don't have a mouth, you cannot perform CPR!") - return - if(!target.check_has_mouth()) - to_chat(user, "They don't have a mouth, you cannot perform CPR!") - return - if((user.head && (user.head.flags_cover & HEADCOVERSMOUTH)) || (user.wear_mask && (user.wear_mask.flags_cover & MASKCOVERSMOUTH) && !user.wear_mask.mask_adjusted)) - to_chat(user, "Remove your mask!") - return 0 - if((target.head && (target.head.flags_cover & HEADCOVERSMOUTH)) || (target.wear_mask && (target.wear_mask.flags_cover & MASKCOVERSMOUTH) && !target.wear_mask.mask_adjusted)) - to_chat(user, "Remove his mask!") - return 0 - - user.visible_message("\The [user] is trying to perform CPR on \the [target]!", \ - "You try to perform CPR on \the [target]!") - if(do_mob(user, target, 40)) - if(target.health > config.health_threshold_dead && target.health <= config.health_threshold_crit) - var/suff = min(target.getOxyLoss(), 7) - target.adjustOxyLoss(-suff) - target.updatehealth() - user.visible_message("\The [user] performs CPR on \the [target]!", \ - "You perform CPR on \the [target].") - - to_chat(target, "You feel a breath of fresh air enter your lungs. It feels good.") - to_chat(user, "Repeat at least every 7 seconds.") - add_attack_logs(user, target, "CPRed", FALSE) - return 1 else - to_chat(user, "You need to stay still while performing CPR!") + user.do_cpr(target) /datum/species/proc/grab(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) if(attacker_style && attacker_style.grab_act(user, target)) From f685a74733a240827b01d17b0f988854565797c2 Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Sat, 31 Mar 2018 23:08:17 +0400 Subject: [PATCH 4/6] removes unnecessary alien and brain rads code fix the wryn harm intent special only slimes that actually die produce death message slime emotes now log, slimes can change their face/mood with new emotes plasma and epinephrine can control slime mutation chances, docility potion makes slimes docile and non-hungry instead of creating a SA slime, added proc to add nutrition slime attack surgery fixes, slimes steal nutrition from other slimes on attacking obj/item/weapon -> obj/item --- code/modules/mob/living/carbon/alien/alien.dm | 31 ------ code/modules/mob/living/carbon/brain/life.dm | 23 +--- .../mob/living/carbon/human/species/apollo.dm | 4 +- .../living/carbon/human/species/species.dm | 8 +- code/modules/mob/living/carbon/slime/death.dm | 8 +- code/modules/mob/living/carbon/slime/emote.dm | 47 ++++++-- code/modules/mob/living/carbon/slime/life.dm | 47 ++++++-- .../modules/mob/living/carbon/slime/powers.dm | 101 +++++++++--------- code/modules/mob/living/carbon/slime/slime.dm | 48 ++++----- .../living/simple_animal/friendly/slime.dm | 1 - .../research/xenobiology/xenobiology.dm | 30 ++---- 11 files changed, 167 insertions(+), 181 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 76d60fc7b19..e706b89ca85 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -9,15 +9,10 @@ icon = 'icons/mob/alien.dmi' gender = NEUTER dna = null - - alien_talk_understand = 1 - nightvision = 1 - var/obj/item/card/id/wear_id = null // Fix for station bounced radios -- Skie var/has_fine_manipulation = 0 - var/move_delay_add = 0 // movement delay to add status_flags = CANPARALYSE|CANPUSH @@ -27,7 +22,6 @@ var/heat_protection = 0.5 var/leaping = 0 ventcrawler = 2 - var/list/alien_organs = list() /mob/living/carbon/alien/New() @@ -118,31 +112,6 @@ else clear_alert("alien_fire") -/mob/living/carbon/alien/handle_mutations_and_radiation() - // Aliens love radiation nom nom nom - if(radiation) - if(radiation > 100) - radiation = 100 - - if(radiation < 0) - radiation = 0 - - switch(radiation) - if(1 to 49) - radiation-- - if(prob(25)) - adjustToxLoss(1) - - if(50 to 74) - radiation -= 2 - adjustToxLoss(1) - if(prob(5)) - radiation -= 5 - - if(75 to 100) - radiation -= 3 - adjustToxLoss(3) - /mob/living/carbon/alien/handle_fire()//Aliens on fire code if(..()) return diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm index e61f8750901..757ccab9fb9 100644 --- a/code/modules/mob/living/carbon/brain/life.dm +++ b/code/modules/mob/living/carbon/brain/life.dm @@ -1,36 +1,20 @@ /mob/living/carbon/brain/handle_mutations_and_radiation() if(radiation) if(radiation > 100) - radiation -= 3 - adjustToxLoss(3) - updatehealth() if(!container) to_chat(src, "You feel weak.") else to_chat(src, "STATUS: CRITICAL AMOUNTS OF RADIATION DETECTED.") switch(radiation) - if(0 to 49) - radiation-- - if(prob(25)) - adjustToxLoss(1) - updatehealth() - if(50 to 74) - radiation -= 2 - adjustToxLoss(1) + if(50 to 75) if(prob(5)) - radiation -= 5 if(!container) to_chat(src, "You feel weak.") else to_chat(src, "STATUS: DANGEROUS AMOUNTS OF RADIATION DETECTED.") - updatehealth() - - if(75 to 100) - radiation -= 3 - adjustToxLoss(3) - updatehealth() + ..() /mob/living/carbon/brain/proc/handle_temperature_damage(body_part, exposed_temperature, exposed_intensity) if(status_flags & GODMODE) @@ -38,13 +22,10 @@ if(exposed_temperature > bodytemperature) var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0) - //adjustFireLoss(2.5*discomfort) - //adjustFireLoss(5.0*discomfort) adjustFireLoss(20.0*discomfort) else var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0) - //adjustFireLoss(2.5*discomfort) adjustFireLoss(5.0*discomfort) /mob/living/carbon/brain/handle_regular_status_updates() diff --git a/code/modules/mob/living/carbon/human/species/apollo.dm b/code/modules/mob/living/carbon/human/species/apollo.dm index 0b38b57c786..6c37da34395 100644 --- a/code/modules/mob/living/carbon/human/species/apollo.dm +++ b/code/modules/mob/living/carbon/human/species/apollo.dm @@ -57,9 +57,7 @@ to_chat(C, "It feels like part of you has died.") /datum/species/wryn/harm(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style) - if(target.handcuffed) - if(!target.get_int_organ(/obj/item/organ/internal/wryn/hivenode)) - return + if(target.handcuffed && target.get_int_organ(/obj/item/organ/internal/wryn/hivenode)) user.visible_message("[user] begins to violently pull off [target]'s antennae.") to_chat(target, "[user] grips your antennae and starts violently pulling!") diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index cd10e5b3e60..3158725d71e 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -423,15 +423,15 @@ target.stop_pulling() //BubbleWrap: Disarming also breaks a grab - this will also stop someone being choked, won't it? - if(istype(target.l_hand, /obj/item/weapon/grab)) - var/obj/item/weapon/grab/lgrab = target.l_hand + if(istype(target.l_hand, /obj/item/grab)) + var/obj/item/grab/lgrab = target.l_hand if(lgrab.affecting) target.visible_message("[user] has broken [target]'s grip on [lgrab.affecting]!") talked = 1 spawn(1) qdel(lgrab) - if(istype(target.r_hand, /obj/item/weapon/grab)) - var/obj/item/weapon/grab/rgrab = target.r_hand + if(istype(target.r_hand, /obj/item/grab)) + var/obj/item/grab/rgrab = target.r_hand if(rgrab.affecting) target.visible_message("[user] has broken [target]'s grip on [rgrab.affecting]!") talked = 1 diff --git a/code/modules/mob/living/carbon/slime/death.dm b/code/modules/mob/living/carbon/slime/death.dm index 240454f3e0f..5c551d6e470 100644 --- a/code/modules/mob/living/carbon/slime/death.dm +++ b/code/modules/mob/living/carbon/slime/death.dm @@ -1,4 +1,6 @@ /mob/living/carbon/slime/death(gibbed) + if(stat == DEAD) + return if(!gibbed) if(is_adult) var/mob/living/carbon/slime/M = new /mob/living/carbon/slime(loc) @@ -11,13 +13,11 @@ number = rand(1, 1000) name = "[colour] [is_adult ? "adult" : "baby"] slime ([number])" return - - if(stat == DEAD) return + else + visible_message("The [name] seizes up and falls limp...") stat = DEAD icon_state = "[colour] baby slime dead" overlays.len = 0 - for(var/mob/O in viewers(src, null)) - O.show_message("The [name] seizes up and falls limp...", 1) //ded -- Urist update_canmove() diff --git a/code/modules/mob/living/carbon/slime/emote.dm b/code/modules/mob/living/carbon/slime/emote.dm index b4a6eb140f0..89a48096b23 100644 --- a/code/modules/mob/living/carbon/slime/emote.dm +++ b/code/modules/mob/living/carbon/slime/emote.dm @@ -1,4 +1,4 @@ -/mob/living/carbon/slime/emote(var/act, var/m_type=1, var/message = null) +/mob/living/carbon/slime/emote(act, m_type = 1, message = null) if(findtext(act, "-", 1, null)) var/t1 = findtext(act, "-", 1, null) //param = copytext(act, t1 + 1, length(act) + 1) @@ -8,6 +8,9 @@ act = copytext(act,1,length(act)) act = lowertext(act) + + var/regenerate_icons + switch(act) //Alphabetical please if("me") if(silent) @@ -58,18 +61,44 @@ message = "The [src.name] vibrates!" m_type = 1 + if("noface") //mfw I have no face + mood = null + regenerate_icons = 1 + + if("smile") + mood = "mischevous" + regenerate_icons = 1 + + if(":3") + mood = ":33" + regenerate_icons = 1 + + if("pout") + mood = "pout" + regenerate_icons = 1 + + if("frown") + mood = "sad" + regenerate_icons = 1 + + if("scowl") + mood = "angry" + regenerate_icons = 1 + if("help") //This is an exception - to_chat(src, "Help for slime emotes. You can use these emotes with say \"*emote\":\n\nbounce, custom, jiggle, light, moan, shiver, sway, twitch, vibrate") + to_chat(src, "Help for slime emotes. You can use these emotes with say \"*emote\":\n\nbounce, custom, jiggle, light, moan, shiver, sway, twitch, vibrate. \n\nYou may also change your face with: \n\nsmile, :3, pout, frown, scowl, noface") else to_chat(src, "Unusable emote '[act]'. Say *help for a list.") - if((message && src.stat == 0)) + if((message && stat == CONSCIOUS)) + if(client) + log_emote("[name]/[key] : [message]") if(m_type & 1) - for(var/mob/O in viewers(src, null)) - O.show_message(message, m_type) - //Foreach goto(703) + visible_message(message) else - for(var/mob/O in hearers(src, null)) - O.show_message(message, m_type) - //Foreach goto(746) + loc.audible_message(message) + + if(regenerate_icons) + regenerate_icons() + return \ No newline at end of file diff --git a/code/modules/mob/living/carbon/slime/life.dm b/code/modules/mob/living/carbon/slime/life.dm index e0afe00ada2..ced452ab652 100644 --- a/code/modules/mob/living/carbon/slime/life.dm +++ b/code/modules/mob/living/carbon/slime/life.dm @@ -156,7 +156,14 @@ if(reagents) reagents.metabolize(src) - src.updatehealth() + + if(reagents.get_reagent_amount("plasma")>=5) + mutation_chance = min(mutation_chance + 5,50) //Prevents mutation chance going >50% + reagents.remove_reagent("plasma", 5) + if(reagents.get_reagent_amount("epinephrine")>=5) + mutation_chance = max(mutation_chance - 5,0) //Prevents mutation chance going <0% + reagents.remove_reagent("epinephrine", 5) + updatehealth() return //TODO: DEFERRED @@ -235,6 +242,10 @@ /mob/living/carbon/slime/proc/handle_nutrition() + if(docile) //God as my witness, I will never go hungry again + nutrition = 700 + return + if(prob(15)) nutrition -= 1 + is_adult @@ -254,6 +265,15 @@ else Evolve() +/mob/living/carbon/slime/proc/add_nutrition(nutrition_to_add = 0, lastnut = 0) + nutrition = min((nutrition + nutrition_to_add), get_max_nutrition()) + if(nutrition >= (lastnut + 50)) + if(prob(80)) + lastnut = nutrition + powerlevel++ + if(powerlevel > 10) + powerlevel = 10 + adjustToxLoss(-10) /mob/living/carbon/slime/proc/handle_targets() if(Tempstun) @@ -282,7 +302,7 @@ if(Target) --target_patience - if(target_patience <= 0 || SStun || Discipline || attacked) // Tired of chasing or something draws out attention + if(target_patience <= 0 || SStun || Discipline || attacked || docile) // Tired of chasing or something draws out attention target_patience = 0 Target = null @@ -365,6 +385,8 @@ else if(holding_still) holding_still = max(holding_still - 1, 0) + else if(docile && pulledby) + holding_still = 10 else if(canmove && isturf(loc) && prob(33)) step(src, pick(cardinal)) else if(!AIproc) @@ -374,8 +396,12 @@ /mob/living/carbon/slime/proc/handle_speech_and_mood() //Mood starts here var/newmood = "" - if(rabid || attacked) newmood = "angry" - else if(Target) newmood = "mischevous" + if(rabid || attacked) + newmood = "angry" + else if(docile) + newmood = ":3" + else if(Target) + newmood = "mischevous" if(!newmood) if(Discipline && prob(25)) @@ -544,8 +570,13 @@ if(is_adult) return 300 else return 200 -/mob/living/carbon/slime/proc/will_hunt(var/hunger = -1) // Check for being stopped from feeding and chasing - if(hunger == 2 || rabid || attacked) return 1 - if(Leader) return 0 - if(holding_still) return 0 +/mob/living/carbon/slime/proc/will_hunt(hunger = -1) // Check for being stopped from feeding and chasing + if(docile) + return 0 + if(hunger == 2 || rabid || attacked) + return 1 + if(Leader) + return 0 + if(holding_still) + return 0 return 1 diff --git a/code/modules/mob/living/carbon/slime/powers.dm b/code/modules/mob/living/carbon/slime/powers.dm index 95359f7d573..a2aca96c163 100644 --- a/code/modules/mob/living/carbon/slime/powers.dm +++ b/code/modules/mob/living/carbon/slime/powers.dm @@ -3,11 +3,15 @@ set desc = "This will let you feed on any valid creature in the surrounding area. This should also be used to halt the feeding process." if(Victim) Feedstop() - return + return 0 + + if(docile) + to_chat(src, "I'm not hungry anymore...") + return 0 if(stat) to_chat(src, "I must be conscious to do this...") - return + return 0 var/list/choices = list() for(var/mob/living/C in view(1,src)) @@ -15,32 +19,31 @@ choices += C var/mob/living/M = input(src,"Who do you wish to feed on?") in null|choices - if(!M) return + if(!M) + return 0 if(Adjacent(M)) - - if(!istype(src, /mob/living/carbon/brain)) - if(!istype(M, /mob/living/carbon/slime)) - if(stat != 2) - if(health > -70) - - for(var/mob/living/carbon/slime/met in view()) - if(met.Victim == M && met != src) - to_chat(src, "The [met.name] is already feeding on this subject...") - return - to_chat(src, "I have latched onto the subject and begun feeding...") - to_chat(M, "The [src.name] has latched onto your head!") - Feedon(M) - - else - to_chat(src, "This subject does not have a strong enough life energy...") - else - to_chat(src, "This subject does not have an edible life energy...") - else - to_chat(src, "I must not feed on my brothers...") - else + if(isbrain(M)) to_chat(src, "This subject does not have an edible life energy...") + return 0 + if(iscarbon(M) && (M.health < -70)) + to_chat(src, "This subject does not have a strong enough life energy...") + return 0 + if(isanimal(M) && (M.health < 1))//animals don't go into crit, stupid; fixes infinite energy exploit + to_chat(src, "This subject does not have a strong enough life energy...") + return 0 + + for(var/mob/living/carbon/slime/met in view()) + if(met.Victim == M && met != src) + to_chat(src, "The [met.name] is already feeding on this subject...") + return 0 + + to_chat(src, "I have latched onto the subject and begun feeding...") + to_chat(M, "The [name] has latched onto your head!") + + Feedon(M) + return 1 /mob/living/carbon/slime/proc/Feedon(var/mob/living/M) Victim = M @@ -49,55 +52,49 @@ anchored = 1 var/lastnut = nutrition var/fed_succesfully = 0 + var/health_minimum = -70 if(is_adult) icon_state = "[colour] adult slime eat" else icon_state = "[colour] baby slime eat" - while(Victim && M.health > -70 && M.stat != DEAD && stat != DEAD) + if(isanimal(Victim)) + health_minimum = 0 + while(Victim && Victim.health > health_minimum && stat != DEAD) canmove = 0 - if(Adjacent(M)) + if(Adjacent(Victim)) loc = M.loc - if(prob(15) && M.client && istype(M, /mob/living/carbon)) - to_chat(M, "[pick("You can feel your body becoming weak!", \ - "You feel like you're about to die!", \ - "You feel every part of your body screaming in agony!", \ - "A low, rolling pain passes through your body!", \ - "Your body feels as if it's falling apart!", \ - "You feel extremely weak!", \ - "A sharp, deep pain bathes every inch of your body!")]") - - if(istype(M, /mob/living/carbon)) + if(iscarbon(Victim)) Victim.adjustCloneLoss(rand(5,6)) Victim.adjustToxLoss(rand(1,2)) if(Victim.health <= 0) Victim.adjustToxLoss(rand(2,4)) + if(prob(15) && Victim.client) + to_chat(Victim, "[pick("You can feel your body becoming weak!", \ + "You feel like you're about to die!", \ + "You feel every part of your body screaming in agony!", \ + "A low, rolling pain passes through your body!", \ + "Your body feels as if it's falling apart!", \ + "You feel extremely weak!", \ + "A sharp, deep pain bathes every inch of your body!")]") + fed_succesfully = 1 - else if(istype(M, /mob/living/simple_animal)) + else if(health_minimum == 0) //we already know it's a simple_animal from above Victim.adjustBruteLoss(is_adult ? rand(7, 15) : rand(4, 12)) fed_succesfully = 1 else - if(prob(25)) - to_chat(src, "[pick("This subject is incompatable", \ - "This subject does not have a life energy", "This subject is empty", \ - "I am not satisified", "I can not feed from this subject", \ - "I do not feel nourished", "This subject is not food")]...") + to_chat(src, "[pick("This subject is incompatable", \ + "This subject does not have a life energy", "This subject is empty", \ + "I am not satisified", "I can not feed from this subject", \ + "I do not feel nourished", "This subject is not food")]...") if(fed_succesfully) - //I have no idea why this is not in handle_nutrition() - nutrition += rand(15,30) - if(nutrition >= lastnut + 50) - if(prob(80)) - lastnut = nutrition - powerlevel++ - if(powerlevel > 10) - powerlevel = 10 - adjustToxLoss(-10) + add_nutrition(rand(15,30), lastnut) //Heal yourself. adjustOxyLoss(-10) @@ -128,7 +125,7 @@ anchored = 0 if(M) - if(M.health <= -70) + if(M.health <= health_minimum) M.canmove = 0 if(!client) if(Victim && !rabid && !attacked) diff --git a/code/modules/mob/living/carbon/slime/slime.dm b/code/modules/mob/living/carbon/slime/slime.dm index f66225d007c..ecb233a2ebf 100644 --- a/code/modules/mob/living/carbon/slime/slime.dm +++ b/code/modules/mob/living/carbon/slime/slime.dm @@ -5,18 +5,14 @@ pass_flags = PASSTABLE ventcrawler = 2 speak_emote = list("telepathically chirps") - layer = 5 - maxHealth = 150 health = 150 gender = NEUTER - nutrition = 700 - see_in_dark = 8 update_slimes = 0 - + faction = list("slime","neutral") // canstun and canweaken don't affect slimes because they ignore stun and weakened variables // for the sake of cleanliness, though, here they are. status_flags = CANPARALYSE|CANPUSH @@ -44,7 +40,7 @@ var/mood = "" // To show its face var/is_adult = 0 - + var/docile = 0 var/core_removal_stage = 0 //For removing cores. var/mutator_used = FALSE //So you can't shove a dozen mutators into a single slime @@ -140,7 +136,8 @@ stat(null, "Health: [round((health / 150) * 100)]%") if(client.statpanel == "Status") - stat(null, "Nutrition: [nutrition]/[get_max_nutrition()]") + if(!docile) + stat(null, "Nutrition: [nutrition]/[get_max_nutrition()]") if(amount_grown >= 10) if(is_adult) stat(null, "You can reproduce!") @@ -194,9 +191,9 @@ return /mob/living/carbon/slime/MouseDrop(atom/movable/A) - if(isliving(A) && A != usr) + if(isliving(A) && A != src && usr == src) var/mob/living/Food = A - if(Food.Adjacent(usr) && !stat && Food.stat != DEAD) //messy + if(Food.Adjacent(src) && !stat && Food.stat != DEAD) //messy Feedon(Food) ..() @@ -208,14 +205,19 @@ /mob/living/carbon/slime/attack_slime(mob/living/carbon/slime/M) ..() - var/damage = rand(1, 3) + if(Victim) + Victim = null + visible_message("[M] pulls [src] off!") + return attacked += 5 - if(M.is_adult) - damage = rand(1, 6) - else - damage = rand(1, 3) - adjustBruteLoss(damage) - updatehealth() + if(nutrition >= 100) //steal some nutrition. negval handled in life() + nutrition -= (50 + (5 * M.amount_grown)) + M.add_nutrition(50 + (5 * M.amount_grown)) + if(health > 0) + adjustBruteLoss(4 + (2 * M.amount_grown)) //amt_grown isn't very linear but it works + updatehealth() + M.adjustBruteLoss(-4 + (-2 * M.amount_grown)) + M.updatehealth() /mob/living/carbon/slime/attack_animal(mob/living/simple_animal/M) if(..()) @@ -282,12 +284,9 @@ step_away(src,M) return - else - if(stat == DEAD && surgeries.len) - if(M.a_intent == INTENT_HELP) - for(var/datum/surgery/S in surgeries) - if(S.next_step(M, src)) - return 1 + + if(..()) //To allow surgery to return properly. + return switch(M.a_intent) @@ -390,11 +389,6 @@ return /mob/living/carbon/slime/attackby(obj/item/W, mob/living/user, params) - if(stat == DEAD && surgeries.len) - if(user.a_intent == INTENT_HELP) - for(var/datum/surgery/S in surgeries) - if(S.next_step(user, src)) - return 1 if(istype(W,/obj/item/stack/sheet/mineral/plasma)) //Lets you feed slimes plasma. if(user in Friends) ++Friends[user] diff --git a/code/modules/mob/living/simple_animal/friendly/slime.dm b/code/modules/mob/living/simple_animal/friendly/slime.dm index a831c830459..13e7c893d86 100644 --- a/code/modules/mob/living/simple_animal/friendly/slime.dm +++ b/code/modules/mob/living/simple_animal/friendly/slime.dm @@ -20,7 +20,6 @@ maxHealth = 200 icon_state = "grey adult slime" icon_living = "grey adult slime" - icon_dead = "grey baby slime dead" /mob/living/simple_animal/slime/New() ..() diff --git a/code/modules/research/xenobiology/xenobiology.dm b/code/modules/research/xenobiology/xenobiology.dm index 67c025cecb0..df0a8a2f55f 100644 --- a/code/modules/research/xenobiology/xenobiology.dm +++ b/code/modules/research/xenobiology/xenobiology.dm @@ -140,39 +140,27 @@ /obj/item/slimepotion/docility/attack(mob/living/carbon/slime/M, mob/user) if(!isslime(M)) - to_chat(user, " The potion only works on slimes!") + to_chat(user, "The potion only works on slimes!") return if(M.stat) - to_chat(user, " The slime is dead!") - return - if(M.mind) - to_chat(user, " The slime resists!") + to_chat(user, "The slime is dead!") return if(being_used) - to_chat(user, " You're already using this on another slime!") + to_chat(user, "You're already using this on another slime!") return - var/mob/living/simple_animal/slime/pet - if(M.is_adult) - pet = new /mob/living/simple_animal/slime/adult(M.loc) - pet.icon_state = "[M.colour] adult slime" - pet.icon_living = "[M.colour] adult slime" - else - pet = new /mob/living/simple_animal/slime(M.loc) - pet.icon_state = "[M.colour] baby slime" - pet.icon_living = "[M.colour] baby slime" - pet.icon_dead = "[M.colour] baby slime dead" - pet.colour = "[M.colour]" - qdel(M) + M.docile = 1 + M.nutrition = 700 + to_chat(M, "You absorb the potion and feel your intense desire to feed melt away.") + to_chat(user, "You feed the slime the potion, removing its hunger and calming it.") being_used = 1 var/newname = sanitize(copytext(input(user, "Would you like to give the slime a name?", "Name your new pet", "pet slime") as null|text,1,MAX_NAME_LEN)) if(!newname) newname = "pet slime" - pet.name = newname - pet.real_name = newname + M.name = newname + M.real_name = newname qdel(src) - to_chat(user, "You feed the slime the potion, removing it's powers and calming it.") /obj/item/slimepotion/sentience name = "sentience potion" From 0665c0ac27ec5f86f2d403cbc847ab976544a6ee Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Mon, 23 Apr 2018 21:43:58 +0500 Subject: [PATCH 5/6] new logging system --- code/modules/mob/living/carbon/alien/humanoid/humanoid.dm | 2 +- .../mob/living/carbon/alien/humanoid/humanoid_defense.dm | 4 ++-- code/modules/mob/living/carbon/alien/larva/larva.dm | 2 +- code/modules/mob/living/carbon/alien/larva/larva_defense.dm | 2 +- code/modules/mob/living/carbon/human/human.dm | 2 +- code/modules/mob/living/carbon/human/human_defense.dm | 4 ++-- code/modules/mob/living/living_defense.dm | 6 +++--- code/modules/mob/living/silicon/robot/robot_defense.dm | 2 +- code/modules/mob/living/silicon/silicon_defense.dm | 5 ++--- code/modules/mob/living/simple_animal/animal_defense.dm | 4 ++-- 10 files changed, 16 insertions(+), 17 deletions(-) diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 61e3aef5b31..8946189b4cb 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -84,7 +84,7 @@ if(M.is_adult) damage = rand(10, 40) adjustBruteLoss(damage) - add_logs(M, src, "attacked", admin=0) + add_attack_logs(src, M, "Slime'd for [damage] damage") updatehealth() return diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm index 1027c0a4245..0056bb709a5 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -20,7 +20,7 @@ "[M] has weakened [src]!", \ "You hear someone fall.") adjustBruteLoss(damage) - add_logs(M, src, "attacked", admin=0) + add_attack_logs(M, src, "Melee attacked with fists") updatehealth() else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) @@ -31,7 +31,7 @@ if(prob(5))//Very small chance to push an alien down. Paralyse(2) playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - add_logs(M, src, "pushed", admin=0) + add_attack_logs(M, src, "Pushed over") visible_message("[M] has pushed down [src]!", \ "[M] has pushed down [src]!") else diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index e1fbd04a60f..783d683f060 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -79,7 +79,7 @@ if(M.is_adult) damage = rand(20, 40) adjustBruteLoss(damage) - add_attack_logs(M, src, "Slime attacked") + add_attack_logs(src, M, "Slime'd for [damage] damage") updatehealth() return diff --git a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm index 029ea07da4f..fc7fa22510b 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm @@ -10,7 +10,7 @@ sleep(3) step_away(src, M, 15) playsound(loc, "punch", 25, 1, -1) - add_logs(M, src, "attacked", admin=0) + add_attack_logs(M, src, "Melee attacked with fists") visible_message("[M] has kicked [src]!", \ "[M] has kicked [src]!") if((stat != DEAD) && (damage > 4.9)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 6f5e692c311..dc640ec68a0 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1756,7 +1756,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X to_chat(H, "You feel a breath of fresh air enter your lungs. It feels good.") to_chat(src, "Repeat at least every 7 seconds.") - add_logs(src, H, "CPRed") + add_attack_logs(src, H, "CPRed", FALSE) return 1 else to_chat(src, "You need to stay still while performing CPR!") diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index d6545d9bff6..c45154e4931 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -391,7 +391,7 @@ emp_act visible_message("[M] has wounded [src]!", \ "[M] has wounded [src]!") apply_effect(4, WEAKEN, armor_block) - add_logs(M, src, "attacked", admin=0) + add_attack_logs(M, src, "Alien attacked") updatehealth() if(M.a_intent == INTENT_DISARM) @@ -399,7 +399,7 @@ emp_act var/obj/item/organ/external/affecting = get_organ(ran_zone(M.zone_sel.selecting)) playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) apply_effect(5, WEAKEN, run_armor_check(affecting, "melee")) - add_logs(M, src, "tackled", admin=0) + add_attack_logs(M, src, "Alien tackled") visible_message("[M] has tackled down [src]!") else if(prob(99)) //this looks fucking stupid but it was previously 'var/randn = rand(1, 100); if(randn <= 99)' diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 0039284a6a0..10c83f4d0f2 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -290,7 +290,7 @@ s.set_up(5, 1, src) s.start() return 1 - add_logs(M, src, "attacked", admin=0) + add_attack_logs(src, M, "Slime'd") return /mob/living/attack_animal(mob/living/simple_animal/M) @@ -303,7 +303,7 @@ M.do_attack_animation(src) visible_message("\The [M] [M.attacktext] [src]!", \ "\The [M] [M.attacktext] [src]!") - add_logs(M, src, "attacked", admin=0) + add_attack_logs(M, src, "Animal attacked") return 1 /mob/living/attack_larva(mob/living/carbon/alien/larva/L) @@ -315,7 +315,7 @@ else L.do_attack_animation(src) if(prob(90)) - add_logs(L, src, "attacked", admin=0) + add_attack_logs(L, src, "Larva attacked") visible_message("[L.name] bites [src]!", \ "[L.name] bites [src]!") playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index ca240058e58..033b244cf8c 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -7,7 +7,7 @@ step(src, get_dir(M,src)) spawn(5) step(src, get_dir(M,src)) - add_logs(M, src, "pushed", admin=0) + add_attack_logs(M, src, "Alien pushed over") playsound(loc, 'sound/weapons/pierce.ogg', 50, 1, -1) visible_message("[M] has forced back [src]!",\ "[M] has forced back [src]!") diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 5659eecc4dc..480c9442bd7 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -5,13 +5,12 @@ if(..()) //if harm or disarm intent var/damage = rand(10, 20) if(prob(90)) - add_logs(M, src, "attacked", admin=0) playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) visible_message("[M] has slashed at [src]!", \ "[M] has slashed at [src]!") if(prob(8)) flash_eyes(affect_silicon = 1) - add_logs(M, src, "attacked", admin=0) + add_attack_logs(M, src, "Alien attacked") adjustBruteLoss(damage) updatehealth() else @@ -55,7 +54,7 @@ if(HULK in M.mutations) var/damage = rand(10,15) adjustBruteLoss(damage) - add_logs(M, src, "attacked", admin=0) + add_attack_logs(M, src, "Melee attacked with fists") playsound(loc, "punch", 25, 1, -1) visible_message("[M] has punched [src]!", \ "[M] has punched [src]!") diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index acf22ed69f7..b122decd322 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -15,7 +15,7 @@ visible_message("[M] [response_harm] [src]!") playsound(loc, "punch", 25, 1, -1) attack_threshold_check(harm_intent_damage) - add_logs(M, src, "attacked", admin=0) + add_attack_logs(M, src, "Melee attacked with fists") updatehealth() return 1 @@ -25,7 +25,7 @@ visible_message("[M] has slashed at [src]!", \ "[M] has slashed at [src]!") playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - add_logs(M, src, "attacked", admin=0) + add_attack_logs(M, src, "Alien attacked") attack_threshold_check(damage) return From 442f4f0b6a30070e8c73a67851d02328e4d2865f Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Fri, 27 Apr 2018 01:31:58 +0500 Subject: [PATCH 6/6] tweak logging --- code/modules/mob/living/carbon/carbon.dm | 26 ++++++++++--------- .../living/carbon/human/species/species.dm | 7 +++-- code/modules/mob/living/living_defense.dm | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 7cdebe4502c..b731831545f 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -201,11 +201,12 @@ swap_hand() /mob/living/carbon/proc/help_shake_act(mob/living/carbon/M) - if(src.health >= config.health_threshold_crit) - if(src == M && istype(src, /mob/living/carbon/human)) + add_attack_logs(M, src, "Shaked", admin_notify = FALSE) + if(health >= config.health_threshold_crit) + if(src == M && ishuman(src)) var/mob/living/carbon/human/H = src - src.visible_message( \ - text("[src] examines [].",src.gender==MALE?"himself":"herself"), \ + visible_message( \ + text("[src] examines [].",gender==MALE?"himself":"herself"), \ "You check yourself for injuries." \ ) @@ -259,20 +260,21 @@ "You shake [src], but they are unresponsive. Probably suffering from SSD.") if(lying) // /vg/: For hugs. This is how update_icon figgers it out, anyway. - N3X15 var/t_him = "it" - if(src.gender == MALE) + if(gender == MALE) t_him = "him" - else if(src.gender == FEMALE) + else if(gender == FEMALE) t_him = "her" - if(istype(src,/mob/living/carbon/human) && src:w_uniform) + if(ishuman(src)) var/mob/living/carbon/human/H = src - H.w_uniform.add_fingerprint(M) + if(H.w_uniform) + H.w_uniform.add_fingerprint(M) AdjustSleeping(-5) - if(src.sleeping == 0) - src.resting = 0 + if(sleeping == 0) + resting = 0 AdjustParalysis(-3) AdjustStunned(-3) AdjustWeakened(-3) - playsound(src.loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) if(!player_logged) M.visible_message( \ "[M] shakes [src] trying to wake [t_him] up!",\ @@ -292,7 +294,7 @@ "[M] gives [src] a [pick("hug","warm embrace")].",\ "You hug [src].",\ ) - if(istype(src,/mob/living/carbon/human)) + if(ishuman(src)) var/mob/living/carbon/human/H = src if(H.wear_suit) H.wear_suit.add_fingerprint(M) diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 3158725d71e..50f969cae45 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -320,7 +320,6 @@ return 1 if(target.health >= config.health_threshold_crit) target.help_shake_act(user) - add_attack_logs(user, target, "Shaked") return 1 else user.do_cpr(target) @@ -358,7 +357,7 @@ var/datum/unarmed_attack/attack = user.species.unarmed user.do_attack_animation(target) - add_attack_logs(user, target, "Melee attacked with fists") + add_attack_logs(user, target, "Melee attacked with fists", admin_notify = target.ckey ? TRUE : FALSE) if(!iscarbon(user)) target.LAssailant = null @@ -396,7 +395,7 @@ if(attacker_style && attacker_style.disarm_act(user, target)) return 1 else - add_attack_logs(user, target, "Disarmed") + add_attack_logs(user, target, "Disarmed", admin_notify = FALSE) user.do_attack_animation(target) if(target.w_uniform) target.w_uniform.add_fingerprint(user) @@ -406,7 +405,7 @@ target.apply_effect(2, WEAKEN, target.run_armor_check(affecting, "melee")) playsound(target.loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) target.visible_message("[user] has pushed [target]!") - add_attack_logs(user, target, "Pushed over") + add_attack_logs(user, target, "Pushed over", admin_notify = FALSE) if(!iscarbon(user)) target.LAssailant = null else diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 10c83f4d0f2..38065ac1f2c 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -240,7 +240,7 @@ to_chat(user, "You already grabbed [src].") return - add_attack_logs(user, src, "Grabbed passively") + add_attack_logs(user, src, "Grabbed passively", admin_notify = FALSE) var/obj/item/grab/G = new /obj/item/grab(user, src) if(buckled)