turf/proc
Add_Height(var/mob/A)
spawn(1) A.pixel_z += Pixel_Height/8 //This allows for smoother transitioning of movement upwards.
spawn(1) A.pixel_z += Pixel_Height/8
spawn(2) A.pixel_z += Pixel_Height/4
Remove_Height(var/mob/A)
spawn(1) A.pixel_z -= Pixel_Height/8
spawn(1) A.pixel_z -= Pixel_Height/8
spawn(2) A.pixel_z -= Pixel_Height/4
South_Climbing(var/mob/A)
if(A.dir == SOUTH && A.ZLevel == src.ZLevel)
A.ZLevel += 1
A.Layer_Calc()
A.Climbing = 1
Add_Height(A)
return 1
else if(A.dir == NORTH && (A.ZLevel - 1) == src.ZLevel)
A.Climbing = 1
Remove_Height(A)
return 1
else if(A.dir == EAST && (A.ZLevel - 1) == src.ZLevel && A.Climbing)
return 1
else if(A.dir == WEST && (A.ZLevel - 1) == src.ZLevel && A.Climbing)
return 1
South_Falling(var/mob/A)
if(A.dir == NORTH)
Remove_Height(A)
A.Climbing = 0
A.ZLevel -= 1
A.Layer_Calc()
return 1
else if(A.dir == SOUTH)
Add_Height(A)
A.Climbing = 0
return 1
else return 1
North_Climbing(var/mob/A)
if(A.dir == NORTH && A.ZLevel == src.ZLevel)
A.ZLevel += 1
A.Layer_Calc()
Add_Height(A)
A.Climbing = 1
return 1
else if(A.dir == SOUTH && (A.ZLevel - 1) == src.ZLevel)
Remove_Height(A)
A.Climbing = 1
return 1
else if(A.dir == WEST && (A.ZLevel - 1) == src.ZLevel && A.Climbing)
return 1
else if(A.dir == EAST && (A.ZLevel - 1) == src.ZLevel && A.Climbing)
return 1
North_Falling(var/mob/A)
if(A.dir == SOUTH)
Remove_Height(A)
A.Climbing = 0
A.ZLevel -= 1
A.Layer_Calc()
return 1
else if(A.dir == NORTH)
Add_Height(A)
A.Climbing = 0
return 1
else return 1
East_Climbing(var/mob/A)
if(A.dir == EAST && A.ZLevel == src.ZLevel)
A.ZLevel += 1
A.Layer_Calc()
Add_Height(A)
A.Climbing = 1
return 1
else if(A.dir == WEST && (A.ZLevel - 1) == src.ZLevel)
Remove_Height(A)
A.Climbing = 1
return 1
else if(A.dir == NORTH && (A.ZLevel - 1) == src.ZLevel && A.Climbing)
return 1
else if(A.dir == SOUTH && (A.ZLevel - 1) == src.ZLevel && A.Climbing)
return 1
East_Falling(var/mob/A)
if(A.dir == WEST)
Remove_Height(A)
A.Climbing = 0
A.ZLevel -= 1
A.Layer_Calc()
return 1
else if(A.dir == EAST)
Add_Height(A)
A.Climbing = 0
return 1
else return 1
West_Climbing(var/mob/A)
if(A.dir == WEST && A.ZLevel == src.ZLevel)
A.ZLevel += 1
A.Layer_Calc()
Add_Height(A)
A.Climbing = 1
return 1
else if(A.dir == EAST && (A.ZLevel - 1) == src.ZLevel)
Remove_Height(A)
A.Climbing = 1
return 1
else if(A.dir == NORTH && (A.ZLevel - 1) == src.ZLevel && A.Climbing)
return 1
else if(A.dir == SOUTH && (A.ZLevel - 1) == src.ZLevel && A.Climbing)
return 1
West_Falling(var/mob/A)
if(A.dir == EAST)
Remove_Height(A)
A.Climbing = 0
A.ZLevel -= 1
A.Layer_Calc()
return 1
else if(A.dir == WEST)
Add_Height(A)
A.Climbing = 0
return 1
else return 1
A quick note, ZLevel is used to determine your "height" and climbing has value when you are on stairs.
Problem description:
This code works quite well, though as you can see...it's a bit on the looong side. I'm trying to find a way to combine at least the Climbing codes together into one or two procs and the same for the falling. I've been unable thus far to come up with a way to combine them without just adding something like if(Stairs.dir == SOUTH) and pasting the South_Climbing code. If there is any way to combine these easily, please tell me, I'd love to know!
Thanks!