Move savePosition() out of EntrySprite into PlaygroundSystem

This commit is contained in:
2023-02-15 05:47:26 -07:00
parent ad8fdd0fd0
commit 141953df42

View File

@@ -83,6 +83,12 @@
pos2 (dictGet (readComponent e2 Positions) _playgroundKey)]
(connectionProcessor archive e pos e2 pos2 ui))))))))
(method savePosition [:Entry e :Float x :Float y &opt :Float z]
(withWritableComponents ui.controller.archive e [positions Positions]
(let [oldPos (dictGet positions _playgroundKey)]
(dictSet positions _playgroundKey
(objectWith [z (or z oldPos.z)] x y)))))
(method defaultPosition [:Entry e]
(object x 0.0 y 0.0 z 0.0))