Skip to content

Commit

Permalink
[MIRROR] bump param 2 is "called" for clarity, applied to overrides &…
Browse files Browse the repository at this point in the history
… uses (#2864)

Co-authored-by: Spookerton <[email protected]>
Co-authored-by: Lexanx <[email protected]>
  • Loading branch information
3 people authored Nov 26, 2024
1 parent 64d5650 commit d53f86d
Show file tree
Hide file tree
Showing 28 changed files with 47 additions and 46 deletions.
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
* - `mover` - The atom that's attempting to move.
* - `target` - The detination turf `mover` is attempting to move to.
*
* Returns boolean. If `FALSE`, blocks movement and calls `mover.Bump(src)`.
* Returns boolean. If `FALSE`, blocks movement and calls `mover.Bump(src, TRUE)`.
*/
/atom/proc/CheckExit(atom/movable/mover, turf/target)
return TRUE
Expand Down
13 changes: 7 additions & 6 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,19 @@
particles = null
return ..()

/atom/movable/Bump(atom/A, yes)
if(!QDELETED(throwing))
throwing.hit_atom(A)

if(inertia_dir)
/// Called should be true when calling this in code.
/atom/movable/Bump(atom/A, called)
if (!QDELETED(throwing))
throwing.hit_atom(A)
if (inertia_dir)
inertia_dir = 0

if (A && yes)
if (A && called)
A.last_bumped = world.time
invoke_async(A, TYPE_PROC_REF(/atom, Bumped), src) // Avoids bad actors sleeping or unexpected side effects, as the legacy behavior was to spawn here
..()


/atom/movable/proc/forceMove(atom/destination)
if((gc_destroyed && gc_destroyed != GC_CURRENTLY_BEING_QDELETED) && !isnull(destination))
CRASH("Attempted to forceMove a QDELETED [src] out of nullspace!!!")
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/narsie.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var/global/list/narsie_list = list()
M.apply_effect(3, EFFECT_STUN)


/obj/singularity/narsie/large/Bump(atom/A)
/obj/singularity/narsie/large/Bump(atom/A, called)
if(!cause_hell) return
if(isturf(A))
narsiewall(A)
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/meteor/meteors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ var/global/list/meteors_cataclysm = list(\
if (!ismissile)
SpinAnimation()

/obj/meteor/Bump(atom/A)
/obj/meteor/Bump(atom/A, called)
..()
if(A && !QDELETED(src)) // Prevents explosions and other effects when we were deleted by whatever we Bumped() - currently used by shields.
ram_turf(get_turf(A))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/chem/water.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
return 0
. = ..()

/obj/effect/water/Bump(atom/A)
/obj/effect/water/Bump(atom/A, called)
if(reagents)
reagents.touch(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 @@ -171,7 +171,7 @@
GLOB.moved_event.unregister(src, src, TYPE_PROC_REF(/obj/spider/spiderling, disturbed))
START_PROCESSING(SSobj, src)

/obj/spider/spiderling/Bump(atom/user)
/obj/spider/spiderling/Bump(atom/user, called)
if(istype(user, /obj/structure/table))
forceMove(user.loc)
else
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/structures/stool_bed_chair_nest/chairs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@
if (propelled)
for (var/mob/O in src.loc)
if (O != occupant)
Bump(O)
Bump(O, TRUE)
else
unbuckle_mob()

/obj/structure/bed/chair/office/Bump(atom/A)
/obj/structure/bed/chair/office/Bump(atom/A, called)
..()
if(!buckled_mob) return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
if (propelled)
for (var/mob/O in src.loc)
if (O != occupant)
Bump(O)
Bump(O, TRUE)
else
unbuckle_mob()
if (pulling && (get_dist(src, pulling) > 1))
Expand Down Expand Up @@ -141,7 +141,7 @@
return TRUE
return FALSE

/obj/structure/bed/chair/wheelchair/Bump(atom/A)
/obj/structure/bed/chair/wheelchair/Bump(atom/A, called)
..()
if(!buckled_mob) return

Expand Down
10 changes: 5 additions & 5 deletions code/game/turfs/turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,33 +164,33 @@
for(var/obj/obstacle in mover.loc)
if(!(obstacle.atom_flags & ATOM_FLAG_CHECKS_BORDER) && (mover != obstacle) && (forget != obstacle))
if(!obstacle.CheckExit(mover, src))
mover.Bump(obstacle, 1)
mover.Bump(obstacle, TRUE)
return 0

//Now, check objects to block exit that are on the border
for(var/obj/border_obstacle in mover.loc)
if((border_obstacle.atom_flags & ATOM_FLAG_CHECKS_BORDER) && (mover != border_obstacle) && (forget != border_obstacle))
if(!border_obstacle.CheckExit(mover, src))
mover.Bump(border_obstacle, 1)
mover.Bump(border_obstacle, TRUE)
return 0

//Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in src)
if(border_obstacle.atom_flags & ATOM_FLAG_CHECKS_BORDER)
if(!border_obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != border_obstacle))
mover.Bump(border_obstacle, 1)
mover.Bump(border_obstacle, TRUE)
return 0

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

//Finally, check objects/mobs to block entry that are not on the border
for(var/atom/movable/obstacle in src)
if(!(obstacle.atom_flags & ATOM_FLAG_CHECKS_BORDER))
if(!obstacle.CanPass(mover, mover.loc, 1, 0) && (forget != obstacle))
mover.Bump(obstacle, 1)
mover.Bump(obstacle, TRUE)
return 0
return 1 //Nothing found to block so return success!

Expand Down
2 changes: 1 addition & 1 deletion code/modules/ZAS/Airflow.dm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Contains helper procs for airflow, handled in /connection_group.
return 0
return 1

/atom/movable/Bump(atom/A)
/atom/movable/Bump(atom/A, called)
if(airflow_speed > 0 && airflow_dest)
if(airborne_acceleration > 1)
airflow_hit(A)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/integrated_electronics/core/assemblies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
var/o_access = O.GetAccess()
. |= o_access

/obj/item/device/electronic_assembly/Bump(atom/AM)
/obj/item/device/electronic_assembly/Bump(atom/AM, called)
collw = weakref(AM)
.=..()
if(istype(AM, /obj/machinery/door/airlock) || istype(AM, /obj/machinery/door/window))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/bot/bot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@

..(message, null, verb)

/mob/living/bot/Bump(atom/A)
/mob/living/bot/Bump(atom/A, called)
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))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/bot/mulebot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
if(T == src.loc)
unload(dir)

