2007-04-12 19:35:57 +00:00
|
|
|
AddCSLuaFile( "cl_init.lua" )
|
|
|
|
AddCSLuaFile( "shared.lua" )
|
|
|
|
|
|
|
|
include('shared.lua')
|
|
|
|
|
|
|
|
ENT.WireDebugName = "DataPort"
|
|
|
|
ENT.OverlayDelay = 0
|
|
|
|
|
|
|
|
function ENT:Initialize()
|
|
|
|
self.Entity:PhysicsInit( SOLID_VPHYSICS )
|
|
|
|
self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
|
|
|
|
self.Entity:SetSolid( SOLID_VPHYSICS )
|
|
|
|
self.Entity:SetUseType( SIMPLE_USE )
|
|
|
|
|
|
|
|
//makeoutputs = {}
|
|
|
|
//for i = 0,7 do
|
|
|
|
// makeoutputs[i] = "Port"..i
|
|
|
|
//end
|
|
|
|
//self.Outputs = Wire_CreateOutputs(self.Entity, makeoutputs)
|
|
|
|
|
|
|
|
self.Outputs = Wire_CreateOutputs(self.Entity, { "Port0","Port1","Port2","Port3","Port4","Port5","Port6","Port7" })
|
|
|
|
self.Inputs = Wire_CreateInputs(self.Entity, { "Port0","Port1","Port2","Port3","Port4","Port5","Port6","Port7" })
|
|
|
|
|
|
|
|
self.Ports = {}
|
|
|
|
for i = 0,7 do
|
|
|
|
self.Ports[i] = 0
|
|
|
|
end
|
2007-06-11 21:45:39 +00:00
|
|
|
self:SetOverlayText( "Data port" )
|
2007-04-12 19:35:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
/*function ENT:Think()
|
|
|
|
self.BaseClass.Think(self)
|
|
|
|
end*/
|
|
|
|
|
|
|
|
function ENT:ReadCell( Address )
|
|
|
|
if (Address >= 0) && (Address <= 7) then
|
|
|
|
return self.Ports[Address]
|
|
|
|
else
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ENT:WriteCell( Address, value )
|
|
|
|
if (Address >= 0) && (Address <= 7) then
|
|
|
|
Wire_TriggerOutput(self.Entity, "Port"..Address, value)
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ENT:TriggerInput(iname, value)
|
|
|
|
for i = 0,7 do
|
|
|
|
if (iname == "Port"..i) then
|
|
|
|
self.Ports[i] = value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|