Advertisement
EditorRUS

Heavy-suit check

Sep 30th, 2012
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. afterattack(obj/target, mob/user , flag)
  2. if(!target.reagents) return
  3.  
  4. switch(mode)
  5. if(SYRINGE_DRAW)
  6.  
  7. if(reagents.total_volume >= reagents.maximum_volume)
  8. user << "\red The syringe is full."
  9. return
  10.  
  11. if(ismob(target))//Blood!
  12. if(istype(target, /mob/living/carbon/metroid))
  13. user << "\red You are unable to locate any blood."
  14. return
  15. if(src.reagents.has_reagent("blood"))
  16. user << "\red There is already a blood sample in this syringe"
  17. return
  18. if(istype(target, /mob/living/carbon))//maybe just add a blood reagent to all mobs. Then you can suck them dry...With hundreds of syringes. Jolly good idea.
  19. var/amount = src.reagents.maximum_volume - src.reagents.total_volume
  20. var/mob/living/carbon/T = target
  21. if(!T.dna)
  22. usr << "You are unable to locate any blood. (To be specific, your target seems to be missing their DNA datum)"
  23. return
  24. if(NOCLONE in T.mutations) //target done been et, no more blood in him
  25. user << "\red You are unable to locate any blood."
  26. return
  27. if(ishuman(T))
  28. if(T:vessel.get_reagent_amount("blood") < amount)
  29. return
  30. if(! ( istype(target:wear_suit, /obj/item/clothing/suit/space) || istype(target:wear_suit, /obj/item/clothing/suit/armor) || istype(target:wear_suit, /obj/item/clothing/suit/bio_hood) || istype(target:wear_suit, /obj/item/clothing/suit/fire) ) )
  31. var/datum/reagent/B = new /datum/reagent/blood
  32. B.holder = src
  33. B.volume = amount
  34. //set reagent data
  35. B.data["donor"] = T
  36. /*
  37. if(T.virus && T.virus.spread_type != SPECIAL)
  38. B.data["virus"] = new T.virus.type(0)
  39. */
  40.  
  41.  
  42.  
  43. for(var/datum/disease/D in T.viruses)
  44. if(!B.data["viruses"])
  45. B.data["viruses"] = list()
  46.  
  47.  
  48. B.data["viruses"] += new D.type
  49.  
  50. // not sure why it was checking if(B.data["virus2"]), but it seemed wrong
  51. if(T.virus2)
  52. B.data["virus2"] = T.virus2.getcopy()
  53.  
  54. B.data["blood_DNA"] = copytext(T.dna.unique_enzymes,1,0)
  55. if(T.resistances&&T.resistances.len)
  56. B.data["resistances"] = T.resistances.Copy()
  57. if(istype(target, /mob/living/carbon/human))//I wish there was some hasproperty operation...
  58. B.data["blood_type"] = copytext(T.dna.b_type,1,0)
  59. var/list/temp_chem = list()
  60. for(var/datum/reagent/R in target.reagents.reagent_list)
  61. temp_chem += R.name
  62. temp_chem[R.name] = R.volume
  63. B.data["trace_chem"] = list2params(temp_chem)
  64. B.data["antibodies"] = T.antibodies
  65. //debug
  66. //for(var/D in B.data)
  67. // world << "Data [D] = [B.data[D]]"
  68. //debug
  69. if(ishuman(T))
  70. T:vessel.remove_reagent("blood",amount) // Removes blood if human
  71.  
  72. src.reagents.reagent_list += B
  73. src.reagents.update_total()
  74. src.on_reagent_change()
  75. src.reagents.handle_reactions()
  76. // T:vessel.trans_to(src, amount) // Virus2 and antibodies aren't in blood in the first place.
  77.  
  78. user << "\blue You take a blood sample from [target]"
  79. for(var/mob/O in viewers(4, user))
  80. O.show_message("\red [user] takes a blood sample from [target].", 1)
  81.  
  82. if(prob(2) && istype(T,/mob/living/carbon/monkey))
  83. T:react_to_attack(user)
  84. else
  85. user << "\blue That creature has strong suit"
  86. return 0
  87. else //if not mob
  88. if(!target.reagents.total_volume)
  89. user << "\red [target] is empty."
  90. return
  91.  
  92. if(!target.is_open_container() && !istype(target,/obj/structure/reagent_dispensers) && !istype(target,/obj/item/metroid_core))
  93. user << "\red You cannot directly remove reagents from this object."
  94. return
  95.  
  96. var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this) // transfer from, transfer to - who cares?
  97.  
  98. user << "\blue You fill the syringe with [trans] units of the solution."
  99. if (reagents.total_volume >= reagents.maximum_volume)
  100. mode=!mode
  101. update_icon()
  102.  
  103. if(SYRINGE_INJECT)
  104. if(!reagents.total_volume)
  105. user << "\red The Syringe is empty."
  106. return
  107. if(istype(target, /obj/item/weapon/implantcase/chem))
  108. return
  109.  
  110. if(!target.is_open_container() && !ismob(target) && !istype(target, /obj/item/weapon/reagent_containers/food) && !istype(target, /obj/item/metroid_core) && !istype(target, /obj/item/clothing/mask/cigarette) && !istype(target, /obj/item/weapon/cigpacket))
  111. user << "\red You cannot directly fill this object."
  112. return
  113. if(target.reagents.total_volume >= target.reagents.maximum_volume)
  114. user << "\red [target] is full."
  115. return
  116.  
  117. if(istype(target, /obj/item/metroid_core))
  118. var/obj/item/metroid_core/core = target
  119. core.Flush = 30 // reset flush counter
  120. if(! ( istype(target:wear_suit, /obj/item/clothing/suit/space) || istype(target:wear_suit, /obj/item/clothing/suit/armor) || istype(target:wear_suit, /obj/item/clothing/suit/bio_hood) || istype(target:wear_suit, /obj/item/clothing/suit/fire) ) )
  121. if(ismob(target) && target != user)
  122. for(var/mob/O in viewers(world.view, user))
  123. O.show_message(text("\red <B>[] is trying to inject []!</B>", user, target), 1)
  124. if(!do_mob(user, target)) return
  125. for(var/mob/O in viewers(world.view, user))
  126. O.show_message(text("\red [] injects [] with the syringe!", user, target), 1)
  127. src.reagents.reaction(target, INGEST)
  128. if(prob(2) && istype(target,/mob/living/carbon/monkey))
  129. var/mob/living/carbon/monkey/M = target
  130. M.react_to_attack(user)
  131. if(ismob(target) && target == user)
  132. src.reagents.reaction(target, INGEST)
  133. spawn(5)
  134. var/datum/reagent/blood/B
  135. for(var/datum/reagent/blood/d in src.reagents.reagent_list)
  136. B = d
  137. break
  138. var/trans
  139. if(B && ishuman(target))
  140. var/mob/living/carbon/human/H = target
  141. H.vessel.add_reagent("blood",(B.volume > 5? 5 : B.volume),B.data)
  142. src.reagents.remove_reagent("blood",(B.volume > 5? 5 : B.volume))
  143. else
  144. trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
  145. user << "\blue You inject [trans] units of the solution. The syringe now contains [src.reagents.total_volume] units."
  146. if (reagents.total_volume <= 0 && mode==SYRINGE_INJECT)
  147. mode = SYRINGE_DRAW
  148. update_icon()
  149. else
  150. user << "\red That creature has strong suit"
  151. return 0
  152. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement