diff options
| author | Apickx <Apickx@cogarr.org> | 2015-12-28 19:18:30 -0500 |
|---|---|---|
| committer | Apickx <Apickx@cogarr.org> | 2015-12-28 19:18:30 -0500 |
| commit | 868e729d68b5913716bfe5ddb512f4099851e9a2 (patch) | |
| tree | 6441108754145dfd68a6e23bea382b5cb1ab63d5 /entities | |
| download | gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.tar.gz gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.tar.bz2 gearfox-868e729d68b5913716bfe5ddb512f4099851e9a2.zip | |
Diffstat (limited to 'entities')
27 files changed, 828 insertions, 0 deletions
diff --git a/entities/entities/base_gf_ai/cl_init.lua b/entities/entities/base_gf_ai/cl_init.lua new file mode 100644 index 0000000..44bb1fd --- /dev/null +++ b/entities/entities/base_gf_ai/cl_init.lua @@ -0,0 +1,100 @@ +include('shared.lua') + +--Took me forever to get this right.... BUT I GOT IT!! + + +local Down = Vector(0,0,-500) +local Up = Vector(0,0,50) + +function ENT:GetModelPos() + return self.ModelPos or self:GetPos() +end + +function ENT:OnRemove() + self:BecomeRagdollOnClient() + self:OnDeath() +end + +function ENT:OnDeath() +end + +function ENT:GetAIPos() + return self.RealPos or self:GetPos() +end + +function ENT:GetDestination() + return self.Destination or self:GetAIPos() +end + +function ENT:OnDraw() +end + +function ENT:OnThink() +end + +function ENT:Think() + self:OnThink() + + if (!self.ModelPos) then + self.ModelPos = self:GetPos() + self.RealPos = self:GetPos() + self.RunTimer = CurTime() + self.OldPos = self:GetPos() + self.Distance = 0 + end + + if ((self.RunTimer-CurTime()) <= 0) then return end + + local Pos1 = self.RealPos + local Pos2 = self.OldPos + + local Dir = Pos1-Pos2 + + self.ModelPos = self.OldPos+(Dir/self.Distance)*(self.Distance-(self.RunTimer-CurTime())) + + local Tr = util.TraceLine({ + start = self.ModelPos+Up, + endpos = self.ModelPos+Down, + mask = MASK_SOLID_BRUSHONLY, + filter = self.Entity, + }) + + self.ModelPos.z = Tr.HitPos.z + + local ang = Dir:Angle() + ang.p = 0 + ang.r = 0 + + self:SetRenderAngles(ang) +end + +function ENT:Draw() + self:OnDraw() + + self:SetRenderOrigin(self.ModelPos) + self:DrawModel() +end + +net.Receive("_GFAISetSpeed",function() + local Ent = ents.GetByIndex(net.ReadLong()) + local Spe = net.ReadLong() + + if (ValidEntity(Ent)) then Ent.gSpeed = Spe end +end) + +net.Receive("_GFAISetDestination",function() + local Ent = ents.GetByIndex(net.ReadLong()) + local Pos = net.ReadVector() + + if (ValidEntity(Ent)) then + Ent.Destination = Pos + + if (Ent.RealPos:Distance(Ent.ModelPos) < 20) then Ent.OldPos = Ent.ModelPos + else Ent.OldPos = Ent.RealPos*1 end + + Ent.RealPos = Pos + + Ent.Distance = (Ent.OldPos-Ent.RealPos):Length()/(Ent.gSpeed or 60) + Ent.RunTimer = CurTime() + Ent.Distance + end +end)
\ No newline at end of file diff --git a/entities/entities/base_gf_ai/init.lua b/entities/entities/base_gf_ai/init.lua new file mode 100644 index 0000000..57d6419 --- /dev/null +++ b/entities/entities/base_gf_ai/init.lua @@ -0,0 +1,139 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +local Up = Vector(0,0,20) + +util.AddNetworkString("_GFAISetSpeed") +util.AddNetworkString("_GFAISetDestination") + +function ENT:Initialize() + self:SetModel( "models/Humans/Group01/male_02.mdl" ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_OBB ) + self:DrawShadow( false ) + + self.gspeed = 200 + self.Reached = false +end + +function ENT:OnThink() +end + +function ENT:Think() + if (!self.TimerSetter) then + self.TimerSetter = CurTime() + self.Destination = self:GetPos() + self.Length = 1 + self.Direct = Vector(0,0,0) + self.OldPos = self:GetPos() + self.TimerR = 0 + self.Path = {} + self.PathProg = 0 + self.ChaseEntity = NULL + end + + local Dire = (self.Destination-self:GetPos()) + Dire.z = 0 + + if (Dire:Length() > 5) then + if (self.TimerSetter < CurTime() or self.TimerR <= CurTime()) then + self.TimerSetter = CurTime()+1 + + self:SetAIPos(self.OldPos+self.Direct*math.Clamp(1-((self.TimerR-CurTime())/self.Length),0,1)) + end + elseif (!self.Reached) then + if (self.Path[self.PathProg+1]) then + self:SetDestination(self.Path[self.PathProg+1]) + self.Path[self.PathProg] = nil + self.PathProg = self.PathProg+1 + else + self.Reached = true + self:OnDestinationReached() + + self.Path = {} + self.PathProg = 0 + end + end + + if (ValidEntity(self.ChaseEntity)) then + if (!self.Path[#self.Path] or self.Path[#self.Path]:Distance(self.ChaseEntity:GetPos()) > 60) then + self:AddAIPathNode(self.ChaseEntity:GetPos()) + end + + if (self.ChaseEntity:GetPos():Distance(self:GetPos()) > 300 and self.PathProg < 1) then + self:SetDestination(self.Path[self.PathProg+1]) + self.PathProg = self.PathProg+1 + end + end + + return self:OnThink() +end + +function ENT:OnDestinationReached() +end + +function ENT:SetAISpeed(speed) + self.gspeed = speed + + net.Start("_GFAISetSpeed") + net.WriteLong(self:EntIndex()) + net.WriteLong(speed) + net.Broadcast() +end + +function ENT:SetAIPos(Pos,bIgnoreZPos) + if (!bIgnoreZPos) then + local Tr2 = util.TraceLine({ + start = Pos+Up, + endpos = Pos-Up*5, + mask = MASK_SOLID_BRUSHONLY, + filter = self.Entity, + }) + + Pos = Tr2.HitPos + end + + self:SetPos(Pos) +end + +function ENT:SetAIPath(Dat) + self.Path = Dat + self.PathProg = 0 +end + +function ENT:AddAIPathNode(vec) + table.insert(self.Path,vec) +end + +function ENT:SetChaseEntity(ent) + self.ChaseEntity = ent +end + +function ENT:SetDestination(Pos) + self.Reached = false + self.Destination = Pos + + local Tr = util.TraceLine({ + start = self:GetPos()+Up, + endpos = Pos+Up, + mask = MASK_SOLID_BRUSHONLY, + filter = self.Entity, + }) + + if (Tr.Hit) then self.Destination = Tr.HitPos end + + self.OldPos = self:GetPos() + self.Direct = self.Destination-self:GetPos() + self.Length = self.Direct:Length()/(self.gspeed or 60) + self.TimerR = CurTime() + self.Length + + net.Start("_GFAISetDestination") + net.WriteLong(self:EntIndex()) + net.WriteVector(self.Destination) + net.Broadcast() +end + + diff --git a/entities/entities/base_gf_ai/shared.lua b/entities/entities/base_gf_ai/shared.lua new file mode 100644 index 0000000..5422615 --- /dev/null +++ b/entities/entities/base_gf_ai/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_anim" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file diff --git a/entities/entities/base_gf_ai_simple/cl_init.lua b/entities/entities/base_gf_ai_simple/cl_init.lua new file mode 100644 index 0000000..2ce0729 --- /dev/null +++ b/entities/entities/base_gf_ai_simple/cl_init.lua @@ -0,0 +1,78 @@ +include('shared.lua') + +--Took me forever to get this right.... BUT I GOT IT!! + + +local Down = Vector(0,0,-500) +local Up = Vector(0,0,50) + +function ENT:GetModelPos() + return self.ModelPos or self:GetPos() +end + +function ENT:GetAIPos() + return self.RealPos or self:GetPos() +end + +function ENT:OnDraw() +end + +function ENT:OnThink() +end + +function ENT:Think() + self:OnThink() + + if (!self.ModelPos) then + self.ModelPos = self:GetPos() + self.RealPos = self:GetPos() + self.RunTimer = CurTime() + self.OldPos = self:GetPos() + self.Distance = 0 + end + + if ((self.RunTimer-CurTime()) <= 0) then return end + + local Pos1 = self.RealPos + local Pos2 = self.OldPos + + local Dir = Pos1-Pos2 + + self.ModelPos = self.OldPos+(Dir/self.Distance)*(self.Distance-(self.RunTimer-CurTime())) + + local Tr = util.TraceLine({ + start = self.ModelPos+Up, + endpos = self.ModelPos+Down, + mask = MASK_SOLID_BRUSHONLY, + filter = self.Entity, + }) + + self.ModelPos.z = Tr.HitPos.z + + local ang = Dir:Angle() + ang.p = 0 + ang.r = 0 + + self:SetRenderAngles(ang) +end + +function ENT:Draw() + self:OnDraw() + + self:SetRenderOrigin(self.ModelPos) + self:DrawModel() +end + + +net.Receive("MoveEntity",function() + local Ent = ents.GetByIndex(net.ReadLong()) + local Pos = net.ReadVector() + + if (ValidEntity(Ent)) then + Ent.OldPos = Ent.RealPos*1 + Ent.RealPos = Pos + + Ent.Distance = (Ent.OldPos-Ent.RealPos):Length()/(Ent.gSpeed or 60) + Ent.RunTimer = CurTime() + Ent.Distance + end +end)
\ No newline at end of file diff --git a/entities/entities/base_gf_ai_simple/init.lua b/entities/entities/base_gf_ai_simple/init.lua new file mode 100644 index 0000000..a15a4f9 --- /dev/null +++ b/entities/entities/base_gf_ai_simple/init.lua @@ -0,0 +1,35 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +local Up = Vector(0,0,20) + +function ENT:Initialize() + self:SetModel( "models/Humans/Group01/male_02.mdl" ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_NONE ) + self:DrawShadow( false ) +end + +function ENT:Think() +end + +function ENT:SetAIPos(Pos) + local Tr = util.TraceLine({ + start = self:GetPos()+Up, + endpos = Pos+Up, + mask = MASK_SOLID, + filter = self.Entity, + }) + + self:SetPos(Pos) + + net.Start("MoveEntity") + net.WriteLong(self:EntIndex()) + net.WriteVector(Pos) + net.Broadcast() +end + + diff --git a/entities/entities/base_gf_ai_simple/shared.lua b/entities/entities/base_gf_ai_simple/shared.lua new file mode 100644 index 0000000..5422615 --- /dev/null +++ b/entities/entities/base_gf_ai_simple/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_anim" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file diff --git a/entities/entities/gf_citizen/cl_init.lua b/entities/entities/gf_citizen/cl_init.lua new file mode 100644 index 0000000..9ec74eb --- /dev/null +++ b/entities/entities/gf_citizen/cl_init.lua @@ -0,0 +1,38 @@ +include('shared.lua') + +function ENT:Initialize() + self.Run = self:LookupSequence("sprint_all") + self.Stand = self:LookupSequence("idle_subtle") + self:SetSequence(self.Stand) + + self.IsRunning = false + self.Cycle = 0 + self.Timer = CurTime() + self.gSpeed = 200 +end + +function ENT:OnDraw() +end + +function ENT:OnDeath() + self:EmitSound("vo/npc/male01/pain0"..math.random(1,9)..".wav") +end + +function ENT:OnThink() + local Destination = self:GetModelPos() + local CurrentPos = self:GetDestination() + local Distance = Destination-CurrentPos + Distance.z = 0 + + if (!self.IsRunning) then + if (Distance:Length() > 2) then self:SetSequence(self.Run) self.IsRunning = true self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime()/4) + else + if (Distance:Length() <= 2) then self:SetSequence(self.Stand) self.IsRunning = false self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime())*((self.gSpeed or 60)/100) + end + + if (self.Cycle >= 1) then self.Cycle = 0 self.Timer = CurTime()+1 end + + self:SetCycle(self.Cycle) +end
\ No newline at end of file diff --git a/entities/entities/gf_citizen/init.lua b/entities/entities/gf_citizen/init.lua new file mode 100644 index 0000000..68a523a --- /dev/null +++ b/entities/entities/gf_citizen/init.lua @@ -0,0 +1,24 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +function ENT:Initialize() + self:SetModel( "models/Humans/Group01/male_0"..math.random(1,9)..".mdl" ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_NONE ) + self:DrawShadow( false ) + + self.gspeed = 200 +end + +function ENT:OnThink() + return false +end + +function ENT:OnDestinationReached() + self:SetDestination(self:GetPos()+Vector(math.random(-1000,1000),math.random(-1000,1000),0)) +end + + diff --git a/entities/entities/gf_citizen/shared.lua b/entities/entities/gf_citizen/shared.lua new file mode 100644 index 0000000..85a63a3 --- /dev/null +++ b/entities/entities/gf_citizen/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_gf_ai" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file diff --git a/entities/entities/gf_citizen_simple/cl_init.lua b/entities/entities/gf_citizen_simple/cl_init.lua new file mode 100644 index 0000000..81c4fca --- /dev/null +++ b/entities/entities/gf_citizen_simple/cl_init.lua @@ -0,0 +1,31 @@ +include('shared.lua') + +function ENT:Initialize() + self.Run = self:LookupSequence("sprint_all") + self.Stand = self:LookupSequence("idle_subtle") + self:SetSequence(self.Stand) + + self.IsRunning = false + self.gSpeed = 200 + self.Cycle = 0 + self.Timer = CurTime() +end + +function ENT:OnDraw() +end + +function ENT:OnThink() + local Destination = self:GetModelPos() + local CurrentPos = self:GetAIPos() + local Distance = Destination-CurrentPos + Distance.z = 0 + + if (Distance:Length() > 8 and self.IsRunning == false) then self:SetSequence(self.Run) self.IsRunning = true self.Cycle=0 + elseif (Distance:Length() <= 8 and self.IsRunning == true) then self:SetSequence(self.Stand) self.IsRunning = false self.Cycle=0 end + + self.Cycle = 1-(self.Timer-CurTime())*self.gSpeed/100 + + if (self.Cycle > 1) then self.Cycle = 0 self.Timer = CurTime()+1 end + + self:SetCycle(self.Cycle) +end
\ No newline at end of file diff --git a/entities/entities/gf_citizen_simple/init.lua b/entities/entities/gf_citizen_simple/init.lua new file mode 100644 index 0000000..db3bd1c --- /dev/null +++ b/entities/entities/gf_citizen_simple/init.lua @@ -0,0 +1,21 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +function ENT:Initialize() + self:SetModel( "models/Humans/Group01/male_02.mdl" ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_NONE ) + self:DrawShadow( false ) +end + +function ENT:Think() + self:SetAIPos(self:GetPos()+Vector(math.random(-200,200),math.random(-200,200),0)) + + self:NextThink(CurTime()+2) + return true +end + + diff --git a/entities/entities/gf_citizen_simple/shared.lua b/entities/entities/gf_citizen_simple/shared.lua new file mode 100644 index 0000000..5883551 --- /dev/null +++ b/entities/entities/gf_citizen_simple/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_gf_ai_simple" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file diff --git a/entities/entities/gf_citizen_tracker/cl_init.lua b/entities/entities/gf_citizen_tracker/cl_init.lua new file mode 100644 index 0000000..b0efcad --- /dev/null +++ b/entities/entities/gf_citizen_tracker/cl_init.lua @@ -0,0 +1,34 @@ +include('shared.lua') + +function ENT:Initialize() + self.Run = self:LookupSequence("sprint_all") + self.Stand = self:LookupSequence("idle_subtle") + self:SetSequence(self.Stand) + + self.IsRunning = false + self.Cycle = 0 + self.Timer = CurTime() + self.gSpeed = 200 +end + +function ENT:OnDraw() +end + +function ENT:OnThink() + local Destination = self:GetModelPos() + local CurrentPos = self:GetDestination() + local Distance = Destination-CurrentPos + Distance.z = 0 + + if (!self.IsRunning) then + if (Distance:Length() > 2) then self:SetSequence(self.Run) self.IsRunning = true self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime()/4) + else + if (Distance:Length() <= 2) then self:SetSequence(self.Stand) self.IsRunning = false self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime())*((self.gSpeed or 60)/100) + end + + if (self.Cycle >= 1) then self.Cycle = 0 self.Timer = CurTime()+1 end + + self:SetCycle(self.Cycle) +end
\ No newline at end of file diff --git a/entities/entities/gf_citizen_tracker/init.lua b/entities/entities/gf_citizen_tracker/init.lua new file mode 100644 index 0000000..e5f6733 --- /dev/null +++ b/entities/entities/gf_citizen_tracker/init.lua @@ -0,0 +1,34 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +function ENT:Initialize() + self:SetModel( "models/Humans/Group01/male_0"..math.random(1,9)..".mdl" ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_NONE ) + self:DrawShadow( false ) + + self.gspeed = 200 +end + +function ENT:OnThink() + if (!ValidEntity(self.ChaseEntity)) then + for k,v in pairs(player.GetAll()) do + if (v:GetPos():Distance(self:GetPos()) < 300) then + self:SetChaseEntity(v) + + print("Chasing "..v:Name()) + break + end + end + end + + return false +end + +function ENT:OnDestinationReached() +end + + diff --git a/entities/entities/gf_citizen_tracker/shared.lua b/entities/entities/gf_citizen_tracker/shared.lua new file mode 100644 index 0000000..85a63a3 --- /dev/null +++ b/entities/entities/gf_citizen_tracker/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_gf_ai" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file diff --git a/entities/entities/gf_combine/cl_init.lua b/entities/entities/gf_combine/cl_init.lua new file mode 100644 index 0000000..b5ce404 --- /dev/null +++ b/entities/entities/gf_combine/cl_init.lua @@ -0,0 +1,36 @@ +include('shared.lua') + +function ENT:Initialize() + self.Run = self:LookupSequence("WalkUnarmed_all") + self.Stand = self:LookupSequence("Idle_Unarmed") + self:SetSequence(self.Stand) + + self.IsRunning = false + self.Cycle = 0 + self.Timer = CurTime() + self.gSpeed = 60 +end + +function ENT:OnDraw() +end + +function ENT:OnDeath() + self:EmitSound("npc/combine_soldier/die"..math.random(1,3)..".wav") +end + +function ENT:OnThink() + local Destination = self:GetModelPos() + local CurrentPos = self:GetDestination() + local Distance = Destination-CurrentPos + Distance.z = 0 + + if (!self.IsRunning) then + if (Distance:Length() > 2) then self:SetSequence(self.Run) self.IsRunning = true self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime()/4) + else + if (Distance:Length() <= 2) then self:SetSequence(self.Stand) self.IsRunning = false self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime())*((self.gSpeed or 60)/140) + end + + self:SetCycle(self.Cycle) +end
\ No newline at end of file diff --git a/entities/entities/gf_combine/init.lua b/entities/entities/gf_combine/init.lua new file mode 100644 index 0000000..3eb5622 --- /dev/null +++ b/entities/entities/gf_combine/init.lua @@ -0,0 +1,24 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +function ENT:Initialize() + self:SetModel( "models/Combine_Super_Soldier.mdl" ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_NONE ) + self:DrawShadow( false ) + + self.gspeed = 60 +end + +function ENT:OnThink() + return false +end + +function ENT:OnDestinationReached() + self:SetDestination(self:GetPos()+Vector(math.random(-1000,1000),math.random(-1000,1000),0)) +end + + diff --git a/entities/entities/gf_combine/shared.lua b/entities/entities/gf_combine/shared.lua new file mode 100644 index 0000000..85a63a3 --- /dev/null +++ b/entities/entities/gf_combine/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_gf_ai" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file diff --git a/entities/entities/gf_synth/cl_init.lua b/entities/entities/gf_synth/cl_init.lua new file mode 100644 index 0000000..7db0d8a --- /dev/null +++ b/entities/entities/gf_synth/cl_init.lua @@ -0,0 +1,32 @@ +include('shared.lua') + +function ENT:Initialize() + self.Run = self:LookupSequence("walk01") + self.Stand = self:LookupSequence("idle01") + self:SetSequence(self.Stand) + + self.IsRunning = false + self.Cycle = 0 + self.Timer = CurTime() + self.gSpeed = 40 +end + +function ENT:OnDraw() +end + +function ENT:OnThink() + local Destination = self:GetModelPos() + local CurrentPos = self:GetDestination() + local Distance = Destination-CurrentPos + Distance.z = 0 + + if (!self.IsRunning) then + if (Distance:Length() > 2) then self:SetSequence(self.Run) self.IsRunning = true self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime()/4) + else + if (Distance:Length() <= 2) then self:SetSequence(self.Stand) self.IsRunning = false self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime())*((self.gSpeed or 60)/140) + end + + self:SetCycle(self.Cycle) +end
\ No newline at end of file diff --git a/entities/entities/gf_synth/init.lua b/entities/entities/gf_synth/init.lua new file mode 100644 index 0000000..38b9a2d --- /dev/null +++ b/entities/entities/gf_synth/init.lua @@ -0,0 +1,24 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +function ENT:Initialize() + self:SetModel( "models/Synth.mdl" ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_NONE ) + self:DrawShadow( false ) + + self.gspeed = 40 +end + +function ENT:OnThink() + return false +end + +function ENT:OnDestinationReached() + self:SetDestination(self:GetPos()+Vector(math.random(-1000,1000),math.random(-1000,1000),0)) +end + + diff --git a/entities/entities/gf_synth/shared.lua b/entities/entities/gf_synth/shared.lua new file mode 100644 index 0000000..85a63a3 --- /dev/null +++ b/entities/entities/gf_synth/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_gf_ai" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file diff --git a/entities/entities/gf_wavesprite/cl_init.lua b/entities/entities/gf_wavesprite/cl_init.lua new file mode 100644 index 0000000..ed461c8 --- /dev/null +++ b/entities/entities/gf_wavesprite/cl_init.lua @@ -0,0 +1,50 @@ + +include("shared.lua") + +local SpritePlants = {} +local Zero = Vector(0,0,0) +local Dir = Vector(16,0,0) +local DirH = Vector(0,0,16) +local TMat = {} + +function ENT:Initialize() + self:PlantSpriteAtVector(self:GetPos(),Vector(100,100,100),{"gearfox/vgui/gfgamemode.png",},300) +end + +function ENT:PlantSpriteAtVector(Origin,BoxSize,SpriteTable,MaxSprites) + Zero.z = BoxSize.z + SpritePlants = {} + + for k,v in pairs(SpriteTable) do if (!TMat[v]) then TMat[v],Unused = Material("gearfox/vgui/gfgamemode.png","nocull") end end + + for i = 1,MaxSprites do + + local Random = Vector(math.Rand(-1,1),math.Rand(-1,1),0) * BoxSize + local Tr = util.TraceLine({ + start = Origin+Zero+Random, + endpos = Origin-Zero+Random, + mask = MASK_SOLID_BRUSHONLY, + }) + + if (Tr.Hit and Tr.HitWorld) then + Dir:Rotate(Angle(0,math.random(0,360),0)) + + table.insert(SpritePlants,{ + V1 = Tr.HitPos+Dir, + V2 = Tr.HitPos-Dir, + Matsy = TMat[SpriteTable[math.random(1,#SpriteTable)]], + }) + end + end +end + +function ENT:Draw() + for k,v in pairs(SpritePlants) do + local MOVE = (v.V1-v.V2):GetNormal()*math.cos(CurTime()*2+k*15)*5 + render.SetMaterial(v.Matsy) + render.DrawQuad(v.V1,v.V2,v.V2+DirH+MOVE,v.V1+DirH+MOVE) + end +end + +function ENT:Think() +end
\ No newline at end of file diff --git a/entities/entities/gf_wavesprite/init.lua b/entities/entities/gf_wavesprite/init.lua new file mode 100644 index 0000000..a9434d4 --- /dev/null +++ b/entities/entities/gf_wavesprite/init.lua @@ -0,0 +1,14 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +function ENT:Initialize() + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_NONE ) + self:DrawShadow( false ) +end + + + diff --git a/entities/entities/gf_wavesprite/shared.lua b/entities/entities/gf_wavesprite/shared.lua new file mode 100644 index 0000000..5422615 --- /dev/null +++ b/entities/entities/gf_wavesprite/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_anim" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file diff --git a/entities/entities/gf_zombie/cl_init.lua b/entities/entities/gf_zombie/cl_init.lua new file mode 100644 index 0000000..4343e04 --- /dev/null +++ b/entities/entities/gf_zombie/cl_init.lua @@ -0,0 +1,36 @@ +include('shared.lua') + +function ENT:Initialize() + self.Run = self:LookupSequence("walk") + self.Stand = self:LookupSequence("Idle01") + self:SetSequence(self.Stand) + + self.IsRunning = false + self.Cycle = 0 + self.Timer = CurTime() + self.gSpeed = 50 +end + +function ENT:OnDraw() +end + +function ENT:OnDeath() + self:EmitSound("npc/zombie/zombie_die"..math.random(1,3)..".wav") +end + +function ENT:OnThink() + local Destination = self:GetModelPos() + local CurrentPos = self:GetDestination() + local Distance = Destination-CurrentPos + Distance.z = 0 + + if (!self.IsRunning) then + if (Distance:Length() > 2) then self:SetSequence(self.Run) self.IsRunning = true self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime()/4) + else + if (Distance:Length() <= 2) then self:SetSequence(self.Stand) self.IsRunning = false self.Cycle=0 end + self.Cycle = 1-(self.Timer-CurTime())*((self.gSpeed or 60)/100) + end + + self:SetCycle(self.Cycle) +end
\ No newline at end of file diff --git a/entities/entities/gf_zombie/init.lua b/entities/entities/gf_zombie/init.lua new file mode 100644 index 0000000..ad898cb --- /dev/null +++ b/entities/entities/gf_zombie/init.lua @@ -0,0 +1,24 @@ + +AddCSLuaFile( "cl_init.lua" ) +AddCSLuaFile( "shared.lua" ) + +include( 'shared.lua' ) + +function ENT:Initialize() + self:SetModel( "models/Zombie/Classic.mdl" ) + self:SetMoveType( MOVETYPE_NONE ) + self:SetSolid( SOLID_NONE ) + self:DrawShadow( false ) + + self.gspeed = 50 +end + +function ENT:OnThink() + return false +end + +function ENT:OnDestinationReached() + self:SetDestination(self:GetPos()+Vector(math.random(-1000,1000),math.random(-1000,1000),0)) +end + + diff --git a/entities/entities/gf_zombie/shared.lua b/entities/entities/gf_zombie/shared.lua new file mode 100644 index 0000000..85a63a3 --- /dev/null +++ b/entities/entities/gf_zombie/shared.lua @@ -0,0 +1,6 @@ + +ENT.Type = "anim" +ENT.Base = "base_gf_ai" +ENT.PrintName = "" +ENT.Author = "Maw" +ENT.Purpose = "Stuff"
\ No newline at end of file |
