Skip to content

Commit

Permalink
Rename Bump to Collide (tgstation#29207)
Browse files Browse the repository at this point in the history
This reduces confusion arising from the fact byond already has a built
in byond proc also named Bump.

We used an argument called yes to distinguish our Bump from byond's
builtin bump, but then we failed to make sure everyone of our bumps
properly override it, so a bunch of things have been double bumping

This resolves that issue permanently

I've also removed the second argument as it no longer has a purpose

I also cleaned up the recycler bump as it didn't do anything the
parent procs didn't already do
  • Loading branch information
optimumtact authored and AnturK committed Jul 14, 2017
1 parent 24e9471 commit 5494f53
Show file tree
Hide file tree
Showing 37 changed files with 77 additions and 85 deletions.
2 changes: 1 addition & 1 deletion code/datums/forced_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

. = . && (vic.loc != tar.loc)

/mob/Bump(atom/A)
/mob/Collide(atom/A)
. = ..()
if(force_moving && force_moving.allow_climbing && istype(A,/obj/structure))
var/obj/structure/S = A
Expand Down
10 changes: 7 additions & 3 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,12 @@
/atom/movable/Crossed(atom/movable/AM, oldloc)
return

/atom/movable/Bump(atom/A, yes) //the "yes" arg is to differentiate our Bump proc from byond's, without it every Bump() call would become a double Bump().
if((A && yes))

//This is tg's equivalent to the byond bump, it used to be called bump with a second arg
//to differentiate it, naturally everyone forgot about this immediately and so some things
//would bump twice, so now it's called Collide
/atom/movable/proc/Collide(atom/A)
if((A))
if(throwing)
throwing.hit_atom(A)
. = 1
Expand Down Expand Up @@ -695,4 +699,4 @@
return FALSE
if(anchored || throwing)
return FALSE
return TRUE
return TRUE
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
/mob/living/simple_animal/hostile/clockwork/fragment/Process_Spacemove(movement_dir = 0)
return 1

/mob/living/simple_animal/hostile/clockwork/fragment/Bump(atom/movable/AM)
/mob/living/simple_animal/hostile/clockwork/fragment/Collide(atom/movable/AM)
. = ..()
if(movement_delay_time <= world.time && next_move <= world.time && isliving(AM) && !is_servant_of_ratvar(AM))
var/mob/living/L = AM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
R.visible_message("<span class='heavy_brass'>[R] forms, and its eyes blink open, glowing bright red!</span>")
R.key = O.key

/obj/structure/destructible/clockwork/massive/ratvar/Bump(atom/A)
/obj/structure/destructible/clockwork/massive/ratvar/Collide(atom/A)
var/turf/T = get_turf(A)
if(T == loc)
T = get_step(T, dir) //please don't run into a window like a bird, ratvar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
affect_mob(AM)
return ..()

/obj/structure/destructible/clockwork/taunting_trail/Bump(atom/movable/AM)
/obj/structure/destructible/clockwork/taunting_trail/Collide(atom/movable/AM)
affect_mob(AM)
return ..()

Expand Down
6 changes: 3 additions & 3 deletions code/game/gamemodes/meteor/meteors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event
SpinAnimation()
QDEL_IN(src, lifetime)

/obj/effect/meteor/Bump(atom/A)
/obj/effect/meteor/Collide(atom/A)
if(A)
ram_turf(get_turf(A))
playsound(src.loc, meteorsound, 40, 1)
Expand Down Expand Up @@ -295,7 +295,7 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event
if(!isspaceturf(T))
new /obj/effect/decal/cleanable/blood(T)

/obj/effect/meteor/meaty/Bump(atom/A)
/obj/effect/meteor/meaty/Collide(atom/A)
A.ex_act(hitpwr)
get_hit()

Expand Down Expand Up @@ -334,7 +334,7 @@ GLOBAL_LIST_INIT(meteorsC, list(/obj/effect/meteor/dust)) //for space dust event
..()
explosion(src.loc, 5, 10, 15, 20, 0)

/obj/effect/meteor/tunguska/Bump()
/obj/effect/meteor/tunguska/Collide()
..()
if(prob(20))
explosion(src.loc,2,4,6,8)
Expand Down
9 changes: 1 addition & 8 deletions code/game/machinery/recycler.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@
is_powered = FALSE
icon_state = icon_name + "[is_powered]" + "[(blood ? "bld" : "")]" // add the blood tag at the end

// This is purely for admin possession !FUN!.
/obj/machinery/recycler/Bump(atom/movable/AM)
..()
if(AM)
Bumped(AM)


/obj/machinery/recycler/Bumped(atom/movable/AM)

if(stat & (BROKEN|NOPOWER))
Expand Down Expand Up @@ -208,4 +201,4 @@
name = "paper - 'garbage duty instructions'"
info = "<h2>New Assignment</h2> You have been assigned to collect garbage from trash bins, located around the station. The crewmembers will put their trash into it and you will collect the said trash.<br><br>There is a recycling machine near your closet, inside maintenance; use it to recycle the trash for a small chance to get useful minerals. Then deliver these minerals to cargo or engineering. You are our last hope for a clean station, do not screw this up!"

#undef SAFETY_COOLDOWN
#undef SAFETY_COOLDOWN
35 changes: 17 additions & 18 deletions code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@
playsound(src,stepsound,40,1)
return result

/obj/mecha/Bump(var/atom/obstacle, yes)
/obj/mecha/Collide(var/atom/obstacle)
if(phasing && get_charge() >= phasing_energy_drain && !throwing)
spawn()
if(can_move)
Expand All @@ -551,23 +551,22 @@
sleep(step_in*3)
can_move = 1
else
if(yes)
if(..()) //mech was thrown
return
if(bumpsmash && occupant) //Need a pilot to push the PUNCH button.
if(nextsmash < world.time)
obstacle.mech_melee_attack(src)
if(!obstacle || !obstacle.density)
step(src,dir)
nextsmash = world.time + smashcooldown
if(isobj(obstacle))
var/obj/O = obstacle
if(!O.anchored)
step(obstacle, dir)
else if(ismob(obstacle))
var/mob/M = obstacle
if(!M.anchored)
step(obstacle, dir)
if(..()) //mech was thrown
return
if(bumpsmash && occupant) //Need a pilot to push the PUNCH button.
if(nextsmash < world.time)
obstacle.mech_melee_attack(src)
if(!obstacle || !obstacle.density)
step(src,dir)
nextsmash = world.time + smashcooldown
if(isobj(obstacle))
var/obj/O = obstacle
if(!O.anchored)
step(obstacle, dir)
else if(ismob(obstacle))
var/mob/M = obstacle
if(!M.anchored)
step(obstacle, dir)



Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/effects/anomalies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
/obj/effect/anomaly/grav/Crossed(mob/A)
gravShock(A)

/obj/effect/anomaly/grav/Bump(mob/A)
/obj/effect/anomaly/grav/Collide(mob/A)
gravShock(A)

/obj/effect/anomaly/grav/Bumped(mob/A)
Expand Down Expand Up @@ -143,7 +143,7 @@
/obj/effect/anomaly/flux/Crossed(mob/living/M)
mobShock(M)

/obj/effect/anomaly/flux/Bump(mob/living/M)
/obj/effect/anomaly/flux/Collide(mob/living/M)
mobShock(M)

/obj/effect/anomaly/flux/Bumped(mob/living/M)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/effect_system/effects_water.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
return 0
.=..()

/obj/effect/particle_effect/water/Bump(atom/A)
/obj/effect/particle_effect/water/Collide(atom/A)
if(reagents)
reagents.reaction(A)
return ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/spiders.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
/obj/structure/spider/spiderling/nurse
grow_as = /mob/living/simple_animal/hostile/poison/giant_spider/nurse

/obj/structure/spider/spiderling/Bump(atom/user)
/obj/structure/spider/spiderling/Collide(atom/user)
if(istype(user, /obj/structure/table))
src.loc = user.loc
else
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/simulated/minerals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
if(istype(M.selected,/obj/item/mecha_parts/mecha_equipment/drill))
src.attackby(M.selected,M)
return*/
//Aparantly mechs are just TOO COOL to call Bump(), so fuck em (for now)
//Aparantly mechs are just TOO COOL to call Collide())
else
return

Expand Down
8 changes: 4 additions & 4 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
// Nothing but border objects stop you from leaving a tile, only one loop is needed
for(var/obj/obstacle in mover.loc)
if(!obstacle.CheckExit(mover, src) && obstacle != mover && obstacle != forget)
mover.Bump(obstacle, 1)
mover.Collide(obstacle)
return FALSE

var/list/large_dense = list()
Expand All @@ -122,14 +122,14 @@
for(var/atom/movable/border_obstacle in src)
if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CanPass(mover, mover.loc, 1) && (forget != border_obstacle))
mover.Bump(border_obstacle, 1)
mover.Collide(border_obstacle)
return FALSE
else
large_dense += border_obstacle

