Code Cleanup: (Bump(), Bumped()) -> (Collide(), CollidedWith()) (#4349)

This PR rips out the old Bump() and Bumped() procs and replaces them with Collide() and CollidedWith() respectively. Behavior should be the same, but Bump() should no longer be double-called, and no longer relies on spawns.

Other changes:

LAssailant is now a weakref.
Some direct loc setting are now forceMove().
This commit is contained in:
Lohikar
2018-03-08 01:39:53 -06:00
committed by Erki
parent 057e787948
commit a86398d0d2
66 changed files with 231 additions and 216 deletions

View File

@@ -86,14 +86,6 @@ obj/item/check_airflow_movable(n)
*/
/atom/movable/Bump(atom/A)
if(airflow_speed > 0 && airflow_dest)
airflow_hit(A)
else
airflow_speed = 0
airflow_time = 0
. = ..()
atom/movable/proc/airflow_hit(atom/A)
airflow_speed = 0
airflow_dest = null

View File

@@ -54,7 +54,9 @@
/atom/proc/on_reagent_change()
return
/atom/proc/Bumped(AM as mob|obj)
// This is called when AM collides with us.
/atom/proc/CollidedWith(atom/movable/AM)
set waitfor = FALSE
return
// Convenience proc to see if a container is open for chemistry handling

View File

@@ -37,18 +37,23 @@
pulledby.pulling = null
pulledby = null
/atom/movable/Bump(var/atom/A, yes)
if(src.throwing)
src.throw_impact(A)
src.throwing = 0
// This is called when this atom is prevented from moving by atom/A.
/atom/movable/proc/Collide(atom/A)
if(airflow_speed > 0 && airflow_dest)
airflow_hit(A)
else
airflow_speed = 0
airflow_time = 0
spawn(0)
if ((A && yes))
A.last_bumped = world.time
A.Bumped(src)
return
..()
return
if (throwing)
throwing = FALSE
. = TRUE
if (!QDELETED(A))
throw_impact(A)
A.CollidedWith(src)
else if (!QDELETED(A))
A.CollidedWith(src)
//called when src is thrown into hit_atom
/atom/movable/proc/throw_impact(atom/hit_atom, var/speed)

View File

@@ -600,14 +600,10 @@
anchored = 1.0
var/spawnable = null
/obj/effect/gateway/Bumped(mob/M as mob|obj)
spawn(0)
return
/obj/effect/gateway/CollidedWith(mob/M)
return
/obj/effect/gateway/Crossed(AM as mob|obj)
spawn(0)
return
return
/obj/effect/gateway/active

View File

@@ -84,14 +84,15 @@ var/global/list/narsie_list = list()
M.apply_effect(3, STUN)
/obj/singularity/narsie/large/Bump(atom/A)
/obj/singularity/narsie/large/Collide(atom/A)
. = ..()
if(!cause_hell) return
if(isturf(A))
narsiewall(A)
else if(istype(A, /obj/structure/cult))
qdel(A)
/obj/singularity/narsie/large/Bumped(atom/A)
/obj/singularity/narsie/large/CollidedWith(atom/A)
if(!cause_hell) return
if(isturf(A))
narsiewall(A)

View File

@@ -102,7 +102,7 @@
Consume(W)
/turf/unsimulated/wall/supermatter/Bumped(atom/AM as mob|obj)
/turf/unsimulated/wall/supermatter/CollidedWith(atom/AM)
if (!AM.simulated)
return ..()

View File

@@ -16,7 +16,8 @@ In my current plan for it, 'solid' will be defined as anything with density == 1
density = 1
anchored = 1
Bump(atom/clong)
Collide(atom/clong)
. = ..()
if(istype(clong, /turf/simulated/shuttle)) //Skip shuttles without actually deleting the rod
return

View File

@@ -93,7 +93,8 @@ The "dust" will damage the hull of the station causin minor hull breaches.
touch_map_edge()
qdel(src)
Bump(atom/A)
Collide(atom/A)
. = ..()
spawn(0)
if(prob(50))
for(var/mob/M in range(10, src))
@@ -114,12 +115,6 @@ The "dust" will damage the hull of the station causin minor hull breaches.
return 0
return
Bumped(atom/A)
Bump(A)
return
ex_act(severity)
qdel(src)
return

View File

@@ -113,7 +113,7 @@
walk(src,0) //this cancels the walk_towards() proc
return ..()
/obj/effect/meteor/Bump(atom/A)
/obj/effect/meteor/Collide(atom/A)
if (!done)
spawn(0)
@@ -184,7 +184,7 @@
ex_act(severity)
return
Bump(atom/A)
Collide(atom/A)
if (!done)
spawn(0)
//Prevent meteors from blowing up the singularity's containment.

View File

@@ -694,7 +694,7 @@
return
// called when bot bumps into anything
/obj/machinery/bot/mulebot/Bump(var/atom/obs)
/obj/machinery/bot/mulebot/Collide(var/atom/obs)
if(!wires.MobAvoid()) //usually just bumps, but if avoidance disabled knock over mobs
var/mob/M = obs
if(ismob(M))
@@ -706,7 +706,7 @@
M.Stun(8)
M.Weaken(5)
M.lying = 1
..()
. = ..()
// called from mob/living/carbon/human/Crossed()
// when mulebot is in the same loc

View File

@@ -129,13 +129,12 @@
if(!surpress_send) send_status()
/obj/machinery/door/airlock/Bumped(atom/AM)
..(AM)
/obj/machinery/door/airlock/CollidedWith(atom/AM)
. = ..()
if(istype(AM, /obj/mecha))
var/obj/mecha/mecha = AM
if(density && radio_connection && mecha.occupant && (src.allowed(mecha.occupant) || src.check_access_list(mecha.operation_req_access)))
send_status(1)
return
/obj/machinery/door/airlock/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)

