Skip to content

Commit

Permalink
Update Chunks.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Captian-obvious authored Nov 23, 2023
1 parent 767ec95 commit d51a74c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class vi:
ClassName=className
Ref=ref
Properties={}
Children={}
Children=[]
##end
return vi
##end
Expand All @@ -26,7 +26,7 @@ class theclass:
##end
rbxm.ClassRefs[ClassID]=theclass
for ref in refs:
rbxm.InstanceRefs[ref]=VirtualInstance(ClassID, ClassName, ref)
rbxm.InstanceRefs[ref-1]=VirtualInstance(ClassID, ClassName, ref)
##end
##end
def META(chunk, rbxm):
Expand All @@ -46,4 +46,18 @@ def PRNT(chunk, rbxm):
count=buffer.readNumber("<I4")
child_refs=basicTypes.RefArray(buffer, count)
parent_refs=basicTypes.RefArray(buffer, count)
for i in range(count):
childID=child_refs[i-1]
parentID=parent_refs[i-1]
child=rbxm.InstanceRefs[childID]
parent=conditionalSet(parentID>=0,rbxm.InstanceRefs[parentID],None)
if (not child):
chunk.Error(f"Could not parent {childID} to {parentID} because child {childID} was nil")
##end
if (parentID>=0 and not parent):
chunk:Error(f"Could not parent {childID} to {parentID} because parent {parentID} was nil")
##end
parentTable=conditionalSet(parent!=None,parent.Children,rbxm.Tree)
parentTable.append(child)
##end
##end

0 comments on commit d51a74c

Please sign in to comment.