8f745830c4a21b705a32a003d02cfbedcc9e9b57 — Francesco Gazzetta 9 months ago e4bdf7c
Do not mutate given definitions

They may be shared.
signs_lib.standard_wood_groups for example IS shared, so it got mutated
and all signs that used it got treated as last_login_signs, overwriting
them all.
1 files changed, 6 insertions(+), 0 deletions(-)

M init.lua
M init.lua => init.lua +6 -0
@@ 31,6 31,12 @@ function last_login_signs.after_place_node(pos, ...)

function last_login_signs.register_sign(name, def)
  -- We're going to mutate the definition table, so let's copy it in case it's
  -- a shared table, like signs_lib.standard_wood_groups.
  -- This is extremely important and WILL cause damage if not done, and it's
  -- not just hipothetical: all sign of an Asuna world got overwritten before
  -- this line was added.
  def = table.copy(def)
  if not def.groups then def.groups = {} end
  def.groups.last_login_signs = 1
  def.on_rightclick = def.on_rightclick or last_login_signs.rightclick_sign