Vampires Sucking Bloodpacks

Vampires can now drain blood from bloodpacks by attacking themselves with it. Note that only total blood is given, not usable blood.
This commit is contained in:
skull132
2016-01-04 15:45:57 +02:00
parent 8d165145f9
commit 7bf23fcef5
@@ -7,22 +7,51 @@
var/blood_type = null
New()
..()
if(blood_type != null)
name = "BloodPack [blood_type]"
reagents.add_reagent("blood", 200, list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_type"=blood_type,"resistances"=null,"trace_chem"=null))
update_icon()
on_reagent_change()
/obj/item/weapon/reagent_containers/blood/New()
..()
if(blood_type != null)
name = "BloodPack [blood_type]"
reagents.add_reagent("blood", 200, list("donor"=null,"viruses"=null,"blood_DNA"=null,"blood_type"=blood_type,"resistances"=null,"trace_chem"=null))
update_icon()
/obj/item/weapon/reagent_containers/blood/on_reagent_change()
update_icon()
var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9) icon_state = "empty"
if(10 to 50) icon_state = "half"
if(51 to INFINITY) icon_state = "full"
/obj/item/weapon/reagent_containers/blood/update_icon()
var/percent = round((reagents.total_volume / volume) * 100)
switch(percent)
if(0 to 9) icon_state = "empty"
if(10 to 50) icon_state = "half"
if(51 to INFINITY) icon_state = "full"
/obj/item/weapon/reagent_containers/blood/attack(mob/living/carbon/human/M as mob, mob/living/carbon/human/user as mob)
if (user == M && (user.mind in ticker.mode.vampires || user.mind.vampire))
if (reagents.get_reagent_amount("blood"))
user.visible_message("\red [user] raises \the [src] up to \his mouth and bites into it.", "\blue You raise \the [src] up to your mouth and bite into it, starting to drain its contents.")
while (do_after(user, 25, 5, 1))
var/blood_taken = 0
var/need_to_break = 0
if (reagents.get_reagent_amount("blood") > 10)
blood_taken = 10
else
blood_taken = reagents.get_reagent_amount("blood")
need_to_break = 1
reagents.remove_reagent("blood", blood_taken)
user.mind.vampire.bloodtotal += blood_taken
user.check_vampire_upgrade(user.mind)
if (blood_taken)
user << "\blue <b>You have accumulated [user.mind.vampire.bloodtotal] [user.mind.vampire.bloodtotal > 1 ? "units" : "unit"] of blood and have [user.mind.vampire.bloodusable] left to use."
if (need_to_break)
break
user.visible_message("\red [user] licks \his fangs dry, lowering \the [src].", "\blue You lick your fangs clean of the tasteless blood.")
else
..()
/obj/item/weapon/reagent_containers/blood/APlus
blood_type = "A+"
@@ -45,4 +74,4 @@
/obj/item/weapon/reagent_containers/blood/empty
name = "Empty BloodPack"
desc = "Seems pretty useless... Maybe if there were a way to fill it?"
icon_state = "empty"
icon_state = "empty"