diff --git a/game/engines/default/engine/class.lua b/game/engines/default/engine/class.lua index 91a73719a0260fe02adac161f8e325e4d5c295a4..af59b8d9cfd1d22a9425ee0892152375b0fa22b9 100644 --- a/game/engines/default/engine/class.lua +++ b/game/engines/default/engine/class.lua @@ -109,7 +109,7 @@ function _M:clone(t) end -local function clonerecursfull(clonetable, d) +local function clonerecursfull(clonetable, d, allow_cloned) local n = {} clonetable[d] = n @@ -126,13 +126,14 @@ local function clonerecursfull(clonetable, d) n[nk] = ne end setmetatable(n, getmetatable(d)) + if n.cloned then n:cloned(d) end return n end --- Clones the object, all subobjects without cloning twice a subobject -function _M:cloneFull() +function _M:cloneFull(allow_cloned) local clonetable = {} - local n = clonerecursfull(clonetable, self) + local n = clonerecursfull(clonetable, self, allow_cloned) return n end