ID:1681750
 
(See the best response by GhostAnime.)
mob
Bump(obj/House/h)
if(!istype(h, /obj/House)) return
if(ismob(src) && src.client)
src.Savedx = src.x
src.Savedy = src.y
src.Savedz = src.z
var/swapmap/SM = SwapMaps_Load("[h.owner.ckey]-house")
src.loc = locate(SM.x1+12,SM.y1+1,SM.z1)
src.location = "[h.owner]'s House"
..()

obj
House
icon = 'Icons/Turfs 3.dmi'
icon_state = "house"
var/mob/owner
density = 1


I have to use the
if(!istype(h, /obj/House)) return
line or else the bump procs for everything I bump into. So now I'm wondering since I used a return statement if it won't check the original(..()) bump proc for anything else anymore. Is there a better way to do this?
Best response
You could make a Bumped() code to be called on the object bumped on to.

//Title: Bumped
//Credit to: Popisfizzy

/*
Just a simple Bumped() proc. This will be called when an
/atom is bumped into by an /obj or /mob.
*/


atom
proc/Bumped(atom/movable/o)
return 0

movable/Bump(atom/a)
a.Bumped(src) //Call Bumped() for the /atom that
//has been bumped into, with src for
//the argumemt, meaning that src is
//what bumped into it.

return ..(a) //Return the value of the parent proc.



mob/Enemy/Dragon
Bumped(atom/A) // When something bumps in to the Dragon
if(ismob(A))
Kill_Opponent(A)
else
world << "The dragon gobbled [A.name]"
del A


Note that /atom/movable is the parent of /mob and /obj.