View File

@@ -47,12 +47,11 @@
// Proc: Bumped()
// Parameters: 1 (AM - Atom that tried to walk through this object)
// Description: If we are open returns zero, otherwise returns result of parent function.
/obj/machinery/door/blast/Bumped(atom/AM)
/obj/machinery/door/blast/CollidedWith(atom/AM)
if(!density)
return ..()
else
return 0
// Proc: update_icon()
// Parameters: None
// Description: Updates icon of this object. Uses icon state variables.
@@ -203,4 +202,4 @@ obj/machinery/door/blast/regular/open
opacity = 0
#undef BLAST_DOOR_CRUSH_DAMAGE
#undef SHUTTER_CRUSH_DAMAGE
#undef SHUTTER_CRUSH_DAMAGE

View File

@@ -136,7 +136,8 @@
return 0
return 1
/obj/machinery/door/Bumped(atom/AM)
/obj/machinery/door/CollidedWith(atom/AM)
. = ..()
if(p_open || operating) return
if (!AM.simulated) return
if(ismob(AM))

View File

@@ -132,7 +132,7 @@
users_to_open_string += ", [users_to_open[i]]"
user << "These people have opened \the [src] during an alert: [users_to_open_string]."
/obj/machinery/door/firedoor/Bumped(atom/AM)
/obj/machinery/door/firedoor/CollidedWith(atom/AM)
if(p_open || operating)
return
if(!density)

View File

@@ -2,7 +2,7 @@
autoclose = 0
var/locked = 0
/obj/machinery/door/unpowered/Bumped(atom/AM)
/obj/machinery/door/unpowered/CollidedWith(atom/AM)
if(src.locked)
return
..()

View File

@@ -57,7 +57,7 @@
update_nearby_tiles()
return ..()
/obj/machinery/door/window/Bumped(atom/movable/AM as mob|obj)
/obj/machinery/door/window/CollidedWith(atom/movable/AM as mob|obj)
if (istype(AM, /obj))
var/mob/living/bot/bot = AM
if(istype(bot))

View File

@@ -37,7 +37,7 @@
log_misc("a [src] didn't find an input plate.")
return
/obj/machinery/gibber/autogibber/Bumped(var/atom/A)
/obj/machinery/gibber/autogibber/CollidedWith(var/atom/A)
if(!input_plate) return
if(ismob(A))

View File

@@ -200,7 +200,7 @@
if(icon_update_tick == 0)
build_overlays()
/obj/machinery/recharge_station/Bumped(var/mob/living/silicon/robot/R)
/obj/machinery/recharge_station/CollidedWith(var/mob/living/silicon/robot/R)
go_in(R)
/obj/machinery/recharge_station/proc/go_in(var/mob/M)

View File

@@ -68,11 +68,11 @@
startWatching(user)
// Let people bump up against it to watch
/obj/machinery/station_map/Bumped(var/atom/movable/AM)
/obj/machinery/station_map/CollidedWith(var/atom/movable/AM)
if(!watching_mob && isliving(AM) && AM.loc == loc)
startWatching(AM)
// In order to actually get Bumped() we need to block movement. We're (visually) on a wall, so people
// In order to actually get CollidedWith() we need to block movement. We're (visually) on a wall, so people
// couldn't really walk into us anyway. But in reality we are on the turf in front of the wall, so bumping
// against where we seem is actually trying to *exit* our real loc
/obj/machinery/station_map/CheckExit(atom/movable/mover as mob|obj, turf/target as turf)

View File

@@ -184,12 +184,10 @@
com = null
return ..()
/obj/machinery/teleport/hub/Bumped(M as mob|obj)
spawn()
if (src.icon_state == "tele1")
teleport(M)
use_power(5000)
return
/obj/machinery/teleport/hub/CollidedWith(M as mob|obj)
if (src.icon_state == "tele1")
teleport(M)
use_power(5000)
/obj/machinery/teleport/hub/proc/teleport(atom/movable/M as mob|obj)
if (!com)
@@ -394,9 +392,9 @@
icon_state = "controller"
/obj/effect/laser/Bump()
/obj/effect/laser/Collide()
. = ..()
src.range--
return
/obj/effect/laser/Move()
src.range--

View File

@@ -35,7 +35,7 @@
if(istype(west, /turf/simulated/floor))
new /obj/machinery/conveyor(west, WEST, 1)
/obj/machinery/transformer/Bumped(var/atom/movable/AM)
/obj/machinery/transformer/CollidedWith(var/atom/movable/AM)
// HasEntered didn't like people lying down.
if(ishuman(AM))
// Only humans can enter from the west side, while lying down.
@@ -67,4 +67,4 @@
else
playsound(src.loc, 'sound/machines/buzz-sigh.ogg', 50, 0)
visible_message("<span class='notice'>The machine displays an error message reading it is still making the required parts.</span>")
return
return

View File

@@ -29,7 +29,7 @@
ME.attach(src)
return
/obj/mecha/combat/phazon/Bump(var/atom/obstacle)
/obj/mecha/combat/phazon/Collide(var/atom/obstacle)
if(phasing && get_charge()>=phasing_energy_drain)
spawn()
if(can_move)
@@ -88,4 +88,4 @@
phasing = !phasing
send_byjax(src.occupant,"exosuit.browser","phasing_command","[phasing?"Dis":"En"]able phasing")
src.occupant_message("<font color=\"[phasing?"#00f\">En":"#f00\">Dis"]abled phasing.</font>")
return
return

View File

@@ -462,7 +462,8 @@
playsound(src,'sound/mecha/mechstep.ogg',40,1)
return result
/obj/mecha/Bump(var/atom/obstacle)
/obj/mecha/Collide(var/atom/obstacle)
. = ..()
// src.inertia_dir = null
if(istype(obstacle, /obj))
var/obj/O = obstacle
@@ -474,11 +475,11 @@
else if(!O.anchored)
step(obstacle,src.dir)
else //I have no idea why I disabled this
obstacle.Bumped(src)
obstacle.CollidedWith(src)
else if(istype(obstacle, /mob))
step(obstacle,src.dir)
else
obstacle.Bumped(src)
obstacle.CollidedWith(src)
return
///////////////////////////////////

View File

@@ -19,7 +19,7 @@ var/list/obj/effect/bump_teleporter/BUMP_TELEPORTERS = list()
BUMP_TELEPORTERS -= src
return ..()
/obj/effect/bump_teleporter/Bumped(atom/user)
/obj/effect/bump_teleporter/CollidedWith(atom/user)
if(!ismob(user))
//user.loc = src.loc //Stop at teleporter location
return
@@ -30,5 +30,5 @@ var/list/obj/effect/bump_teleporter/BUMP_TELEPORTERS = list()
for(var/obj/effect/bump_teleporter/BT in BUMP_TELEPORTERS)
if(BT.id == src.id_target)
usr.loc = BT.loc //Teleport to location with correct id.
usr.forceMove(BT.loc) //Teleport to location with correct id.
return

View File

@@ -65,7 +65,7 @@
return 0
. = ..()
/obj/effect/effect/water/Bump(atom/A)
/obj/effect/effect/water/Collide(atom/A)
var/turf/T = get_turf(A)
wet_things(T)
return ..()

View File

@@ -10,7 +10,7 @@
var/creator = null
anchored = 1.0
/obj/effect/portal/Bumped(mob/M as mob|obj)
/obj/effect/portal/CollidedWith(mob/M as mob|obj)
set waitfor = FALSE
src.teleport(M)

View File

@@ -148,9 +148,9 @@
STOP_PROCESSING(SSprocessing, src)
return ..()
/obj/effect/spider/spiderling/Bump(atom/user)
/obj/effect/spider/spiderling/Collide(atom/user)
if(istype(user, /obj/structure/table))
src.loc = user.loc
forceMove(user.loc)
else
..()

View File

@@ -20,8 +20,9 @@
else
icon_state = initial(icon_state)
/obj/structure/grille/Bumped(atom/user)
if(ismob(user)) shock(user, 70)
/obj/structure/grille/CollidedWith(atom/user)
if(ismob(user))
shock(user, 70)
/obj/structure/grille/attack_hand(mob/user as mob)

View File

@@ -47,7 +47,7 @@
/obj/structure/simple_door/get_material()
return material
/obj/structure/simple_door/Bumped(atom/user)
/obj/structure/simple_door/CollidedWith(atom/user)
..()
if(!state)
return TryToSwitchState(user)

View File

@@ -134,7 +134,7 @@
..()
/obj/structure/bed/chair/office/Move()
..()
. = ..()
if(buckled_mob)
var/mob/living/occupant = buckled_mob
occupant.buckled = null
@@ -144,13 +144,14 @@
if (propelled)
for (var/mob/O in src.loc)
if (O != occupant)
Bump(O)
Collide(O)
else
unbuckle_mob()
/obj/structure/bed/chair/office/Bump(atom/A)
..()
if(!buckled_mob) return
/obj/structure/bed/chair/office/Collide(atom/A)
. = ..()
if(!buckled_mob)
return
if(propelled)
var/mob/living/occupant = unbuckle_mob()

View File

@@ -85,7 +85,7 @@
driving = 0
/obj/structure/bed/chair/wheelchair/Move()
..()
. = ..()
if(buckled_mob)
var/mob/living/occupant = buckled_mob
if(!driving)
@@ -96,7 +96,7 @@
if (propelled)
for (var/mob/O in src.loc)
if (O != occupant)
Bump(O)
Collide(O)
else
unbuckle_mob()
if (pulling && (get_dist(src, pulling) > 1))
@@ -133,9 +133,10 @@
pulling = null
return
/obj/structure/bed/chair/wheelchair/Bump(atom/A)
..()
if(!buckled_mob) return
/obj/structure/bed/chair/wheelchair/Collide(atom/A)
. = ..()
if(!buckled_mob)
return
if(propelled || (pulling && (pulling.a_intent == I_HURT)))
var/mob/living/occupant = unbuckle_mob()

View File

@@ -98,7 +98,7 @@ obj/structure/ex_act(severity)
/obj/structure/transit_tube/Bumped(mob/AM as mob|obj)
/obj/structure/transit_tube/CollidedWith(mob/AM as mob|obj)
var/obj/structure/transit_tube/T = locate() in AM.loc
if(T)
AM << "<span class='warning'>The tube's support pylons block your way.</span>"
@@ -113,7 +113,7 @@ obj/structure/ex_act(severity)
/obj/structure/transit_tube/station/Bumped(mob/AM as mob|obj)
/obj/structure/transit_tube/station/CollidedWith(mob/AM as mob|obj)
if(!pod_moving && icon_state == "open" && istype(AM, /mob))
for(var/obj/structure/transit_tube_pod/pod in loc)
if(pod.contents.len)

View File

@@ -3,14 +3,9 @@
icon = 'icons/obj/weapons.dmi'
hitsound = "swing_hit"
/obj/item/weapon/Bump(mob/M as mob)
spawn(0)
..()
return
//Called when the user alt-clicks on something with this item in their active hand
//this function is designed to be overridden by individual weapons
/obj/item/weapon/proc/alt_attack(var/atom/target, var/mob/user)
return 1
//A return value of 1 continues on to do the normal alt-click action.
//A return value of 0 does not continue, and will not do the alt-click
//A return value of 0 does not continue, and will not do the alt-click

View File

@@ -145,33 +145,33 @@
for(var/obj/obstacle in mover.loc)
if(!(obstacle.flags & ON_BORDER) && (mover != obstacle) && (forget != obstacle))
if(!obstacle.CheckExit(mover, src))
mover.Bump(obstacle, 1)
mover.Collide(obstacle)
return 0
//Now, check objects to block exit that are on the border
for(var/obj/border_obstacle in mover.loc)
if((border_obstacle.flags & ON_BORDER) && (mover != border_obstacle) && (forget != border_obstacle))
if(!border_obstacle.CheckExit(mover, src))
mover.Bump(border_obstacle, 1)
mover.Collide(border_obstacle)
return 0
//Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in src)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != border_obstacle))
mover.Bump(border_obstacle, 1)
mover.Collide(border_obstacle)
return 0
//Then, check the turf itself
if (!src.CanPass(mover, src))
mover.Bump(src, 1)
mover.Collide(src)
return 0
//Finally, check objects/mobs to block entry that are not on the border
for(var/atom/movable/obstacle in src)
if(!(obstacle.flags & ON_BORDER))
if(!obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != obstacle))
mover.Bump(obstacle, 1)
mover.Collide(obstacle)
return 0
return 1 //Nothing found to block so return success!

