local cache = {} local function Parse(filename) if (cache[filename]) then return cache[filename] end cache[filename] = {Hitboxes = {}} local fl = file.Open(filename, "rb", "GAME") if not fl then print("[LuaMDL] Unable to open: "..filename) return end local ident = fl:Read(4) if ident ~= "IDST" then print("[LuaMDL] Invalid file header: "..ident) return end local rtn = {} rtn.version = fl:ReadLong() rtn.checksum = fl:ReadLong() fl:Read(64) //name rtn.dataLength = fl:ReadLong() fl:Read(12) //eyeposition fl:Read(12) //illumposition fl:Read(12) //hull_min fl:Read(12) //hull_max fl:Read(12) //view_bbmin fl:Read(12) //view_bbmax rtn.flags = fl:ReadLong() //mstudiobone_t rtn.bone_count = fl:ReadLong() rtn.bone_offset = fl:ReadLong() //mstudiobonecontroller_t rtn.bonecontroller_count = fl:ReadLong() rtn.bonecontroller_offset = fl:ReadLong() //mstudiobonecontroller_t rtn.hitbox_count = fl:ReadLong() rtn.hitbox_offset = fl:ReadLong() fl:Seek(rtn.hitbox_offset) rtn.sznameindex = fl:ReadLong() rtn.numhitboxes = fl:ReadLong() rtn.hitboxindex = fl:ReadLong() fl:Seek(rtn.hitbox_offset + rtn.hitboxindex) rtn.Hitboxes = {} for z = 1, rtn.numhitboxes do local tmp = {} tmp.bone = fl:ReadLong() tmp.group = fl:ReadLong() tmp.bbmin = Vector(fl:ReadFloat(),fl:ReadFloat(),fl:ReadFloat()) tmp.bbmax = Vector(fl:ReadFloat(),fl:ReadFloat(),fl:ReadFloat()) tmp.szhitboxnameindex = fl:ReadLong() fl:Read(32) rtn.Hitboxes[tmp.bone] = tmp end fl:Close() cache[filename] = rtn; return rtn end local doneSkins = {} for l,p in pairs(PS.Items) do if doneSkins[p.Model] or !p.Model or p.Category == "playermodels" then continue end doneSkins[p.Model] = true local ModelInfo = Parse( p.Model ) if !ModelInfo then continue end local HitBoxCount = {} for k,v in pairs(ModelInfo.Hitboxes) do if v.group != 0 then HitBoxCount[v.group] = (HitBoxCount[v.group] or 0) + 1 end end if #(HitBoxCount) == 0 then print("Hitbox Error! "..p.Model) end end