SHARE
TWEET

Untitled

a guest Jun 19th, 2017 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var/list/recipes=list()
  2. world/New()
  3.     ..()
  4.     for(var/a in typesof(/recipe/crafting) - /recipe/crafting)
  5.         var/recipe/crafting/R = new a()
  6.         recipes += R
  7.  
  8. /* Recipe Dantum    */
  9. recipe
  10.     var
  11.         name=""
  12.         list/ingredients
  13.         list/results   
  14.         list/race_req    
  15.         lev_req
  16.     proc
  17.         Make(mob/M)
  18.             var/list/remove=list()
  19.             for(var/a in ingredients)
  20.                 var/amount = 0
  21.                 for(var/obj/O in M)
  22.                     if(istype(O, text2path(a)))
  23.                         amount ++
  24.                         remove += O
  25.                 if(amount < ingredients[a])
  26.            usr << "You don't seem to have the right amount of ingredients to craft [name]"
  27.            return 0
  28.  
  29.             M.contents.Remove(remove)
  30.  
  31.             for(var/a in results)
  32.                 var/p = text2path(a)
  33.                 var/amount = results[a]
  34.                 while(amount,amount>0,amount--)
  35.                     var/atom/movable/A = new p()
  36.                     if(isobj(A)) A.Move(M)
  37.                   //else if(ismob(A)) M.Move(M.loc) //Don't think you'll ever craft a mob O.o so this can be removed
  38.  
  39. /*  Crafting Command    */
  40. mob
  41.     var
  42.         tmp
  43.             is_crafting = 0
  44.         skill_craft_lvl = 1
  45.         skill_craft_exp = 0
  46.         skill_craft_max_exp = 10
  47.  
  48. obj
  49.     crafting
  50.         new_anvil
  51.             name="New Anvil"
  52.             icon = 'Icons/anvil.dmi'
  53.             density = 1
  54.             Click()
  55.                 var/list/rs = list()
  56.                 for(var/recipe/crafting/r in recipes)
  57.                    
  58.                     if(r.name && r.ingredients && r.results )
  59.                         rs += r.name
  60.  
  61.                     // Select a item to craft
  62.                 var/make = input("What item would you like to craft") as null|anything in rs
  63.                 if(!make)
  64.                                            return
  65.  
  66.                 for(var/recipe/crafting/r in recipes)
  67.                     if(r.name == make)
  68.                         r.make(usr)
  69.                    
  70.    
  71. /*  Recipe Listings */
  72. recipe
  73.     crafting
  74.         red_gem
  75.             name = "Red Crystal"
  76.             ingredients = list("/obj/items/mining/red_gem" = 3)//ingredient path and number reqired
  77.             results = list("/obj/items/crystals/red_dhd" = 1)//crafted item and number given
  78.         blue_gem
  79.             name = "Blue Crystal"
  80.             ingredients = list("/obj/items/mining/blue_gem" = 3)
  81.             results = list("/obj/items/crystals/blue_dhd" = 1)
  82.  
  83. obj
  84.     items
  85.         mining
  86.             icon='new_items.dmi'
  87.             red_gem
  88.                 icon_state="red_gem"
  89.                 name = "Red Gem Stone"
  90.                 price = 25
RAW Paste Data
Want to get better at C++?
Learn to code C++ in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top