View File

@@ -236,13 +236,13 @@
return
return
/obj/effect/beam/i_beam/Bump()
/obj/effect/beam/i_beam/Collide()
. = ..()
qdel(src)
return
/obj/effect/beam/i_beam/Bumped()
/obj/effect/beam/i_beam/CollidedWith()
..()
hit()
return
/obj/effect/beam/i_beam/Crossed(atom/movable/AM as mob|obj)
if(istype(AM, /obj/effect/beam))

View File

@@ -116,10 +116,10 @@ obj/machinery/gateway/centerstation/process()
//okay, here's the good teleporting stuff
/obj/machinery/gateway/centerstation/Bumped(atom/movable/M as mob|obj)
if(!ready) return
if(!active) return
if(!awaygate) return
/obj/machinery/gateway/centerstation/CollidedWith(atom/movable/M as mob|obj)
if(!ready || !active || !awaygate)
return
if(awaygate.calibrated)
M.loc = get_step(awaygate.loc, SOUTH)
M.set_dir(SOUTH)
@@ -216,9 +216,10 @@ obj/machinery/gateway/centerstation/process()
toggleoff()
/obj/machinery/gateway/centeraway/Bumped(atom/movable/M as mob|obj)
if(!ready) return
if(!active) return
/obj/machinery/gateway/centeraway/CollidedWith(atom/movable/M as mob|obj)
if(!ready || !active)
return
if(istype(M, /mob/living/carbon))
for(var/obj/item/weapon/implant/exile/E in M)//Checking that there is an exile implant in the contents
if(E.imp_in == M)//Checking that it's actually implanted vs just in their pocket

View File

