Code Tidy - Pastebin

New     Fork     Embed     View raw     Report

Building - javascript

Embed

You can embed this paste into a blog or website with this code:

<iframe class="codetidy" type="text/html" width="100%" src="http://codetidy.com/paste/embed/3003" frameborder="0"></iframe>

Add comment

Captcha
  1. #define islist(x) istype(x,/list)?
  2.  ?
  3. mob/Player/proc/Build_Start(obj/item,list/needed=list(),basetime,upskills=null)?
  4.     if(busy) return?
  5.     else if(!istype(loc,/turf/Terrain/Grass))return?
  6.     world << output("I love Networking!")?
  7.     var/check=0?
  8.     ASSERT(needed.len)?
  9.     for(var/a in needed)?
  10.         var/newtype = text2path("/obj/item/stackable/[a]")?
  11.         var/obj/item/stackable/S = locate(newtype) in contents?
  12.         if(S&&S.count >= needed[a]) check++?
  13.         else break?
  14.  ?
  15.     if(check==needed.len)?
  16.         src << "<B>You started [upskills]!"?
  17.         move=0?
  18.         busy=1?
  19.         if(upskills=="metal crafting"||"wood crafting")?
  20.             icon_state="crafting"?
  21.         else?
  22.             icon_state = "building"?
  23.         for(var/i=basetime+Time("[upskills]"),i>0,i-=10)?
  24.             view() << sound('Sounds/chop.ogg',,,,rand(25,100))?
  25.             sleep(10)?
  26.  ?
  27.         move = 1?
  28.         busy = 0?
  29.         icon_state = ""?
  30.  ?
  31.         if(islist(upskills))    for(var/i in upskills)Check_Exp(i)?
  32.         else                    Check_Exp(upskills)?
  33.  ?
  34.         Check_Exp("[upskills]")?
  35.  ?
  36.         src << "<B>You finished [upskills]!</B>"?
  37.  ?
  38.         for(var/a in needed)?
  39.             var/newtype = text2path("/obj/item/stackable/[a]")?
  40.             var/obj/item/stackable/S = locate(newtype) in contents?
  41.             Item_Remove(S,needed[a])?
  42.  ?
  43.         if(item in typesof(/obj/Built))?
  44.             var/obj/Built/s = new item?
  45.             s.owner = key+"(Player)"?
  46.             s.loc=locate(x,y,z)?
  47.  ?
  48.         else if(item in typesof(/turf/Built))?
  49.             var/turf/Built/T = new item(locate(x,y,z))?
  50.             T.owner = key+"(Player)"?
  51.  ?
  52.         else if(ispath(item))?
  53.             var/atom/movable/O = new item?
  54.             O.loc = locate(x,y,z)?
  55.  ?
  56.         else?
  57.             CRASH("There seems to be a problem with the item path type(Arguement 1)!")?
  58.  ?
  59.         Check_Weight()?
  60.         Update()?
  61.  ?
  62.     else?
  63.         src << "<b>You need more materials:</b> "?
  64.         for(var/a in needed)?
  65.             var/newtype = text2path("/obj/item/stackable/[a]")?
  66.             var/obj/item/stackable/X = locate(newtype) in contents?
  67.             if(X&&X.count < needed[a])src << "<b>[a]\s:</b> [needed[a]-X.count]"?
  68.             else src << "<b>[a]\s:</b> [needed[a]]"?
© 2011 Code Tidy