Skip to content

Commit 1213321

Browse files
committed
Use MAX_EDICT_BITS global
1 parent 96b25f8 commit 1213321

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

lua/entities/gmod_wire_expression2/core/hologram.lua

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,13 @@ local function flush_scale_queue(queue, recipient)
239239
net.Start("wire_holograms_set_scale")
240240
for _, plyqueue in pairs(queue) do
241241
for Holo, scale in pairs(plyqueue) do
242-
net.WriteUInt(Holo.ent:EntIndex(), WireLib.MAX_EDICT_BITS)
242+
net.WriteUInt(Holo.ent:EntIndex(), MAX_EDICT_BITS)
243243
net.WriteFloat(scale.x)
244244
net.WriteFloat(scale.y)
245245
net.WriteFloat(scale.z)
246246
end
247247
end
248-
net.WriteUInt(0, WireLib.MAX_EDICT_BITS)
248+
net.WriteUInt(0, MAX_EDICT_BITS)
249249
if recipient then net.Send(recipient) else net.Broadcast() end
250250
end
251251

@@ -257,15 +257,15 @@ local function flush_bone_scale_queue(queue, recipient)
257257
for _, plyqueue in pairs(queue) do
258258
for Holo, holoqueue in pairs(plyqueue) do
259259
for bone, scale in pairs(holoqueue) do
260-
net.WriteUInt(Holo.ent:EntIndex(), WireLib.MAX_EDICT_BITS)
260+
net.WriteUInt(Holo.ent:EntIndex(), MAX_EDICT_BITS)
261261
net.WriteUInt(bone + 1, 9) -- using +1 to be able reset holo bones scale with -1 and not use signed int
262262
net.WriteFloat(scale.x)
263263
net.WriteFloat(scale.y)
264264
net.WriteFloat(scale.z)
265265
end
266266
end
267267
end
268-
net.WriteUInt(0, WireLib.MAX_EDICT_BITS)
268+
net.WriteUInt(0, MAX_EDICT_BITS)
269269
net.WriteUInt(0, 16)
270270
if recipient then net.Send(recipient) else net.Broadcast() end
271271
end
@@ -279,7 +279,7 @@ local function flush_clip_queue(queue, recipient)
279279
for Holo,holoqueue in pairs(plyqueue) do
280280
for _, clip in pairs(holoqueue) do
281281
if clip and clip.index then
282-
net.WriteUInt(Holo.ent:EntIndex(), WireLib.MAX_EDICT_BITS)
282+
net.WriteUInt(Holo.ent:EntIndex(), MAX_EDICT_BITS)
283283
net.WriteUInt(clip.index, 4) -- 4: absolute highest wire_holograms_max_clips is thus 16
284284
if clip.enabled ~= nil then
285285
net.WriteBool(true)
@@ -288,13 +288,13 @@ local function flush_clip_queue(queue, recipient)
288288
net.WriteBool(false)
289289
net.WriteVector(clip.origin)
290290
net.WriteVector(clip.normal)
291-
net.WriteUInt(clip.localentid, WireLib.MAX_EDICT_BITS)
291+
net.WriteUInt(clip.localentid, MAX_EDICT_BITS)
292292
end
293293
end
294294
end
295295
end
296296
end
297-
net.WriteUInt(0, WireLib.MAX_EDICT_BITS)
297+
net.WriteUInt(0, MAX_EDICT_BITS)
298298
if recipient then net.Send(recipient) else net.Broadcast() end
299299
end
300300

@@ -305,10 +305,10 @@ local function flush_vis_queue()
305305
if IsValid( ply ) and next(plyqueue) ~= nil then
306306
net.Start("wire_holograms_set_visible")
307307
for Holo,visible in pairs(plyqueue) do
308-
net.WriteUInt(Holo.ent:EntIndex(), WireLib.MAX_EDICT_BITS)
308+
net.WriteUInt(Holo.ent:EntIndex(), MAX_EDICT_BITS)
309309
net.WriteBit(visible)
310310
end
311-
net.WriteUInt(0, WireLib.MAX_EDICT_BITS)
311+
net.WriteUInt(0, MAX_EDICT_BITS)
312312
net.Send(ply)
313313
end
314314
end
@@ -320,11 +320,11 @@ local function flush_player_color_queue()
320320
net.Start("wire_holograms_set_player_color")
321321
for _, plyqueue in pairs(player_color_queue) do
322322
for Holo,color in pairs(plyqueue) do
323-
net.WriteUInt(Holo.ent:EntIndex(), WireLib.MAX_EDICT_BITS)
323+
net.WriteUInt(Holo.ent:EntIndex(), MAX_EDICT_BITS)
324324
net.WriteVector(color)
325325
end
326326
end
327-
net.WriteUInt(0, WireLib.MAX_EDICT_BITS)
327+
net.WriteUInt(0, MAX_EDICT_BITS)
328328
net.Broadcast()
329329
end
330330

lua/entities/gmod_wire_hologram.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ if CLIENT then
182182

183183
net.Receive("wire_holograms_clip", function(netlen)
184184
while true do
185-
local entid = net.ReadUInt(WireLib.MAX_EDICT_BITS)
185+
local entid = net.ReadUInt(MAX_EDICT_BITS)
186186
if entid == 0 then return end -- stupid hack to not include amount of entities in the message. feel free to rework this.
187187

188188
local clipid = net.ReadUInt(4)
189189

190190
if net.ReadBool() then
191191
SetClipEnabled(entid, clipid, net.ReadBool())
192192
else
193-
SetClip(entid, clipid, net.ReadVector(), net.ReadVector(), net.ReadUInt(WireLib.MAX_EDICT_BITS))
193+
SetClip(entid, clipid, net.ReadVector(), net.ReadVector(), net.ReadUInt(MAX_EDICT_BITS))
194194
end
195195

196196
local ent = Entity(entid)
@@ -270,21 +270,21 @@ if CLIENT then
270270
end
271271

272272
net.Receive("wire_holograms_set_scale", function(netlen)
273-
local index = net.ReadUInt(WireLib.MAX_EDICT_BITS)
273+
local index = net.ReadUInt(MAX_EDICT_BITS)
274274

275275
while index ~= 0 do
276276
SetScale(index, Vector(net.ReadFloat(), net.ReadFloat(), net.ReadFloat()))
277-
index = net.ReadUInt(WireLib.MAX_EDICT_BITS)
277+
index = net.ReadUInt(MAX_EDICT_BITS)
278278
end
279279
end)
280280

281281
net.Receive("wire_holograms_set_bone_scale", function(netlen)
282-
local index = net.ReadUInt(WireLib.MAX_EDICT_BITS)
282+
local index = net.ReadUInt(MAX_EDICT_BITS)
283283
local bindex = net.ReadUInt(9) - 1 -- using -1 to get negative -1 for reset
284284

285285
while index ~= 0 do
286286
SetBoneScale(index, bindex, Vector(net.ReadFloat(), net.ReadFloat(), net.ReadFloat()))
287-
index = net.ReadUInt(WireLib.MAX_EDICT_BITS)
287+
index = net.ReadUInt(MAX_EDICT_BITS)
288288
bindex = net.ReadUInt(9) - 1
289289
end
290290
end)
@@ -301,7 +301,7 @@ if CLIENT then
301301
end
302302

303303
net.Receive("wire_holograms_set_visible", function(netlen)
304-
local index = net.ReadUInt(WireLib.MAX_EDICT_BITS)
304+
local index = net.ReadUInt(MAX_EDICT_BITS)
305305

306306
while index ~= 0 do
307307

@@ -312,7 +312,7 @@ if CLIENT then
312312
vis_buffer[index] = net.ReadBit() == 0
313313
end
314314

315-
index = net.ReadUInt(WireLib.MAX_EDICT_BITS)
315+
index = net.ReadUInt(MAX_EDICT_BITS)
316316
end
317317
end)
318318

@@ -336,7 +336,7 @@ if CLIENT then
336336
end
337337

338338
net.Receive("wire_holograms_set_player_color", function(netlen)
339-
local index = net.ReadUInt(WireLib.MAX_EDICT_BITS)
339+
local index = net.ReadUInt(MAX_EDICT_BITS)
340340

341341
while index ~= 0 do
342342
local ent = Entity(index)
@@ -346,7 +346,7 @@ if CLIENT then
346346
player_color_buffer[index] = net.ReadVector()
347347
end
348348

349-
index = net.ReadUInt(WireLib.MAX_EDICT_BITS)
349+
index = net.ReadUInt(MAX_EDICT_BITS)
350350
end
351351
end)
352352

lua/wire/wireshared.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ local string_sub = string.sub
1616
local utf8_char = utf8.char
1717
local hook = hook
1818

19-
WireLib.MAX_EDICT_BITS = MAX_EDICT_BITS or 13
19+
MAX_EDICT_BITS = MAX_EDICT_BITS or 13 -- Delete once MAX_EDICT_BITS is fully out in base GMod
2020

2121
-- extra table functions
2222

0 commit comments

Comments
 (0)