Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function iGo2_Chat(ply,txt)
- local explode = string.Explode(" ",txt)
- if ply:IsSuperAdmin() or iGo2_AsLeDroit(ply:SteamID()) then
- if explode[1] == "!dial" then
- if explode[2] != "" and explode[2] != nil then
- iGo2_OpenGates_DepartClosest_DestChat(ply,explode[2])
- else
- iGo2_SendColoredText(ply,"Veuillez rentrer une adresse !",Color(255,255,255))
- end
- return ""
- elseif explode[1] == "!close" then
- iGo2_CloseGate(ply)
- return ""
- elseif explode[1] == "!rdm" then
- iGo2_OpenGates_RandomDest(ply)
- return ""
- elseif explode[1] == "!inverse" then
- iGo2_InverseGates(ply)
- return ""
- elseif explode[1] == "!closeall" and ply:IsSuperAdmin() then
- iGo2_CloseAllGates(ply)
- return ""
- elseif explode[1] == "!dialid" then
- if explode[2] != "" and tonumber(explode[2]) != nil then
- iGo2_OpenGates_DepartClosest_DestID(ply,explode[2])
- else
- iGo2_SendColoredText(ply,"Veuillez rentrer un ID !",Color(255,255,255))
- end
- return ""
- elseif explode[1] == "!miroir" then
- iGo2_CreateMiroir(ply)
- return ""
- elseif explode[1] == "!iris" and ply:IsSuperAdmin() then
- iGo2_DisableIris(ply)
- return ""
- elseif explode[1] == "!boom" and ply:IsSuperAdmin() then
- iGo2_TrololoBOOM(ply)
- return ""
- elseif explode[1] == "!igorank" and ply:IsSuperAdmin() then
- if explode[2] != "" and explode[2] != nil then
- iGo2_Rank(ply,explode[2])
- end
- return ""
- elseif explode[1] == "!igodel" and ply:IsSuperAdmin() then
- if explode[2] != "" and explode[2] != nil then
- iGo2_UnRank(ply,explode[2])
- end
- return ""
- elseif explode[1] == "!liste" then
- iGo2_ACC_Liste(ply)
- return ""
- elseif explode[1] == "!tollan" then
- iGo2_TollanGate(ply)
- elseif explode[1] == "!atlantis" then
- iGo2_AtlantisGate(ply)
- end
- else
- if txt == "!tollan" then
- iGo2_TollanGate(ply)
- elseif txt == "!atlantis" then
- iGo2_AtlantisGate(ply)
- end
- end
- end
- hook.Add("PlayerSay","iGo2_Chat",iGo2_Chat)
- local function FilterList(list, criterion)
- local index = 1
- while index <= #list do
- if not criterion(list[index]) then
- list[index] = list[#list]
- table.remove(list)
- else index = index + 1 end
- end
- return list
- end
- function iGo2_AtlantisGate(jou)
- porte = iGo2_TrouverGate(ply)
- if jou:IsAdmin() or jou:IsSuperAdmin() then
- if porte != nil then
- if porte:GetClass() == "stargate_atlantis" then
- if porte.IsTollan then
- iGo2_AtlantisRAW(porte)
- iGo2_SendColoredText(jou,"Transformation : tollan --> atlantis ( ADMIN ! )",Color(255,255,255))
- else iGo2_SendColoredText(jou,"Cette porte n'est pas une porte Tollan !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Cette porte n'est pas une Stargate Atlantis-Tollan !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Vous n'etes pres d'aucune porte !",Color(255,0,0)) end
- else
- if porte != nil then
- if porte:GetClass() == "stargate_atlantis" then
- if porte.Owner == jou then
- if porte.IsTollan then
- iGo2_AtlantisRAW(porte)
- iGo2_SendColoredText(jou,"Transformation : tollan --> atlantis ( NON ADMIN ! )",Color(255,255,255))
- else iGo2_SendColoredText(jou,"Cette porte n'est pas une porte Tollan !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Vous ne possedez pas cette porte, impossible de la transformer en Atlantis !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Cette porte n'est pas une Stargate Atlantis-Tollan !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Vous n'etes pres d'aucune porte !",Color(255,0,0)) end
- end
- end
- function iGo2_AtlantisRAW(porte)
- porte:AddChevron()
- for i=1,7 do porte.Chevron[i]:SetAngles(porte:GetAngles()) end
- porte:SetModel("models/zup/stargate/sga_base.mdl")
- porte.Sounds = {
- Ring=Sound("stargate/gate_roll_atlantis.mp3"),
- Open=Sound("stargate/gate_open_atlantis.mp3"),
- Travel=Sound("stargate/gate_travel.mp3"),
- Close=Sound("stargate/gate_close.mp3"),
- Chevron=Sound("stargate/chevron_atlantis.mp3"),
- Inbound=Sound("stargate/chevron_atlantis_incoming.mp3"),
- Lock=Sound("stargate/chevron_lock_atlantis.mp3"),
- LockInbound=Sound("stargate/chevron_lock_atlantis_incoming.mp3"),
- Fail=Sound("stargate/dial_fail_atlantis.mp3")
- }
- porte.IsTollan = false
- end
- function iGo2_TollanGate(jou)
- porte = iGo2_TrouverGate(jou)
- if jou:IsAdmin() or jou:IsSuperAdmin() then
- if porte != nil then
- if porte:GetClass() == "stargate_atlantis" then
- if not porte.IsTollan then
- iGo2_TollanRAW(porte)
- iGo2_SendColoredText(jou,"Transformation : atlantis --> tollan ( ADMIN ! )",Color(255,255,255))
- else iGo2_SendColoredText(jou,"Cette porte est deja une porte Tollan !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Cette porte n'est pas une Stargate Atlantis !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Vous n'etes pres d'aucune porte !",Color(255,0,0)) end
- else
- if porte != nil then
- if porte:GetClass() == "stargate_atlantis" then
- if porte.Owner == jou then
- if not porte.IsTollan then
- iGo2_TollanRAW(porte)
- iGo2_SendColoredText(jou,"Transformation : atlantis --> tollan ( NON ADMIN !)",Color(255,255,255))
- else iGo2_SendColoredText(jou,"Cette porte est deja une porte Tollan !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Vous ne possedez pas cette porte, impossible de la transformer en Tollan !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Cette porte n'est pas une Stargate Atlantis !",Color(255,0,0)) end
- else iGo2_SendColoredText(jou,"Vous n'etes pres d'aucune porte !",Color(255,0,0)) end
- end
- end
- function iGo2_TollanRAW(porte)
- porte:SetModel("models/Cebt/test_sgt.mdl")
- for i=1,7 do porte.Chevron[i]:Remove() end
- porte.Sounds = {
- Ring=Sound("stargate/supergate/roll.mp3"),
- Open=Sound("stargate/shield/hit_2.mp3"),
- Lock=Sound("stargate/shield/close.mp3"),
- Chevron=Sound("stargate/iris_atlantis_hit.mp3"),
- Inbound=Sound("stargate/iris_atlantis_hit.mp3"),
- LockInbound=Sound("stargate/shield/close.mp3"),
- Fail=Sound("stargate/iris/hit_2.mp3")
- }
- porte.IsTollan = true
- end
- function iGo2_FindPEByName(name)
- name = string.lower(name)
- return FilterList(player.GetAll(), function(ent) return string.find(string.lower(ent:GetName()), name,1,true) end)[1]
- end
- function iGo2_ACC_Liste(ply)
- if table.Count(iGo2_AcceptedClients) == 0 then
- ply:ChatPrint("liste vide")
- else
- ply:ChatPrint("liste :")
- for k,v in pairs(iGo2_AcceptedClients) do
- ply:ChatPrint(tostring(k).." : "..v)
- end
- end
- end
- function iGo2_ReloadFile()
- if file.Exists("iGo2AcceptedClients.txt") then
- iGo2_AcceptedClients = glon.decode(file.Read("iGo2AcceptedClients.txt"))
- else
- file.Write("iGo2AcceptedClients.txt",glon.encode({}))
- iGo2_AcceptedClients = {}
- end
- end
- iGo2_ReloadFile()
- function iGo2_RewriteFile()
- file.Write("iGo2AcceptedClients.txt",glon.encode(iGo2_AcceptedClients))
- end
- function iGo2_Rank(ply,name)
- local temp_arank = iGo2_FindPEByName(name)
- if temp_arank then
- local verify_print = iGo2_RankRAW(temp_arank)
- if verify_print then
- iGo2_SendColoredText(ply,"Le joueur \\\""..temp_arank:Nick().."\\\" possede deja le droit d'utiliser iGo V2.",Color(255,255,255))
- else
- iGo2_SendColoredText(ply,"Le joueur \\\""..temp_arank:Nick().."\\\" peut maintenant utiliser iGo V2.",Color(255,255,255))
- end
- else
- iGo2_SendColoredText(ply,"Joueur introuvable !",Color(255,255,255))
- end
- end
- function iGo2_UnRank(ply,name)
- local temp_arank = iGo2_FindPEByName(name)
- if temp_arank then
- local verify_print = iGo2_UnRankRAW(temp_arank)
- if verify_print then
- iGo2_SendColoredText(ply,"Le joueur \\\""..temp_arank:Nick().."\\\" n'a plus le droit d'utiliser iGo V2.",Color(255,255,255))
- else
- iGo2_SendColoredText(ply,"Le joueur n'est pas present dans la liste ACC.",Color(255,255,255))
- end
- else
- iGo2_SendColoredText(ply,"Joueur introuvable !",Color(255,255,255))
- end
- end
- function iGo2_UnRankRAW(temp_arank)
- local TEMP = false
- if table.Count(iGo2_AcceptedClients) != 0 then
- for k,v in pairs(iGo2_AcceptedClients) do
- if v == temp_arank:SteamID() then
- TEMP = true
- TEMP_NUM = k
- end
- end
- end
- if TEMP == true then
- iGo2_SendColoredText(temp_arank,"Vous n'avez plus le droit d'utiliser iGo V2...",Color(255,255,255))
- table.remove(iGo2_AcceptedClients,TEMP_NUM)
- iGo2_RewriteFile()
- end
- return TEMP
- end
- function iGo2_RankRAW(temp_arank)
- local TEMP = false
- if table.Count(iGo2_AcceptedClients) != 0 then
- for k,v in pairs(iGo2_AcceptedClients) do
- if v == temp_arank:SteamID() then TEMP = true end
- end
- end
- if TEMP == false then
- table.insert(iGo2_AcceptedClients,temp_arank:SteamID())
- iGo2_SendColoredText(temp_arank,"Felicitations, un administrateur vous donne le droit d'utiliser iGo V2 !",Color(255,255,255))
- iGo2_RewriteFile()
- end
- return TEMP
- end
- function iGo2_AsLeDroit(SID)
- local RET = false
- for k,v in pairs(iGo2_AcceptedClients) do
- if v == SID then RET = true end
- end
- return RET
- end
- function iGo2_TrololoBOOM(ply)
- local VerifyGates = iGo2_TrouverGate(ply)
- if VerifyGates != nil then
- if VerifyGates.IsOpen then
- StargateExtras:DestroyStargate(VerifyGates.Target)
- iGo2_SendColoredText(ply,"YA TATATA YA TATATATATATA KABOOOOOOOOOM !",Color(255,255,255))
- else
- iGo2_SendColoredText(ply,"La porte la plus proche n'est pas ouverte !.",Color(255,255,255))
- end
- else
- iGo2_SendColoredText(ply,"Aucune porte sur la map.",Color(255,255,255))
- end
- end
- function iGo2_DisableIris(ply)
- local VerifyGates = iGo2_TrouverGate(ply)
- if VerifyGates != nil then
- if VerifyGates.IsOpen then
- local Iris1 = iGo2_GetIrisFromGate(VerifyGates)
- if Iris1 then if Iris1.IsActivated then Iris1:Toggle() end end
- local Iris2 = iGo2_GetIrisFromGate(VerifyGates.Target)
- if Iris2 then if Iris2.IsActivated then Iris2:Toggle() end end
- else
- local Iris1 = iGo2_GetIrisFromGate(VerifyGates)
- if Iris1 then if Iris1.IsActivated then Iris1:Toggle() end end
- end
- else
- iGo2_SendColoredText(ply,"Aucune porte sur la map.",Color(255,255,255))
- end
- end
- function iGo2_GetIrisFromGate(porte)
- local Final = nil
- local max = 15
- for _,v in pairs(ents.FindByClass("stargate_iris")) do
- local distance = (porte:GetPos()-v:GetPos()):Length()
- if ( distance < max ) then
- max = distance
- Final = v
- end
- end
- return Final
- end
- function iGo2_CloseGate(jou)
- local Porte = iGo2_TrouverGate(jou)
- if Porte.IsOpen then
- Porte:AbortDialling()
- hook.Call("StarGate.Player.ClosedGate",GAMEMODE,jou,Porte)
- iGo2_SendColoredText(jou,"Fermeture de la porte !",Color(255,255,255))
- else
- iGo2_SendColoredText(jou,"Cette porte n'est pas ouverte !",Color(255,255,255))
- end
- end
- function iGo2_UnlinkG(SG)
- if SG != nil then
- if SG.IsOpen then
- SG.DialledAddress = {}
- SG.Target = nil
- SG:Close(1)
- end
- end
- end
- function iGo2_SendColoredText(ply,txt,col)
- ply:SendLua("chat.AddText(Color(200,100,0),\"[iGo] \",Color("..col.r..","..col.g..","..col.b.."),\""..txt.."\")")
- end
- function iGo2_OpenGates_RandomDest(ply)
- local Tdep = iGo2_TrouverGate(ply)
- local Tdest = iGo2_GetRandomGate_Except(Tdep,ply)
- iGo2_OpenGates_Security(ply,Tdep,Tdest)
- end
- function iGo2_CloseAllGates(ply)
- local VerifyGates = iGo2_TrouverGate(ply)
- if VerifyGates != nil then
- for k,v in pairs(iGo2_ListeGates()) do
- v:AbortDialling()
- end
- iGo2_SendColoredText(ply,"Fermeture de toute les portes de la map !",Color(255,255,255))
- else
- iGo2_SendColoredText(ply,"Aucune porte sur la map !",Color(255,255,255))
- end
- end
- function iGo2_InverseGates(ply)
- local VerifyGates = iGo2_TrouverGate(ply)
- if VerifyGates != nil then
- TINVDepart = iGo2_TrouverGate(ply)
- if TINVDepart.IsOpen then
- if TINVDepart.Outbound then
- iGo2_OpenGates_Security(ply,TINVDepart.Target,TINVDepart)
- else
- iGo2_OpenGates_Security(ply,TINVDepart,TINVDepart.Target)
- end
- else
- iGo2_SendColoredText(ply,"Impossible d'inverser les vortex, cette porte n'est pas ouverte.",Color(255,255,255))
- end
- else
- iGo2_SendColoredText(ply,"Aucune porte sur la map.",Color(255,255,255))
- end
- end
- function iGo2_GetRandomGate_Except(gatetoeject,ply)
- TEMP_LG = iGo2_ListeGates()
- if table.Count(TEMP_LG) > 1 then
- local TEMP_LG = iGo2_ListeGates()
- for k,v in pairs(TEMP_LG) do
- if v == gatetoeject then
- table.remove(TEMP_LG,k)
- end
- end
- local random_number_gate = math.random(1,table.Count(TEMP_LG))
- return TEMP_LG[random_number_gate]
- else
- return nil
- end
- end
- function iGo2_OpenGates_DepartClosest_DestChat(ply,txt)
- local departT = iGo2_TrouverGate(ply)
- local destT = iGo2_AddressToEntity(txt)
- iGo2_OpenGates_Security(ply,departT,destT)
- end
- function iGo2_OpenGates_DepartClosest_DestID(ply,testnum)
- local departT = iGo2_TrouverGate(ply)
- local destT = ents.GetByIndex(tonumber(testnum))
- if destT:EntIndex() != 0 and destT != nil then
- if destT.IsStargate then
- iGo2_OpenGates_Security(ply,departT,destT)
- else
- iGo2_SendColoredText(ply,"La destination "..tonumber(testnum).." n'est pas une stargate ( \\\""..destT:GetClass().."\\\" )!",Color(255,255,255))
- end
- else
- iGo2_SendColoredText(ply,"La destination "..tonumber(testnum).." n'existe pas !",Color(255,255,255))
- end
- end
- function iGo2_OpenGates_Security(ply,depf,destf)
- if ValidEntity(ply) then
- if ply:IsPlayer() then
- if !depf then
- iGo2_SendColoredText(ply,"Stargate de depart invalide !",Color(255,255,255))
- elseif !destf then
- iGo2_SendColoredText(ply,"Stargate de destination invalide !",Color(255,255,255))
- depf.EmitSound(depf,depf.Sounds.Fail,90,math.random(95,105))
- elseif depf == destf then
- iGo2_SendColoredText(ply,"Impossible d'appeler la meme porte ! ( Depart = Destination )",Color(255,255,255))
- depf.EmitSound(depf,depf.Sounds.Fail,90,math.random(95,105))
- else
- iGo2_OpenTwoGates(depf,destf)
- iGo2_SendColoredText(ply,"Ouverture vers "..string.upper(destf:GetGateAddress()).." !",Color(255,255,255))
- end
- end
- end
- end
- function iGo2_AddressToEntity(addr)
- local find = nil
- for k,v in pairs(iGo2_ListeGates()) do
- if string.lower(v:GetGateAddress()) == string.lower(addr) then
- find = v
- end
- end
- return find
- end
- function iGo2_CreateMiroir(ply)
- MiroirT = iGo2_TrouverGate(ply)
- if MiroirT != nil then
- MiroirT.Target = MiroirT
- MiroirT.Outbound = true
- iGo2_ActChevron(MiroirT,0)
- iGo2_CreateEV(MiroirT)
- MiroirT.EventHorizon:SetMaterial("models/props_lab/Tank_Glass001")
- iGo2_SendColoredText(ply,"Creation d'une stargate miroir !",Color(255,255,255))
- else
- iGo2_SendColoredText(ply,"Aucune porte sur la map.",Color(255,255,255))
- end
- end
- function iGo2_OpenTwoGates(gate1,gate2)
- if gate1.IsStargate and gate2.IsStargate then
- if gate1.Target != gate2 and gate2.Target != gate1 then
- if gate1.IsOpen then iGo2_UnlinkG(gate1.Target) end
- if gate2.IsOpen then iGo2_UnlinkG(gate2.Target) end
- end
- local Iris1 = iGo2_GetIrisFromGate(gate1)
- if Iris1 then if Iris1.IsActivated then Iris1:Toggle() end end
- local Iris2 = iGo2_GetIrisFromGate(gate2)
- if Iris2 then if Iris2.IsActivated then Iris2:Toggle() end end
- gate1.Target = gate2
- gate2.Target = gate1
- gate1.Outbound = true
- gate2.Outbound = false
- iGo2_ActChevron(gate1,0)
- iGo2_ActChevron(gate2,1)
- iGo2_CreateEV(gate1)
- iGo2_CreateEV(gate2)
- gate1.IsOpen = true
- gate2.IsOpen = true
- iGo2_ActivateDHD(gate1,gate2:GetGateAddress())
- iGo2_ActivateDHD(gate2,gate1:GetGateAddress())
- end
- end
- function iGo2_ListeGates()
- local sg1 = ents.FindByClass("stargate_sg1")
- local sga = ents.FindByClass("stargate_atlantis")
- local sg1p = ents.FindByClass("stargate_energy_sg1")
- local gates = {}
- for _,v in pairs(sg1) do table.insert(gates,v) end
- for _,v in pairs(sga) do table.insert(gates,v) end
- for _,v in pairs(sg1p) do table.insert(gates,v) end
- return gates
- end
- function iGo2_TrouverGate(jou)
- tr = jou:GetEyeTrace()
- Find = 0
- if tr.Entity:IsValid() then
- AimEnt = tr.Entity
- if AimEnt:GetClass() != "stargate_iris" and AimEnt:GetClass():find("stargate_") then
- Find = 1
- return AimEnt
- end
- end
- if Find == 0 then
- local gate
- local dist = 1000000
- local pos = jou:GetPos()
- for _,v in pairs(iGo2_ListeGates()) do
- local sg_dist = (pos-v:GetPos()):Length()
- if ( sg_dist < dist ) then
- dist = sg_dist
- gate = v
- end
- end
- return gate
- end
- end
- function iGo2_ActChevron(Porte,inbound)
- if not Porte:IsPlayer() then
- if Porte:GetClass() == "stargate_atlantis" or Porte:GetClass() == "stargate_sg1" then
- for i=1,7 do
- Porte.Chevron[i]:Fire("skin",1)
- Porte:SetNWBool("chevron"..i,true)
- end
- Porte:Fire("SetBodyGroup",8+inbound)
- end
- end
- end
- function iGo2_ActivateDHD(gate,address)
- if address == "" then
- for k,v in pairs(gate:FindDHD()) do
- v:AddChevron("DIAL",true)
- end
- else
- for k,v in pairs(gate:FindDHD()) do
- for u,i in pairs(string.Explode("",address)) do
- v:AddChevron(i,true)
- end
- v:AddChevron("DIAL",true)
- end
- end
- end
- function iGo2_CreateEV(SG)
- if not SG:IsPlayer() then SG:SetStatus(true,false,false) end
- local e = ents.Create("event_horizon")
- e:SetPos(SG:GetPos())
- e:SetAngles(SG:GetAngles())
- e:SetParent(SG.Entity)
- e:SetEVInstantOpen()
- if SG.Sounds and SG.Sounds.Open then e.Sounds.Open = SG.Sounds.Open end
- e:Spawn()
- e:Activate()
- if SG.Outbound then e:SetTarget(SG.Target) end
- if ValidEntity(SG.EventHorizon) then SG.EventHorizon:Remove() end
- SG.EventHorizon = e
- end
- function iGo2_SG_Initialize(EventHorizon)
- EventHorizon.Sounds = {
- Idle=Sound("stargate/wormhole_loop.wav"),
- Teleport=Sound("stargate/teleport.mp3"),
- Shutdown=Sound("stargate/gate_close.mp3"),
- Open=Sound("stargate/shield/hit.mp3")
- }
- EventHorizon.Entity:SetModel(EventHorizon.Model)
- EventHorizon.Entity:PhysicsInit(SOLID_VPHYSICS)
- EventHorizon.Entity:SetMoveType(MOVETYPE_NONE)
- EventHorizon.Entity:SetTrigger(true)
- EventHorizon.Entity:SetNotSolid(true)
- EventHorizon.Entity:DrawShadow(false)
- EventHorizon.Entity:SetColor(255,255,255,1)
- EventHorizon.Created = CurTime()
- EventHorizon.AutoClose = StarGate.CFG:Get("stargate","autoclose",true)
- EventHorizon.HorizonRadius = 150
- EventHorizon.OpeningDelay = 0.7
- EventHorizon.OpenTime = 0.7
- EventHorizon.Holding = {}
- EventHorizon.DoNotDestroy = {}
- iGo2_SG_Open(EventHorizon)
- local phys = EventHorizon.Entity:GetPhysicsObject()
- if phys:IsValid() then
- phys:EnableCollisions(true)
- end
- end
- function iGo2_SG_Open(EventHorizon)
- EventHorizon.Attached = {}
- local parent = EventHorizon.Entity:GetParent()
- if ValidEntity(parent) then
- EventHorizon.Attached[parent] = true
- EventHorizon.Attached[parent.Target] = true
- EventHorizon.Attached[EventHorizon.Entity] = true
- for _,v in pairs(StarGate.GetConstrainedEnts(parent,10) or {}) do EventHorizon.Attached[v] = true end
- end
- local e = EventHorizon.Entity
- local fx = EffectData()
- fx:SetEntity(e)
- fx:SetOrigin(e:GetPos())
- fx:SetScale(EventHorizon.OpeningDelay+0.1);
- util.Effect("eventhorizon_open",fx,true,true);
- EventHorizon.Entity:EmitSound(EventHorizon.Sounds.Open,90,math.random(98,102))
- timer.Create("EventHorizonOpening"..EventHorizon.Entity:EntIndex(),EventHorizon.OpeningDelay,1,
- function()
- if ValidEntity(e) then
- local blocked = false
- if ValidEntity(parent) and parent.IsStargate then blocked = parent:IsBlocked() end
- if not ValidEntity(EventHorizon.Target) and ValidEntity(EventHorizon.TargetGate) then EventHorizon.Target = EventHorizon.TargetGate.EventHorizon end
- e:SetNWEntity("Target",EventHorizon.Target)
- local pos = e:GetPos()
- e:SetColor(255,255,255,255)
- timer.Simple(e.OpenTime+0.3,function()
- if ValidEntity(e) then e:SetColor(255,255,255,255) end
- end)
- e:SetNWBool("activate_lights",true)
- util.ScreenShake(pos,2,2.5,3,1000)
- e.IdleSound = CreateSound(e,e.Sounds.Idle)
- e.IdleSound:Play()
- local fx = EffectData()
- fx:SetEntity(e)
- fx:SetOrigin(pos)
- fx:SetScale(e.OpenTime)
- util.Effect("eventhorizon_stabilize",fx,true,true)
- local fx = EffectData()
- fx:SetEntity(e)
- fx:SetOrigin(pos)
- util.Effect("eventhorizon_refract",fx,true,true)
- end
- end)
- end
- function iGo2_SG_OpenViaConsoleCommand(ply,C,A)
- if A[1] != nil then
- if A[1] != "" then
- iGo2_OpenGates_DepartClosest_DestID(ply,A[1])
- else
- iGo2_SendColoredText(ply,"DEBUG CONSOLE / Empty value for arg",Color(255,255,255))
- end
- else
- iGo2_SendColoredText(ply,"DEBUG CONSOLE / Nil value for arg",Color(255,255,255))
- end
- end
- concommand.Add("_iGoV2_OpenClosestGateToEntIndex",iGo2_SG_OpenViaConsoleCommand)
- EV_MT = FindMetaTable("Entity")
- function EV_MT:SetEVInstantOpen()
- self.Initialize = function() iGo2_SG_Initialize(self) end
- end
Add Comment
Please, Sign In to add comment