//Then, check the turf itself
if (!src.CanPass(mover, src))
mover.Bump(src, 1)
mover.Collide(src)
return FALSE

//Finally, check objects/mobs to block entry that are not on the border
Expand All @@ -141,7 +141,7 @@
tompost_bump = obstacle
top_layer = obstacle.layer
if(tompost_bump)
mover.Bump(tompost_bump,1)
mover.Collide(tompost_bump)
return FALSE

return TRUE //Nothing found to block so return success!
Expand Down
2 changes: 1 addition & 1 deletion code/modules/assembly/infrared.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
master.last = I
I.process()

/obj/effect/beam/i_beam/Bump()
/obj/effect/beam/i_beam/Collide()
qdel(src)
return

Expand Down
2 changes: 1 addition & 1 deletion code/modules/awaymissions/capture_the_flag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@
/obj/effect/ctf/ammo/Crossed(atom/movable/AM)
reload(AM)

/obj/effect/ctf/ammo/Bump(atom/movable/AM)
/obj/effect/ctf/ammo/Collide(atom/movable/AM)
reload(AM)

/obj/effect/ctf/ammo/Bumped(atom/movable/AM)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/events/immovable_rod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1
/obj/effect/immovablerod/ex_act(severity, target)
return 0

/obj/effect/immovablerod/Bump(atom/clong)
/obj/effect/immovablerod/Collide(atom/clong)
if(prob(10))
playsound(src, 'sound/effects/bang.ogg', 50, 1)
audible_message("<span class='danger'>You hear a CLANG!</span>")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@
return 1
..()

