Fix egp datastreams (#3145)

* Send vertices for poly objects properly

* Send datastream after player is added to table

* Use IMaterial if the value is a string
This commit is contained in:
Redox 2024-10-15 03:32:44 +02:00 committed by GitHub
parent 7dd11e5c17
commit 235f883bff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 3 deletions

View File

@ -85,7 +85,11 @@ function baseObj:EditObject(args)
end
for k, v in pairs(args) do
if self[k] ~= nil and self[k] ~= v then
self[k] = v
if CLIENT and k == "material" and isstring(v) then
self[k] = Material(v)
else
self[k] = v
end
ret = true
end
end

View File

@ -53,7 +53,7 @@ Obj.Receive = function( self )
return tbl
end
Obj.DataStreamInfo = function( self )
return { material = self.material, r = self.r, g = self.g, b = self.b, a = self.a, filtering = self.filtering, parent = self.parent, x = self.x, y = self.y, angle = self.angle }
return { material = self.material, r = self.r, g = self.g, b = self.b, a = self.a, filtering = self.filtering, parent = self.parent, x = self.x, y = self.y, angle = self.angle, vertices = self.vertices }
end
function Obj:Contains(x, y)

View File

@ -145,12 +145,13 @@ else -- SERVER
local function EGPHudConnect(ent, state, ply)
if state then
EGP:SendDataStream(ply, ent:EntIndex(), true)
if not ent.Users then ent.Users = {} end
if not ent.Users[ply] then
ent.Users[ply] = true
end
EGP:SendDataStream(ply, ent:EntIndex(), true)
elseif ent.Users and ent.Users[ply] then
ent.Users[ply] = nil