Byond calls New on entity's in lists in BYOND Discussion
|
|
I came across something that I wasn't expecting on load.
The new proc was being called on an entity if it was located inside of a list.
Here is an example
mob var/obj/book/MyBook verb Selftest() MakeBook() AddSpellToBook() Save() Load() Save() var/savefile/A=new("save.txt") world<<"Saving" src.Write(A) world<<"Saved" Load() var/savefile/A=new("save.txt") world<<"Loading" src.Read(A) world<<"Loaded" MakeBook() MyBook=new() world<<"Made book" AddSpellToBook() if(istype(MyBook)) MyBook.AddSpell()
obj book var/list/spells proc AddSpell() spells+= new /spell(1) world<<"Spell added" GetSpells() if(istype(spells)) return "This many spells: [spells.len]" world<<"No spells" RemoveSpell() if(istype(spells)&&spells.len) spells.len-- world<<"Removed a spell" world<<"No spells" spell New(var/A) if(!A) world<<"New was called on load" del(src)
|
Is this a bug or is it intended behavior?
Does it call New() while loading on anything other then entity's in lists? I think this should be discussed before a bug report is posted.
|