diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 9e05a1e39a..365865543f 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -23,14 +23,8 @@ /obj/item/proc/attack(mob/living/M as mob, mob/living/user as mob, def_zone) - if (!istype(M)) // not sure if this is the right thing... - return 0 - var/messagesource = M - if (can_operate(M)) //Checks if mob is lying down on table for surgery - if (do_surgery(M,user,src)) - return 0 - if (istype(M,/mob/living/carbon/brain)) - messagesource = M:container + if(!istype(M) || (can_operate(M) && do_surgery(M,user,src))) return 0 + ///////////////////////// user.lastattacked = M M.lastattacker = user @@ -38,125 +32,29 @@ user.attack_log += "\[[time_stamp()]\] Attacked [M.name] ([M.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" M.attack_log += "\[[time_stamp()]\] Attacked by [user.name] ([user.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" msg_admin_attack("[key_name(user)] attacked [key_name(M)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damtype)])" ) - - //spawn(1800) // this wont work right - // M.lastattacker = null ///////////////////////// var/power = force if(HULK in user.mutations) power *= 2 - if(!istype(M, /mob/living/carbon/human)) - if(istype(M, /mob/living/carbon/slime)) - var/mob/living/carbon/slime/slime = M - if(prob(25)) - user << "\red [src] passes right through [M]!" - return - - if(power > 0) - slime.attacked += 10 - - if(slime.Discipline && prob(50)) // wow, buddy, why am I getting attacked?? - slime.Discipline = 0 - - if(power >= 3) - if(slime.is_adult) - if(prob(5 + round(power/2))) - - if(slime.Victim) - if(prob(80) && !slime.client) - slime.Discipline++ - slime.Victim = null - slime.anchored = 0 - - spawn() - if(slime) - slime.SStun = 1 - sleep(rand(5,20)) - if(slime) - slime.SStun = 0 - - spawn(0) - if(slime) - slime.canmove = 0 - step_away(slime, user) - if(prob(25 + power)) - sleep(2) - if(slime && user) - step_away(slime, user) - slime.canmove = 1 - - else - if(prob(10 + power*2)) - if(slime) - if(slime.Victim) - if(prob(80) && !slime.client) - slime.Discipline++ - - if(slime.Discipline == 1) - slime.attacked = 0 - - spawn() - if(slime) - slime.SStun = 1 - sleep(rand(5,20)) - if(slime) - slime.SStun = 0 - - slime.Victim = null - slime.anchored = 0 - - - spawn(0) - if(slime && user) - step_away(slime, user) - slime.canmove = 0 - if(prob(25 + power*4)) - sleep(2) - if(slime && user) - step_away(slime, user) - slime.canmove = 1 - - - var/showname = "." - if(user) - showname = " by [user]." - if(!(user in viewers(M, null))) - showname = "." - - for(var/mob/O in viewers(messagesource, null)) - if(attack_verb.len) - O.show_message("\red [M] has been [pick(attack_verb)] with [src][showname] ", 1) - else - O.show_message("\red [M] has been attacked with [src][showname] ", 1) - - if(!showname && user) - if(user.client) - user << "\red You attack [M] with [src]. " - - - + // TODO: needs to be refactored into a mob/living level attacked_by() proc. ~Z if(istype(M, /mob/living/carbon/human)) - var/hit = M:attacked_by(src, user, def_zone) - if (hit && hitsound) + var/mob/living/carbon/human/H = M + var/hit = H.attacked_by(src, user, def_zone) + if(hit && hitsound) playsound(loc, hitsound, 50, 1, -1) return hit else + user.visible_message("[M] has been [pick(attack_verb)] with [src] by [user]!") if (hitsound) playsound(loc, hitsound, 50, 1, -1) switch(damtype) if("brute") - if(istype(src, /mob/living/carbon/slime)) - M.adjustBrainLoss(power) - - else - - M.take_organ_damage(power) - if (prob(33)) // Added blood for whacking non-humans too - var/turf/location = M.loc - if (istype(location, /turf/simulated)) - location:add_blood_floor(M) + M.take_organ_damage(power) + if(prob(33)) // Added blood for whacking non-humans too + var/turf/simulated/location = get_turf(M) + if(istype(location)) location.add_blood_floor(M) if("fire") if (!(COLD_RESISTANCE in M.mutations)) M.take_organ_damage(0, power)