Burning Adventure Snippet 1


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. mob
  2. verb
  3. Blacksmith()
  4. var/list/L = list()
  5. for(var/smithItem/s in smithItems)
  6. L += s.name //We'll use the nice name for input
  7. var/V = input(src, "What do you want to smith?", "Smithing") in L
  8. var/smithItem/S = smithItems[L.Find(V)]
  9. //Confusing. We're finding what we selected, and then selecting the corresponding item from the global list.
  10.  
  11. var/list/held = contents //Copy the contents list
  12. for(var/atom/A in S.tools)
  13. for(var/V = 0, V < S.tools[A], V++)
  14. var/atom/B = locate(A) in held
  15. if(B)
  16. held -= B
  17. else
  18. if(S.tools[A] > 1)
  19. usr << "You need [S.tools[A]] [A]s"
  20. else
  21. usr << "You need \an [A]"
  22. return 0
  23. held = contents //Reset the list
  24. //We reset it because materials may have the same thing as tools
  25. //Thus, the tools would be destroyed after use. Elegent, no?
  26. for(var/atom/A in S.materials)
  27. for(var/V = 0, V < S.materials[A], V++)
  28. var/atom/B = locate(A) in held
  29. if(B)
  30. held -= B
  31. else
  32. if(S.materials[A] > 1)
  33. usr << "You need [S.materials[A]] [A]s"
  34. else
  35. usr << "You need \an [A]"
  36. return 0
  37.  
  38. //If we're here, we've passed the test.
  39. contents = held
  40. //It has all the materials already removed.
  41. for(var/V in S.itemType)
  42. for(var/v = 0, v < S.itemType[V}, v++)
  43. new V()
  44. src << "You made \a [V]"
  45. if(!V.Move(src))
  46. V.Move(loc)
  47. //And give us what we made.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.