ID:1331605
 
(See the best response by Kitsueki.)
Code:
mob
proc
Problem_Code(atom/A)
var/x = A.x
var/y = A.y
var/step_x = 0
var/step_y = 0

if(A.parent_type == /mob)
step_x = A.step_x
step_y = A.step_y


Problem description:
I can get the x and y just fine. I can't get the step_x or step_y. By asking for mob/A, the code works just fine. But I want this function to also accept turfs. Is there a way to do this without giving it a mob specific argument slot?
Best response
proc/codeBit(atom/A)
var x = A.x, y = A.y, sx = 0, sy = 0
if(ismob(A))
var mob/m = A
sx = m.step_x, sy = m.step_y


That should do what I think you're asking.

Edit: whoops, forgot to do the typecasting.
Doesn't quite seem to fix it. What's odd is the documentation says atom should have step_x and step_y in it. Mob definitely has it, as shown by changing it to mob/A.

If it matters, this proc is held in /mob. Updating OP to show that.

E: Just saw your edit. Works now. Many thanks.
In response to SqueakyReaper
Ah, yup. This is a pretty nifty little technique. When you need to narrow a bit of data down to a certain type of object so that you can access it's variables, verbs, or procs.. just use a typecasted variable.
As an off note, unrelated to the problem, is this just a documentation error?

http://www.byond.com/docs/ref/info.html#/atom/movable/var/ step_x

It sounds like an atom has step_x, rather than a mob.
That is referencing the /atom/movable type.

/atom doesn't have step_x, but it's child, /atom/movable does.

/turf and /area derive from /atom, /mob and /obj derive from /atom/movable.
Huh. Legitimately didn't know that. Thanks for the help.