@@ -128,7 +128,7 @@ var/list/mineral_can_smooth_with = list(
if(emitter_blasts_taken > 2) // 3 blasts per tile
GetDrilled()
/turf/simulated/mineral/Bumped(AM)
/turf/simulated/mineral/CollidedWith(AM)
. = ..()
if(istype(AM,/mob/living/carbon/human))
var/mob/living/carbon/human/H = AM

View File

@@ -117,13 +117,13 @@
..(message, null, verb)
/mob/living/bot/Bump(var/atom/A)
/mob/living/bot/Collide(atom/A)
if(on && botcard && istype(A, /obj/machinery/door))
var/obj/machinery/door/D = A
if(!istype(D, /obj/machinery/door/firedoor) && !istype(D, /obj/machinery/door/blast) && D.check_access(botcard))
D.open()
else
..()
. = ..()
/mob/living/bot/emag_act(var/remaining_charges, var/mob/user)
return 0

View File

@@ -23,7 +23,7 @@
G.affecting = src
G.synch()
LAssailant = M
LAssailant = WEAKREF(M)
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
for(var/mob/O in viewers(src, null))
@@ -56,4 +56,4 @@
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("<span class='danger'>[] has attempted to punch []!</span>", M, src), 1)
return
return

View File

@@ -377,12 +377,12 @@
if(alert(src,"You sure you want to sleep for a while?","Sleep","Yes","No") == "Yes")
usr.sleeping = 20 //Short nap
/mob/living/carbon/Bump(var/atom/movable/AM, yes)
if(now_pushing || !yes)
/mob/living/carbon/Collide(atom/A)
if(now_pushing)
return
..()
if(istype(AM, /mob/living/carbon) && prob(10))
src.spread_disease_to(AM, "Contact")
. = ..()
if(istype(A, /mob/living/carbon) && prob(10))
src.spread_disease_to(A, "Contact")
/mob/living/carbon/cannot_use_vents()
return

View File

@@ -166,7 +166,7 @@
return
M.put_in_active_hand(G)
G.synch()
LAssailant = M
LAssailant = WEAKREF(M)
H.do_attack_animation(src)
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)

View File

@@ -101,10 +101,14 @@
return tally + config.slime_delay
/mob/living/carbon/slime/Bump(atom/movable/AM as mob|obj, yes)
if ((!(yes) || now_pushing))
/mob/living/carbon/slime/proc/reset_atkcooldown()
Atkcool = FALSE
/mob/living/carbon/slime/Collide(atom/movable/AM as mob|obj, yes)
if (now_pushing)
return
now_pushing = 1
now_pushing = TRUE
if(isobj(AM) && !client && powerlevel > 0)
var/probab = 10
@@ -120,9 +124,8 @@
if(nutrition <= get_hunger_nutrition() && !Atkcool)
if (is_adult || prob(5))
UnarmedAttack(AM)
Atkcool = 1
spawn(45)
Atkcool = 0
Atkcool = TRUE
addtimer(CALLBACK(src, .proc/reset_atkcooldown), 45)
if(ismob(AM))
var/mob/tmob = AM
@@ -130,16 +133,16 @@
if(is_adult)
if(istype(tmob, /mob/living/carbon/human))
if(prob(90))
now_pushing = 0
now_pushing = FALSE
return
else
if(istype(tmob, /mob/living/carbon/human))
now_pushing = 0
now_pushing = FALSE
return
now_pushing = 0
now_pushing = FALSE
..()
. = ..()
/mob/living/carbon/slime/Allow_Spacemove()
return 1
@@ -272,7 +275,7 @@
G.synch()
LAssailant = M
LAssailant = WEAKREF(M)
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
visible_message("<span class='warning'>[M] has grabbed [src] passively!</span>")

View File

@@ -90,10 +90,12 @@
if(M && invalidFeedTarget(M)) // This means that the slime drained the victim
if(!client)
if(Victim && !rabid && !attacked && Victim.LAssailant && Victim.LAssailant != Victim && prob(50))
if(!(Victim.LAssailant in Friends))
Friends[Victim.LAssailant] = 1
else
++Friends[Victim.LAssailant]
var/real_assailant = Victim.LAssailant.resolve()
if (real_assailant)
if(!(real_assailant in Friends))
Friends[real_assailant] = TRUE
else
++Friends[real_assailant]
else
src << "<span class='notice'>This subject does not have a strong enough life energy anymore...</span>"
@@ -170,4 +172,4 @@
else
src << "<span class='notice'>I am not ready to reproduce yet...</span>"
else
src << "<span class='notice'>I am not old enough to reproduce yet...</span>"
src << "<span class='notice'>I am not old enough to reproduce yet...</span>"

View File

