From 0a942bf23a98604cf9e7d5ab00788aad576bfa1f Mon Sep 17 00:00:00 2001 From: uraniummeltdown Date: Sun, 25 Mar 2018 17:48:38 +0400 Subject: [PATCH] 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"