/mob/living/bot/mulebot/Bump(mob/living/carbon/human/M)
/mob/living/bot/mulebot/Bump(mob/living/carbon/human/M, called)
if(!safety && istype(M))
visible_message(SPAN_WARNING("[src] knocks over [M]!"))
M.Stun(8)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
if(nymphs[user]) step(src, direction) // ANARCHY! DEMOCRACY! ANARCHY! DEMOCRACY!

// Naaaa na na na na naa naa https://www.youtube.com/watch?v=iMH49ieL4es
/obj/structure/diona_gestalt/Bump(atom/movable/AM, yes) // what a useful argname, thanks oldcoders
/obj/structure/diona_gestalt/Bump(atom/movable/AM, called)
. = ..()
if(AM && can_roll_up_atom(AM) && AM.Adjacent(src))
var/turf/stepping = AM.loc
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@
if(alert("Are you sure you want to [player_triggered_sleeping ? "wake up?" : "sleep for a while? Use 'sleep' again to wake up"]", "Sleep", "No", "Yes") == "Yes")
player_triggered_sleeping = !player_triggered_sleeping

/mob/living/carbon/Bump(atom/movable/AM, yes)
if(now_pushing || !yes)
/mob/living/carbon/Bump(atom/movable/AM, called)
if(now_pushing || !called)
return
..()
//[SIERRA-ADD] VIRUSOLOGY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@

return tally

/mob/living/carbon/slime/Bump(atom/movable/AM as mob|obj, yes)
if ((!(yes) || now_pushing))
/mob/living/carbon/slime/Bump(atom/movable/AM, called)
if ((!(called) || now_pushing))
return
now_pushing = 1

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ default behaviour is:
return 0
return ..()

/mob/living/Bump(atom/movable/AM, yes)
/mob/living/Bump(atom/movable/AM, called)

// This is boilerplate from /atom/movable/Bump() but in all honest
// I have no clue what is going on in the logic below this and I'm
Expand All @@ -75,7 +75,7 @@ default behaviour is:
// End boilerplate.

spawn(0)
if ((!( yes ) || now_pushing) || !loc)
if ((!( called ) || now_pushing) || !loc)
return

now_pushing = 1
Expand Down
2 changes: 1 addition & 1 deletion code/modules/overmap/ships/ship.dm
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ var/global/const/OVERMAP_SPEED_CONSTANT = (1 SECOND)
if(!SSshuttle.overmap_halted)
halted = 0