@@ -44,96 +44,109 @@ default behaviour is:
return 1
return 0
/mob/living/Bump(atom/movable/AM, yes)
spawn(0)
if ((!( yes ) || now_pushing) || !loc)
/mob/living
var/tmp/last_push_notif
/mob/living/Collide(atom/movable/AM)
spawn
if (now_pushing || !loc)
return
now_pushing = 1
now_pushing = TRUE
if (istype(AM, /mob/living))
var/mob/living/tmob = AM
for(var/mob/living/M in range(tmob, 1))
if(tmob.pinned.len || ((M.pulling == tmob && ( tmob.restrained() && !( M.restrained() ) && M.stat == 0)) || locate(/obj/item/weapon/grab, tmob.grabbed_by.len)) )
if ( !(world.time % 5) )
if(tmob.pinned.len || ((M.pulling == tmob && ( tmob.restrained() && !( M.restrained() ) && M.stat == 0)) || locate(/obj/item/weapon/grab, tmob.grabbed_by.len)) )
if (last_push_notif + 0.5 SECONDS <= world.time)
src << "<span class='warning'>[tmob] is restrained, you cannot push past</span>"
now_pushing = 0
last_push_notif = world.time
now_pushing = FALSE
return
if( tmob.pulling == M && ( M.restrained() && !( tmob.restrained() ) && tmob.stat == 0) )
if ( !(world.time % 5) )
if (last_push_notif + 0.5 SECONDS <= world.time)
src << "<span class='warning'>[tmob] is restraining [M], you cannot push past</span>"
now_pushing = 0
last_push_notif = world.time
now_pushing = FALSE
return
//Leaping mobs just land on the tile, no pushing, no anything.
if(status_flags & LEAPING)
loc = tmob.loc
forceMove(tmob.loc)
status_flags &= ~LEAPING
now_pushing = 0
now_pushing = FALSE
return
if(can_swap_with(tmob)) // mutual brohugs all around!
var/turf/oldloc = loc
forceMove(tmob.loc)
tmob.forceMove(oldloc)
now_pushing = 0
now_pushing = FALSE
for(var/mob/living/carbon/slime/slime in view(1,tmob))
if(slime.Victim == tmob)
slime.UpdateFeed()
return
if(!can_move_mob(tmob, 0, 0))
now_pushing = 0
now_pushing = FALSE
return
if(a_intent == I_HELP || src.restrained())
now_pushing = 0
now_pushing = FALSE
return
if(istype(tmob, /mob/living/carbon/human) && (FAT in tmob.mutations))
if(prob(40) && !(FAT in src.mutations))
src << "<span class='danger'>You fail to push [tmob]'s fat ass out of the way.</span>"
now_pushing = 0
now_pushing = FALSE
return
if(tmob.r_hand && istype(tmob.r_hand, /obj/item/weapon/shield/riot))
if(istype(tmob.r_hand, /obj/item/weapon/shield/riot))
if(prob(99))
now_pushing = 0
now_pushing = FALSE
return
if(tmob.l_hand && istype(tmob.l_hand, /obj/item/weapon/shield/riot))
if(istype(tmob.l_hand, /obj/item/weapon/shield/riot))
if(prob(99))
now_pushing = 0
now_pushing = FALSE
return
if(!(tmob.status_flags & CANPUSH))
now_pushing = 0
now_pushing = FALSE
return
tmob.LAssailant = src
tmob.LAssailant = WEAKREF(src)
now_pushing = 0
now_pushing = FALSE
spawn(0)
..()
. = ..()
if (!istype(AM, /atom/movable))
return
if (!now_pushing)
now_pushing = 1
now_pushing = TRUE
if (!AM.anchored)
if(isobj(AM))
var/obj/O = AM
if ((can_pull_size == 0) || (can_pull_size < O.w_class))
now_pushing = 0
now_pushing = FALSE
return
var/t = get_dir(src, AM)
if (istype(AM, /obj/structure/window))
for(var/obj/structure/window/win in get_step(AM,t))
now_pushing = 0
now_pushing = FALSE
return
step(AM, t)
if(ishuman(AM) && AM:grabbed_by)
for(var/obj/item/weapon/grab/G in AM:grabbed_by)
step(G:assailant, get_dir(G:assailant, AM))
G.adjust_position()
now_pushing = 0
return
return
now_pushing = FALSE
/proc/swap_density_check(var/mob/swapper, var/mob/swapee)
var/turf/T = get_turf(swapper)

View File

@@ -381,7 +381,7 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
G.synch()
G.affecting = src
LAssailant = M
LAssailant = WEAKREF(M)
M.visible_message("<span class='warning'>[M] has grabbed [src] passively!</span>")
M.do_attack_animation(src)
@@ -682,4 +682,4 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
if (stat != DEAD && flying)
return TRUE
else
return FALSE
return FALSE

View File

@@ -110,7 +110,8 @@
previous.Move(attachementNextPosition)
update_icon()
Bump(atom/obstacle)
Collide(atom/obstacle)
. = ..()
if(currentlyEating != obstacle)
currentlyEating = obstacle
eatingDuration = 0
@@ -121,8 +122,6 @@
currentlyEating = null
eatingDuration = 0
return
update_icon() //only for the sake of consistency with the other update icon procs
if(stat == CONSCIOUS || stat == UNCONSCIOUS)
if(previous) //midsection

View File

@@ -179,7 +179,8 @@
*/
//The last mob/living/carbon to push/drag/grab this mob (mostly used by slimes friend recognition)
var/mob/living/carbon/LAssailant = null
// This is stored as a weakref because BYOND's harddeleter sucks ass.
var/datum/weakref/LAssailant
//Wizard mode, but can be used in other modes thanks to the brand new "Give Spell" badmin button
var/spell/list/spell_list

View File

@@ -37,7 +37,8 @@
return
/obj/effect/accelerated_particle/Bump(atom/A)
/obj/effect/accelerated_particle/Collide(atom/A)
. = ..()
if (A)
if(ismob(A))
toxmob(A)
@@ -45,11 +46,10 @@
A:energy += energy
return
/obj/effect/accelerated_particle/Bumped(atom/A)
/obj/effect/accelerated_particle/CollidedWith(atom/A)
. = ..()
if(ismob(A))
Bump(A)
return
toxmob(A)
/obj/effect/accelerated_particle/ex_act(severity)

View File

@@ -72,11 +72,15 @@
/obj/singularity/bullet_act(obj/item/projectile/P)
return 0 //Will there be an impact? Who knows. Will we see it? No.
/obj/singularity/Bump(atom/A)
consume(A)
/obj/singularity/Collide(atom/A)
. = ..()
if (A)
consume(A)
/obj/singularity/Bumped(atom/A)
consume(A)
/obj/singularity/CollidedWith(atom/movable/AM)
. = ..()
if (AM)
consume(AM)
/obj/singularity/process()
eat()

View File

@@ -114,10 +114,12 @@
EB.orbit(src, orbitsize, pick(FALSE, TRUE), rand(10, 25), pick(3, 4, 5, 6, 36))
/obj/singularity/energy_ball/Bump(atom/A)
/obj/singularity/energy_ball/Collide(atom/A)
. = ..()
dust_mobs(A)
/obj/singularity/energy_ball/Bumped(atom/A)
/obj/singularity/energy_ball/CollidedWith(atom/A)
. = ..()
dust_mobs(A)
/obj/singularity/energy_ball/orbit(obj/singularity/energy_ball/target)

View File

@@ -254,7 +254,8 @@
return 1
/obj/item/projectile/Bump(atom/A as mob|obj|turf|area, forced=0)
/obj/item/projectile/Collide(atom/A, forced = 0)
. = ..()
if(A == src)
return 0 //no
@@ -276,8 +277,8 @@
var/obj/item/weapon/grab/G = locate() in M
if(G && G.state >= GRAB_NECK)
visible_message("<span class='danger'>\The [M] uses [G.affecting] as a shield!</span>")
if(Bump(G.affecting, forced=1))
return //If Bump() returns 0 (keep going) then we continue on to attack M.
if(Collide(G.affecting, forced = 1))
return //If Collide() returns 0 (keep going) then we continue on to attack M.
passthrough = !attack_mob(M, distance)
else
@@ -350,7 +351,7 @@
if(!bumped && !isturf(original))
if(loc == get_turf(original))
if(!(original in permutated))
if(Bump(original))
if(Collide(original))
return
if(first_step)
@@ -436,7 +437,7 @@
xo = null
var/result = 0 //To pass the message back to the gun.
/obj/item/projectile/test/Bump(atom/A as mob|obj|turf|area)
/obj/item/projectile/test/Collide(atom/A)
if(A == firer)
loc = A.loc
return //cannot shoot yourself

View File

@@ -6,8 +6,8 @@
nodamage = 1
check_armour = "energy"
/obj/item/projectile/animate/Bump(var/atom/change)
/obj/item/projectile/animate/Collide(atom/change)
if((istype(change, /obj/item) || istype(change, /obj/structure)) && !is_type_in_list(change, protected_objects))
var/obj/O = change
new /mob/living/simple_animal/hostile/mimic/copy(O.loc, O, firer)
..()
. = ..()

View File

@@ -71,12 +71,11 @@
icon_state = "pulse1_bl"
var/life = 20
/obj/item/projectile/beam/pulse/heavy/Bump(atom/A)
/obj/item/projectile/beam/pulse/heavy/Collide(atom/A)
A.bullet_act(src, def_zone)
src.life -= 10
if(life <= 0)
qdel(src)
return
/obj/item/projectile/beam/emitter
name = "emitter beam"
@@ -345,4 +344,4 @@
/obj/item/projectile/beam/energy_net/proc/do_net(var/mob/M)
var/obj/item/weapon/energy_net/net = new (get_turf(M))
net.throw_impact(M)
net.throw_impact(M)

View File

@@ -75,7 +75,7 @@
var/base_spread = 90 //lower means the pellets spread more across body parts. If zero then this is considered a shrapnel explosion instead of a shrapnel cone
var/spread_step = 10 //higher means the pellets spread more across body parts with distance
/obj/item/projectile/bullet/pellet/Bumped()
/obj/item/projectile/bullet/pellet/CollidedWith()
. = ..()
bumped = 0 //can hit all mobs in a tile. pellets is decremented inside attack_mob so this should be fine.
@@ -122,7 +122,7 @@
if(. && !base_spread && isturf(loc))
for(var/mob/living/M in loc)
if(M.lying || !M.CanPass(src, loc)) //Bump if lying or if we would normally Bump.
if(Bump(M)) //Bump will make sure we don't hit a mob multiple times
if(Collide(M)) //Bump will make sure we don't hit a mob multiple times
return
/* short-casing projectiles, like the kind used in pistols or SMGs */

