Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Sirius Satellite - PropCore
- @persist [Lights Gens SGens EStor WStor SStor CStor PewAr]:array
- @persist [E T S Node Pe Planet]:entity
- @persist [Avoid AvoidSize]:array
- @persist Light Ready
- @persist [PewPew EneStor WatStor SteStor SteGe]:wirelink
- @persist [PlPos TPos]:vector PlRad TRad Moved
- @outputs C
- if(duped())
- {
- timer("init",1500)
- gSetGroup("Sirius Satellites")
- C=gGetNum("count")
- gSetNum("count",C+1)
- }
- if(first()|clk("init"))
- {
- if(first())
- {
- gSetGroup("Sirius Satellites")
- C=gGetNum("count")
- gSetNum("count",C+1)
- }
- E=entity()
- S=E:isWeldedTo()
- Avoid=array(vec(-9728,-6144,-8192),vec(2.3,-1.4,4620),vec(4041,-10257,-2047))
- AvoidSize=array(5658,9549,1724)
- if(S:getColor()==vec(255,0,0))
- {
- S:setColor(vec(255,255,255))
- }
- Bloop=E:getConstraints()
- foreach(In,Bl:entity=Bloop)
- {
- if(Bl:owner()==owner())
- {
- if(Bl:type():find("generator"))
- {
- if(Bl:type():find("fusion"))
- {
- Gens:pushEntity(Bl)
- }
- elseif(Bl:type():find("steam"))
- {
- SGens:pushEntity(Bl)
- Ge=Bl:getWirelink()
- Ge["Mute",number]=1
- Ge["Multplier",number]=5
- Ge["On",number]=1
- }
- }
- elseif(Bl:type()=="gmod_wire_light")
- {
- Lights:pushEntity(Bl)
- Light=1
- }
- elseif(Bl:type()=="pewpew_base_cannon")
- {
- PewPew=Bl:getWirelink()
- PewAr:pushEntity(Bl)
- Pe=Bl
- }
- elseif(Bl:type()=="resource_node")
- {
- Node=Bl
- }
- elseif(Bl:type():find("storage"))
- {
- if(Bl:type():find("water"))
- {
- WStor:pushEntity(Bl)
- }
- elseif(Bl:type():find("cache"))
- {
- CStor:pushEntity(Bl)
- }
- elseif(Bl:type():find("energy"))
- {
- EStor:pushEntity(Bl)
- }
- elseif(Bl:type():find("steam"))
- {
- SStor:pushEntity(Bl)
- }
- }
- elseif(Bl:type()=="rd_pump")
- {
- Pump=Bl
- }
- }
- }
- findByClass("base_sb_planet*")
- findSortByDistance(E:pos())
- Planet=find()
- PlPos=Planet:pos()
- if(map()=="sb_gooniverse")
- {
- if(PlPos==vec(-9728,-6144,-8192))
- {
- PlRad=5658
- }
- elseif(PlPos==vec(2.3,-1.4,4620))
- {
- PlRad=9549
- }
- else
- {
- PlRad=6000
- }
- TRad=PlRad*200
- }
- XR=random(-1,1)
- YR=0-XR
- ZR=0.8
- TPos=PlPos+(vec(XR,YR,ZR)*(PlRad*1.3))
- if(EStor:count())
- {
- EneStor=EStor[1,entity]:getWirelink()
- }
- elseif(CStor:count())
- {
- EneStor=CStor[1,entity]:getWirelink()
- }
- if(WStor:count())
- {
- WatStor=WStor[1,entity]:getWirelink()
- }
- elseif(CStor:count())
- {
- WatStor=CStor[1,entity]:getWirelink()
- }
- if(SStor:count())
- {
- SteStor=SStor[1,entity]:getWirelink()
- }
- if(SGens:count())
- {
- SteGe=SGens[1,entity]:getWirelink()
- }
- if(Node)
- {
- timer("link1",100)
- Pump:link(Node)
- }
- else
- {
- Error=1
- S:setColor(vec(255,0,0))
- exit()
- }
- findClearWhiteList()
- findClearBlackList()
- }
- if(clk("link1"))
- {
- timer("link2",100)
- foreach(In,Bl:entity=Gens)
- {
- Bl:link(Node)
- Bl:setColor(vec(50,0,0))
- }
- }
- if(clk("link2"))
- {
- timer("link3",100)
- foreach(In,Bl:entity=SGens)
- {
- Bl:link(Node)
- Bl:setColor(vec(50,0,0))
- }
- }
- if(clk("link3"))
- {
- timer("link4",100)
- foreach(In,Bl:entity=EStor)
- {
- Bl:link(Node)
- Bl:setColor(vec(50,0,0))
- }
- }
- if(clk("link4"))
- {
- timer("link5",100)
- foreach(In,Bl:entity=WStor)
- {
- Bl:link(Node)
- Bl:setColor(vec(50,0,0))
- }
- }
- if(clk("link5"))
- {
- timer("link6",100)
- foreach(In,Bl:entity=WStor)
- {
- Bl:link(Node)
- Bl:setColor(vec(50,0,0))
- }
- }
- if(clk("link6"))
- {
- timer("link7",100)
- foreach(In,Bl:entity=SStor)
- {
- Bl:link(Node)
- Bl:setColor(vec(50,0,0))
- }
- }
- if(clk("link7"))
- {
- timer("link8",100)
- foreach(In,Bl:entity=CStor)
- {
- Bl:link(Node)
- Bl:setColor(vec(50,0,0))
- }
- }
- if(clk("link8"))
- {
- timer("color",1500)
- if(Pe)
- {
- Pe:link(Node)
- Pe:setColor(vec(50,0,0))
- }
- }
- if(clk("color"))
- {
- Bloop=S:getConstraints()
- foreach(In,Bl:entity=Bloop)
- {
- Bl:setColor(vec(255,255,255))
- Bl:parentTo(S)
- Bl:propFreeze(0)
- # Bl:propNotSolid(1)
- }
- Ready=1
- S:propFreeze(1)
- }
- if(clk("move"))
- {
- Bloop=S:getConstraints()
- Bloop:pushEntity(S)
- foreach(In,Bl:entity=Bloop)
- {
- Offset=S:toLocal(Bl:pos())
- Bl:setPos(TPos+Offset)
- }
- Moved=1
- }
- if(Ready)
- {
- if(Pe&findCanQuery()&Moved)
- {
- findIncludeClass("pewpew")
- findIncludeClass("gyro")
- findIncludeClass("expression")
- findIncludeClass("player")
- findExcludeClass("roid")
- findExcludeClass("sa_crystal")
- findExcludeClass("pewpew_base_bullet")
- findExcludePlayerProps(owner())
- findExcludePlayer(owner())
- findInSphere(PlPos,TRad)
- for(I=1,3)
- {
- findClipFromSphere(Avoid[I,vector],AvoidSize[I,number])
- } T=find()
- if(T)
- {
- foreach(In,Pew:entity=PewAr)
- {
- PewPew=Pew:getWirelink()
- if(PewPew:hasInput("XYZ"))
- {
- PewPew["XYZ",vector]=T:pos()
- }
- if(PewPew["Can Fire",number])
- {
- PewPew["Fire",number]=1
- }
- else
- {
- PewPew["Fire",number]=0
- }
- }
- }
- }
- if(T)
- {
- interval(10)
- Gyro=(T:pos()-S:pos()):toAngle()
- }
- else
- {
- interval(500)
- Gyro=(PlPos-S:pos()):toAngle()
- }
- S:setAng(Gyro)
- if(WatStor["Water",number]<=150)
- {
- gSetEnt("Request",E)
- }
- else
- {
- if(EneStor["Energy",number]>=EneStor["Max Energy",number])
- {
- foreach(In,Bl:entity=Gens)
- {
- Ge=Bl:getWirelink()
- Ge["On",number]=0
- }
- if(!Moved)
- {
- timer("move",1000)
- }
- }
- else
- {
- foreach(In,Bl:entity=Gens)
- {
- Ge=Bl:getWirelink()
- Ge["On",number]=1
- }
- }
- }
- if(SteStor["Steam",number]>=SteGe["SteamUsage",number])
- {
- foreach(In,Bl:entity=SGens)
- {
- Ge=Bl:getWirelink()
- Ge["On",number]=1
- }
- }
- else
- {
- foreach(In,Bl:entity=SGens)
- {
- Ge=Bl:getWirelink()
- Ge["On",number]=0
- }
- }
- }
- if(last())
- {
- gSetNum("count",gGetNum("count")-1)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement