var/list/denyvar = list("locs","type","parent_type","verbs")
for(var/obj/custom_card/cust in usr.custom_cards)
if(cust.template_card)
var/obj/cards/CC = new cust.template_card.type()
for(var/i in cust.template_card.vars)
if(i in denyvar) continue
CC.vars[i] = cust.template_card.vars[i]
CC.CrdLoc = 0
usr.Set += CC
Problem description:
runtime error: Cannot write to datum.vars.
proc name: View Set (/mob/verb/View_Set)
usr: (src)
src: IceFire2050 (/mob)
src.loc: (65,125,1) (/turf/FLOOR/CENTER/SMOL)
call stack:
IceFire2050 (/mob): View Set("cust")
So I am trying to add a system to my card game that allows for some flexible use of custom created cards.
I've been slowly working through the system and this is the last piece that seems to be giving me issue.
The usr mob has a list var usr.custom_cards which stores all of their created cards. It's a list of the obj/custom_card.
The obj/custom_card has a var which is template_card which stores a copy of a created card with all of its 3 dozen-ish variables already defined.
My goal with the above code is to make a copy of the template_card. Give the copy all the same variables as the template_card, and then add it to the usr.Set list, which will be used in a farther section of this code.
But when I try to run this, I get the error above.
Anyone know if I'm overlooking something?