Advertisement
EditorRUS

smoothwall.dm

Jan 25th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.61 KB | None | 0 0
  1. //Separate dm because it relates to two types of atoms + ease of removal in case it's needed.
  2. //Also assemblies.dm for falsewall checking for this when used.
  3. //I should really make the shuttle wall check run every time it's moved, but centcom uses unsimulated floors so !effort
  4.  
  5. /atom/proc/relativewall() //atom because it should be useable both for walls and false walls
  6. if(istype(src,/turf/simulated/floor/vault)||istype(src,/turf/simulated/wall/vault)) //HACK!!!
  7. return
  8.  
  9. var/junction = 0 //will be used to determine from which side the wall is connected to other walls
  10.  
  11. if(!istype(src,/turf/simulated/shuttle/wall)) //or else we'd have wacky shuttle merging with walls action
  12. for(var/turf/simulated/wall/W in orange(src,1))
  13. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  14. junction |= get_dir(src,W)
  15. for(var/obj/structure/falsewall/W in orange(src,1))
  16. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  17. junction |= get_dir(src,W)
  18. for(var/obj/structure/falserwall/W in orange(src,1))
  19. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  20. junction |= get_dir(src,W)
  21.  
  22. /* Commenting this out for now until we figure out what to do with shuttle smooth walls, if anything.
  23. As they are now, they sort of work screwy and may need further coding. Or just be scrapped.*/
  24. /*else
  25. for(var/turf/simulated/shuttle/wall/W in orange(src,1))
  26. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  27. junction |= get_dir(src,W)
  28. for(var/obj/machinery/shuttle/W in orange(src,1)) //stuff like engine and propulsion should merge with walls
  29. if(abs(src.x-W.x)-abs(src.y-W.y))
  30. junction |= get_dir(src,W)
  31. for(var/obj/machinery/door/W in orange(src,1)) //doors should not result in diagonal walls, it just looks ugly. checking if area is shuttle so it won't merge with the station
  32. if((abs(src.x-W.x)-abs(src.y-W.y)) && (istype(W.loc.loc,/area/shuttle) || istype(W.loc.loc,/area/supply)))
  33. junction |= get_dir(src,W)
  34. for(var/obj/structure/grille/W in orange(src,1)) //same for grilles. checking if area is shuttle so it won't merge with the station
  35. if((abs(src.x-W.x)-abs(src.y-W.y)) && (istype(W.loc.loc,/area/shuttle) || istype(W.loc.loc,/area/supply)))
  36. junction |= get_dir(src,W)*/
  37.  
  38. if(istype(src,/turf/simulated/wall))
  39. var/turf/simulated/wall/wall = src
  40. wall.icon_state = "[wall.walltype][junction]"
  41. else if (istype(src,/obj/structure/falserwall))
  42. src.icon_state = "rwall[junction]"
  43. else if (istype(src,/obj/structure/falsewall))
  44. var/obj/structure/falsewall/fwall = src
  45. fwall.icon_state = "[fwall.mineral][junction]"
  46. /* else if(istype(src,/turf/simulated/shuttle/wall))
  47. var/newicon = icon;
  48. var/newiconstate = icon_state;
  49. if(junction!=5 && junction!=6 && junction!=9 && junction!=10) //if it's not diagonal, all is well, no additional calculations needed
  50. src.icon_state = "swall[junction]"
  51. else //if it's diagonal, we need to figure out if we're using the floor diagonal or the space diagonal sprite
  52. var/is_floor = 0
  53. for(var/turf/unsimulated/floor/F in orange(src,1))
  54. if(abs(src.x-F.x)-abs(src.y-F.y))
  55. if((15-junction) & get_dir(src,F)) //if there's a floor in at least one of the empty space directions, return 1
  56. is_floor = 1
  57. newicon = F.icon
  58. newiconstate = F.icon_state //we'll save these for later
  59. for(var/turf/simulated/floor/F in orange(src,1))
  60. if(abs(src.x-F.x)-abs(src.y-F.y))
  61. if((15-junction) & get_dir(src,F)) //if there's a floor in at least one of the empty space directions, return 1
  62. is_floor = 1
  63. newicon = F.icon
  64. newiconstate = F.icon_state //we'll save these for later
  65. for(var/turf/simulated/shuttle/floor/F in orange(src,1))
  66. if(abs(src.x-F.x)-abs(src.y-F.y))
  67. if((15-junction) & get_dir(src,F)) //if there's a floor in at least one of the empty space directions, return 1
  68. is_floor = 1
  69. newicon = F.icon
  70. newiconstate = F.icon_state //we'll save these for later
  71. if(is_floor) //if is_floor = 1, we use the floor diagonal sprite
  72. src.icon = newicon; //we'll set the floor's icon to the floor next to it and overlay the wall segment. shuttle floor sprites have priority
  73. src.icon_state = newiconstate; //
  74. src.overlays += icon('shuttle.dmi',"swall_f[junction]")
  75. else //otherwise, the space one
  76. src.icon_state = "swall_s[junction]"*/
  77.  
  78. return
  79.  
  80. /atom/proc/relativewall_neighbours()
  81. for(var/turf/simulated/wall/W in range(src,1))
  82. W.relativewall()
  83. for(var/obj/structure/falsewall/W in range(src,1))
  84. W.relativewall()
  85. for(var/obj/structure/falserwall/W in range(src,1))
  86. W.relativewall()
  87. return
  88.  
  89. /turf/simulated/wall/New()
  90. relativewall_neighbours()
  91. ..()
  92.  
  93. /obj/structure/falsewall/New()
  94. relativewall_neighbours()
  95. ..()
  96.  
  97. /obj/structure/falserwall/New()
  98. relativewall_neighbours()
  99. ..()
  100.  
  101. /*/turf/simulated/shuttle/wall/New()
  102.  
  103. spawn(20) //testing if this will make /obj/machinery/shuttle and /door count - It does, it stays.
  104. if(src.icon_state in list("wall1", "wall", "diagonalWall", "wall_floor", "wall_space")) //so wizard den, syndie shuttle etc will remain black
  105. for(var/turf/simulated/shuttle/wall/W in range(src,1))
  106. W.relativewall()
  107.  
  108. ..()*/
  109.  
  110. /turf/simulated/wall/Del()
  111.  
  112. var/temploc = src.loc
  113.  
  114. spawn(10)
  115. for(var/turf/simulated/wall/W in range(temploc,1))
  116. W.relativewall()
  117.  
  118. for(var/obj/structure/falsewall/W in range(temploc,1))
  119. W.relativewall()
  120.  
  121. for(var/direction in cardinal)
  122. for(var/obj/effect/glowshroom/shroom in get_step(src,direction))
  123. if(!shroom.floor) //shrooms drop to the floor
  124. shroom.floor = 1
  125. shroom.icon_state = "glowshroomf"
  126. shroom.pixel_x = 0
  127. shroom.pixel_y = 0
  128.  
  129. ..()
  130.  
  131. /obj/structure/falsewall/Del()
  132.  
  133. var/temploc = src.loc
  134.  
  135. spawn(10)
  136. for(var/turf/simulated/wall/W in range(temploc,1))
  137. W.relativewall()
  138.  
  139. for(var/obj/structure/falsewall/W in range(temploc,1))
  140. W.relativewall()
  141.  
  142. for(var/obj/structure/falserwall/W in range(temploc,1))
  143. W.relativewall()
  144. ..()
  145.  
  146. /*/turf/simulated/shuttle/wall/Del()
  147.  
  148. var/temploc = src.loc
  149.  
  150. spawn(10)
  151. for(var/turf/simulated/shuttle/wall/W in range(temploc,1))
  152. W.relativewall()
  153.  
  154. ..()*/
  155.  
  156. /turf/simulated/wall/relativewall()
  157. if(istype(src,/turf/simulated/wall/vault)) //HACK!!!
  158. return
  159.  
  160. var/junction = 0 //will be used to determine from which side the wall is connected to other walls
  161.  
  162. for(var/turf/simulated/wall/W in orange(src,1))
  163. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  164. if(src.mineral == W.mineral)//Only 'like' walls connect -Sieve
  165. junction |= get_dir(src,W)
  166. for(var/obj/structure/falsewall/W in orange(src,1))
  167. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  168. if(src.mineral == W.mineral)
  169. junction |= get_dir(src,W)
  170. for(var/obj/structure/falserwall/W in orange(src,1))
  171. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  172. if(src.mineral == W.mineral)
  173. junction |= get_dir(src,W)
  174. var/turf/simulated/wall/wall = src
  175. wall.icon_state = "[wall.walltype][junction]"
  176. return
  177.  
  178. /obj/structure/falsewall/relativewall()
  179.  
  180. var/junction = 0 //will be used to determine from which side the wall is connected to other walls
  181.  
  182. for(var/turf/simulated/wall/W in orange(src,1))
  183. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  184. if(src.mineral == W.mineral)//Only 'like' walls connect -Sieve
  185. junction |= get_dir(src,W)
  186. for(var/obj/structure/falsewall/W in orange(src,1))
  187. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  188. if(src.mineral == W.mineral)
  189. junction |= get_dir(src,W)
  190. for(var/obj/structure/falserwall/W in orange(src,1))
  191. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  192. if(src.mineral == W.mineral)
  193. junction |= get_dir(src,W)
  194. var/obj/structure/falsewall/fwall = src
  195. fwall.icon_state = "[fwall.mineral][junction]"
  196. return
  197.  
  198. /obj/structure/falserwall/relativewall()
  199.  
  200. var/junction = 0 //will be used to determine from which side the wall is connected to other walls
  201.  
  202. for(var/turf/simulated/wall/W in orange(src,1))
  203. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  204. if(src.mineral == W.mineral)//Only 'like' walls connect -Sieve
  205. junction |= get_dir(src,W)
  206. for(var/obj/structure/falsewall/W in orange(src,1))
  207. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  208. if(src.mineral == W.mineral)
  209. junction |= get_dir(src,W)
  210. for(var/obj/structure/falserwall/W in orange(src,1))
  211. if(abs(src.x-W.x)-abs(src.y-W.y)) //doesn't count diagonal walls
  212. if(src.mineral == W.mineral)
  213. junction |= get_dir(src,W)
  214. src.icon_state = "rwall[junction]"
  215. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement