From b560ff82844599b2259377bb877479573bc9c46c Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 17 Nov 2019 06:23:12 +0100 Subject: [PATCH 001/192] refactoring code to allow all living mobs to use shields. --- code/__HELPERS/unsorted.dm | 10 --- code/_onclick/item_attack.dm | 20 ++--- .../mob/living/carbon/alien/alien_defense.dm | 15 ++-- .../carbon/alien/humanoid/humanoid_defense.dm | 74 +++++++++---------- .../mob/living/carbon/carbon_defense.dm | 65 ++++++++-------- .../mob/living/carbon/human/human_defense.dm | 53 ++++--------- .../mob/living/carbon/human/species.dm | 5 -- .../living/carbon/monkey/monkey_defense.dm | 4 +- code/modules/mob/living/living_defense.dm | 34 ++++++++- .../mob/living/silicon/ai/ai_defense.dm | 20 ++++- .../mob/living/silicon/pai/pai_defense.dm | 3 + .../mob/living/silicon/silicon_defense.dm | 15 ---- .../living/simple_animal/animal_defense.dm | 4 +- code/modules/paperwork/paperplane.dm | 2 +- 14 files changed, 167 insertions(+), 157 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 9abe42ea8e..43791a5642 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -758,16 +758,6 @@ GLOBAL_LIST_INIT(can_embed_types, typecacheof(list( /obj/item/stack/rods, /obj/item/pipe))) -/proc/can_embed(obj/item/W) - if(W.get_sharpness()) - return 1 - if(is_pointed(W)) - return 1 - - if(is_type_in_typecache(W, GLOB.can_embed_types)) - return 1 - - /* Checks if that loc and dir has an item on the wall */ diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 3a45e9bf60..9107fa9e3e 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -109,17 +109,19 @@ take_damage(I.force, I.damtype, "melee", 1) /mob/living/attacked_by(obj/item/I, mob/living/user) + //CIT CHANGES START HERE - combatmode and resting checks + var/totitemdamage = I.force + if(iscarbon(user)) + var/mob/living/carbon/tempcarb = user + if(!tempcarb.combatmode) + totitemdamage *= 0.5 + if(user.resting) + totitemdamage *= 0.5 + //CIT CHANGES END HERE + if(user != src && check_shields(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration)) + return FALSE send_item_attack_message(I, user) if(I.force) - //CIT CHANGES START HERE - combatmode and resting checks - var/totitemdamage = I.force - if(iscarbon(user)) - var/mob/living/carbon/tempcarb = user - if(!tempcarb.combatmode) - totitemdamage *= 0.5 - if(user.resting) - totitemdamage *= 0.5 - //CIT CHANGES END HERE apply_damage(totitemdamage, I.damtype) //CIT CHANGE - replaces I.force with totitemdamage if(I.damtype == BRUTE) if(prob(33)) diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm index b9e27c0637..b6fbe3a875 100644 --- a/code/modules/mob/living/carbon/alien/alien_defense.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -6,8 +6,10 @@ return 2 //no ears /mob/living/carbon/alien/hitby(atom/movable/AM, skipcatch, hitpush) - ..(AM, skipcatch = TRUE, hitpush = FALSE) + return ..(AM, skipcatch = TRUE, hitpush = FALSE) +/mob/living/carbon/alien/can_embed(obj/item/I) + return FALSE /*Code for aliens attacking aliens. Because aliens act on a hivemind, I don't see them as very aggressive with each other. As such, they can either help or harm other aliens. Help works like the human help command while harm is a simple nibble. @@ -50,9 +52,9 @@ In all, this is a lot like the monkey code. /N /mob/living/carbon/alien/attack_hand(mob/living/carbon/human/M) - if(..()) //to allow surgery to return properly. - return 0 - + . = ..() + if(.) //To allow surgery to return properly. + return switch(M.a_intent) if("help") help_shake_act(M) @@ -60,11 +62,10 @@ In all, this is a lot like the monkey code. /N grabbedby(M) if ("harm") M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) - return 1 + return FALSE if("disarm") M.do_attack_animation(src, ATTACK_EFFECT_DISARM) - return 1 - return 0 + return FALSE /mob/living/carbon/alien/attack_paw(mob/living/carbon/monkey/M) 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 b3839a6033..c2be4249a2 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -21,46 +21,46 @@ return 1 /mob/living/carbon/alien/humanoid/attack_hand(mob/living/carbon/human/M) - if(..()) - switch(M.a_intent) - if ("harm") - var/damage = rand(1, 9) - if (prob(90)) - playsound(loc, "punch", 25, 1, -1) - visible_message("[M] has punched [src]!", \ - "[M] has punched [src]!", null, COMBAT_MESSAGE_RANGE) - if ((stat != DEAD) && (damage > 9 || prob(5)))//Regular humans have a very small chance of knocking an alien down. - Unconscious(40) - visible_message("[M] has knocked [src] down!", \ - "[M] has knocked [src] down!") - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(damage, BRUTE, affecting) - log_combat(M, src, "attacked") + . = ..() + if(.) //To allow surgery to return properly. + return + switch(M.a_intent) + if ("harm") + var/damage = rand(1, 9) + if (prob(90)) + playsound(loc, "punch", 25, 1, -1) + visible_message("[M] has punched [src]!", \ + "[M] has punched [src]!", null, COMBAT_MESSAGE_RANGE) + if ((stat != DEAD) && (damage > 9 || prob(5)))//Regular humans have a very small chance of knocking an alien down. + Unconscious(40) + visible_message("[M] has knocked [src] down!", \ + "[M] has knocked [src] down!") + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + apply_damage(damage, BRUTE, affecting) + log_combat(M, src, "attacked") + else + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to punch [src]!", \ + "[M] has attempted to punch [src]!", null, COMBAT_MESSAGE_RANGE) + + if ("disarm") + if (!lying) + if (prob(5)) + Unconscious(40) + playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) + log_combat(M, src, "pushed") + visible_message("[M] has pushed down [src]!", \ + "[M] has pushed down [src]!") else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to punch [src]!", \ - "[M] has attempted to punch [src]!", null, COMBAT_MESSAGE_RANGE) - - if ("disarm") - if (!lying) - if (prob(5)) - Unconscious(40) + if (prob(50)) + dropItemToGround(get_active_held_item()) playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - log_combat(M, src, "pushed") - visible_message("[M] has pushed down [src]!", \ - "[M] has pushed down [src]!") + visible_message("[M] has disarmed [src]!", \ + "[M] has disarmed [src]!", null, COMBAT_MESSAGE_RANGE) else - if (prob(50)) - dropItemToGround(get_active_held_item()) - playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - visible_message("[M] has disarmed [src]!", \ - "[M] has disarmed [src]!", null, COMBAT_MESSAGE_RANGE) - else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to disarm [src]!",\ - "[M] has attempted to disarm [src]!", null, COMBAT_MESSAGE_RANGE) - - + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to disarm [src]!",\ + "[M] has attempted to disarm [src]!", null, COMBAT_MESSAGE_RANGE) /mob/living/carbon/alien/humanoid/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) if(!no_effect && !visual_effect_icon) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index b0e9b808df..6f03ea4364 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -48,31 +48,48 @@ if(affecting && affecting.dismemberable && affecting.get_damage() >= (affecting.max_damage - P.dismemberment)) affecting.dismember(P.damtype) -/mob/living/carbon/proc/can_catch_item(skip_throw_mode_check) - . = FALSE +/mob/living/carbon/catch_item(obj/item/I, skip_throw_mode_check = FALSE) + . = ..() if(!skip_throw_mode_check && !in_throw_mode) return if(get_active_held_item()) return if(restrained()) return - return TRUE + I.attack_hand(src) + if(get_active_held_item() == I) //if our attack_hand() picks up the item... + visible_message("[src] catches [I]!") //catch that sucker! + throw_mode_off() + return TRUE -/mob/living/carbon/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked = FALSE) - if(!skipcatch) //ugly, but easy - if(can_catch_item()) - if(istype(AM, /obj/item)) - var/obj/item/I = AM - if(isturf(I.loc)) - I.attack_hand(src) - if(get_active_held_item() == I) //if our attack_hand() picks up the item... - visible_message("[src] catches [I]!") //catch that sucker! - throw_mode_off() - return 1 - ..() +/mob/living/carbon/can_embed(obj/item/I) + if(I.get_sharpness() || is_pointed(I) || is_type_in_typecache(I, GLOB.can_embed_types)) + return TRUE +/mob/living/carbon/embed_item(obj/item/I) + throw_alert("embeddedobject", /obj/screen/alert/embeddedobject) + var/obj/item/bodypart/L = pick(bodyparts) + L.embedded_objects |= I + I.add_mob_blood(src)//it embedded itself in you, of course it's bloody! + I.forceMove(src) + L.receive_damage(I.w_class*I.embedding.embedded_impact_pain_multiplier) + visible_message("[I] embeds itself in [src]'s [L.name]!","[I] embeds itself in your [L.name]!") + SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "embedded", /datum/mood_event/embedded) /mob/living/carbon/attacked_by(obj/item/I, mob/living/user) + //CIT CHANGES START HERE - combatmode and resting checks + var/totitemdamage = I.force + if(iscarbon(user)) + var/mob/living/carbon/tempcarb = user + if(!tempcarb.combatmode) + totitemdamage *= 0.5 + if(user.resting) + totitemdamage *= 0.5 + if(!combatmode) + totitemdamage *= 1.5 + //CIT CHANGES END HERE + if(user != src && check_shields(I, totitemdamage, "the [I.name]", MELEE_ATTACK, I.armour_penetration)) + return FALSE var/obj/item/bodypart/affecting if(user == src) affecting = get_bodypart(check_zone(user.zone_selected)) //we're self-mutilating! yay! @@ -83,17 +100,6 @@ SEND_SIGNAL(I, COMSIG_ITEM_ATTACK_ZONE, src, user, affecting) send_item_attack_message(I, user, affecting.name) if(I.force) - //CIT CHANGES START HERE - combatmode and resting checks - var/totitemdamage = I.force - if(iscarbon(user)) - var/mob/living/carbon/tempcarb = user - if(!tempcarb.combatmode) - totitemdamage *= 0.5 - if(user.resting) - totitemdamage *= 0.5 - if(!combatmode) - totitemdamage *= 1.5 - //CIT CHANGES END HERE apply_damage(totitemdamage, I.damtype, affecting) //CIT CHANGE - replaces I.force with totitemdamage if(I.damtype == BRUTE && affecting.status == BODYPART_ORGANIC) var/basebloodychance = affecting.brute_dam + totitemdamage @@ -127,7 +133,9 @@ //ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/carbon/attack_hand(mob/living/carbon/human/user) - + . = ..() + if(.) //To allow surgery to return properly. + return for(var/thing in diseases) var/datum/disease/D = thing if(D.spread_flags & DISEASE_SPREAD_CONTACT_SKIN) @@ -142,8 +150,7 @@ if(user.a_intent == INTENT_HELP || user.a_intent == INTENT_DISARM) for(var/datum/surgery/S in surgeries) if(S.next_step(user, user.a_intent)) - return 1 - return 0 + return TRUE /mob/living/carbon/attack_paw(mob/living/carbon/monkey/M) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 2ab7c6d404..fda60aeb98 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -100,23 +100,29 @@ return 1 return 0 -/mob/living/carbon/human/proc/check_shields(atom/AM, var/damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) +/mob/living/proc/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) var/block_chance_modifier = round(damage / -3) - for(var/obj/item/I in held_items) if(!istype(I, /obj/item/clothing)) var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example if(I.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) - return 1 + return TRUE + return FALSE + +/mob/living/carbon/human/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) + . = ..() + if(.) + return + var/block_chance_modifier = round(damage / -3) if(wear_suit) var/final_block_chance = wear_suit.block_chance - (CLAMP((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier if(wear_suit.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) - return 1 + return TRUE if(w_uniform) var/final_block_chance = w_uniform.block_chance - (CLAMP((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier if(w_uniform.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) - return 1 - return 0 + return TRUE + return FALSE /mob/living/carbon/human/proc/check_block() if(mind) @@ -125,37 +131,7 @@ return FALSE /mob/living/carbon/human/hitby(atom/movable/AM, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE) - if(dna && dna.species) - var/spec_return = dna.species.spec_hitby(AM, src) - if(spec_return) - return spec_return - var/obj/item/I - var/throwpower = 30 - if(istype(AM, /obj/item)) - I = AM - throwpower = I.throwforce - if(I.thrownby == src) //No throwing stuff at yourself to trigger hit reactions - return ..() - if(check_shields(AM, throwpower, "\the [AM.name]", THROWN_PROJECTILE_ATTACK)) - hitpush = FALSE - skipcatch = TRUE - blocked = TRUE - else if(I) - if(I.throw_speed >= EMBED_THROWSPEED_THRESHOLD) - if(can_embed(I)) - if(prob(I.embedding.embed_chance) && !HAS_TRAIT(src, TRAIT_PIERCEIMMUNE)) - throw_alert("embeddedobject", /obj/screen/alert/embeddedobject) - var/obj/item/bodypart/L = pick(bodyparts) - L.embedded_objects |= I - I.add_mob_blood(src)//it embedded itself in you, of course it's bloody! - I.forceMove(src) - L.receive_damage(I.w_class*I.embedding.embedded_impact_pain_multiplier) - visible_message("[I] embeds itself in [src]'s [L.name]!","[I] embeds itself in your [L.name]!") - SEND_SIGNAL(src, COMSIG_ADD_MOOD_EVENT, "embedded", /datum/mood_event/embedded) - hitpush = FALSE - skipcatch = TRUE //can't catch the now embedded item - - return ..() + return dna?.species?.spec_hitby(AM, src) || ..() /mob/living/carbon/human/grabbedby(mob/living/carbon/user, supress_message = 0) if(user == src && pulling && !pulling.anchored && grab_state >= GRAB_AGGRESSIVE && (HAS_TRAIT(src, TRAIT_FAT)) && ismonkey(pulling)) @@ -203,7 +179,8 @@ return 1 /mob/living/carbon/human/attack_hand(mob/user) - if(..()) //to allow surgery to return properly. + . = ..() + if(.) //To allow surgery to return properly. return if(ishuman(user)) var/mob/living/carbon/human/H = user diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 49ae178d8c..b54f30df57 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1678,11 +1678,6 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) return if(M.mind) attacker_style = M.mind.martial_art - if((M != H) && M.a_intent != INTENT_HELP && H.check_shields(M, 0, M.name, attack_type = UNARMED_ATTACK)) - log_combat(M, H, "attempted to touch") - H.visible_message("[M] attempted to touch [H]!") - return 0 - SEND_SIGNAL(M, COMSIG_MOB_ATTACK_HAND, M, H, attacker_style) switch(M.a_intent) if("help") help(M, H, attacker_style) diff --git a/code/modules/mob/living/carbon/monkey/monkey_defense.dm b/code/modules/mob/living/carbon/monkey/monkey_defense.dm index df90dd56fd..da5f8e75c3 100644 --- a/code/modules/mob/living/carbon/monkey/monkey_defense.dm +++ b/code/modules/mob/living/carbon/monkey/monkey_defense.dm @@ -28,9 +28,9 @@ apply_damage(damage, BRUTE, affecting) /mob/living/carbon/monkey/attack_hand(mob/living/carbon/human/M) - if(..()) //To allow surgery to return properly. + . = ..() + if(.) //To allow surgery to return properly. return - switch(M.a_intent) if("help") help_shake_act(M) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 93e64fd4cc..f5dd982ad5 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -55,9 +55,32 @@ else return 0 +/mob/living/proc/catch_item(obj/item/I, skip_throw_mode_check = FALSE) + return FALSE + +/mob/living/proc/embed_item(obj/item/I) + return + +/mob/living/proc/can_embed(obj/item/I) + return FALSE + /mob/living/hitby(atom/movable/AM, skipcatch, hitpush = TRUE, blocked = FALSE) - if(istype(AM, /obj/item)) - var/obj/item/I = AM + var/obj/item/I + var/throwpower = 30 + if(isitem(AM)) + I = AM + throwpower = I.throwforce + if(check_shields(AM, throwpower, "\the [AM.name]", THROWN_PROJECTILE_ATTACK)) + hitpush = FALSE + skipcatch = TRUE + blocked = TRUE + else if(I && I.throw_speed >= EMBED_THROWSPEED_THRESHOLD && can_embed(I, src) && prob(I.embedding.embed_chance) && !HAS_TRAIT(src, TRAIT_PIERCEIMMUNE)) + embed_item(I) + hitpush = FALSE + skipcatch = TRUE //can't catch the now embedded item + if(I) + if(!skipcatch && isturf(I.loc) && catch_item(I)) + return TRUE var/zone = ran_zone(BODY_ZONE_CHEST, 65)//Hits a random part of the body, geared towards the chest var/dtype = BRUTE var/volume = I.get_volume_by_throwforce_and_or_w_class() @@ -211,6 +234,13 @@ Move(user.loc) return 1 +/mob/living/attack_hand(mob/user) + ..() //Ignoring parent return value here. + SEND_SIGNAL(user, COMSIG_MOB_ATTACK_HAND, user, src) + if((user != src) && user.a_intent != INTENT_HELP && check_shields(user, 0, user.name, attack_type = UNARMED_ATTACK)) + log_combat(user, src, "attempted to touch") + visible_message("[user] attempted to touch [src]!") + return TRUE /mob/living/attack_slime(mob/living/simple_animal/slime/M) if(!SSticker.HasRoundStarted()) diff --git a/code/modules/mob/living/silicon/ai/ai_defense.dm b/code/modules/mob/living/silicon/ai/ai_defense.dm index 7c59c2b791..8799d34a08 100644 --- a/code/modules/mob/living/silicon/ai/ai_defense.dm +++ b/code/modules/mob/living/silicon/ai/ai_defense.dm @@ -1,8 +1,26 @@ +//ATTACK HAND IGNORING PARENT RETURN VALUE +/mob/living/silicon/ai/attack_hand(mob/living/carbon/human/M) + . = ..() + if(.) //the attack was blocked + return + switch(M.a_intent) + if ("help") + M.visible_message("[M] pets [src].", \ + "You pet [src].") + if("grab") + grabbedby(M) + else + M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) + playsound(src.loc, 'sound/effects/bang.ogg', 10, 1) + visible_message("[M] punches [src], but doesn't leave a dent.", \ + "[M] punches [src], but doesn't leave a dent.", null, COMBAT_MESSAGE_RANGE) /mob/living/silicon/ai/attacked_by(obj/item/I, mob/living/user, def_zone) + . = ..() + if(!.) + return FALSE if(I.force && I.damtype != STAMINA && stat != DEAD) //only sparks if real damage is dealt. spark_system.start() - return ..() /mob/living/silicon/ai/attack_alien(mob/living/carbon/alien/humanoid/M) diff --git a/code/modules/mob/living/silicon/pai/pai_defense.dm b/code/modules/mob/living/silicon/pai/pai_defense.dm index dda8ddfebd..647951ed4e 100644 --- a/code/modules/mob/living/silicon/pai/pai_defense.dm +++ b/code/modules/mob/living/silicon/pai/pai_defense.dm @@ -27,6 +27,9 @@ Knockdown(200) /mob/living/silicon/pai/attack_hand(mob/living/carbon/human/user) + . = ..() + if(.) + return switch(user.a_intent) if("help") visible_message("[user] gently pats [src] on the head, eliciting an off-putting buzzing from its holographic field.") diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 073a2eec2b..482ecc429f 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -63,21 +63,6 @@ return 1 return 0 -//ATTACK HAND IGNORING PARENT RETURN VALUE -/mob/living/silicon/attack_hand(mob/living/carbon/human/M) - switch(M.a_intent) - if ("help") - M.visible_message("[M] pets [src].", \ - "You pet [src].") - if("grab") - grabbedby(M) - else - M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) - playsound(src.loc, 'sound/effects/bang.ogg', 10, 1) - visible_message("[M] punches [src], but doesn't leave a dent.", \ - "[M] punches [src], but doesn't leave a dent.", null, COMBAT_MESSAGE_RANGE) - return 0 - /mob/living/silicon/attack_drone(mob/living/simple_animal/drone/M) if(M.a_intent == INTENT_HARM) return diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index 793df63c87..e74b29be44 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -1,7 +1,9 @@ /mob/living/simple_animal/attack_hand(mob/living/carbon/human/M) - ..() + . = ..() + if(.) //the attack was blocked + return switch(M.a_intent) if("help") if (health > 0) diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index b547089aef..9ba7fba157 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -100,7 +100,7 @@ /obj/item/paperplane/throw_impact(atom/hit_atom) if(iscarbon(hit_atom)) var/mob/living/carbon/C = hit_atom - if(C.can_catch_item(TRUE)) + if(!get_active_held_item() && !restrained()) var/datum/action/innate/origami/origami_action = locate() in C.actions if(origami_action?.active) //if they're a master of origami and have the ability turned on, force throwmode on so they'll automatically catch the plane. C.throw_mode_on() From 5d06ea5d486a40900d68221307e334a32f352673 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 17 Nov 2019 07:16:53 +0100 Subject: [PATCH 002/192] o --- code/modules/paperwork/paperplane.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index 9ba7fba157..0920b76332 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -100,7 +100,7 @@ /obj/item/paperplane/throw_impact(atom/hit_atom) if(iscarbon(hit_atom)) var/mob/living/carbon/C = hit_atom - if(!get_active_held_item() && !restrained()) + if(!C.get_active_held_item() && !C.restrained()) var/datum/action/innate/origami/origami_action = locate() in C.actions if(origami_action?.active) //if they're a master of origami and have the ability turned on, force throwmode on so they'll automatically catch the plane. C.throw_mode_on() From 6e9d2d57c08244309234a6efbf0818511cf26e9a Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sun, 17 Nov 2019 22:06:19 +0100 Subject: [PATCH 003/192] check_shields from human to living, part 2 --- code/game/atoms.dm | 2 +- .../mob/living/carbon/alien/alien_defense.dm | 35 +++--- .../carbon/alien/humanoid/humanoid_defense.dm | 10 +- .../carbon/alien/larva/larva_defense.dm | 38 ++++--- .../mob/living/carbon/carbon_defense.dm | 2 +- .../mob/living/carbon/human/human_defense.dm | 105 +++++++----------- .../mob/living/carbon/monkey/combat.dm | 22 ++++ .../living/carbon/monkey/monkey_defense.dm | 99 +++++++++-------- code/modules/mob/living/living_defense.dm | 36 +++++- .../mob/living/silicon/ai/ai_defense.dm | 24 ---- .../mob/living/silicon/pai/pai_defense.dm | 23 ++-- .../mob/living/silicon/robot/robot_defense.dm | 36 +++--- .../mob/living/silicon/silicon_defense.dm | 44 ++++++-- .../living/simple_animal/animal_defense.dm | 51 +++++---- .../mob/living/simple_animal/bot/honkbot.dm | 2 +- .../mob/living/simple_animal/friendly/cat.dm | 8 +- .../mob/living/simple_animal/friendly/dog.dm | 4 +- .../friendly/drone/interaction.dm | 38 +++---- .../living/simple_animal/hostile/mushroom.dm | 4 +- .../mob/living/simple_animal/slime/slime.dm | 10 +- 20 files changed, 316 insertions(+), 277 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index e8651ba93d..f9c45184b7 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -164,7 +164,7 @@ return FALSE -/atom/proc/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/atom/proc/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) SEND_SIGNAL(src, COMSIG_ATOM_HULK_ATTACK, user) if(does_attack_animation) user.changeNext_move(CLICK_CD_MELEE) diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm index b6fbe3a875..839239a888 100644 --- a/code/modules/mob/living/carbon/alien/alien_defense.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -16,13 +16,10 @@ As such, they can either help or harm other aliens. Help works like the human he In all, this is a lot like the monkey code. /N */ /mob/living/carbon/alien/attack_alien(mob/living/carbon/alien/M) - if(isturf(loc) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return - + . = ..() switch(M.a_intent) - if ("help") + if (INTENT_HELP) if(!recoveringstam) resting = 0 AdjustStun(-60) @@ -31,10 +28,9 @@ In all, this is a lot like the monkey code. /N AdjustSleeping(-100) visible_message("[M.name] nuzzles [src] trying to wake [p_them()] up!") - if ("grab") - grabbedby(M) - - else + if(INTENT_DISARM, INTENT_HARM) + if(!.) // the attack was blocked or was help/grab intent + return if(health > 0) M.do_attack_animation(src, ATTACK_EFFECT_BITE) playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) @@ -56,23 +52,26 @@ In all, this is a lot like the monkey code. /N if(.) //To allow surgery to return properly. return switch(M.a_intent) - if("help") + if(INTENT_HELP) help_shake_act(M) - if("grab") + if(INTENT_GRAB) grabbedby(M) - if ("harm") + if (INTENT_HARM) + if(HAS_TRAIT(M, TRAIT_PACIFISM)) + to_chat(M, "You don't want to hurt [src]!") + return TRUE M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) - return FALSE - if("disarm") + if(INTENT_DISARM) + if(HAS_TRAIT(M, TRAIT_PACIFISM)) + to_chat(M, "You don't want to hurt [src]!") + return TRUE M.do_attack_animation(src, ATTACK_EFFECT_DISARM) - return FALSE /mob/living/carbon/alien/attack_paw(mob/living/carbon/monkey/M) if(..()) - if (stat != DEAD) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(rand(1, 3), BRUTE, affecting) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + apply_damage(rand(1, 3), BRUTE, affecting) /mob/living/carbon/alien/attack_animal(mob/living/simple_animal/M) 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 c2be4249a2..468abf251a 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -5,9 +5,11 @@ else ..() -/mob/living/carbon/alien/humanoid/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/carbon/alien/humanoid/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - ..(user, 1) + . = ..(user, TRUE) + if(.) + return adjustBruteLoss(15) var/hitverb = "punched" if(mob_size < MOB_SIZE_LARGE) @@ -25,7 +27,7 @@ if(.) //To allow surgery to return properly. return switch(M.a_intent) - if ("harm") + if (INTENT_HARM) var/damage = rand(1, 9) if (prob(90)) playsound(loc, "punch", 25, 1, -1) @@ -43,7 +45,7 @@ visible_message("[M] has attempted to punch [src]!", \ "[M] has attempted to punch [src]!", null, COMBAT_MESSAGE_RANGE) - if ("disarm") + if (INTENT_DISARM) if (!lying) if (prob(5)) Unconscious(40) 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 69c1be707d..88c34f4387 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm @@ -1,26 +1,30 @@ /mob/living/carbon/alien/larva/attack_hand(mob/living/carbon/human/M) - if(..()) - var/damage = rand(1, 9) - if (prob(90)) - playsound(loc, "punch", 25, 1, -1) - log_combat(M, src, "attacked") - visible_message("[M] has kicked [src]!", \ - "[M] has kicked [src]!", null, COMBAT_MESSAGE_RANGE) - if ((stat != DEAD) && (damage > 4.9)) - Unconscious(rand(100,200)) + . = ..() + if(. || M.a_intent == INTENT_HELP || M.a_intent == INTENT_GRAB) + return + var/damage = rand(1, 9) + if (prob(90)) + playsound(loc, "punch", 25, 1, -1) + log_combat(M, src, "attacked") + visible_message("[M] has kicked [src]!", \ + "[M] has kicked [src]!", null, COMBAT_MESSAGE_RANGE) + if ((stat != DEAD) && (damage > 4.9)) + Unconscious(rand(100,200)) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - apply_damage(damage, BRUTE, affecting) - else - playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to kick [src]!", \ - "[M] has attempted to kick [src]!", null, COMBAT_MESSAGE_RANGE) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + apply_damage(damage, BRUTE, affecting) + else + playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to kick [src]!", \ + "[M] has attempted to kick [src]!", null, COMBAT_MESSAGE_RANGE) -/mob/living/carbon/alien/larva/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/carbon/alien/larva/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - ..(user, 1) + . = ..(user, TRUE) + if(.) + return adjustBruteLoss(5 + rand(1,9)) new /datum/forced_movement(src, get_step_away(user,src, 30), 1) return 1 diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 6f03ea4364..d045e5361d 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -134,7 +134,7 @@ //ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/carbon/attack_hand(mob/living/carbon/human/user) . = ..() - if(.) //To allow surgery to return properly. + if(.) //was the attack blocked? return for(var/thing in diseases) var/datum/disease/D = thing diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index fda60aeb98..7e7cb18d37 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -85,11 +85,7 @@ return -1 // complete projectile permutation - if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) - P.on_hit(src, 100, def_zone) - return 2 - - return (..(P , def_zone)) + return ..() /mob/living/carbon/human/proc/check_reflect(def_zone) //Reflection checks for anything in your l_hand, r_hand, or wear_suit based on the reflection chance of the object if(wear_suit) @@ -100,15 +96,6 @@ return 1 return 0 -/mob/living/proc/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) - var/block_chance_modifier = round(damage / -3) - for(var/obj/item/I in held_items) - if(!istype(I, /obj/item/clothing)) - var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example - if(I.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) - return TRUE - return FALSE - /mob/living/carbon/human/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) . = ..() if(.) @@ -165,12 +152,12 @@ return dna.species.spec_attacked_by(I, user, affecting, a_intent, src) -/mob/living/carbon/human/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/carbon/human/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - var/hulk_verb = pick("smash","pummel") - if(check_shields(user, 15, "the [hulk_verb]ing")) + . = ..(user, TRUE) + if(.) return - ..(user, 1) + var/hulk_verb = pick("smash","pummel") playsound(loc, user.dna.species.attack_sound, 25, 1, -1) var/message = "[user] has [hulk_verb]ed [src]!" visible_message("[message]", \ @@ -214,56 +201,50 @@ if(can_inject(M, 1, affecting))//Thick suits can stop monkey bites. if(..()) //successful monkey bite, this handles disease contraction. var/damage = rand(1, 3) - if(check_shields(M, damage, "the [M.name]")) - return 0 - if(stat != DEAD) - apply_damage(damage, BRUTE, affecting, run_armor_check(affecting, "melee")) + apply_damage(damage, BRUTE, affecting, run_armor_check(affecting, "melee")) return 1 /mob/living/carbon/human/attack_alien(mob/living/carbon/alien/humanoid/M) - if(check_shields(M, 0, "the M.name")) - visible_message("[M] attempted to touch [src]!") - return 0 + . = ..() + if(!.) + return + if(M.a_intent == INTENT_HARM) + if (w_uniform) + w_uniform.add_fingerprint(M) + var/damage = prob(90) ? 20 : 0 + if(!damage) + playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1) + visible_message("[M] has lunged at [src]!", \ + "[M] has lunged at [src]!") + return 0 + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + var/armor_block = run_armor_check(affecting, "melee", null, null,10) - if(..()) - if(M.a_intent == INTENT_HARM) - if (w_uniform) - w_uniform.add_fingerprint(M) - var/damage = prob(90) ? 20 : 0 - if(!damage) - playsound(loc, 'sound/weapons/slashmiss.ogg', 50, 1, -1) - visible_message("[M] has lunged at [src]!", \ - "[M] has lunged at [src]!") - return 0 - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor_block = run_armor_check(affecting, "melee", null, null,10) + playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) + visible_message("[M] has slashed at [src]!", \ + "[M] has slashed at [src]!") + log_combat(M, src, "attacked") + if(!dismembering_strike(M, M.zone_selected)) //Dismemberment successful + return 1 + apply_damage(damage, BRUTE, affecting, armor_block) - playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - visible_message("[M] has slashed at [src]!", \ - "[M] has slashed at [src]!") - log_combat(M, src, "attacked") - if(!dismembering_strike(M, M.zone_selected)) //Dismemberment successful - return 1 - apply_damage(damage, BRUTE, affecting, armor_block) - - if(M.a_intent == INTENT_DISARM) //Always drop item in hand, if no item, get stun instead. - var/obj/item/I = get_active_held_item() - if(I && dropItemToGround(I)) - playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) - visible_message("[M] disarmed [src]!", \ - "[M] disarmed [src]!") + if(M.a_intent == INTENT_DISARM) //Always drop item in hand, if no item, get stun instead. + var/obj/item/I = get_active_held_item() + if(I && dropItemToGround(I)) + playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) + visible_message("[M] disarmed [src]!", \ + "[M] disarmed [src]!") + else + playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) + if(!lying) //CITADEL EDIT + Knockdown(100, TRUE, FALSE, 30, 25) else - playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) - if(!lying) //CITADEL EDIT - Knockdown(100, TRUE, FALSE, 30, 25) - else - Knockdown(100) - log_combat(M, src, "tackled") - visible_message("[M] has tackled down [src]!", \ - "[M] has tackled down [src]!") - + Knockdown(100) + log_combat(M, src, "tackled") + visible_message("[M] has tackled down [src]!", \ + "[M] has tackled down [src]!") /mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/L) diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm index 25bc243f07..59f694e0f6 100644 --- a/code/modules/mob/living/carbon/monkey/combat.dm +++ b/code/modules/mob/living/carbon/monkey/combat.dm @@ -365,6 +365,28 @@ retaliate(L) return ..() +/mob/living/carbon/monkey/attack_alien(mob/living/carbon/alien/humanoid/M) + if(M.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) + retaliate(M) + else if(M.a_intent == INTENT_DISARM && prob(MONKEY_RETALIATE_DISARM_PROB)) + retaliate(M) + return ..() + +/mob/living/carbon/monkey/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) + if(user.a_intent == INTENT_HARM) + if(prob(MONKEY_RETALIATE_HARM_PROB)) + retaliate(user) + . = ..(user, TRUE) + if(.) + return + var/hulk_verb = pick("smash","pummel") + playsound(loc, user.dna.species.attack_sound, 25, 1, -1) + var/message = "[user] has [hulk_verb]ed [src]!" + visible_message("[message]", \ + "[message]") + adjustBruteLoss(15) + return 1 + /mob/living/carbon/monkey/attack_paw(mob/living/L) if(L.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) retaliate(L) diff --git a/code/modules/mob/living/carbon/monkey/monkey_defense.dm b/code/modules/mob/living/carbon/monkey/monkey_defense.dm index da5f8e75c3..6d2d7bcbcf 100644 --- a/code/modules/mob/living/carbon/monkey/monkey_defense.dm +++ b/code/modules/mob/living/carbon/monkey/monkey_defense.dm @@ -13,9 +13,8 @@ affecting = get_bodypart(BODY_ZONE_CHEST) if(M.limb_destroyer) dismembering_strike(M, affecting.body_zone) - if(stat != DEAD) - var/dmg = rand(1, 5) - apply_damage(dmg, BRUTE, affecting) + var/dmg = rand(1, 5) + apply_damage(dmg, BRUTE, affecting) /mob/living/carbon/monkey/attack_larva(mob/living/carbon/alien/larva/L) if(..()) //successful larva bite. @@ -32,11 +31,14 @@ if(.) //To allow surgery to return properly. return switch(M.a_intent) - if("help") + if(INTENT_HELP) help_shake_act(M) - if("grab") + if(INTENT_GRAB) grabbedby(M) - if("harm") + if(INTENT_HARM) + if(HAS_TRAIT(M, TRAIT_PACIFISM)) + to_chat(M, "You don't want to hurt [src]!") + return M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) if (prob(75)) visible_message("[M] has punched [name]!", \ @@ -60,7 +62,7 @@ playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) visible_message("[M] has attempted to punch [name]!", \ "[M] has attempted to punch [name]!", null, COMBAT_MESSAGE_RANGE) - if("disarm") + if(INTENT_DISARM) if(!IsUnconscious()) M.do_attack_animation(src, ATTACK_EFFECT_DISARM) if (prob(25)) @@ -74,50 +76,51 @@ visible_message("[M] has disarmed [src]!", "[M] has disarmed [src]!", null, COMBAT_MESSAGE_RANGE) /mob/living/carbon/monkey/attack_alien(mob/living/carbon/alien/humanoid/M) - if(..()) //if harm or disarm intent. - if (M.a_intent == INTENT_HARM) - if ((prob(95) && health > 0)) - playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - var/damage = rand(15, 30) - if (damage >= 25) - damage = rand(20, 40) - if(AmountUnconscious() < 300) - Unconscious(rand(200, 300)) - visible_message("[M] has wounded [name]!", \ - "[M] has wounded [name]!", null, COMBAT_MESSAGE_RANGE) - else - visible_message("[M] has slashed [name]!", \ - "[M] has slashed [name]!", null, COMBAT_MESSAGE_RANGE) - - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) - log_combat(M, src, "attacked") - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - if(!dismembering_strike(M, affecting.body_zone)) //Dismemberment successful - return 1 - apply_damage(damage, BRUTE, affecting) - + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return + if (M.a_intent == INTENT_HARM) + if ((prob(95) && health > 0)) + playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) + var/damage = rand(15, 30) + if (damage >= 25) + damage = rand(20, 40) + if(AmountUnconscious() < 300) + Unconscious(rand(200, 300)) + visible_message("[M] has wounded [name]!", \ + "[M] has wounded [name]!", null, COMBAT_MESSAGE_RANGE) else - playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to lunge at [name]!", \ - "[M] has attempted to lunge at [name]!", null, COMBAT_MESSAGE_RANGE) + visible_message("[M] has slashed [name]!", \ + "[M] has slashed [name]!", null, COMBAT_MESSAGE_RANGE) - if (M.a_intent == INTENT_DISARM) - var/obj/item/I = null - playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) - if(prob(95)) - Knockdown(20) - visible_message("[M] has tackled down [name]!", \ - "[M] has tackled down [name]!", null, COMBAT_MESSAGE_RANGE) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) + log_combat(M, src, "attacked") + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + if(!dismembering_strike(M, affecting.body_zone)) //Dismemberment successful + return 1 + apply_damage(damage, BRUTE, affecting) + + else + playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) + visible_message("[M] has attempted to lunge at [name]!", \ + "[M] has attempted to lunge at [name]!", null, COMBAT_MESSAGE_RANGE) + + else + var/obj/item/I = null + playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) + if(prob(95)) + Knockdown(20) + visible_message("[M] has tackled down [name]!", \ + "[M] has tackled down [name]!", null, COMBAT_MESSAGE_RANGE) + else + I = get_active_held_item() + if(dropItemToGround(I)) + visible_message("[M] has disarmed [name]!", "[M] has disarmed [name]!", null, COMBAT_MESSAGE_RANGE) else - I = get_active_held_item() - if(dropItemToGround(I)) - visible_message("[M] has disarmed [name]!", "[M] has disarmed [name]!", null, COMBAT_MESSAGE_RANGE) - else - I = null - log_combat(M, src, "disarmed", "[I ? " removing \the [I]" : ""]") - updatehealth() - + I = null + log_combat(M, src, "disarmed", "[I ? " removing \the [I]" : ""]") + updatehealth() /mob/living/carbon/monkey/attack_animal(mob/living/simple_animal/M) . = ..() diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index f5dd982ad5..d4f07e531e 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -36,7 +36,19 @@ /mob/living/proc/on_hit(obj/item/projectile/P) return +/mob/living/proc/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) + var/block_chance_modifier = round(damage / -3) + for(var/obj/item/I in held_items) + if(!istype(I, /obj/item/clothing)) + var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example + if(I.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type)) + return TRUE + return FALSE + /mob/living/bullet_act(obj/item/projectile/P, def_zone) + if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) + P.on_hit(src, 100, def_zone) + return 2 var/armor = run_armor_check(def_zone, P.flag, null, null, P.armour_penetration, null) if(!P.nodamage) apply_damage(P.damage, P.damage_type, def_zone, armor) @@ -242,6 +254,17 @@ visible_message("[user] attempted to touch [src]!") return TRUE +/mob/living/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) + if(user.a_intent == INTENT_HARM) + if(HAS_TRAIT(user, TRAIT_PACIFISM)) + to_chat(user, "You don't want to hurt [src]!") + return TRUE + var/hulk_verb = pick("smash","pummel") + if(user != src && check_shields(user, 15, "the [hulk_verb]ing")) + return TRUE + ..() + return FALSE + /mob/living/attack_slime(mob/living/simple_animal/slime/M) if(!SSticker.HasRoundStarted()) to_chat(M, "You cannot attack people before the game has started.") @@ -295,6 +318,8 @@ if(M.is_muzzled() || (M.wear_mask && M.wear_mask.flags_cover & MASKCOVERSMOUTH)) to_chat(M, "You can't bite with your mouth covered!") return FALSE + if(check_shields(M, 0, "the [M.name]")) + return FALSE M.do_attack_animation(src, ATTACK_EFFECT_BITE) if (prob(75)) log_combat(M, src, "attacked") @@ -331,20 +356,23 @@ return FALSE /mob/living/attack_alien(mob/living/carbon/alien/humanoid/M) + if((M != src) && M.a_intent != INTENT_HELP && check_shields(M, 0, "the [M.name]")) + visible_message("[M] attempted to touch [src]!") + return FALSE switch(M.a_intent) - if ("help") + if (INTENT_HELP) visible_message("[M] caresses [src] with its scythe like arm.") return FALSE - if ("grab") + if (INTENT_GRAB) grabbedby(M) return FALSE - if("harm") + if(INTENT_HARM) if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") return FALSE M.do_attack_animation(src) return TRUE - if("disarm") + if(INTENT_DISARM) M.do_attack_animation(src, ATTACK_EFFECT_DISARM) return TRUE diff --git a/code/modules/mob/living/silicon/ai/ai_defense.dm b/code/modules/mob/living/silicon/ai/ai_defense.dm index 8799d34a08..97d26f672a 100644 --- a/code/modules/mob/living/silicon/ai/ai_defense.dm +++ b/code/modules/mob/living/silicon/ai/ai_defense.dm @@ -1,20 +1,3 @@ -//ATTACK HAND IGNORING PARENT RETURN VALUE -/mob/living/silicon/ai/attack_hand(mob/living/carbon/human/M) - . = ..() - if(.) //the attack was blocked - return - switch(M.a_intent) - if ("help") - M.visible_message("[M] pets [src].", \ - "You pet [src].") - if("grab") - grabbedby(M) - else - M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) - playsound(src.loc, 'sound/effects/bang.ogg', 10, 1) - visible_message("[M] punches [src], but doesn't leave a dent.", \ - "[M] punches [src], but doesn't leave a dent.", null, COMBAT_MESSAGE_RANGE) - /mob/living/silicon/ai/attacked_by(obj/item/I, mob/living/user, def_zone) . = ..() if(!.) @@ -22,13 +5,6 @@ if(I.force && I.damtype != STAMINA && stat != DEAD) //only sparks if real damage is dealt. spark_system.start() - -/mob/living/silicon/ai/attack_alien(mob/living/carbon/alien/humanoid/M) - if(!SSticker.HasRoundStarted()) - to_chat(M, "You cannot attack people before the game has started.") - return - ..() - /mob/living/silicon/ai/attack_slime(mob/living/simple_animal/slime/user) return //immune to slimes diff --git a/code/modules/mob/living/silicon/pai/pai_defense.dm b/code/modules/mob/living/silicon/pai/pai_defense.dm index 647951ed4e..f8fc5faaab 100644 --- a/code/modules/mob/living/silicon/pai/pai_defense.dm +++ b/code/modules/mob/living/silicon/pai/pai_defense.dm @@ -26,16 +26,14 @@ fold_in(force = 1) Knockdown(200) +//ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/silicon/pai/attack_hand(mob/living/carbon/human/user) - . = ..() - if(.) - return switch(user.a_intent) - if("help") + if(INTENT_HELP) visible_message("[user] gently pats [src] on the head, eliciting an off-putting buzzing from its holographic field.") - if("disarm") + if(INTENT_DISARM) visible_message("[user] boops [src] on the head!") - if("harm") + if(INTENT_HARM) user.do_attack_animation(src) if (user.name == master) visible_message("Responding to its master's touch, [src] disengages its holochassis emitter, rapidly losing coherence.") @@ -44,14 +42,19 @@ if(user.put_in_hands(card)) user.visible_message("[user] promptly scoops up [user.p_their()] pAI's card.") else + if(HAS_TRAIT(user, TRAIT_PACIFISM)) + to_chat(user, "You don't want to hurt [src]!") + return visible_message("[user] stomps on [src]!.") take_holo_damage(2) + else + grabbedby(user) -/mob/living/silicon/pai/bullet_act(obj/item/projectile/Proj) - if(Proj.stun) +/mob/living/silicon/pai/bullet_act(obj/item/projectile/P, def_zone) + if(P.stun) fold_in(force = TRUE) - src.visible_message("The electrically-charged projectile disrupts [src]'s holomatrix, forcing [src] to fold in!") - . = ..(Proj) + visible_message("The electrically-charged projectile disrupts [src]'s holomatrix, forcing [src] to fold in!") + . = ..() /mob/living/silicon/pai/stripPanelUnequip(obj/item/what, mob/who, where) //prevents stripping to_chat(src, "Your holochassis stutters and warps intensely as you attempt to interact with the object, forcing you to cease lest the field fail.") diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index 0f09b6f62a..ddf2da2343 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -14,6 +14,9 @@ return ..() /mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M) + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return if (M.a_intent == INTENT_DISARM) if(!(lying)) M.do_attack_animation(src, ATTACK_EFFECT_DISARM) @@ -30,9 +33,6 @@ visible_message("[M] has forced back [src]!", \ "[M] has forced back [src]!", null, COMBAT_MESSAGE_RANGE) playsound(loc, 'sound/weapons/pierce.ogg', 50, 1, -1) - else - ..() - return /mob/living/silicon/robot/attack_slime(mob/living/simple_animal/slime/M) if(..()) //successful slime shock @@ -56,23 +56,17 @@ //ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/silicon/robot/attack_hand(mob/living/carbon/human/user) add_fingerprint(user) - if(opened && !wiresexposed && !issilicon(user)) - if(cell) - cell.update_icon() - 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 && !wiresexposed && cell && !issilicon(user)) + cell.update_icon() + 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) + return ..() /mob/living/silicon/robot/fire_act() if(!on_fire) //Silicons don't gain stacks from hotspots, but hotspots can ignite them @@ -182,9 +176,9 @@ if (stat != DEAD) adjustBruteLoss(30) -/mob/living/silicon/robot/bullet_act(var/obj/item/projectile/Proj) - ..(Proj) +/mob/living/silicon/robot/bullet_act(obj/item/projectile/P, def_zone) + ..() updatehealth() - if(prob(75) && Proj.damage > 0) + if(prob(75) && P.damage > 0) spark_system.start() return 2 diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 482ecc429f..80a5058ed4 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -6,7 +6,10 @@ return 2 /mob/living/silicon/attack_alien(mob/living/carbon/alien/humanoid/M) - if(..()) //if harm or disarm intent + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return + if(M.a_intent == INTENT_HARM) var/damage = 20 if (prob(90)) log_combat(M, src, "attacked") @@ -53,9 +56,11 @@ if(L.a_intent == INTENT_HELP) visible_message("[L.name] rubs its head against [src].") -/mob/living/silicon/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/silicon/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - ..(user, 1) + . = ..(user, TRUE) + if(.) + return adjustBruteLoss(rand(10, 15)) playsound(loc, "punch", 25, 1, -1) visible_message("[user] has punched [src]!", \ @@ -63,6 +68,22 @@ return 1 return 0 +/mob/living/silicon/attack_hand(mob/living/carbon/human/M) + . = ..() + if(.) //the attack was blocked + return + switch(M.a_intent) + if (INTENT_HELP) + M.visible_message("[M] pets [src].", \ + "You pet [src].") + if(INTENT_GRAB) + grabbedby(M) + else + M.do_attack_animation(src, ATTACK_EFFECT_PUNCH) + playsound(src.loc, 'sound/effects/bang.ogg', 10, 1) + visible_message("[M] punches [src], but doesn't leave a dent.", \ + "[M] punches [src], but doesn't leave a dent.", null, COMBAT_MESSAGE_RANGE) + /mob/living/silicon/attack_drone(mob/living/simple_animal/drone/M) if(M.a_intent == INTENT_HARM) return @@ -93,19 +114,22 @@ M.visible_message("[M] is thrown off of [src]!") flash_act(affect_silicon = 1) -/mob/living/silicon/bullet_act(obj/item/projectile/Proj) - if((Proj.damage_type == BRUTE || Proj.damage_type == BURN)) - adjustBruteLoss(Proj.damage) - if(prob(Proj.damage*1.5)) +/mob/living/silicon/bullet_act(obj/item/projectile/P, def_zone) + if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) + P.on_hit(src, 100, def_zone) + return 2 + if((P.damage_type == BRUTE || P.damage_type == BURN)) + adjustBruteLoss(P.damage) + if(prob(P.damage*1.5)) for(var/mob/living/M in buckled_mobs) M.visible_message("[M] is knocked off of [src]!") unbuckle_mob(M) M.Knockdown(40) - if(Proj.stun || Proj.knockdown) + if(P.stun || P.knockdown) for(var/mob/living/M in buckled_mobs) unbuckle_mob(M) - M.visible_message("[M] is knocked off of [src] by the [Proj]!") - Proj.on_hit(src) + M.visible_message("[M] is knocked off of [src] by the [P]!") + P.on_hit(src) return 2 /mob/living/silicon/flash_act(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0, type = /obj/screen/fullscreen/flash/static) diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index e74b29be44..4542f140d4 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -5,18 +5,18 @@ if(.) //the attack was blocked return switch(M.a_intent) - if("help") + if(INTENT_HELP) if (health > 0) visible_message("[M] [response_help] [src].") playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - if("grab") + if(INTENT_GRAB) if(grab_state >= GRAB_AGGRESSIVE && isliving(pulling)) vore_attack(M, pulling) else grabbedby(M) - if("harm", "disarm") + if(INTENT_HARM, INTENT_DISARM) if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt [src]!") return @@ -29,12 +29,11 @@ updatehealth() return TRUE -/mob/living/simple_animal/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) +/mob/living/simple_animal/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) - if(HAS_TRAIT(user, TRAIT_PACIFISM)) - to_chat(user, "You don't want to hurt [src]!") - return FALSE - ..(user, 1) + . = ..(user, TRUE) + if(.) + return playsound(loc, "punch", 25, 1, -1) visible_message("[user] has punched [src]!", \ "[user] has punched [src]!", null, COMBAT_MESSAGE_RANGE) @@ -43,10 +42,9 @@ /mob/living/simple_animal/attack_paw(mob/living/carbon/monkey/M) if(..()) //successful monkey bite. - if(stat != DEAD) - var/damage = rand(1, 3) - attack_threshold_check(damage) - return 1 + var/damage = rand(1, 3) + attack_threshold_check(damage) + return 1 if (M.a_intent == INTENT_HELP) if (health > 0) visible_message("[M.name] [response_help] [src].") @@ -54,20 +52,21 @@ /mob/living/simple_animal/attack_alien(mob/living/carbon/alien/humanoid/M) - if(..()) //if harm or disarm intent. - if(M.a_intent == INTENT_DISARM) - playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) - visible_message("[M] [response_disarm] [name]!", \ - "[M] [response_disarm] [name]!", null, COMBAT_MESSAGE_RANGE) - log_combat(M, src, "disarmed") - else - var/damage = rand(15, 30) - visible_message("[M] has slashed at [src]!", \ - "[M] has slashed at [src]!", null, COMBAT_MESSAGE_RANGE) - playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) - attack_threshold_check(damage) - log_combat(M, src, "attacked") - return 1 + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return + if(M.a_intent == INTENT_DISARM) + playsound(loc, 'sound/weapons/pierce.ogg', 25, 1, -1) + visible_message("[M] [response_disarm] [name]!", \ + "[M] [response_disarm] [name]!", null, COMBAT_MESSAGE_RANGE) + log_combat(M, src, "disarmed") + else + var/damage = rand(15, 30) + visible_message("[M] has slashed at [src]!", \ + "[M] has slashed at [src]!", null, COMBAT_MESSAGE_RANGE) + playsound(loc, 'sound/weapons/slice.ogg', 25, 1, -1) + attack_threshold_check(damage) + log_combat(M, src, "attacked") /mob/living/simple_animal/attack_larva(mob/living/carbon/alien/larva/L) . = ..() diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index 1c19cd82a1..5ca3f1f758 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -112,7 +112,7 @@ Maintenance panel panel is [open ? "opened" : "closed"]"}, mode = BOT_HUNT /mob/living/simple_animal/bot/honkbot/attack_hand(mob/living/carbon/human/H) - if(H.a_intent == "harm") + if(H.a_intent == INTENT_HARM) retaliate(H) addtimer(CALLBACK(src, .proc/react_buzz), 5) return ..() diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 3a21a04bf9..de43098496 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -231,9 +231,9 @@ /mob/living/simple_animal/pet/cat/attack_hand(mob/living/carbon/human/M) . = ..() switch(M.a_intent) - if("help") + if(INTENT_HELP) wuv(1, M) - if("harm") + if(INTENT_HARM) wuv(-1, M) /mob/living/simple_animal/pet/cat/proc/wuv(change, mob/M) @@ -288,7 +288,9 @@ D.frost_donut() /mob/living/simple_animal/pet/cat/cak/attack_hand(mob/living/L) - ..() + . = ..() + if(.) //the attack was blocked + return if(L.a_intent == INTENT_HARM && L.reagents && !stat) L.reagents.add_reagent("nutriment", 0.4) L.reagents.add_reagent("vitamin", 0.4) diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index c194233c42..366a1ff20f 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -638,9 +638,9 @@ /mob/living/simple_animal/pet/dog/attack_hand(mob/living/carbon/human/M) . = ..() switch(M.a_intent) - if("help") + if(INTENT_HELP) wuv(1,M) - if("harm") + if(INTENT_HARM) wuv(-1,M) /mob/living/simple_animal/pet/dog/proc/wuv(change, mob/M) diff --git a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm index 33031fd80c..b2f58bc01b 100644 --- a/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm +++ b/code/modules/mob/living/simple_animal/friendly/drone/interaction.dm @@ -31,26 +31,24 @@ //ATTACK HAND IGNORING PARENT RETURN VALUE /mob/living/simple_animal/drone/attack_hand(mob/user) - if(ishuman(user)) - if(stat == DEAD || status_flags & GODMODE || !can_be_held) - ..() - return - if(user.get_active_held_item()) - to_chat(user, "Your hands are full!") - return - visible_message("[user] starts picking up [src].", \ - "[user] starts picking you up!") - if(!do_after(user, 20, target = src)) - return - visible_message("[user] picks up [src]!", \ - "[user] picks you up!") - if(buckled) - to_chat(user, "[src] is buckled to [buckled] and cannot be picked up!") - return - to_chat(user, "You pick [src] up.") - drop_all_held_items() - var/obj/item/clothing/head/mob_holder/drone/DH = new(get_turf(src), src) - user.put_in_hands(DH) + if(user.a_intent != INTENT_HELP || !LAZYLEN(user.held_items) || stat == DEAD || status_flags & GODMODE || !can_be_held) + return ..() + if(user.get_active_held_item()) + to_chat(user, "Your hands are full!") + return + visible_message("[user] starts picking up [src].", \ + "[user] starts picking you up!") + if(!do_after(user, 20, target = src)) + return + visible_message("[user] picks up [src]!", \ + "[user] picks you up!") + if(buckled) + to_chat(user, "[src] is buckled to [buckled] and cannot be picked up!") + return + to_chat(user, "You pick [src] up.") + drop_all_held_items() + var/obj/item/clothing/head/mob_holder/drone/DH = new(get_turf(src), src) + user.put_in_hands(DH) /mob/living/simple_animal/drone/proc/try_reactivate(mob/living/user) var/mob/dead/observer/G = get_ghost() diff --git a/code/modules/mob/living/simple_animal/hostile/mushroom.dm b/code/modules/mob/living/simple_animal/hostile/mushroom.dm index dbaa8ab5fa..da8101ee6a 100644 --- a/code/modules/mob/living/simple_animal/hostile/mushroom.dm +++ b/code/modules/mob/living/simple_animal/hostile/mushroom.dm @@ -166,7 +166,9 @@ ..() /mob/living/simple_animal/hostile/mushroom/attack_hand(mob/living/carbon/human/M) - ..() + . = ..() + if(.) // the attack was blocked + return if(M.a_intent == INTENT_HARM) Bruise() diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 2001c61e12..4deb62aac2 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -61,7 +61,7 @@ var/mood = "" // To show its face var/mutator_used = FALSE //So you can't shove a dozen mutators into a single slime var/force_stasis = FALSE - + do_footstep = TRUE var/static/regex/slime_name_regex = new("\\w+ (baby|adult) slime \\(\\d+\\)") @@ -320,9 +320,11 @@ attacked += 10 /mob/living/simple_animal/slime/attack_alien(mob/living/carbon/alien/humanoid/M) - if(..()) //if harm or disarm intent. - attacked += 10 - discipline_slime(M) + . = ..() + if(!.) // the attack was blocked or was help/grab intent + return + attacked += 10 + discipline_slime(M) /mob/living/simple_animal/slime/attackby(obj/item/W, mob/living/user, params) From bddb43787296906d763a31f5c59eab13490723f0 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Mon, 18 Nov 2019 18:30:46 +0100 Subject: [PATCH 004/192] It works now. --- code/game/objects/items/melee/misc.dm | 5 +- code/game/objects/items/robot/robot_items.dm | 8 +- code/game/objects/items/stunbaton.dm | 8 +- .../abductor/equipment/abduction_gear.dm | 8 +- .../mob/living/carbon/alien/alien_defense.dm | 25 ++--- .../carbon/alien/humanoid/caste/hunter.dm | 7 +- .../carbon/alien/humanoid/humanoid_defense.dm | 4 +- .../carbon/alien/larva/larva_defense.dm | 3 + .../mob/living/carbon/carbon_defense.dm | 44 ++++----- .../mob/living/carbon/human/human_defense.dm | 98 +++++++------------ .../mob/living/carbon/monkey/combat.dm | 21 ++-- .../living/carbon/monkey/monkey_defense.dm | 74 ++++++++------ code/modules/mob/living/living_defense.dm | 67 ++++++++++--- .../mob/living/silicon/robot/robot_defense.dm | 29 +++--- .../mob/living/silicon/silicon_defense.dm | 17 ++-- .../living/simple_animal/animal_defense.dm | 7 +- .../simple_animal/guardian/types/charger.dm | 6 +- .../mob/living/simple_animal/slime/slime.dm | 35 +++---- .../living/silicon/robot/dogborg_equipment.dm | 7 +- 19 files changed, 244 insertions(+), 229 deletions(-) diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index d7c2f7f4f6..1120e1856d 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -216,10 +216,11 @@ return else if(last_hit < world.time) + if(target.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) + playsound(target, 'sound/weapons/genhit.ogg', 50, 1) + return if(ishuman(target)) var/mob/living/carbon/human/H = target - if (H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) - return if(check_martial_counter(H, user)) return playsound(get_turf(src), 'sound/effects/woodhit.ogg', 75, 1, -1) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 77bc7ed810..c09f5b1b65 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -11,11 +11,9 @@ var/charge_cost = 30 /obj/item/borg/stun/attack(mob/living/M, mob/living/user) - if(ishuman(M)) - var/mob/living/carbon/human/H = M - if(H.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK)) - playsound(M, 'sound/weapons/genhit.ogg', 50, 1) - return FALSE + if(M.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK)) + playsound(M, 'sound/weapons/genhit.ogg', 50, 1) + return FALSE if(iscyborg(user)) var/mob/living/silicon/robot/R = user if(!R.cell.use(charge_cost)) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 47d9af2795..e1e599b1b6 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -168,11 +168,9 @@ /obj/item/melee/baton/proc/baton_stun(mob/living/L, mob/user) - if(ishuman(L)) - var/mob/living/carbon/human/H = L - if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that - playsound(L, 'sound/weapons/genhit.ogg', 50, 1) - return FALSE + if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) //No message; check_shields() handles that + playsound(L, 'sound/weapons/genhit.ogg', 50, 1) + return FALSE var/stunpwr = stunforce var/obj/item/stock_parts/cell/our_cell = get_cell() if(!our_cell) diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index 37652d1887..ee5000a3b8 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -482,11 +482,9 @@ user.do_attack_animation(L) - if(ishuman(L)) - var/mob/living/carbon/human/H = L - if(H.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) - playsound(L, 'sound/weapons/genhit.ogg', 50, 1) - return 0 + if(L.check_shields(src, 0, "[user]'s [name]", MELEE_ATTACK)) + playsound(L, 'sound/weapons/genhit.ogg', 50, 1) + return 0 switch (mode) if(BATON_STUN) diff --git a/code/modules/mob/living/carbon/alien/alien_defense.dm b/code/modules/mob/living/carbon/alien/alien_defense.dm index 839239a888..bdc691ce49 100644 --- a/code/modules/mob/living/carbon/alien/alien_defense.dm +++ b/code/modules/mob/living/carbon/alien/alien_defense.dm @@ -17,8 +17,9 @@ In all, this is a lot like the monkey code. /N */ /mob/living/carbon/alien/attack_alien(mob/living/carbon/alien/M) . = ..() + if(!.) // the attack was blocked or was help/grab intent + return switch(M.a_intent) - if (INTENT_HELP) if(!recoveringstam) resting = 0 @@ -27,10 +28,7 @@ In all, this is a lot like the monkey code. /N AdjustUnconscious(-60) AdjustSleeping(-100) visible_message("[M.name] nuzzles [src] trying to wake [p_them()] up!") - if(INTENT_DISARM, INTENT_HARM) - if(!.) // the attack was blocked or was help/grab intent - return if(health > 0) M.do_attack_animation(src, ATTACK_EFFECT_BITE) playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1) @@ -69,7 +67,8 @@ In all, this is a lot like the monkey code. /N /mob/living/carbon/alien/attack_paw(mob/living/carbon/monkey/M) - if(..()) + . = ..() + if(.) //successful monkey bite. var/obj/item/bodypart/affecting = get_bodypart(ran_zone(M.zone_selected)) apply_damage(rand(1, 3), BRUTE, affecting) @@ -93,13 +92,15 @@ In all, this is a lot like the monkey code. /N adjustStaminaLoss(damage) /mob/living/carbon/alien/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - var/damage = rand(5, 35) - if(M.is_adult) - damage = rand(10, 40) - adjustBruteLoss(damage) - log_combat(M, src, "attacked") - updatehealth() + . = ..() + if(!.) //unsuccessful slime attack + return + var/damage = rand(5, 35) + if(M.is_adult) + damage = rand(10, 40) + adjustBruteLoss(damage) + log_combat(M, src, "attacked") + updatehealth() /mob/living/carbon/alien/ex_act(severity, target, origin) if(origin && istype(origin, /datum/spacevine_mutation) && isvineimmune(src)) diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm index fe682b5c99..d1ed09665b 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm @@ -63,12 +63,7 @@ if(A) if(isliving(A)) var/mob/living/L = A - var/blocked = FALSE - if(ishuman(A)) - var/mob/living/carbon/human/H = A - if(H.check_shields(src, 0, "the [name]", attack_type = LEAP_ATTACK)) - blocked = TRUE - if(!blocked) + if(!L.check_shields(src, 0, "the [name]", attack_type = LEAP_ATTACK)) L.visible_message("[src] pounces on [L]!", "[src] pounces on you!") L.Knockdown(100) sleep(2)//Runtime prevention (infinite bump() calls on hulks) 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 468abf251a..1d613db07a 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid_defense.dm @@ -42,7 +42,7 @@ log_combat(M, src, "attacked") else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to punch [src]!", \ + visible_message("[M] has attempted to punch [src]!", \ "[M] has attempted to punch [src]!", null, COMBAT_MESSAGE_RANGE) if (INTENT_DISARM) @@ -61,7 +61,7 @@ "[M] has disarmed [src]!", null, COMBAT_MESSAGE_RANGE) else playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1) - visible_message("[M] has attempted to disarm [src]!",\ + visible_message("[M] has attempted to disarm [src]!",\ "[M] has attempted to disarm [src]!", null, COMBAT_MESSAGE_RANGE) /mob/living/carbon/alien/humanoid/do_attack_animation(atom/A, visual_effect_icon, obj/item/used_item, no_effect) 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 88c34f4387..7dabcf5abf 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva_defense.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva_defense.dm @@ -25,6 +25,9 @@ . = ..(user, TRUE) if(.) return + playsound(loc, "punch", 25, 1, -1) + visible_message("[user] has pummeled [src]!", \ + "[user] has pummeled [src]!", null, COMBAT_MESSAGE_RANGE) adjustBruteLoss(5 + rand(1,9)) new /datum/forced_movement(src, get_step_away(user,src, 30), 1) return 1 diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index d045e5361d..815b0a909b 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -62,10 +62,6 @@ throw_mode_off() return TRUE -/mob/living/carbon/can_embed(obj/item/I) - if(I.get_sharpness() || is_pointed(I) || is_type_in_typecache(I, GLOB.can_embed_types)) - return TRUE - /mob/living/carbon/embed_item(obj/item/I) throw_alert("embeddedobject", /obj/screen/alert/embeddedobject) var/obj/item/bodypart/L = pick(bodyparts) @@ -170,7 +166,8 @@ help_shake_act(M) return 0 - if(..()) //successful monkey bite. + . = ..() + if(.) //successful monkey bite. for(var/thing in M.diseases) var/datum/disease/D = thing ForceContractDisease(D) @@ -178,26 +175,27 @@ /mob/living/carbon/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - 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 + . = ..() + if(!.) + return + 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]!") + visible_message("The [M.name] has shocked [src]!", \ + "The [M.name] has shocked [src]!") - do_sparks(5, TRUE, src) - var/power = M.powerlevel + rand(0,3) - Knockdown(power*20) - if(stuttering < power) - stuttering = power - if (prob(stunprob) && M.powerlevel >= 8) - adjustFireLoss(M.powerlevel * rand(6,10)) - updatehealth() - return 1 + do_sparks(5, TRUE, src) + var/power = M.powerlevel + rand(0,3) + Knockdown(power*20) + if(stuttering < power) + stuttering = power + if (prob(stunprob) && M.powerlevel >= 8) + adjustFireLoss(M.powerlevel * rand(6,10)) + updatehealth() /mob/living/carbon/proc/dismembering_strike(mob/living/attacker, dam_zone) if(!attacker.limb_destroyer) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 7e7cb18d37..a8d1eb8180 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -61,40 +61,12 @@ P.setAngle(rand(0, 360))//SHING return FALSE - if(!(P.original == src && P.firer == src)) //can't block or reflect when shooting yourself - if(P.is_reflectable) - if(check_reflect(def_zone)) // Checks if you've passed a reflection% check - visible_message("The [P.name] gets reflected by [src]!", \ - "The [P.name] gets reflected by [src]!") - // Find a turf near or on the original location to bounce to - if(P.starting) - var/new_x = P.starting.x + pick(0, 0, 0, 0, 0, -1, 1, -2, 2) - var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2) - var/turf/curloc = get_turf(src) - - // redirect the projectile - P.original = locate(new_x, new_y, P.z) - P.starting = curloc - P.firer = src - P.yo = new_y - curloc.y - P.xo = new_x - curloc.x - var/new_angle_s = P.Angle + rand(120,240) - while(new_angle_s > 180) // Translate to regular projectile degrees - new_angle_s -= 360 - P.setAngle(new_angle_s) - - return -1 // complete projectile permutation - return ..() -/mob/living/carbon/human/proc/check_reflect(def_zone) //Reflection checks for anything in your l_hand, r_hand, or wear_suit based on the reflection chance of the object - if(wear_suit) - if(wear_suit.IsReflect(def_zone) == 1) - return 1 - for(var/obj/item/I in held_items) - if(I.IsReflect(def_zone) == 1) - return 1 - return 0 +/mob/living/carbon/human/check_reflect(def_zone) + if(wear_suit?.IsReflect(def_zone)) + return TRUE + return ..() /mob/living/carbon/human/check_shields(atom/AM, damage, attack_text = "the attack", attack_type = MELEE_ATTACK, armour_penetration = 0) . = ..() @@ -111,6 +83,11 @@ return TRUE return FALSE +/mob/living/carbon/human/can_embed(obj/item/I) + if(I.get_sharpness() || is_pointed(I) || is_type_in_typecache(I, GLOB.can_embed_types)) + return TRUE + return FALSE + /mob/living/carbon/human/proc/check_block() if(mind) if(mind.martial_art && prob(mind.martial_art.block_chance) && mind.martial_art.can_use(src) && in_throw_mode && !incapacitated(FALSE, TRUE)) @@ -179,8 +156,7 @@ if(!affecting) affecting = get_bodypart(BODY_ZONE_CHEST) if(M.a_intent == INTENT_HELP) - ..() //shaking - return 0 + return ..() //shaking if(M.a_intent == INTENT_DISARM) //Always drop item in hand, if no item, get stunned instead. var/obj/item/I = get_active_held_item() @@ -247,26 +223,23 @@ "[M] has tackled down [src]!") /mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/L) - - if(..()) //successful larva bite. - var/damage = rand(1, 3) - if(check_shields(L, damage, "the [L.name]")) - return 0 - if(stat != DEAD) - L.amount_grown = min(L.amount_grown + damage, L.max_grown) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor_block = run_armor_check(affecting, "melee") - apply_damage(damage, BRUTE, affecting, armor_block) + . = ..() + if(!.) //unsuccessful larva bite. + return + var/damage = rand(1, 3) + if(stat != DEAD) + L.amount_grown = min(L.amount_grown + damage, L.max_grown) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected)) + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + var/armor_block = run_armor_check(affecting, "melee") + apply_damage(damage, BRUTE, affecting, armor_block) /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(M, damage, "the [M.name]", MELEE_ATTACK, M.armour_penetration)) - return FALSE var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) if(!dam_zone) //Dismemberment successful return TRUE @@ -278,23 +251,22 @@ /mob/living/carbon/human/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - var/damage = rand(5, 25) - if(M.is_adult) - damage = rand(10, 35) + . = ..() + if(!.) //unsuccessful slime attack + return + var/damage = rand(5, 25) + if(M.is_adult) + damage = rand(10, 35) - if(check_shields(M, damage, "the [M.name]")) - return 0 + var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) + if(!dam_zone) //Dismemberment successful + return 1 - var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) - if(!dam_zone) //Dismemberment successful - return 1 - - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - var/armor_block = run_armor_check(affecting, "melee") - apply_damage(damage, BRUTE, affecting, armor_block) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + var/armor_block = run_armor_check(affecting, "melee") + apply_damage(damage, BRUTE, affecting, armor_block) /mob/living/carbon/human/mech_melee_attack(obj/mecha/M) diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm index 59f694e0f6..30afa491c5 100644 --- a/code/modules/mob/living/carbon/monkey/combat.dm +++ b/code/modules/mob/living/carbon/monkey/combat.dm @@ -372,20 +372,15 @@ retaliate(M) return ..() +/mob/living/carbon/monkey/attack_larva(mob/living/carbon/alien/larva/L) + if(L.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) + retaliate(user) + return ..() + /mob/living/carbon/monkey/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) - if(user.a_intent == INTENT_HARM) - if(prob(MONKEY_RETALIATE_HARM_PROB)) - retaliate(user) - . = ..(user, TRUE) - if(.) - return - var/hulk_verb = pick("smash","pummel") - playsound(loc, user.dna.species.attack_sound, 25, 1, -1) - var/message = "[user] has [hulk_verb]ed [src]!" - visible_message("[message]", \ - "[message]") - adjustBruteLoss(15) - return 1 + if(user.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) + retaliate(user) + return ..() /mob/living/carbon/monkey/attack_paw(mob/living/L) if(L.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) diff --git a/code/modules/mob/living/carbon/monkey/monkey_defense.dm b/code/modules/mob/living/carbon/monkey/monkey_defense.dm index 6d2d7bcbcf..32e3d21ee2 100644 --- a/code/modules/mob/living/carbon/monkey/monkey_defense.dm +++ b/code/modules/mob/living/carbon/monkey/monkey_defense.dm @@ -6,25 +6,41 @@ ..() /mob/living/carbon/monkey/attack_paw(mob/living/M) - if(..()) //successful monkey bite. - var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - if(M.limb_destroyer) - dismembering_strike(M, affecting.body_zone) - var/dmg = rand(1, 5) - apply_damage(dmg, BRUTE, affecting) + . = ..() + if(!.) //unsuccessful monkey bite. + return + var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + if(M.limb_destroyer) + dismembering_strike(M, affecting.body_zone) + var/dmg = rand(1, 5) + apply_damage(dmg, BRUTE, affecting) /mob/living/carbon/monkey/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/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - apply_damage(damage, BRUTE, affecting) + . = ..() + if(!.) //unsuccessful larva bite + return + var/damage = rand(1, 3) + if(stat != DEAD) + L.amount_grown = min(L.amount_grown + damage, L.max_grown) + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(L.zone_selected)) + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + apply_damage(damage, BRUTE, affecting) + +/mob/living/carbon/monkey/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) + . = ..(user, TRUE) + if(.) + return + var/hulk_verb = pick("smash","pummel") + playsound(loc, user.dna.species.attack_sound, 25, 1, -1) + var/message = "[user] has [hulk_verb]ed [src]!" + visible_message("[message]", \ + "[message]") + adjustBruteLoss(15) + return TRUE /mob/living/carbon/monkey/attack_hand(mob/living/carbon/human/M) . = ..() @@ -135,17 +151,19 @@ apply_damage(damage, M.melee_damage_type, affecting) /mob/living/carbon/monkey/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - var/damage = rand(5, 35) - if(M.is_adult) - damage = rand(20, 40) - var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) - if(!dam_zone) //Dismemberment successful - return 1 - var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) - if(!affecting) - affecting = get_bodypart(BODY_ZONE_CHEST) - apply_damage(damage, BRUTE, affecting) + . = ..() + if(!.) //unsuccessful slime attack + return + var/damage = rand(5, 35) + if(M.is_adult) + damage = rand(20, 40) + var/dam_zone = dismembering_strike(M, pick(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) + if(!dam_zone) //Dismemberment successful + return 1 + var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone)) + if(!affecting) + affecting = get_bodypart(BODY_ZONE_CHEST) + apply_damage(damage, BRUTE, affecting) /mob/living/carbon/monkey/acid_act(acidpwr, acid_volume, bodyzone_hit) . = 1 diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index d4f07e531e..e95e994734 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -45,10 +45,41 @@ return TRUE return FALSE +/mob/living/proc/check_reflect(def_zone) //Reflection checks for anything in your hands, based on the reflection chance of the object(s) + for(var/obj/item/I in held_items) + if(I.IsReflect(def_zone)) + return TRUE + return FALSE + +/mob/living/proc/reflect_bullet_check(obj/item/projectile/P, def_zone) + if(P.is_reflectable && check_reflect(def_zone)) // Checks if you've passed a reflection% check + visible_message("The [P.name] gets reflected by [src]!", \ + "The [P.name] gets reflected by [src]!") + // Find a turf near or on the original location to bounce to + if(P.starting) + var/new_x = P.starting.x + pick(0, 0, 0, 0, 0, -1, 1, -2, 2) + var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2) + var/turf/curloc = get_turf(src) + // redirect the projectile + P.original = locate(new_x, new_y, P.z) + P.starting = curloc + P.firer = src + P.yo = new_y - curloc.y + P.xo = new_x - curloc.x + var/new_angle_s = P.Angle + rand(120,240) + while(new_angle_s > 180) // Translate to regular projectile degrees + new_angle_s -= 360 + P.setAngle(new_angle_s) + return TRUE + return FALSE + /mob/living/bullet_act(obj/item/projectile/P, def_zone) - if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) - P.on_hit(src, 100, def_zone) - return 2 + if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself + if(reflect_bullet_check(P, def_zone)) + return -1 // complete projectile permutation + if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) + P.on_hit(src, 100, def_zone) + return 2 var/armor = run_armor_check(def_zone, P.flag, null, null, P.armour_penetration, null) if(!P.nodamage) apply_damage(P.damage, P.damage_type, def_zone, armor) @@ -279,6 +310,12 @@ to_chat(M, "You don't want to hurt anyone!") return FALSE + var/damage = rand(5, 35) + if(M.is_adult) + damage = rand(20, 40) + if(check_shields(M, damage, "the [M.name]")) + return FALSE + if (stat != DEAD) log_combat(M, src, "attacked") M.do_attack_animation(src) @@ -295,7 +332,8 @@ if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") return FALSE - + if(check_shields(M, rand(M.melee_damage_lower, M.melee_damage_upper), "the [M.name]", MELEE_ATTACK, M.armour_penetration)) + return FALSE if(M.attack_sound) playsound(loc, M.attack_sound, 50, 1, 1) M.do_attack_animation(src) @@ -306,10 +344,6 @@ /mob/living/attack_paw(mob/living/carbon/monkey/M) - if(isturf(loc) && istype(loc.loc, /area/start)) - to_chat(M, "No attacking people at spawn, you jackass.") - return FALSE - if (M.a_intent == INTENT_HARM) if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") @@ -334,15 +368,16 @@ /mob/living/attack_larva(mob/living/carbon/alien/larva/L) switch(L.a_intent) - if("help") + if(INTENT_HELP) visible_message("[L.name] rubs its head against [src].") return FALSE else if(HAS_TRAIT(L, TRAIT_PACIFISM)) to_chat(L, "You don't want to hurt anyone!") - return - + return FALSE + if(L != src && check_shields(L, rand(1, 3), "the [L.name]")) + return FALSE L.do_attack_animation(src) if(prob(90)) log_combat(L, src, "attacked") @@ -353,7 +388,6 @@ else visible_message("[L.name] has attempted to bite [src]!", \ "[L.name] has attempted to bite [src]!", null, COMBAT_MESSAGE_RANGE) - return FALSE /mob/living/attack_alien(mob/living/carbon/alien/humanoid/M) if((M != src) && M.a_intent != INTENT_HELP && check_shields(M, 0, "the [M.name]")) @@ -361,7 +395,8 @@ return FALSE switch(M.a_intent) if (INTENT_HELP) - visible_message("[M] caresses [src] with its scythe like arm.") + if(!isalien(src)) //I know it's ugly, but the alien vs alien attack_alien behaviour is a bit different. + visible_message("[M] caresses [src] with its scythe like arm.") return FALSE if (INTENT_GRAB) grabbedby(M) @@ -370,10 +405,12 @@ if(HAS_TRAIT(M, TRAIT_PACIFISM)) to_chat(M, "You don't want to hurt anyone!") return FALSE - M.do_attack_animation(src) + if(!isalien(src)) + M.do_attack_animation(src) return TRUE if(INTENT_DISARM) - M.do_attack_animation(src, ATTACK_EFFECT_DISARM) + if(!isalien(src)) + M.do_attack_animation(src, ATTACK_EFFECT_DISARM) return TRUE /mob/living/ex_act(severity, target, origin) diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index ddf2da2343..7e06c66eff 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -13,6 +13,15 @@ spark_system.start() return ..() +/mob/living/silicon/robot/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) + . = ..() + if(.) + spark_system.start() + spawn(0) + step_away(src,user,15) + sleep(3) + step_away(src,user,15) + /mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M) . = ..() if(!.) // the attack was blocked or was help/grab intent @@ -35,19 +44,17 @@ playsound(loc, 'sound/weapons/pierce.ogg', 50, 1, -1) /mob/living/silicon/robot/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime shock - flash_act() - var/stunprob = M.powerlevel * 7 + 10 - if(prob(stunprob) && M.powerlevel >= 8) - adjustBruteLoss(M.powerlevel * rand(6,10)) - - var/damage = rand(1, 3) - + . = ..() + if(!.) //unsuccessful slime shock + return + var/stunprob = M.powerlevel * 7 + 10 + var/damage = M.powerlevel * rand(6,10) + if(prob(stunprob) && M.powerlevel >= 8) + flash_act(affect_silicon = TRUE) //my borg eyes! if(M.is_adult) - damage = rand(20, 40) + damage += rand(10, 20) else - damage = rand(5, 35) - damage = round(damage / 2) // borgs receive half damage + damage += rand(2, 17) adjustBruteLoss(damage) updatehealth() diff --git a/code/modules/mob/living/silicon/silicon_defense.dm b/code/modules/mob/living/silicon/silicon_defense.dm index 80a5058ed4..ca8ad25713 100644 --- a/code/modules/mob/living/silicon/silicon_defense.dm +++ b/code/modules/mob/living/silicon/silicon_defense.dm @@ -52,10 +52,6 @@ /mob/living/silicon/attack_paw(mob/living/user) return attack_hand(user) -/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_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) if(user.a_intent == INTENT_HARM) . = ..(user, TRUE) @@ -65,8 +61,8 @@ playsound(loc, "punch", 25, 1, -1) visible_message("[user] has punched [src]!", \ "[user] has punched [src]!") - return 1 - return 0 + return TRUE + return FALSE /mob/living/silicon/attack_hand(mob/living/carbon/human/M) . = ..() @@ -115,9 +111,12 @@ flash_act(affect_silicon = 1) /mob/living/silicon/bullet_act(obj/item/projectile/P, def_zone) - if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) - P.on_hit(src, 100, def_zone) - return 2 + if(P.original != src || P.firer != src) //try to block or reflect the bullet, can't do so when shooting oneself + if(reflect_bullet_check(P, def_zone)) + return -1 // complete projectile permutation + if(check_shields(P, P.damage, "the [P.name]", PROJECTILE_ATTACK, P.armour_penetration)) + P.on_hit(src, 100, def_zone) + return 2 if((P.damage_type == BRUTE || P.damage_type == BURN)) adjustBruteLoss(P.damage) if(prob(P.damage*1.5)) diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index 4542f140d4..0dfa126e79 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -41,7 +41,8 @@ return TRUE /mob/living/simple_animal/attack_paw(mob/living/carbon/monkey/M) - if(..()) //successful monkey bite. + . = ..() + if(.) //successful larva bite var/damage = rand(1, 3) attack_threshold_check(damage) return 1 @@ -50,7 +51,6 @@ visible_message("[M.name] [response_help] [src].") playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1) - /mob/living/simple_animal/attack_alien(mob/living/carbon/alien/humanoid/M) . = ..() if(!.) // the attack was blocked or was help/grab intent @@ -83,7 +83,8 @@ return attack_threshold_check(damage, M.melee_damage_type) /mob/living/simple_animal/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack + . = ..() + if(.) //successful slime shock var/damage = rand(15, 25) if(M.is_adult) damage = rand(20, 35) diff --git a/code/modules/mob/living/simple_animal/guardian/types/charger.dm b/code/modules/mob/living/simple_animal/guardian/types/charger.dm index 3ece5d4e27..3719861d63 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/charger.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/charger.dm @@ -54,10 +54,8 @@ var/blocked = FALSE if(hasmatchingsummoner(A)) //if the summoner matches don't hurt them blocked = TRUE - if(ishuman(A)) - var/mob/living/carbon/human/H = A - if(H.check_shields(src, 90, "[name]", attack_type = THROWN_PROJECTILE_ATTACK)) - blocked = TRUE + if(L.check_shields(src, 90, "[name]", attack_type = THROWN_PROJECTILE_ATTACK)) + blocked = TRUE if(!blocked) L.drop_all_held_items() L.visible_message("[src] slams into [L]!", "[src] slams into you!") diff --git a/code/modules/mob/living/simple_animal/slime/slime.dm b/code/modules/mob/living/simple_animal/slime/slime.dm index 4deb62aac2..affb476534 100644 --- a/code/modules/mob/living/simple_animal/slime/slime.dm +++ b/code/modules/mob/living/simple_animal/slime/slime.dm @@ -252,33 +252,34 @@ return /mob/living/simple_animal/slime/attack_slime(mob/living/simple_animal/slime/M) - if(..()) //successful slime attack - if(M == src) - return - if(buckled) - Feedstop(silent = TRUE) - visible_message("[M] pulls [src] off!") - return - attacked += 5 - if(nutrition >= 100) //steal some nutrition. negval handled in life() - nutrition -= (50 + (40 * M.is_adult)) - M.add_nutrition(50 + (40 * M.is_adult)) - if(health > 0) - M.adjustBruteLoss(-10 + (-10 * M.is_adult)) - M.updatehealth() + . = ..() + if(!. || M == src) //unsuccessful slime shock + return + if(buckled) + Feedstop(silent = TRUE) + visible_message("[M] pulls [src] off!") + return + attacked += 5 + if(nutrition >= 100) //steal some nutrition. negval handled in life() + nutrition -= (50 + (40 * M.is_adult)) + M.add_nutrition(50 + (40 * M.is_adult)) + if(health > 0) + M.adjustBruteLoss(-10 + (-10 * M.is_adult)) + M.updatehealth() /mob/living/simple_animal/slime/attack_animal(mob/living/simple_animal/M) . = ..() if(.) attacked += 10 - /mob/living/simple_animal/slime/attack_paw(mob/living/carbon/monkey/M) - if(..()) //successful monkey bite. + . = ..() + if(.)//successful monkey bite. attacked += 10 /mob/living/simple_animal/slime/attack_larva(mob/living/carbon/alien/larva/L) - if(..()) //successful larva bite. + . = ..() + if(.) //successful larva bite. attacked += 10 /mob/living/simple_animal/slime/attack_hulk(mob/living/carbon/human/user, does_attack_animation = 0) diff --git a/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm b/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm index 99ba9ad3e2..6f73d5ae84 100644 --- a/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm +++ b/modular_citadel/code/modules/mob/living/silicon/robot/dogborg_equipment.dm @@ -400,12 +400,7 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm ! if(A) if(isliving(A)) var/mob/living/L = A - var/blocked = 0 - if(ishuman(A)) - var/mob/living/carbon/human/H = A - if(H.check_shields(0, "the [name]", src, attack_type = LEAP_ATTACK)) - blocked = 1 - if(!blocked) + if(!L.check_shields(0, "the [name]", src, attack_type = LEAP_ATTACK)) L.visible_message("[src] pounces on [L]!", "[src] pounces on you!") L.Knockdown(iscarbon(L) ? 60 : 45, override_stamdmg = CLAMP(pounce_stamloss, 0, pounce_stamloss_cap-L.getStaminaLoss())) // Temporary. If someone could rework how dogborg pounces work to accomodate for combat changes, that'd be nice. playsound(src, 'sound/weapons/Egloves.ogg', 50, 1) From d5e7f77c13ca0f86828783ccbbc68de06c7f9758 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Mon, 18 Nov 2019 18:47:34 +0100 Subject: [PATCH 005/192] A --- code/modules/mob/living/carbon/monkey/combat.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/monkey/combat.dm b/code/modules/mob/living/carbon/monkey/combat.dm index 30afa491c5..0a21994145 100644 --- a/code/modules/mob/living/carbon/monkey/combat.dm +++ b/code/modules/mob/living/carbon/monkey/combat.dm @@ -374,7 +374,7 @@ /mob/living/carbon/monkey/attack_larva(mob/living/carbon/alien/larva/L) if(L.a_intent == INTENT_HARM && prob(MONKEY_RETALIATE_HARM_PROB)) - retaliate(user) + retaliate(L) return ..() /mob/living/carbon/monkey/attack_hulk(mob/living/carbon/human/user, does_attack_animation = FALSE) From ccd966ed28ccf7bcfaa6994aa34cde005e6afdb3 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Wed, 4 Dec 2019 20:32:25 +0100 Subject: [PATCH 006/192] Update, fix. --- code/modules/mob/living/living_defense.dm | 2 +- code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 82ebb6e763..39c8435076 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -282,7 +282,7 @@ /mob/living/attack_hand(mob/user) ..() //Ignoring parent return value here. - SEND_SIGNAL(user, COMSIG_MOB_ATTACK_HAND, user, src) + SEND_SIGNAL(src, COMSIG_MOB_ATTACK_HAND, user) if((user != src) && user.a_intent != INTENT_HELP && check_shields(user, 0, user.name, attack_type = UNARMED_ATTACK)) log_combat(user, src, "attempted to touch") visible_message("[user] attempted to touch [src]!") diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm index 8c304d8a2b..56c50078c1 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm @@ -26,10 +26,9 @@ Contents: /obj/item/clothing/suit/space/space_ninja/proc/enable_signals() if(!affecting) return - RegisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_TELEPORTED, COMSIG_LIVING_GUN_PROCESS_FIRE), .proc/reduce_stealth) + RegisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_HUMAN_MELEE_UNARMED_ATTACK, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_TELEPORTED, COMSIG_LIVING_GUN_PROCESS_FIRE), .proc/reduce_stealth) RegisterSignal(affecting, COMSIG_MOVABLE_BUMP, .proc/bumping_stealth) - /obj/item/clothing/suit/space/space_ninja/proc/reduce_stealth(datum/source) affecting.alpha = min(affecting.alpha + 40, 100) @@ -42,7 +41,7 @@ Contents: return FALSE stealth = !stealth stealth_cooldown = world.time + 5 SECONDS - UnregisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_TELEPORTED, COMSIG_LIVING_GUN_PROCESS_FIRE)) + UnregisterSignal(affecting, list(COMSIG_MOB_ITEM_ATTACK, COMSIG_MOB_ATTACK_RANGED, COMSIG_HUMAN_MELEE_UNARMED_ATTACK, COMSIG_MOB_ATTACK_HAND, COMSIG_MOB_THROW, COMSIG_PARENT_ATTACKBY, COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_TELEPORTED, COMSIG_LIVING_GUN_PROCESS_FIRE)) animate(affecting, alpha = 255, time = 3 SECONDS) affecting.visible_message("[affecting.name] appears from thin air!", \ "You are now visible.") From cd1cf1e1e32c95c7154241a432c08af799e44757 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 8 Dec 2019 22:01:50 -0700 Subject: [PATCH 007/192] Update carbon.dm --- code/modules/mob/living/carbon/carbon.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 3a9495a5cb..568edaa8d5 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -157,6 +157,7 @@ if(getStaminaLoss() >= STAMINA_SOFTCRIT) to_chat(src, "You're too exhausted.") return + var/random_turn = a_itnent == INTENT_DISARM //END OF CIT CHANGES var/atom/movable/thrown_thing @@ -960,4 +961,4 @@ /mob/living/carbon/transfer_ckey(mob/new_mob, send_signal = TRUE) if(combatmode) toggle_combat_mode(TRUE, TRUE) - return ..() \ No newline at end of file + return ..() From f8c6f0eb8a92e0025e9921df3cfbb92dfb407e92 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 8 Dec 2019 22:03:35 -0700 Subject: [PATCH 008/192] Update items.dm --- code/game/objects/items.dm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index c5d198c05f..b7f6ef550f 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -578,21 +578,22 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) itempush = 0 //too light to push anything return A.hitby(src, 0, itempush) -/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback) +/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, messy_throw = TRUE) thrownby = thrower - callback = CALLBACK(src, .proc/after_throw, callback) //replace their callback with our own + callback = CALLBACK(src, .proc/after_throw, callback, messy_throw) //replace their callback with our own . = ..(target, range, speed, thrower, spin, diagonals_first, callback) -/obj/item/proc/after_throw(datum/callback/callback) +/obj/item/proc/after_throw(datum/callback/callback, messy_throw) if (callback) //call the original callback . = callback.Invoke() throw_speed = initial(throw_speed) //explosions change this. item_flags &= ~IN_INVENTORY - var/matrix/M = matrix(transform) - M.Turn(rand(-170, 170)) - transform = M - pixel_x = rand(-8, 8) - pixel_y = rand(-8, 8) + if(messy_throw) + var/matrix/M = matrix(transform) + M.Turn(rand(-170, 170)) + transform = M + pixel_x = rand(-8, 8) + pixel_y = rand(-8, 8) /obj/item/proc/remove_item_from_storage(atom/newLoc) //please use this if you're going to snowflake an item out of a obj/item/storage if(!newLoc) From 5cbcc064976ce515786218a5ead8e68e7252e165 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 8 Dec 2019 22:04:32 -0700 Subject: [PATCH 009/192] Update objs.dm --- code/game/objects/objs.dm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index e6c7f987d5..da9cd6ba82 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -80,13 +80,12 @@ SEND_SIGNAL(src, COMSIG_OBJ_SETANCHORED, anchorvalue) anchored = anchorvalue -/obj/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback) - ..() +/obj/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, messy_throw) + . = ..() if(obj_flags & FROZEN) visible_message("[src] shatters into a million pieces!") qdel(src) - /obj/assume_air(datum/gas_mixture/giver) if(loc) return loc.assume_air(giver) From 4ba64f5fa767f62a065dfd01a7755cce954f2fea Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 8 Dec 2019 22:05:13 -0700 Subject: [PATCH 010/192] Update atoms_movable.dm --- code/game/atoms_movable.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index ef20b6e35e..6bc960332d 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -515,10 +515,10 @@ step(src, AM.dir) ..() -/atom/movable/proc/safe_throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback) - return throw_at(target, range, speed, thrower, spin, diagonals_first, callback) +/atom/movable/proc/safe_throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback, messy_throw = TRUE) + return throw_at(target, range, speed, thrower, spin, diagonals_first, callback, messy_throw) -/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback) //If this returns FALSE then callback will not be called. +/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback, messy_throw = TURE) //If this returns FALSE then callback will not be called. . = FALSE if (!target || speed <= 0) return From 0dc69942a9411dee111c95f5778b7a10e7b2223b Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 8 Dec 2019 22:08:29 -0700 Subject: [PATCH 011/192] Update carbon.dm --- code/modules/mob/living/carbon/carbon.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 568edaa8d5..413bfb0f14 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -194,7 +194,7 @@ do_attack_animation(target, no_effect = 1) playsound(loc, 'sound/weapons/punchmiss.ogg', 50, 1, -1) newtonian_move(get_dir(target, src)) - thrown_thing.throw_at(target, thrown_thing.throw_range, thrown_thing.throw_speed, src) + thrown_thing.throw_at(target, thrown_thing.throw_range, thrown_thing.throw_speed, src, null, null, null, random_turn) /mob/living/carbon/restrained(ignore_grab) . = (handcuffed || (!ignore_grab && pulledby && pulledby.grab_state >= GRAB_AGGRESSIVE)) From 1866276d38d577601625d7d5cd221a46be6e05b7 Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Sun, 8 Dec 2019 22:13:15 -0700 Subject: [PATCH 012/192] wrong intent --- code/modules/mob/living/carbon/carbon.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 413bfb0f14..e3ee7db90e 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -157,7 +157,7 @@ if(getStaminaLoss() >= STAMINA_SOFTCRIT) to_chat(src, "You're too exhausted.") return - var/random_turn = a_itnent == INTENT_DISARM + var/random_turn = a_intent == INTENT_HARM //END OF CIT CHANGES var/atom/movable/thrown_thing From d8dd0a4db599beecd064c010ee74d2403b18064a Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Mon, 9 Dec 2019 12:45:27 -0700 Subject: [PATCH 013/192] bet Co-Authored-By: Ghom <42542238+Ghommie@users.noreply.github.com> --- code/game/objects/items.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index b7f6ef550f..a410827347 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -580,7 +580,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) /obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, messy_throw = TRUE) thrownby = thrower - callback = CALLBACK(src, .proc/after_throw, callback, messy_throw) //replace their callback with our own + callback = CALLBACK(src, .proc/after_throw, callback, (spin && messy_throw)) //replace their callback with our own . = ..(target, range, speed, thrower, spin, diagonals_first, callback) /obj/item/proc/after_throw(datum/callback/callback, messy_throw) From f42164964752c99470b200cb2186c5fb86834f4d Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Mon, 9 Dec 2019 23:00:59 -0700 Subject: [PATCH 014/192] Update atoms_movable.dm --- code/game/atoms_movable.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 6bc960332d..7c57de74a4 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -518,7 +518,7 @@ /atom/movable/proc/safe_throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback, messy_throw = TRUE) return throw_at(target, range, speed, thrower, spin, diagonals_first, callback, messy_throw) -/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback, messy_throw = TURE) //If this returns FALSE then callback will not be called. +/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower, spin=TRUE, diagonals_first = FALSE, var/datum/callback/callback, messy_throw = TRUE) //If this returns FALSE then callback will not be called. . = FALSE if (!target || speed <= 0) return From c098d497ad1b2e4c1cdf9b32067626357c8bf134 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Fri, 13 Dec 2019 06:50:14 +0100 Subject: [PATCH 015/192] Minor underwear fixes and tweaks. --- code/__HELPERS/mobs.dm | 2 - code/game/objects/structures/dresser.dm | 6 +-- code/modules/client/preferences.dm | 6 +-- .../sprite_accessories/_sprite_accessories.dm | 3 +- .../new_player/sprite_accessories/socks.dm | 3 ++ .../sprite_accessories/underwear.dm | 9 ++++ .../mob/living/carbon/human/species.dm | 39 ++++++++++-------- icons/mob/underwear.dmi | Bin 59789 -> 60553 bytes icons/mob/underwear_old.dmi | Bin 52536 -> 0 bytes 9 files changed, 41 insertions(+), 27 deletions(-) delete mode 100644 icons/mob/underwear_old.dmi diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index 0d6345dae2..f9b3d0bb2b 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -20,8 +20,6 @@ else return "000" -#define UNDIE_COLORABLE(U) (U?.has_color) - /proc/random_underwear(gender) if(!GLOB.underwear_list.len) init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear/bottom, GLOB.underwear_list, GLOB.underwear_m, GLOB.underwear_f) diff --git a/code/game/objects/structures/dresser.dm b/code/game/objects/structures/dresser.dm index 05e62c196f..7f0c3c6eb8 100644 --- a/code/game/objects/structures/dresser.dm +++ b/code/game/objects/structures/dresser.dm @@ -30,11 +30,11 @@ return var/list/undergarment_choices = list("Underwear", "Underwear Color", "Undershirt", "Undershirt Color", "Socks", "Socks Color") - if(!UNDIE_COLORABLE(GLOB.underwear_list[H.underwear])) + if(!(GLOB.underwear_list[H.underwear]?.has_color)) undergarment_choices -= "Underwear Color" - if(!UNDIE_COLORABLE(GLOB.undershirt_list[H.undershirt])) + if(!(GLOB.undershirt_list[H.undershirt]?.has_color)) undergarment_choices -= "Undershirt Color" - if(!UNDIE_COLORABLE(GLOB.socks_list[H.socks])) + if(!(GLOB.socks_list[H.socks]?.has_color)) undergarment_choices -= "Socks Color" var/choice = input(H, "Underwear, Undershirt, or Socks?", "Changing") as null|anything in undergarment_choices diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index e91d379ddd..322f79b8c3 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -712,13 +712,13 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += "