more careful entry saving

This commit is contained in:
2021-08-02 20:30:37 -06:00
parent a70474daad
commit 7db311dffe
2 changed files with 3 additions and 3 deletions

View File

@@ -186,5 +186,5 @@
files (VarText null)]
(doFor e entries
(doFor file files
(withWritableEntry archive e (addFile archive e file))))
(addFile archive e file)))
entries))

View File

@@ -26,10 +26,10 @@
// TODO check not overwriting a component
(defMacro addComponent [archive e componentType c]
`(let [componentId (Uuid.v4)]
`(withWritableEntry ,archive ,e (let [componentId (uuid.Uuid.v4)]
(dictSet .components ,e ,(symbolName componentType) componentId)
(writeComponent ,archive ,e ,componentType ,c)
,e))
,e)))
// Retrieve multiple components from an Entity with mutable access.
// All components will be serialized after the block is done.