2007-02-04 01:16:06 +00:00
|
|
|
|
|
|
|
AddCSLuaFile( "cl_init.lua" )
|
|
|
|
AddCSLuaFile( "shared.lua" )
|
|
|
|
|
|
|
|
include('shared.lua')
|
|
|
|
|
|
|
|
ENT.WireDebugName = "No Name"
|
|
|
|
|
|
|
|
function ENT:Think()
|
2007-05-16 19:44:02 +00:00
|
|
|
if (!Wire_DisableOverlayTextUpdate) and (self.NextOverlayTextTime) and (CurTime() >= self.NextOverlayTextTime) then
|
2007-04-07 18:40:13 +00:00
|
|
|
if (self.NextOverlayText) then
|
2007-05-16 19:44:02 +00:00
|
|
|
//self.BaseClass.BaseClass.SetOverlayText(self, self.NextOverlayText)
|
2007-04-07 18:40:13 +00:00
|
|
|
self.Entity:SetNetworkedBeamString( "GModOverlayText", self.NextOverlayText )
|
2007-02-04 01:16:06 +00:00
|
|
|
self.NextOverlayText = nil
|
2007-05-16 19:44:02 +00:00
|
|
|
self.NextOverlayTextTime = CurTime() + (self.OverlayDelay or 0.4) + math.random()*(self.OverlayRandom or 0.2)
|
|
|
|
if (Wire_SlowerOverlayTextUpdate) then
|
|
|
|
self.NextOverlayTextTime = self.NextOverlayTextTime + 1 //add a sec between updates
|
|
|
|
end
|
|
|
|
else
|
2007-02-04 01:16:06 +00:00
|
|
|
self.NextOverlayText = nil
|
2007-05-16 19:44:02 +00:00
|
|
|
self.NextOverlayTextTime = nil
|
2007-02-04 01:16:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ENT:SetOverlayText(txt)
|
2007-04-29 11:02:53 +00:00
|
|
|
if (Wire_DisableOverlayTextUpdate) then return end
|
2007-04-07 18:40:13 +00:00
|
|
|
|
2007-05-16 19:44:02 +00:00
|
|
|
if (Wire_FastOverlayTextUpdate) then
|
2007-04-07 18:40:13 +00:00
|
|
|
|
2007-04-29 11:02:53 +00:00
|
|
|
self.Entity:SetNetworkedBeamString( "GModOverlayText", txt, true ) //send it now, damn it!
|
2007-04-07 18:40:13 +00:00
|
|
|
|
2007-02-04 01:16:06 +00:00
|
|
|
else
|
2007-05-16 19:44:02 +00:00
|
|
|
|
|
|
|
if (self.NextOverlayTextTime) then
|
|
|
|
self.NextOverlayText = txt
|
|
|
|
else
|
|
|
|
//self.BaseClass.BaseClass.SetOverlayText(self, txt)
|
2007-04-07 18:40:13 +00:00
|
|
|
self.Entity:SetNetworkedBeamString( "GModOverlayText", txt )
|
|
|
|
|
2007-05-16 19:44:02 +00:00
|
|
|
self.NextOverlayText = nil
|
2007-04-07 18:40:13 +00:00
|
|
|
|
2007-04-29 11:02:53 +00:00
|
|
|
if (not self.OverlayDelay) or (self.OverlayDelay > 0) or (Wire_SlowerOverlayTextUpdate) or (!SinglePlayer()) or (Wire_ForceDelayOverlayTextUpdate) then
|
2007-04-07 18:40:13 +00:00
|
|
|
self.NextOverlayTextTime = CurTime() + (self.OverlayDelay or 0.6) + math.random()*(self.OverlayRandom or 0.2)
|
|
|
|
end
|
2007-02-04 01:16:06 +00:00
|
|
|
end
|
2007-04-07 18:40:13 +00:00
|
|
|
|
2007-02-04 01:16:06 +00:00
|
|
|
end
|
2007-04-07 18:40:13 +00:00
|
|
|
|
2007-02-04 01:16:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function ENT:OnRemove()
|
|
|
|
Wire_Remove(self.Entity)
|
|
|
|
end
|
|
|
|
|
|
|
|
function ENT:OnRestore()
|
|
|
|
Wire_Restored(self.Entity)
|
|
|
|
end
|
|
|
|
|
|
|
|
function ENT:BuildDupeInfo()
|
2007-08-07 19:21:29 +00:00
|
|
|
return WireLib.BuildDupeInfo( self.Entity )
|
2007-02-04 01:16:06 +00:00
|
|
|
end
|
|
|
|
|
2007-03-22 03:27:52 +00:00
|
|
|
function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID)
|
2007-08-07 19:21:29 +00:00
|
|
|
WireLib.ApplyDupeInfo( ply, ent, info, GetEntByID )
|
2007-02-04 01:16:06 +00:00
|
|
|
end
|
2007-03-22 03:27:52 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
//new duplicator stuff
|
|
|
|
//
|
|
|
|
function ENT:PreEntityCopy()
|
|
|
|
//build the DupeInfo table and save it as an entity mod
|
|
|
|
local DupeInfo = self:BuildDupeInfo()
|
|
|
|
if DupeInfo then
|
|
|
|
duplicator.StoreEntityModifier( self.Entity, "WireDupeInfo", DupeInfo )
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function ENT:PostEntityPaste( Player, Ent, CreatedEntities )
|
|
|
|
//apply the DupeInfo
|
|
|
|
if (Ent.EntityMods) and (Ent.EntityMods.WireDupeInfo) then
|
|
|
|
Ent:ApplyDupeInfo(Player, Ent, Ent.EntityMods.WireDupeInfo, function(id) return CreatedEntities[id] end)
|
|
|
|
end
|
|
|
|
end
|