View File

@@ -152,7 +152,7 @@
if(!bumped && !isturf(original))
if(loc == get_turf(original))
if(!(original in permutated))
if(Bump(original))
if(Collide(original))
return
if(first_step)

View File

@@ -69,7 +69,7 @@
nodamage = 1
check_armour = "bullet"
/obj/item/projectile/meteor/Bump(atom/A as mob|obj|turf|area)
/obj/item/projectile/meteor/Collide(atom/A)
if(A == firer)
loc = A.loc
return

View File

@@ -383,7 +383,7 @@
/obj/machinery/disposal/deliveryChute/update()
return
/obj/machinery/disposal/deliveryChute/Bumped(var/atom/movable/AM) //Go straight into the chute
/obj/machinery/disposal/deliveryChute/CollidedWith(var/atom/movable/AM) //Go straight into the chute
if(istype(AM, /obj/item/projectile) || istype(AM, /obj/effect)) return
switch(dir)
if(NORTH)

View File

@@ -105,9 +105,8 @@
"<span class='notice'>[src] has been whittled away under your careful excavation, but there was nothing of interest inside.</span>")
qdel(src)
/obj/structure/boulder/Bumped(AM)
/obj/structure/boulder/CollidedWith(AM)
. = ..()
if(istype(AM,/mob/living/carbon/human))
var/mob/living/carbon/human/H = AM
if((istype(H.l_hand,/obj/item/weapon/pickaxe)) && (!H.hand))

View File

@@ -20,7 +20,8 @@
icon_state = "gigadrill_mov"
user << "<span class='notice'>You press a button and [src] shudders to life.</span>"
/obj/machinery/giga_drill/Bump(atom/A)
/obj/machinery/giga_drill/Collide(atom/A)
. = ..()
if(active && !drilling_turf)
if(istype(A,/turf/simulated/mineral))
var/turf/simulated/mineral/M = A

View File

@@ -84,7 +84,7 @@
secondary_effect.process()
if(pulledby)
Bumped(pulledby)
CollidedWith(pulledby)
//if either of our effects rely on environmental factors, work that out
var/trigger_cold = 0
@@ -254,7 +254,7 @@
if(secondary_effect && secondary_effect.trigger == TRIGGER_FORCE && prob(25))
secondary_effect.ToggleActivate(0)
/obj/machinery/artifact/Bumped(M as mob|obj)
/obj/machinery/artifact/CollidedWith(M as mob|obj)
..()
if(istype(M,/obj))
if(M:throwforce >= 10)

View File

@@ -223,5 +223,6 @@
else
STOP_PROCESSING(SSprocessing, src)
/obj/effect/shadow_wight/Bump(var/atom/obstacle)
/obj/effect/shadow_wight/Collide(var/atom/obstacle)
. = ..()
obstacle << "<span class='warning'>You feel a chill run down your spine!</span>"

View File

@@ -43,7 +43,7 @@
qdel(src)
return
/obj/item/projectile/spell_projectile/Bump(var/atom/A)
/obj/item/projectile/spell_projectile/Collide(atom/A)
if(loc && carried)
prox_cast(carried.choose_prox_targets(user = carried.holder, spell_holder = src))
return 1

View File

@@ -359,7 +359,7 @@
user.apply_effect(150, IRRADIATE, blocked = user.getarmor(null, "rad"))
/obj/machinery/power/supermatter/Bumped(atom/AM as mob|obj)
/obj/machinery/power/supermatter/CollidedWith(atom/AM as mob|obj)
if(!AM.simulated)
return
if(istype(AM, /obj/effect))

View File

@@ -104,18 +104,18 @@
..()
update_stats()
/obj/vehicle/train/cargo/engine/Bump(atom/Obstacle)
/obj/vehicle/train/cargo/engine/Collide(atom/Obstacle)
var/obj/machinery/door/D = Obstacle
var/mob/living/carbon/human/H = load
if(istype(D) && istype(H))
D.Bumped(H) //a little hacky, but hey, it works, and respects access rights
D.Collide(H) //a little hacky, but hey, it works, and respects access rights
..()
. = ..()
/obj/vehicle/train/cargo/trolley/Bump(atom/Obstacle)
/obj/vehicle/train/cargo/trolley/Collide(atom/Obstacle)
if(!lead)
return //so people can't knock others over by pushing a trolley around
..()
. = ..()
//-------------------------------------------
// Train procs

View File

@@ -39,7 +39,8 @@
unattach()
return 0
/obj/vehicle/train/Bump(atom/Obstacle)
/obj/vehicle/train/Collide(atom/Obstacle)
. = ..()
if(!istype(Obstacle, /atom/movable))
return
var/atom/movable/A = Obstacle