ID:2566639
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
If we try to write like this:
//EXAMPLE CODE
/obj/paper_creator/var/text_on_papers = "Hewwo"
/obj/structure_creator/Click()
new/obj/paper{text = text_on_papers;}()
var/t = "Another hewwo"
new/obj/paper{text = t;}()

We will get cross-reference loop or undefined var, I think it’s worth to make some way to get vars of proc or of object that creating it with new{}()
Maybe something like in-{} vars like myBase or myProc or anything else that will contain ref of creator or vars of proc.

So it can looks like this:
//EXAMPLE CODE
/obj/paper_creator/var/text_on_papers = "Hewwo"
/obj/structure_creator/Click()
new/obj/paper{text = myBase.text_on_papers;}()
var/t = "Another hewwo"
new/obj/paper{text = myProc.t;}()


I haven't problem with workarounds of this like change vars after creation of instance like:
/obj/paper_creator/var/text_on_papers = "Hewwo"
/obj/structure_creator/Click()
var/obj/paper/P = new/obj/paper()
P.text = text_on_papers

But it will be cooler without this workaround
I think what you're looking for already exists. BYOND uses atom.New() as a constructor function:

obj/paper
text_on_paper = "Hewwo"

obj/paper/New(t)
src.text_on_paper = t

mob/Login()
var /obj/paper/p = new ("uwu uguu~~")
src << p.text_on_paper // uwu uguu~
In response to LordAndrew
LordAndrew wrote:
I think what you're looking for already exists. BYOND uses atom.New() as a constructor function:

> obj/paper
> text_on_paper = "Hewwo"
>
> obj/paper/New(t)
> src.text_on_paper = t
>
> mob/Login()
> var /obj/paper/p = new ("uwu uguu~~")
> src << p.text_on_paper // uwu uguu~
>

Dude, sorry, but i already told that i haven't problem with that... and prefabs already exists, i isn't request feature like 'new{var = value}()', i request ability to replace value in 'new{var = value}()' on some var not on in-code constant...

And please don't use "src." :c
Your "workaround" is what LordAndrew suggested and probably the best use.
In response to Kozuma3
Kozuma3 wrote:
Your "workaround" is what LordAndrew suggested and probably the best use.

Dude, i need't workarounds, i need cool upgrade of prefab feature