Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AddCSLuaFile()
- DEFINE_BASECLASS( "base_gmodentity" )
- ENT.PrintName = "Main Signal"
- ENT.Author = "Ron"
- ENT.Category = "Ron's German Signals"
- ENT.Editable = false
- ENT.Spawnable = true
- ENT.AdminOnly = false
- function ENT:SetupDataTables()
- self:NetworkVar( "Int", 0, "Signal State" )
- end
- function ENT:SpawnFunction( ply, tr, ClassName )
- if ( !tr.Hit ) then return end
- local ent = ents.Create( ClassName )
- ent:SetModel("models/ron/signals/hp_lichtsignal.mdl")
- ent:PhysicsInit( SOLID_VPHYSICS )
- ent:SetMoveType( MOVETYPE_VPHYSICS )
- ent:SetSolid( SOLID_VPHYSICS )
- ent:SetPos( tr.HitPos + tr.HitNormal )
- ent:Spawn()
- ent:GetPhysicsObject():SetMass(50000)
- ent:SetCollisionGroup( COLLISION_GROUP_WORLD )
- return ent
- end
- function ENT:Initialize()
- if SERVER then
- if WireLib then
- if !WireLib.CreateSpecialInputs then return end
- self.Inputs = WireLib.CreateSpecialInputs( self, { "Signal_State" }, { "NORMAL" } )
- self.WireDebugName = "Main Signal"
- end
- end
- end
- function ENT:TriggerInput(inname, value)
- if inname == "Signal_State" && value ~= 0 then
- self:SetBodygroup(1, value)
- elseif inname == "Signal_State" && value == 0 then
- self:SetBodygroup(1, 0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement