Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.79 KB | None | 0 0
  1. @name Sirius Satellite - PropCore
  2. @persist [Lights Gens SGens EStor WStor SStor CStor PewAr]:array
  3. @persist [E T S Node Pe Planet]:entity
  4. @persist [Avoid AvoidSize]:array
  5. @persist Light Ready
  6. @persist [PewPew EneStor WatStor SteStor SteGe]:wirelink
  7. @persist [PlPos TPos]:vector PlRad TRad Moved
  8. @outputs C
  9.  
  10. if(duped())
  11. {
  12. timer("init",1500)
  13. gSetGroup("Sirius Satellites")
  14. C=gGetNum("count")
  15. gSetNum("count",C+1)
  16. }
  17.  
  18. if(first()|clk("init"))
  19. {
  20. if(first())
  21. {
  22. gSetGroup("Sirius Satellites")
  23. C=gGetNum("count")
  24. gSetNum("count",C+1)
  25. }
  26.  
  27. E=entity()
  28. S=E:isWeldedTo()
  29.  
  30. Avoid=array(vec(-9728,-6144,-8192),vec(2.3,-1.4,4620),vec(4041,-10257,-2047))
  31. AvoidSize=array(5658,9549,1724)
  32.  
  33. if(S:getColor()==vec(255,0,0))
  34. {
  35. S:setColor(vec(255,255,255))
  36. }
  37.  
  38. Bloop=E:getConstraints()
  39.  
  40. foreach(In,Bl:entity=Bloop)
  41. {
  42. if(Bl:owner()==owner())
  43. {
  44. if(Bl:type():find("generator"))
  45. {
  46. if(Bl:type():find("fusion"))
  47. {
  48. Gens:pushEntity(Bl)
  49. }
  50. elseif(Bl:type():find("steam"))
  51. {
  52. SGens:pushEntity(Bl)
  53. Ge=Bl:getWirelink()
  54. Ge["Mute",number]=1
  55. Ge["Multplier",number]=5
  56. Ge["On",number]=1
  57. }
  58. }
  59. elseif(Bl:type()=="gmod_wire_light")
  60. {
  61. Lights:pushEntity(Bl)
  62. Light=1
  63. }
  64. elseif(Bl:type()=="pewpew_base_cannon")
  65. {
  66. PewPew=Bl:getWirelink()
  67. PewAr:pushEntity(Bl)
  68. Pe=Bl
  69. }
  70. elseif(Bl:type()=="resource_node")
  71. {
  72. Node=Bl
  73. }
  74. elseif(Bl:type():find("storage"))
  75. {
  76. if(Bl:type():find("water"))
  77. {
  78. WStor:pushEntity(Bl)
  79. }
  80. elseif(Bl:type():find("cache"))
  81. {
  82. CStor:pushEntity(Bl)
  83. }
  84. elseif(Bl:type():find("energy"))
  85. {
  86. EStor:pushEntity(Bl)
  87. }
  88. elseif(Bl:type():find("steam"))
  89. {
  90. SStor:pushEntity(Bl)
  91. }
  92. }
  93. elseif(Bl:type()=="rd_pump")
  94. {
  95. Pump=Bl
  96. }
  97. }
  98. }
  99.  
  100. findByClass("base_sb_planet*")
  101. findSortByDistance(E:pos())
  102. Planet=find()
  103. PlPos=Planet:pos()
  104.  
  105. if(map()=="sb_gooniverse")
  106. {
  107. if(PlPos==vec(-9728,-6144,-8192))
  108. {
  109. PlRad=5658
  110. }
  111. elseif(PlPos==vec(2.3,-1.4,4620))
  112. {
  113. PlRad=9549
  114. }
  115. else
  116. {
  117. PlRad=6000
  118. }
  119.  
  120. TRad=PlRad*200
  121. }
  122.  
  123. XR=random(-1,1)
  124. YR=0-XR
  125. ZR=0.8
  126. TPos=PlPos+(vec(XR,YR,ZR)*(PlRad*1.3))
  127.  
  128. if(EStor:count())
  129. {
  130. EneStor=EStor[1,entity]:getWirelink()
  131. }
  132. elseif(CStor:count())
  133. {
  134. EneStor=CStor[1,entity]:getWirelink()
  135. }
  136.  
  137. if(WStor:count())
  138. {
  139. WatStor=WStor[1,entity]:getWirelink()
  140. }
  141. elseif(CStor:count())
  142. {
  143. WatStor=CStor[1,entity]:getWirelink()
  144. }
  145.  
  146. if(SStor:count())
  147. {
  148. SteStor=SStor[1,entity]:getWirelink()
  149. }
  150.  
  151. if(SGens:count())
  152. {
  153. SteGe=SGens[1,entity]:getWirelink()
  154. }
  155.  
  156. if(Node)
  157. {
  158. timer("link1",100)
  159. Pump:link(Node)
  160. }
  161. else
  162. {
  163. Error=1
  164. S:setColor(vec(255,0,0))
  165. exit()
  166. }
  167.  
  168. findClearWhiteList()
  169. findClearBlackList()
  170. }
  171.  
  172. if(clk("link1"))
  173. {
  174. timer("link2",100)
  175. foreach(In,Bl:entity=Gens)
  176. {
  177. Bl:link(Node)
  178. Bl:setColor(vec(50,0,0))
  179. }
  180. }
  181. if(clk("link2"))
  182. {
  183. timer("link3",100)
  184. foreach(In,Bl:entity=SGens)
  185. {
  186. Bl:link(Node)
  187. Bl:setColor(vec(50,0,0))
  188. }
  189. }
  190. if(clk("link3"))
  191. {
  192. timer("link4",100)
  193. foreach(In,Bl:entity=EStor)
  194. {
  195. Bl:link(Node)
  196. Bl:setColor(vec(50,0,0))
  197. }
  198. }
  199. if(clk("link4"))
  200. {
  201. timer("link5",100)
  202. foreach(In,Bl:entity=WStor)
  203. {
  204. Bl:link(Node)
  205. Bl:setColor(vec(50,0,0))
  206. }
  207. }
  208. if(clk("link5"))
  209. {
  210. timer("link6",100)
  211. foreach(In,Bl:entity=WStor)
  212. {
  213. Bl:link(Node)
  214. Bl:setColor(vec(50,0,0))
  215. }
  216. }
  217. if(clk("link6"))
  218. {
  219. timer("link7",100)
  220. foreach(In,Bl:entity=SStor)
  221. {
  222. Bl:link(Node)
  223. Bl:setColor(vec(50,0,0))
  224. }
  225. }
  226. if(clk("link7"))
  227. {
  228. timer("link8",100)
  229. foreach(In,Bl:entity=CStor)
  230. {
  231. Bl:link(Node)
  232. Bl:setColor(vec(50,0,0))
  233. }
  234. }
  235. if(clk("link8"))
  236. {
  237. timer("color",1500)
  238. if(Pe)
  239. {
  240. Pe:link(Node)
  241. Pe:setColor(vec(50,0,0))
  242. }
  243. }
  244. if(clk("color"))
  245. {
  246. Bloop=S:getConstraints()
  247. foreach(In,Bl:entity=Bloop)
  248. {
  249. Bl:setColor(vec(255,255,255))
  250. Bl:parentTo(S)
  251. Bl:propFreeze(0)
  252. # Bl:propNotSolid(1)
  253. }
  254.  
  255. Ready=1
  256.  
  257. S:propFreeze(1)
  258. }
  259. if(clk("move"))
  260. {
  261. Bloop=S:getConstraints()
  262. Bloop:pushEntity(S)
  263. foreach(In,Bl:entity=Bloop)
  264. {
  265. Offset=S:toLocal(Bl:pos())
  266. Bl:setPos(TPos+Offset)
  267. }
  268. Moved=1
  269. }
  270.  
  271. if(Ready)
  272. {
  273.  
  274. if(Pe&findCanQuery()&Moved)
  275. {
  276. findIncludeClass("pewpew")
  277. findIncludeClass("gyro")
  278. findIncludeClass("expression")
  279. findIncludeClass("player")
  280. findExcludeClass("roid")
  281. findExcludeClass("sa_crystal")
  282. findExcludeClass("pewpew_base_bullet")
  283. findExcludePlayerProps(owner())
  284. findExcludePlayer(owner())
  285. findInSphere(PlPos,TRad)
  286. for(I=1,3)
  287. {
  288. findClipFromSphere(Avoid[I,vector],AvoidSize[I,number])
  289. } T=find()
  290.  
  291. if(T)
  292. {
  293. foreach(In,Pew:entity=PewAr)
  294. {
  295. PewPew=Pew:getWirelink()
  296. if(PewPew:hasInput("XYZ"))
  297. {
  298. PewPew["XYZ",vector]=T:pos()
  299. }
  300.  
  301. if(PewPew["Can Fire",number])
  302. {
  303. PewPew["Fire",number]=1
  304. }
  305. else
  306. {
  307. PewPew["Fire",number]=0
  308. }
  309. }
  310. }
  311. }
  312.  
  313. if(T)
  314. {
  315. interval(10)
  316. Gyro=(T:pos()-S:pos()):toAngle()
  317. }
  318. else
  319. {
  320. interval(500)
  321. Gyro=(PlPos-S:pos()):toAngle()
  322. }
  323.  
  324. S:setAng(Gyro)
  325.  
  326. if(WatStor["Water",number]<=150)
  327. {
  328. gSetEnt("Request",E)
  329. }
  330. else
  331. {
  332. if(EneStor["Energy",number]>=EneStor["Max Energy",number])
  333. {
  334. foreach(In,Bl:entity=Gens)
  335. {
  336. Ge=Bl:getWirelink()
  337. Ge["On",number]=0
  338. }
  339.  
  340. if(!Moved)
  341. {
  342. timer("move",1000)
  343. }
  344. }
  345. else
  346. {
  347. foreach(In,Bl:entity=Gens)
  348. {
  349. Ge=Bl:getWirelink()
  350. Ge["On",number]=1
  351. }
  352. }
  353. }
  354.  
  355. if(SteStor["Steam",number]>=SteGe["SteamUsage",number])
  356. {
  357. foreach(In,Bl:entity=SGens)
  358. {
  359. Ge=Bl:getWirelink()
  360. Ge["On",number]=1
  361. }
  362. }
  363. else
  364. {
  365. foreach(In,Bl:entity=SGens)
  366. {
  367. Ge=Bl:getWirelink()
  368. Ge["On",number]=0
  369. }
  370. }
  371. }
  372.  
  373. if(last())
  374. {
  375. gSetNum("count",gGetNum("count")-1)
  376. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement