ID:2072414
 
(See the best response by Kaiochao.)
Code:
obj/Items
New()
world<<"New obj/item is a..."

Sword
New()
world<<"SWORD!"
Shield
New()
world<<"SHIELD"


Problem description:
On the creation of a new sword, I'd like the output to say:

"new obj/item is a...
SWORD!"


rather than just:

"SWORD!"


Is this behaviour possible?



Ugh. I search for 20 mins for answer. And the moment I post to the forum I work it out myself!!

obj/Items
New()
world<<"New obj/item is a..."

Sword
New()
world<<"SWORD!"
return ..()
Shield
New()
world<<"SHIELD"
return ..()


I don't think the chronological order matches my specific question, but this is all I need! Thanks me!
Best response
To call the inherited behavior, call the ..() proc.
Doing this with overridden procs seems like a really bad idea, when you can use a var and do it with one proc.

obj/Items
var/shoutyname
New()
world<<"New obj/item is a...\n[shoutyname||uppertext(name||"[src]")]"

Sword
shoutyname = "SWORD!"
Shield
In response to Lummox JR
Truth be told I was just putting a dead simple example up. My intent is to have some item behaviour set universally for obj/Items, and have other variables and icon functions act more specifically.

If I wanted to have a couple boolean vars set universally, and some icon behaviour / item clumping functions run for some other items - would the ..() method still be a "really bad idea"?

Because I could always just use if() qualifiers, if there's something I've overlooked?

EDIT: Oh and importantly, some obj/items/ITEMNAME wont even have a New() defined (many, in fact), at least not with anything that isnt just a copy and paste. Hence my want for a main New and an optional New for select items