Everything works up for the first code, but the second code, it stops once it starts to call/read "O" being the obj taken from the prior verb "Cook".
Code 1:
obj/items/campfire
icon='build7.dmi'
icon_state="82"
name="Camp fire"
New()
spawn(600)
del(src)
var
beingcooked=0
verb
Put_Out()
set src in oview(1)
set category = "Skills"
if(!src.beingcooked)
view(usr)<<output("A campfire was put out.","rpoutput")
del(src)
else
usr<<"The fire is cooking something."
return
verb
Cook()
set src in oview(1)
set category = "Skills"
if(!usr.cooking)
var/list/Options=list()
for(var/obj/items/Food/Cookable/F in usr.contents)
Options["[F.name] - x[F.Amount]"]=F
var/obj/items/Food/Cookable/Choice = usr.CustomInput("Cook","What would you like to cook?",Options + "Cancel")
if(Choice:name=="Cancel")
return
if(typesof(Choice,/obj/items/Food/Cookable/))
usr.cooking=1
view(usr)<<output("[usr] is cooking a [Choice]","rpoutput")
src.beingcooked=1
usr<<"test"
usr.cookselection=Choice
usr<<"testfinish"
Choice.Cookup(Choice) // I had this originally at just Cookup(Choice) and it still gives the same error, was just testing if there was a difference.
sleep(30)
//F.Amount-=1
usr.cooking=0
src.beingcooked=0
view(usr)<<output("[usr] has cooked a [Choice].","rpoutput")
usr.cookselection-=Choice
return
else
usr<<"You are already cooking."
Code 2:
This is the code for "Cookup(Choice)" that's giving me problems. In game, I've added a test to the type it calls, and apparently the name and everything stays, but the type changes to: obj/Copy. This is due to CustomInput proc.
Not sure if that has to do with anything but I was almost certain a simple O.type change would work but it doesn't. Might've tried all that I've known.
obj/proc/Cookup(obj/items/Food/Cookable/O in usr.cookselection)
usr<<"[O.name] - [O.type] - verified"
//if(O:Amount>=1)
usr<<"testedfirst" // The code stops here in game. Nothing else happens for this code.
var/obj/items/Food/Cookable/F = new
F.icon=O.icon
F.hungerpts=O.hungerpts
F.thirstpts=O.thirstpts
F.hungerr=O.hungerr
F.strbuff=O.strbuff
F.endbuff=O.endbuff
F.resbuff=O.resbuff
F.forcebuff=O.forcebuff
F.speedbuff=O.speedbuff
F.offbuff=O.offbuff
F.defbuff=O.defbuff
F.regenbuff=O.regenbuff
F.recovbuff=O.recovbuff
usr<<"firsttestfinished"
// O.name=replacetext(O.name,"Raw","Cooked")
//F.name="Cooked [O.name]"
F.name=O.name
usr<<"another test"
if(F.strbuff>0.0001) //strcook
F.strbuff+=0.5
if(F.endbuff>0.0001)//endcook
F.endbuff+=0.5
if(F.forcebuff>0.0001)//force cook
F.forcebuff+=0.5
if(F.resbuff>0.0001)// res cook
F.resbuff+=0.5
if(F.speedbuff>0.0001) // spd cook
F.speedbuff+=0.5
if(F.offbuff>0.0001)
F.offbuff+=0.5
if(F.defbuff>0.0001)
F.defbuff+=0.5
if(F.regenbuff>0.0001)
F.regenbuff+=0.5
if(F.recovbuff>0.0001)
F.recovbuff+=0.5
var/icon/I=new(F.icon)
I.Blend(rgb(90,0,30),ICON_MULTIPLY)
usr<<"finaltest"
F.icon=I
//F.Amount=1
usr.itemAdd(F)
Problem description:
Trying to just cook one item from another proc. It being the item casted from ones inventory, into their cooking-selection, and the cookup proc applying stats/buffs and the cooked icon/name. Everything works up until it starts to change the cooked items(O) variables. Nothing changes, or happens after "usr<< testedfirst" line.
Should I be using parent_type here?
</<>
It appears that CustomInput() is returning an /obj/Copy instance that represents an option. It's not the option itself (food) so you need to get that back somehow. The code for CustomInput() might have a clue how to do that.