dvdvideo1234 / TrackAssemblyTool

A Garry's mod tool for assembing a prop-segmented track
GNU Affero General Public License v3.0
21 stars 2 forks source link

[BUG] Ghosts are not getting cleared #50

Closed dvdvideo1234 closed 1 year ago

dvdvideo1234 commented 1 year ago

Describe the bug TA does not clear client ghosts on request

To Reproduce Steps to reproduce the behavior:

  1. Pick TA. Ghosts are drawn
  2. Pick another tool
  3. Ghosts stay visible

Expected behavior Ghosts to be deleted on swtch

Screenshots image

Host machine (please complete the following information):

Additional context

1
2
3
4   38
5   Entity [-1][class C_PhysPropClientside]
5   Entity [-1][class C_PhysPropClientside]
5   Entity [-1][class C_PhysPropClientside]
5   Entity [-1][class C_PhysPropClientside]
5   Entity [-1][class C_PhysPropClientside]
5   Entity [-1][class C_PhysPropClientside]
NET
dvdvideo1234 commented 1 year ago
function ClearGhosts(vSiz, bCol)
  print(1)
  if(SERVER) then return true end
  print(2)
  local tGho = GetOpVar("ARRAY_GHOST")
  print(3)
  if(not IsHere(tGho)) then return true end
  local iSiz = mathCeil(tonumber(vSiz) or tGho.Size)
  print(4, iSiz)
  for iD = 1, iSiz do local eGho = tGho[iD]
    if(eGho and eGho:IsValid()) then
      print(5, eGho)
      eGho:SetNoDraw(true); eGho:Remove()
    end; eGho, tGho[iD] = nil, nil
  end; tGho.Size, tGho.Slot = 0, GetOpVar("MISS_NOMD")
  if(bCol) then collectgarbage() end; return true
end
dvdvideo1234 commented 1 year ago

https://wiki.facepunch.com/gmod/Global.SafeRemoveEntityDelayed https://wiki.facepunch.com/gmod/timer.Simple

SetNoDraw doesn’t prevent the object from being drawn using DrawModel. You might not be
despawning the clientside model. If you draw the model with it set to no draw, it’ll still be
drawable when using DrawModel. Check and see if you can find if the entity exists after being
removed. It looks like it’s probably the above issue. If the client model is removed, properly, it’ll be gone.