Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Holo-Map
- @inputs E:wirelink
- @model models/MarkJaw/mcd/mcd.mdl
- @inputs Active ScanPos:vector HoloOutput:vector
- @inputs ScanRange HoloScale Transparent SaveTarget Next Previous
- @outputs Target:entity SavedTarget:entity
- @persist ScanPos:vector Target:entity Scanned:array Holos:array Refresh
- @persist BlackList:array Range Scale MinSize MinTargetSize Index Props Alpha
- interval(100)
- if (first()|dupefinished()){
- #entity():setColor(vec(50,50,50))
- dsJoinGroup("Security")
- dsSetScope(2)
- MinSize = 5000
- #the smallest number you set the smallest range you will get
- MinTargetSize = 100
- Index = 1
- Props = 0
- Scanned = array()
- Holos = array()
- Alpha = 255
- #ifdef holoAnim()
- hint("This E2 can't run on this server, you need to enable holo")
- #endif
- }
- #####START Manage wire inputs#####
- if (->ScanRange){
- Range = ScanRange
- }
- else{
- Range = 60000
- }
- if (->HoloScale){
- Scale = HoloScale
- }
- else{
- Scale = 50
- }
- #####END Manage wire inputs#####
- if (Next&~Next){
- holoColor(Holos[Index%Props+1,number],vec(255,255,255))
- Index += 1
- holoColor(Holos[Index%Props+1,number],vec(255,0,0))
- Target = Scanned[Index%Props,entity]
- }
- if (Previous&~Previous){
- holoColor(Holos[Index%Props+1,number],vec(255,255,255))
- Index -= 1
- holoColor(Holos[Index%Props+1,number],vec(255,0,0))
- Target = Scanned[Index%Props,entity]
- }
- if (SaveTarget&~SaveTarget){
- SavedTarget = Target
- print("Saved target")
- }
- if (~Transparent){
- if (Transparent){
- Alpha = 200
- }else{
- Alpha = 255
- }
- for (X=2,Holos:count()){
- holoAlpha(Holos[X,number],Alpha)
- }
- }
- if (dsClk("KillAll")){
- Ent = dsGetEntity()
- if (Ent == owner()){
- E:egpBox(1000,vec2(256,256),vec2(10000,10000))
- holoDeleteAll()
- }
- }
- if (!Active&~Active){
- soundStop(0)
- entity():soundPlay(1,0,"common/warning.wav")
- E:egpClear()
- holoDeleteAll()
- }
- if (Active&~Active){
- entity():soundPlay(1,0,"tech/asgard_holo.wav")
- entity():soundPlay(0,0,"npc/scanner/combat_scan_loop2.wav")
- timer("refresh",10000)
- }
- if (Active) {
- Refresh = clk("refresh")
- if (Refresh == 1) {
- holoDeleteAll()
- timer("refresh",10000)
- }
- #holo for holo emitter
- holoCreate(0)
- holoPos(0,entity():toWorld(vec(0,0,50)))
- holoAng(0,entity():angles())
- holoParent(0,entity())
- holoAlpha(0,0)
- #holo for scanning
- holoCreate(1)
- holoPos(1,entity():toWorld(vec(0,0,50)))
- holoAlpha(1,0)
- if (->HoloOutput){
- holoPos(0,HoloOutput)
- }
- else{
- holoPos(0,entity():toWorld(vec(0,0,50)))
- }
- if (->ScanPos){
- holoPos(1,ScanPos)
- }
- else{
- holoPos(1,entity():pos())
- }
- HoloDest = holoEntity(0)
- HoloScan = holoEntity(1)
- #findExcludeClass("gmod_*")
- #findExcludeClass("weapon_*")
- #findExcludeClass("shield_*")
- #findExcludeClass("energy_*")
- #findExcludeClass("cloak_*")
- findExcludeEntities(BlackList)
- findInSphere(HoloScan:pos(),Range)
- findSortByDistance(HoloScan:pos())
- Entities = findToArray()
- Scanned = array()
- Holos = array()
- Index = 1
- Props = 0
- X = 1
- while (X < Entities:count() & perf()){
- Entity = Entities[X,entity]
- if (Entity:volume()>MinSize|Entity:isPlayer()){
- ID = Entity:id()+5#+5 (you can add 5 holo before it)
- if (Entity:volume()>MinTargetSize|Entity:isPlayer()){
- #entities that will be targetable
- Scanned[Scanned:count()+1,entity] = Entity
- Holos[Scanned:count()+1,number] = ID
- Props += 1
- }
- holoCreate(ID)
- holoModel(ID,Entity:model())
- holoMaterial(ID,Entity:getMaterial())
- holoScale(ID,vec(1,1,1)/Scale)
- holoAlpha(ID,Alpha)
- LocalPos = HoloScan:toLocal(Entity:pos())/Scale
- LocalAng = HoloScan:toLocal(Entity:angles())
- WorldPos = HoloDest:toWorld(LocalPos)
- WorldAng = HoloDest:toWorld(LocalAng)
- holoAng(ID,WorldAng)
- holoPos(ID,WorldPos)
- holoParent(ID,HoloDest)
- ######## START EGP Texts ########
- EgpPrint = 0
- #ifdef stargateSystemType()
- if (Entity:stargateName()){
- EgpPrint = 1
- EgpName = Entity:stargateName()
- }
- if (Entity:stargateRingAddress()){
- EgpPrint = 1
- EgpName = "Rings: " + Entity:stargateRingAddress()
- }
- #endif
- if (Entity:isPlayer()){
- EgpPrint = 1
- EgpName = Entity:name()
- }
- if (EgpPrint){
- TrackerId = X
- NameId = X+Entities:count()
- E:egp3DTracker(TrackerId,Entity:pos())
- E:egpText(NameId,EgpName,vec2(0,0))
- E:egpSize(NameId,15)
- E:egpColor(NameId,vec(170,170,255))
- E:egpParent(NameId,TrackerId)
- E:egpPos(TrackerId,WorldPos)
- }
- ######## END EGP Texts ########
- }
- else{
- BlackList[BlackList:count()+1,entity] = Entity
- }
- X += 1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement