MoondancerPony

Untitled

Feb 3rd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. /atom/movable/Move(atom/newloc, direct=0)
  2. . = FALSE
  3. if(!newloc || newloc == loc)
  4. return
  5.  
  6. if(!direct)
  7. direct = get_dir(src, newloc)
  8. setDir(direct)
  9.  
  10. if(!loc.Exit(src, newloc))
  11. return
  12.  
  13. if(!newloc.Enter(src, src.loc))
  14. return
  15. // Past this is the point of no return
  16. var/atom/oldloc = loc
  17. var/area/oldarea = get_area(oldloc)
  18. var/area/newarea = get_area(newloc)
  19. loc = newloc
  20. . = TRUE
  21. oldloc.Exited(src, newloc)
  22. if(oldarea != newarea)
  23. oldarea.Exited(src, newloc)
  24.  
  25. for(var/i in oldloc)
  26. if(i == src) // Multi tile objects
  27. continue
  28. var/atom/movable/thing = i
  29. thing.Uncrossed(src)
  30.  
  31. newloc.Entered(src, oldloc)
  32. if(oldarea != newarea)
  33. newarea.Entered(src, oldloc)
  34.  
  35. for(var/i in loc)
  36. if(i == src) // Multi tile objects
  37. continue
  38. var/atom/movable/thing = i
  39. thing.Crossed(src)
  40. //
  41. ////////////////////////////////////////
  42.  
  43. /atom/movable/Move(atom/newloc, direct)
  44. if(!loc || !newloc)
  45. return FALSE
  46. var/atom/oldloc = loc
  47.  
  48. if(loc != newloc)
  49. if (!(direct & (direct - 1))) //Cardinal move
  50. . = ..()
  51. else //Diagonal move, split it into cardinal moves
  52. moving_diagonally = FIRST_DIAG_STEP
  53. var/first_step_dir
  54. // The `&& moving_diagonally` checks are so that a forceMove taking
  55. // place due to a Crossed, Bumped, etc. call will interrupt
  56. // the second half of the diagonal movement, or the second attempt
  57. // at a first half if step() fails because we hit something.
  58. if (direct & NORTH)
  59. if (direct & EAST)
  60. if (step(src, NORTH) && moving_diagonally)
  61. first_step_dir = NORTH
  62. moving_diagonally = SECOND_DIAG_STEP
  63. . = step(src, EAST)
  64. else if (moving_diagonally && step(src, EAST))
  65. first_step_dir = EAST
  66. moving_diagonally = SECOND_DIAG_STEP
  67. . = step(src, NORTH)
  68. else if (direct & WEST)
  69. if (step(src, NORTH) && moving_diagonally)
  70. first_step_dir = NORTH
  71. moving_diagonally = SECOND_DIAG_STEP
  72. . = step(src, WEST)
  73. else if (moving_diagonally && step(src, WEST))
  74. first_step_dir = WEST
  75. moving_diagonally = SECOND_DIAG_STEP
  76. . = step(src, NORTH)
  77. else if (direct & SOUTH)
  78. if (direct & EAST)
  79. if (step(src, SOUTH) && moving_diagonally)
  80. first_step_dir = SOUTH
  81. moving_diagonally = SECOND_DIAG_STEP
  82. . = step(src, EAST)
  83. else if (moving_diagonally && step(src, EAST))
  84. first_step_dir = EAST
  85. moving_diagonally = SECOND_DIAG_STEP
  86. . = step(src, SOUTH)
  87. else if (direct & WEST)
  88. if (step(src, SOUTH) && moving_diagonally)
  89. first_step_dir = SOUTH
  90. moving_diagonally = SECOND_DIAG_STEP
  91. . = step(src, WEST)
  92. else if (moving_diagonally && step(src, WEST))
  93. first_step_dir = WEST
  94. moving_diagonally = SECOND_DIAG_STEP
  95. . = step(src, SOUTH)
  96. if(moving_diagonally == SECOND_DIAG_STEP)
  97. if(!.)
  98. setDir(first_step_dir)
  99. //else if (!inertia_moving)
  100. // inertia_next_move = world.time + inertia_move_delay
  101. // newtonian_move(direct)
  102. moving_diagonally = 0
  103. return
  104.  
  105. if(!loc || (loc == oldloc && oldloc != newloc))
  106. last_move = 0
  107. return
  108.  
  109. if(.)
  110. Moved(oldloc, direct)
  111.  
  112. //Polaris stuff
  113. move_speed = world.time - l_move_time
  114. l_move_time = world.time
  115. m_flag = 1
  116. //End
  117.  
  118. last_move = direct
  119. setDir(direct)
  120. if(. && has_buckled_mobs() && !handle_buckled_mob_movement(loc,direct)) //movement failed due to buckled mob(s)
  121. return FALSE
Advertisement
Add Comment
Please, Sign In to add comment