diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 7a876ea9f4f1..4328525f5f70 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -108,70 +108,8 @@ if(prob(25)) to_chat(user, "[I] passes right through [M]!") return 0 - - 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.slime_lifestage == SLIME_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 + //Handles pushing slimes off of targets, making them hostile from being attacked etc. + slime.slime_item_attacked(src, user, power) //The code has been moved to code/modules/mob/living/carbon/slime/slime.dm var/showname = "" if(user) diff --git a/code/modules/mob/living/carbon/slime/slime.dm b/code/modules/mob/living/carbon/slime/slime.dm index 426625a77a86..64a5934269e8 100644 --- a/code/modules/mob/living/carbon/slime/slime.dm +++ b/code/modules/mob/living/carbon/slime/slime.dm @@ -1029,6 +1029,40 @@ /mob/living/carbon/slime/ApplySlip(var/obj/effect/overlay/puddle/P) return FALSE +//This was previously added directly in item_attack.dm in handle_attack() +//Now it's its own proc that gets called there, freeing up roughly 61 lines of code +/mob/living/carbon/slime/proc/slime_item_attacked(var/obj/item/I, var/mob/living/user, var/force) + if(force > 0) + attacked += 10 + + if(Discipline && prob(50)) // wow, buddy, why am I getting attacked?? + Discipline = 0 + + if(force >= 3) + var/probability = isslimeadult(src) ? (prob(5 + round(force/2))) : (prob(10 + force*2)) + if(probability) //We basically roll the check already in the above variable, to save up on copypaste by not having two separate rolls + if(Victim) //Can only be disciplined if they are currently attacking someone + if(prob(80) && !client) + Discipline++ + attacked = !isslimeadult(src) //Adult slimes will not stop attacking, since discipline doesn't affect them. + Victim = null + anchored = 0 + spawn() + if(src) + SStun = 1 + sleep(rand(5,20)) + if(src) + SStun = 0 + spawn(0) + if(src) + canmove = 0 + step_away(src, user) + if(prob(25 + force * (isslimeadult(src) ? 1 : 4))) + sleep(2) + if(src && user) + step_away(src, user) + canmove = 1 + //////////////////////////////Old shit from metroids/RoRos, and the old cores, would not take much work to re-add them//////////////////////// /*