/mob/living/carbon/human/Bump(atom/A)
/mob/living/carbon/human/Collide(atom/A)
..()
var/crashdir = get_dir(src, A)
var/obj/item/device/flightpack/FP = get_flightpack()
Expand Down
16 changes: 8 additions & 8 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@
staticOverlays["animal"] = staticOverlay


//Generic Bump(). Override MobBump() and ObjBump() instead of this.
/mob/living/Bump(atom/A, yes)
//Generic Collide(). Override MobCollide() and ObjCollide() instead of this.
/mob/living/Collide(atom/A)
if(..()) //we are thrown onto something
return
if (buckled || !yes || now_pushing)
if (buckled || now_pushing)
return
if(ismob(A))
var/mob/M = A
if(MobBump(M))
if(MobCollide(M))
return
if(isobj(A))
var/obj/O = A
if(ObjBump(O))
if(ObjCollide(O))
return
if(ismovableatom(A))
var/atom/movable/AM = A
Expand All @@ -104,7 +104,7 @@
last_bumped = world.time

//Called when we bump onto a mob
/mob/living/proc/MobBump(mob/M)
/mob/living/proc/MobCollide(mob/M)
//Even if we don't push/swap places, we "touched" them, so spread fire
spreadFire(M)

Expand Down Expand Up @@ -174,7 +174,7 @@
return 1

//Called when we bump onto an obj
/mob/living/proc/ObjBump(obj/O)
/mob/living/proc/ObjCollide(obj/O)
return

//Called when we want to push an atom/movable
Expand Down Expand Up @@ -893,7 +893,7 @@
ExtinguishMob()

//Share fire evenly between the two mobs
//Called in MobBump() and Crossed()
//Called in MobCollide() and Crossed()
/mob/living/proc/spreadFire(mob/living/L)
if(!istype(L))
return
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/living_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

var/list/surgeries = list() //a list of surgery datums. generally empty, they're added when the player wants them.

var/now_pushing = null //used by living/Bump() and living/PushAM() to prevent potential infinite loop.
var/now_pushing = null //used by living/Collide() and living/PushAM() to prevent potential infinite loop.

var/cameraFollow = null

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/bot/bot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ Pass a positive integer as an argument to override a bot's default speed.
else // no path, so calculate new one
calc_summon_path()

/mob/living/simple_animal/bot/Bump(M as mob|obj) //Leave no door unopened!
/mob/living/simple_animal/bot/Collide(M as mob|obj) //Leave no door unopened!
. = ..()
if((istype(M, /obj/machinery/door/airlock) || istype(M, /obj/machinery/door/window)) && (!isnull(access_card)))
var/obj/machinery/door/D = M
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/bot/mulebot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@
return

// called when bot bumps into anything
/mob/living/simple_animal/bot/mulebot/Bump(atom/obs)
/mob/living/simple_animal/bot/mulebot/Collide(atom/obs)
if(wires.is_cut(WIRE_AVOIDANCE)) // usually just bumps, but if avoidance disabled knock over mobs
if(isliving(obs))
var/mob/living/L = obs
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/constructs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
can_repair_constructs = TRUE


/mob/living/simple_animal/hostile/construct/harvester/Bump(atom/AM)
/mob/living/simple_animal/hostile/construct/harvester/Collide(atom/AM)
. = ..()
if(istype(AM, /turf/closed/wall/mineral/cult) && AM != loc) //we can go through cult walls
var/atom/movable/stored_pulling = pulling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
else
to_chat(user, "<span class='holoparasite'>[src] glows with a strange <font color=\"[spawner.namedatum.colour]\">light</font>, and you don't touch it.</span>")

/obj/guardian_bomb/Bump(atom/A)
/obj/guardian_bomb/Collide(atom/A)
detonate(A)
..()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
..()
collision_ignite(AM)

/mob/living/simple_animal/hostile/guardian/fire/Bump(AM as mob|obj)
/mob/living/simple_animal/hostile/guardian/fire/Collide(AM as mob|obj)
..()
collision_ignite(AM)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Difficulty: Hard
SetRecoveryTime(MEGAFAUNA_DEFAULT_RECOVERY_TIME)


/mob/living/simple_animal/hostile/megafauna/bubblegum/Bump(atom/A)
/mob/living/simple_animal/hostile/megafauna/bubblegum/Collide(atom/A)
if(charging)
if(isturf(A) || isobj(A) && A.density)
A.ex_act(EXPLODE_HEAVY)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/simple_animal/slime/slime.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

. += config.slime_delay

/mob/living/simple_animal/slime/ObjBump(obj/O)
/mob/living/simple_animal/slime/ObjCollide(obj/O)
if(!client && powerlevel > 0)
var/probab = 10
switch(powerlevel)
Expand Down
Loading

0 comments on commit 5494f53

Please sign in to comment.