diff --git a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm index 42bdc619170..c8c8be9e829 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/humanoid.dm @@ -15,31 +15,6 @@ real_name = name ..() -//This is fine, works the same as a human -/mob/living/carbon/alien/humanoid/Bump(atom/movable/AM as mob|obj, yes) - if ((!( yes ) || now_pushing)) - return - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - - if (ismob(AM)) - var/mob/tmob = AM - tmob.LAssailant = src - - if (!now_pushing) - now_pushing = 1 - if (!AM.anchored) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null - /mob/living/carbon/alien/humanoid/movement_delay() . = ..() . += move_delay_add + config.alien_delay //move_delay_add is used to slow aliens with stuns diff --git a/code/modules/mob/living/carbon/alien/larva/larva.dm b/code/modules/mob/living/carbon/alien/larva/larva.dm index 190efb392ed..ebb39cc84cf 100644 --- a/code/modules/mob/living/carbon/alien/larva/larva.dm +++ b/code/modules/mob/living/carbon/alien/larva/larva.dm @@ -23,27 +23,6 @@ regenerate_icons() ..() -//This is fine, works the same as a human -/mob/living/carbon/alien/larva/Bump(atom/movable/AM as mob|obj, yes) - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - tmob.LAssailant = src - - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - step(AM, t) - now_pushing = null - - //This needs to be fixed /mob/living/carbon/alien/larva/Stat() ..() diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index 2f0d259284c..00e67a07eb7 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -17,7 +17,7 @@ death(1) //Brains can die again. AND THEY SHOULD AHA HA HA HA HA HA ghostize() //Ghostize checks for key so nothing else is necessary. ..() - + /mob/living/carbon/brain/update_canmove() if(in_contents_of(/obj/mecha)) canmove = 1 else canmove = 0 diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index f71a38b1f1a..e291877b51c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -48,78 +48,6 @@ qdel(organelle) return ..() -/mob/living/carbon/human/Bump(atom/movable/AM as mob|obj, yes) - if ((!( yes ) || now_pushing || buckled)) - return - now_pushing = 1 - if (ismob(AM)) - var/mob/tmob = AM - -//BubbleWrap - Should stop you pushing a restrained person out of the way - - if(istype(tmob, /mob/living/carbon/human)) - - for(var/mob/M in range(tmob, 1)) - if( ((M.pulling == tmob && ( tmob.restrained() && !( M.restrained() ) && M.stat == 0)) || locate(/obj/item/weapon/grab, tmob.grabbed_by.len)) ) - if ( !(world.time % 5) ) - src << "[tmob] is restrained, you cannot push past." - now_pushing = 0 - return - if( tmob.pulling == M && ( M.restrained() && !( tmob.restrained() ) && tmob.stat == 0) ) - if ( !(world.time % 5) ) - src << "[tmob] is restraining [M], you cannot push past." - now_pushing = 0 - return - - //BubbleWrap: people in handcuffs are always switched around as if they were on 'help' intent to prevent a person being pulled from being seperated from their puller - if((tmob.a_intent == "help" || tmob.restrained()) && (a_intent == "help" || src.restrained()) && tmob.canmove && canmove) // mutual brohugs all around! - var/turf/oldloc = loc - var/turf/other_loc = tmob.loc - - loc = tmob.loc - tmob.loc = oldloc - now_pushing = 0 - - for(var/mob/living/carbon/slime/slime in view(1,tmob)) - if(slime.Victim == tmob) - slime.UpdateFeed() - - //cross any movable atoms on either turf - for(var/atom/movable/M in other_loc) - M.Crossed(src) - for(var/atom/movable/M in oldloc) - M.Crossed(tmob) - - return - - if(tmob.r_hand && istype(tmob.r_hand, /obj/item/weapon/shield/riot)) - if(prob(99)) - now_pushing = 0 - return - if(tmob.l_hand && istype(tmob.l_hand, /obj/item/weapon/shield/riot)) - if(prob(99)) - now_pushing = 0 - return - if(!(tmob.status_flags & CANPUSH)) - now_pushing = 0 - return - - tmob.LAssailant = src - - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - if (!now_pushing) - now_pushing = 1 - - if (!AM.anchored) - if(pulling == AM) - stop_pulling() - var/t = get_dir(src, AM) - AM.Move(get_step(AM, t), t) - now_pushing = 0 - /mob/living/carbon/human/Stat() ..() statpanel("Status") diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index 4b7dfc96796..efdb9d872a3 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -47,34 +47,6 @@ tally += (283.222 - bodytemperature) / 10 * 1.75 return tally+config.monkey_delay -/mob/living/carbon/monkey/Bump(atom/movable/AM as mob|obj, yes) - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - if(!(tmob.status_flags & CANPUSH)) - now_pushing = 0 - return - - tmob.LAssailant = src - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null - - /mob/living/carbon/monkey/attack_paw(mob/living/M as mob) if(..()) //successful monkey bite. var/damage = rand(1, 5) diff --git a/code/modules/mob/living/carbon/slime/slime.dm b/code/modules/mob/living/carbon/slime/slime.dm index 0103ea58388..86cc557e814 100644 --- a/code/modules/mob/living/carbon/slime/slime.dm +++ b/code/modules/mob/living/carbon/slime/slime.dm @@ -97,59 +97,31 @@ return tally + config.slime_delay -/mob/living/carbon/slime/Bump(atom/movable/AM as mob|obj, yes) - if ((!(yes) || now_pushing)) - return - now_pushing = 1 +/mob/living/carbon/slime/ObjBump(obj/O) + if(!client && powerlevel > 0) + var/probab = 10 + switch(powerlevel) + if(1 to 2) probab = 20 + if(3 to 4) probab = 30 + if(5 to 6) probab = 40 + if(7 to 8) probab = 60 + if(9) probab = 70 + if(10) probab = 95 + if(prob(probab)) + if(istype(O, /obj/structure/window) || istype(O, /obj/structure/grille)) + if(nutrition <= get_hunger_nutrition() && !Atkcool) + if (is_adult || prob(5)) + O.attack_slime(src) + Atkcool = 1 + spawn(45) + Atkcool = 0 - if(isobj(AM)) - if(!client && powerlevel > 0) - var/probab = 10 - switch(powerlevel) - if(1 to 2) probab = 20 - if(3 to 4) probab = 30 - if(5 to 6) probab = 40 - if(7 to 8) probab = 60 - if(9) probab = 70 - if(10) probab = 95 - if(prob(probab)) - if(istype(AM, /obj/structure/window) || istype(AM, /obj/structure/grille)) - if(nutrition <= get_hunger_nutrition() && !Atkcool) - if (is_adult || prob(5)) - AM.attack_slime(src) - spawn() - Atkcool = 1 - sleep(45) - Atkcool = 0 - - if(ismob(AM)) - var/mob/tmob = AM - - if(is_adult) - if(istype(tmob, /mob/living/carbon/human)) - if(prob(90)) - now_pushing = 0 - return +/mob/living/carbon/slime/MobBump(mob/M) + if(istype(M, /mob/living/carbon/human)) //pushing humans + if(is_adult && prob(10)) //only if we're adult, and 10% of the time + return 0 else - if(istype(tmob, /mob/living/carbon/human)) - now_pushing = 0 - return - - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null + return 1 /mob/living/carbon/slime/Process_Spacemove(var/movement_dir = 0) return 2 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 83c4e95bbb9..7d9357582f6 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -10,6 +10,96 @@ ..() del(src) +//Generic Bump(). Override MobBump() and ObjBump() instead of this. +/mob/living/Bump(atom/A, yes) + if (buckled || !yes || now_pushing) + return + if(ismob(A)) + var/mob/M = A + if(MobBump(M)) + return + ..() + if(isobj(A)) + var/obj/O = A + if(ObjBump(O)) + return + if(istype(A, /atom/movable)) + var/atom/movable/AM = A + if(PushAM(AM)) + return + +//Called when we bump onto a mob +/mob/living/proc/MobBump(mob/M) + if(now_pushing) + return 1 + + //BubbleWrap: Should stop you pushing a restrained person out of the way + if(istype(M, /mob/living/carbon/human)) + for(var/mob/MM in range(M, 1)) + if( ((MM.pulling == M && ( M.restrained() && !( MM.restrained() ) && MM.stat == CONSCIOUS)) || locate(/obj/item/weapon/grab, M.grabbed_by.len)) ) + if ( !(world.time % 5) ) + src << "[M] is restrained, you cannot push past." + return 1 + if( M.pulling == MM && ( MM.restrained() && !( M.restrained() ) && M.stat == CONSCIOUS) ) + if ( !(world.time % 5) ) + src << "[M] is restraining [MM], you cannot push past." + return 1 + + //switch our position with M + //BubbleWrap: people in handcuffs are always switched around as if they were on 'help' intent to prevent a person being pulled from being seperated from their puller + if((M.a_intent == "help" || M.restrained()) && (a_intent == "help" || restrained()) && M.canmove && canmove) // mutual brohugs all around! + now_pushing = 1 + //TODO: Make this use Move(). we're pretty much recreating it here. + //it could be done by setting one of the locs to null to make Move() work, then setting it back and Move() the other mob + var/oldloc = loc + loc = M.loc + M.loc = oldloc + M.LAssailant = src + + for(var/mob/living/carbon/slime/slime in view(1,M)) + if(slime.Victim == M) + slime.UpdateFeed() + + //cross any movable atoms on either turf + for(var/atom/movable/AM in loc) + AM.Crossed(src) + for(var/atom/movable/AM in oldloc) + AM.Crossed(M) + now_pushing = 0 + return 1 + + //okay, so we didn't switch. but should we push? + //not if he's not CANPUSH of course + if(!(M.status_flags & CANPUSH) ) + return 1 + //anti-riot equipment is also anti-push + if(M.r_hand && istype(M.r_hand, /obj/item/weapon/shield/riot)) + return 1 + if(M.l_hand && istype(M.l_hand, /obj/item/weapon/shield/riot)) + return 1 + +//Called when we bump onto an obj +/mob/living/proc/ObjBump(obj/O) + return + +//Called when we want to push an atom/movable +/mob/living/proc/PushAM(atom/movable/AM) + if(now_pushing) + return 1 + if(!AM.anchored) + now_pushing = 1 + var/t = get_dir(src, AM) + if (istype(AM, /obj/structure/window)) + var/obj/structure/window/W = AM + if(W.fulltile) + for(var/obj/structure/window/win in get_step(W,t)) + now_pushing = 0 + return + if(pulling == AM) + stop_pulling() + step(AM, t) + now_pushing = 0 + //mob verbs are a lot faster than object verbs //for more info on why this is not atom/pull, see examinate() in mob.dm /mob/living/verb/pulled(atom/movable/AM as mob|obj in oview(1)) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index a1d4cc93437..597eda3fc5a 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -281,31 +281,6 @@ usr << browse(list, "window=laws") -/mob/living/silicon/Bump(atom/movable/AM as mob|obj, yes) //Allows the AI to bump into mobs if it's itself pushed - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - if(!(tmob.status_flags & CANPUSH)) - now_pushing = 0 - return - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - if (!now_pushing) - now_pushing = 1 - if (!AM.anchored) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null - /mob/living/silicon/put_in_hand_check() // This check is for borgs being able to receive items, not put them in others' hands. return 0 diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm index 1a56a56386d..f52831f11af 100644 --- a/code/modules/mob/living/simple_animal/constructs.dm +++ b/code/modules/mob/living/simple_animal/constructs.dm @@ -1,4 +1,3 @@ - /mob/living/simple_animal/construct name = "Construct" real_name = "Construct" @@ -56,34 +55,6 @@ user << msg -/mob/living/simple_animal/construct/Bump(atom/movable/AM as mob|obj, yes) - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - if(!(tmob.status_flags & CANPUSH)) - now_pushing = 0 - return - - tmob.LAssailant = src - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null - - /mob/living/simple_animal/construct/attack_animal(mob/living/simple_animal/M as mob) if(istype(M, /mob/living/simple_animal/construct/builder)) health += 5 diff --git a/code/modules/mob/living/simple_animal/friendly/corgi.dm b/code/modules/mob/living/simple_animal/friendly/corgi.dm index 68f68f57d4b..47477095bac 100644 --- a/code/modules/mob/living/simple_animal/friendly/corgi.dm +++ b/code/modules/mob/living/simple_animal/friendly/corgi.dm @@ -400,34 +400,6 @@ dir = i sleep(1) -/mob/living/simple_animal/corgi/Ian/Bump(atom/movable/AM as mob|obj, yes) - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - if(!(tmob.status_flags & CANPUSH)) - now_pushing = 0 - return - - tmob.LAssailant = src - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null -//PC stuff-Sieve - /mob/living/simple_animal/corgi/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri if(istype(O, /obj/item/weapon/newspaper)) if(!stat) diff --git a/code/modules/mob/living/simple_animal/friendly/slime.dm b/code/modules/mob/living/simple_animal/friendly/slime.dm index ef0f511b1a6..13f6b7e40f2 100644 --- a/code/modules/mob/living/simple_animal/friendly/slime.dm +++ b/code/modules/mob/living/simple_animal/friendly/slime.dm @@ -15,33 +15,6 @@ ventcrawler = 2 var/colour = "grey" -/mob/living/simple_animal/slime/Bump(atom/movable/AM as mob|obj, yes) - if ((!( yes ) || now_pushing)) - return - now_pushing = 1 - if(ismob(AM)) - var/mob/tmob = AM - if(!(tmob.status_flags & CANPUSH)) - now_pushing = 0 - return - - tmob.LAssailant = src - now_pushing = 0 - ..() - if (!istype(AM, /atom/movable)) - return - if (!( now_pushing )) - now_pushing = 1 - if (!( AM.anchored )) - var/t = get_dir(src, AM) - if (istype(AM, /obj/structure/window)) - if(AM:ini_dir == NORTHWEST || AM:ini_dir == NORTHEAST || AM:ini_dir == SOUTHWEST || AM:ini_dir == SOUTHEAST) - for(var/obj/structure/window/win in get_step(AM,t)) - now_pushing = 0 - return - step(AM, t) - now_pushing = null - /mob/living/simple_animal/adultslime name = "pet slime" desc = "A lovable, domesticated slime." @@ -61,7 +34,6 @@ ..() overlays += "aslime-:33" - /mob/living/simple_animal/slime/adult/Die() var/mob/living/simple_animal/slime/S1 = new /mob/living/simple_animal/slime (src.loc) S1.icon_state = "[src.colour] baby slime" diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/bat.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/bat.dm index ea55fb94082..1173ef3418c 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/bat.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/bat.dm @@ -10,7 +10,6 @@ response_disarm = "flails at" response_harm = "hits" speak_chance = 0 - a_intent = "harm" stop_automated_movement_when_pulled = 0 maxHealth = 15 health = 15 diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index fc70dd153d6..b295ffa078e 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -211,20 +211,6 @@ adjustBruteLoss(unsuitable_atmos_damage) return 1 -/mob/living/simple_animal/Bumped(AM as mob|obj) - if(!AM) return - - if(resting || buckled) - return - - if(isturf(src.loc)) - if((status_flags & CANPUSH) && ismob(AM)) - var/newamloc = src.loc - src.loc = AM:loc - AM:loc = newamloc - else - ..() - /mob/living/simple_animal/gib(var/animation = 0) if(icon_gib) flick(icon_gib, src)