Forge2
icon_state="Forge"
density=1
Click()
if(get_dist(usr, src) < 2)
usr.Freeze=1
if(locate(/obj/items/Mining/Ores)in usr.contents)
var/Smeltlist=list()
if(locate(/obj/items/Mining/Ores/Ironore)in usr.contents)
Smeltlist+="Ironore"
if(locate(/obj/items/Mining/Ores/Copperore)in usr.contents)
Smeltlist+="Copperore"
if(locate(/obj/items/Mining/Ores/Bronzeore)in usr.contents)
Smeltlist+="Bronzeore"
if(locate(/obj/items/Mining/Ores/Silverore)in usr.contents)
Smeltlist+="Silverore"
var/D=input("Which ore would you like to smelt?") in Smeltlist+"Cancel"
var/Total
for(D in usr.contents)
Total++
var/C=input("How many would you like to smelt?","Smelt",Total)as num
if(C>Total)
usr<<"[A][RED]You do not have this many!"
usr.Freeze=0
return
if(C<1)
usr<<"[A][RED]You cannot smelt less than 1!"
usr.Freeze=0
return
else
if(D==/obj/items/Mining/Ores/Ironore)
if(usr.Mining>=1)
start1:
if(Total>1)
sleep(20)
usr<<"[A][BLUE]You forge an iron ingot!"
del(D)
new/obj/items/Blacksmithing/Ingots/Ironingot(usr)
Total--
if(usr.Blacksmithing>=200)
goto start1:
else
usr.BlacksmithingXP+=5
usr.Blacksmithingup()
goto start1:
else
usr<<"[A][GREEN]Smelting completed!"
usr.Freeze=0
del(Smeltlist)
return
else
usr<<"[A][RED]You need at least 1 mining to smelt this!"
usr.Freeze=0
return
else
usr<<"[A][RED]You have nothing to smelt!"
usr.Freeze=0
return
The code isn't finished, I just did the coding for iron ore, once I know how to do it, I will apply to all of them. Thanks
minskill: the Mining skill required to smelt it
maxskill: the most Blacksmithing (why is there a Mining requirement but then a Blacksmithing skill gain?) skill you can get by smelting it
ingottype: the type of ingot that will be created when the ore is smelted
Obviously, all these variables would be defined under /obj/items/Mining/Ores, and then given values for each specific type of ore. For example:
With these variables, we can create a very generalized process of smelting the ore:
//and here we've failed the skill check, so inform the player
else
usr << "[A][RED]You need at least [O.minskill] to smelt this!"
And that will work for any type of ore provided you've defined the three variables correctly. Now, we just need to write something to select the type of ore. Basically, we just need a list containing one of each type of ore you have in your inventory. That's actually rather easy, though there's one caveat: we also want to make sure we don't have multiples. Fortunately, a simple locate() can do that for us:
And that's all you need to do to select a piece of ore, and that goes straight into the first chunk of code. Easy.