/obj/overmap/visitable/ship/Bump(atom/A)
/obj/overmap/visitable/ship/Bump(atom/A, called)
if(istype(A,/turf/unsimulated/map/edge))
handle_wraparound()
..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
active = TRUE
move(1)

/obj/accelerated_particle/Bump(atom/A)
/obj/accelerated_particle/Bump(atom/A, called)
if (!active)
return
if (A)
Expand All @@ -50,7 +50,7 @@
if (!active)
return
if(ismob(A))
Bump(A)
Bump(A, TRUE)

/obj/accelerated_particle/ex_act(severity)
if (!active)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/singularity/singularity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
/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)
/obj/singularity/Bump(atom/A, called)
consume(A)

/obj/singularity/Bumped(atom/A)
Expand Down
8 changes: 4 additions & 4 deletions code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@
return 1


/obj/item/projectile/Bump(atom/atom, forced)
/obj/item/projectile/Bump(atom/atom, called)
if (atom == src)
return FALSE
if (atom == firer)
forceMove(atom.loc)
return FALSE
if (bumped && !forced || (atom in permutated))
if (bumped && !called || (atom in permutated))
return FALSE
bumped = TRUE
var/passthrough
Expand Down Expand Up @@ -377,7 +377,7 @@
if(!bumped && !isturf(original))
if(loc == get_turf(original))
if(!(original in permutated))
if(Bump(original))
if(Bump(original, TRUE))
return

if(first_step)
Expand Down Expand Up @@ -458,7 +458,7 @@
var/result = 0 //To pass the message back to the gun.
var/atom/hit_thing

/obj/item/projectile/test/Bump(atom/A as mob|obj|turf|area, forced=0)
/obj/item/projectile/test/Bump(atom/A, called)
if(A == firer)
forceMove(A.loc)
return //cannot shoot yourself
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/projectile/animate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
nodamage = TRUE
damage_flags = 0

/obj/item/projectile/animate/Bump(atom/change, forced=0)
/obj/item/projectile/animate/Bump(atom/change, called)
if((istype(change, /obj/item) || istype(change, /obj/structure)) && !is_type_in_list(change, GLOB.mimic_protected))
var/obj/O = change
new /mob/living/simple_animal/hostile/mimic/(O.loc, O, firer)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/projectile/bullets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
if(. && !base_spread && isturf(loc))
for(var/mob/living/M in loc)
if(M.lying || !M.CanPass(src, loc, 0.5, 0)) //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(Bump(M, TRUE)) //Bump will make sure we don't hit a mob multiple times
return

/* short-casing projectiles, like the kind used in pistols or SMGs */
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/projectile/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
damage_type = DAMAGE_BRUTE
nodamage = TRUE

/obj/item/projectile/meteor/Bump(atom/A as mob|obj|turf|area, forced=0)
/obj/item/projectile/meteor/Bump(atom/A, called)
if(A == firer)
forceMove(A.loc)
return
Expand Down
2 changes: 1 addition & 1 deletion code/modules/spells/aoe_turf/drain_blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
tracer_type = /obj/projectile/blood
impact_type = /obj/projectile/blood

/obj/item/projectile/beam/blood_effect/Bump(atom/a, forced=0)
/obj/item/projectile/beam/blood_effect/Bump(atom/a, called)
if(a == original)
on_impact(a)
qdel(src)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/spells/spell_projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
qdel(src)
return

/obj/item/projectile/spell_projectile/Bump(atom/A, forced=0)
/obj/item/projectile/spell_projectile/Bump(atom/A, called)
if(loc && carried)
prox_cast(carried.choose_prox_targets(user = carried.holder, spell_holder = src))
return 1
Expand Down
2 changes: 1 addition & 1 deletion code/modules/xenoarcheaology/artifacts/gigadrill.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
to_chat(user, SPAN_NOTICE("You press a button and \the [src] shudders to life."))
return TRUE

/obj/machinery/giga_drill/Bump(atom/A)
/obj/machinery/giga_drill/Bump(atom/A, called)
if(active && !drilling_turf)
if(istype(A,/turf/simulated/mineral))
var/turf/simulated/mineral/M = A
Expand Down
2 changes: 1 addition & 1 deletion code/modules/xenoarcheaology/finds/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,5 @@
else
STOP_PROCESSING(SSobj, src)

/obj/shadow_wight/Bump(atom/obstacle)
/obj/shadow_wight/Bump(atom/obstacle, called)
to_chat(obstacle, SPAN_WARNING("You feel a chill run down your spine!"))

0 comments on commit d53f86d

Please sign in to comment.