Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. @name Holo-Map
  2. @inputs E:wirelink
  3. @model models/MarkJaw/mcd/mcd.mdl
  4. @inputs Active ScanPos:vector HoloOutput:vector
  5. @inputs ScanRange HoloScale Transparent SaveTarget Next Previous
  6.  
  7. @outputs Target:entity SavedTarget:entity
  8.  
  9. @persist ScanPos:vector Target:entity Scanned:array Holos:array Refresh
  10. @persist BlackList:array Range Scale MinSize MinTargetSize Index Props Alpha
  11.  
  12.  
  13.  
  14.  
  15. interval(100)
  16.  
  17. if (first()|dupefinished()){
  18. #entity():setColor(vec(50,50,50))
  19. dsJoinGroup("Security")
  20. dsSetScope(2)
  21.  
  22. MinSize = 5000
  23. #the smallest number you set the smallest range you will get
  24.  
  25. MinTargetSize = 100
  26. Index = 1
  27. Props = 0
  28. Scanned = array()
  29. Holos = array()
  30. Alpha = 255
  31.  
  32.  
  33. #ifdef holoAnim()
  34. hint("This E2 can't run on this server, you need to enable holo")
  35. #endif
  36. }
  37.  
  38. #####START Manage wire inputs#####
  39.  
  40. if (->ScanRange){
  41. Range = ScanRange
  42. }
  43. else{
  44. Range = 60000
  45. }
  46. if (->HoloScale){
  47. Scale = HoloScale
  48. }
  49. else{
  50. Scale = 50
  51. }
  52.  
  53.  
  54. #####END Manage wire inputs#####
  55. if (Next&~Next){
  56. holoColor(Holos[Index%Props+1,number],vec(255,255,255))
  57. Index += 1
  58. holoColor(Holos[Index%Props+1,number],vec(255,0,0))
  59.  
  60. Target = Scanned[Index%Props,entity]
  61. }
  62. if (Previous&~Previous){
  63. holoColor(Holos[Index%Props+1,number],vec(255,255,255))
  64. Index -= 1
  65. holoColor(Holos[Index%Props+1,number],vec(255,0,0))
  66.  
  67. Target = Scanned[Index%Props,entity]
  68. }
  69. if (SaveTarget&~SaveTarget){
  70. SavedTarget = Target
  71. print("Saved target")
  72. }
  73. if (~Transparent){
  74. if (Transparent){
  75. Alpha = 200
  76. }else{
  77. Alpha = 255
  78. }
  79. for (X=2,Holos:count()){
  80. holoAlpha(Holos[X,number],Alpha)
  81. }
  82. }
  83.  
  84. if (dsClk("KillAll")){
  85. Ent = dsGetEntity()
  86. if (Ent == owner()){
  87. E:egpBox(1000,vec2(256,256),vec2(10000,10000))
  88. holoDeleteAll()
  89. }
  90. }
  91.  
  92. if (!Active&~Active){
  93. soundStop(0)
  94. entity():soundPlay(1,0,"common/warning.wav")
  95. E:egpClear()
  96. holoDeleteAll()
  97. }
  98. if (Active&~Active){
  99. entity():soundPlay(1,0,"tech/asgard_holo.wav")
  100. entity():soundPlay(0,0,"npc/scanner/combat_scan_loop2.wav")
  101. timer("refresh",10000)
  102. }
  103. if (Active) {
  104. Refresh = clk("refresh")
  105. if (Refresh == 1) {
  106. holoDeleteAll()
  107. timer("refresh",10000)
  108. }
  109.  
  110.  
  111.  
  112. #holo for holo emitter
  113. holoCreate(0)
  114. holoPos(0,entity():toWorld(vec(0,0,50)))
  115. holoAng(0,entity():angles())
  116. holoParent(0,entity())
  117. holoAlpha(0,0)
  118.  
  119. #holo for scanning
  120. holoCreate(1)
  121. holoPos(1,entity():toWorld(vec(0,0,50)))
  122. holoAlpha(1,0)
  123.  
  124. if (->HoloOutput){
  125. holoPos(0,HoloOutput)
  126. }
  127. else{
  128. holoPos(0,entity():toWorld(vec(0,0,50)))
  129. }
  130. if (->ScanPos){
  131. holoPos(1,ScanPos)
  132. }
  133. else{
  134. holoPos(1,entity():pos())
  135. }
  136.  
  137. HoloDest = holoEntity(0)
  138. HoloScan = holoEntity(1)
  139.  
  140. #findExcludeClass("gmod_*")
  141. #findExcludeClass("weapon_*")
  142. #findExcludeClass("shield_*")
  143. #findExcludeClass("energy_*")
  144. #findExcludeClass("cloak_*")
  145. findExcludeEntities(BlackList)
  146. findInSphere(HoloScan:pos(),Range)
  147.  
  148. findSortByDistance(HoloScan:pos())
  149.  
  150. Entities = findToArray()
  151.  
  152.  
  153. Scanned = array()
  154. Holos = array()
  155. Index = 1
  156. Props = 0
  157. X = 1
  158.  
  159. while (X < Entities:count() & perf()){
  160. Entity = Entities[X,entity]
  161.  
  162. if (Entity:volume()>MinSize|Entity:isPlayer()){
  163. ID = Entity:id()+5#+5 (you can add 5 holo before it)
  164.  
  165. if (Entity:volume()>MinTargetSize|Entity:isPlayer()){
  166. #entities that will be targetable
  167. Scanned[Scanned:count()+1,entity] = Entity
  168. Holos[Scanned:count()+1,number] = ID
  169. Props += 1
  170. }
  171.  
  172.  
  173. holoCreate(ID)
  174. holoModel(ID,Entity:model())
  175. holoMaterial(ID,Entity:getMaterial())
  176. holoScale(ID,vec(1,1,1)/Scale)
  177. holoAlpha(ID,Alpha)
  178.  
  179. LocalPos = HoloScan:toLocal(Entity:pos())/Scale
  180. LocalAng = HoloScan:toLocal(Entity:angles())
  181.  
  182. WorldPos = HoloDest:toWorld(LocalPos)
  183. WorldAng = HoloDest:toWorld(LocalAng)
  184.  
  185. holoAng(ID,WorldAng)
  186. holoPos(ID,WorldPos)
  187.  
  188.  
  189. holoParent(ID,HoloDest)
  190.  
  191. ######## START EGP Texts ########
  192. EgpPrint = 0
  193. #ifdef stargateSystemType()
  194. if (Entity:stargateName()){
  195. EgpPrint = 1
  196. EgpName = Entity:stargateName()
  197. }
  198. if (Entity:stargateRingAddress()){
  199. EgpPrint = 1
  200. EgpName = "Rings: " + Entity:stargateRingAddress()
  201. }
  202. #endif
  203. if (Entity:isPlayer()){
  204.  
  205. EgpPrint = 1
  206. EgpName = Entity:name()
  207. }
  208. if (EgpPrint){
  209. TrackerId = X
  210. NameId = X+Entities:count()
  211.  
  212. E:egp3DTracker(TrackerId,Entity:pos())
  213.  
  214. E:egpText(NameId,EgpName,vec2(0,0))
  215. E:egpSize(NameId,15)
  216. E:egpColor(NameId,vec(170,170,255))
  217.  
  218. E:egpParent(NameId,TrackerId)
  219.  
  220. E:egpPos(TrackerId,WorldPos)
  221. }
  222. ######## END EGP Texts ########
  223. }
  224. else{
  225. BlackList[BlackList:count()+1,entity] = Entity
  226. }
  227. X += 1
  228. }
  229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement