Showed that huge proc in /atom what polymorphism' is.

Now instead of huge condition line it's handled where it was supposed to be handled.
This commit is contained in:
Chinsky
2013-06-01 12:24:43 +04:00
parent 0b9c904252
commit 89fff29db1
5 changed files with 82 additions and 85 deletions
@@ -89,6 +89,6 @@ Bonus
if(brute_dam < 50)
M.adjustBruteLoss(3)
var/turf/pos = get_turf(M)
var/turf/simulated/pos = get_turf(M)
pos.add_blood_floor(M)
playsound(pos, 'sound/effects/splat.ogg', 50, 1)
+1 -80
View File
@@ -420,6 +420,7 @@ its easier to just keep the beam vertical.
//returns 1 if made bloody, returns 0 otherwise
/atom/proc/add_blood(mob/living/carbon/human/M as mob)
.=1
if (!( istype(M, /mob/living/carbon/human) ))
return 0
if (!istype(M.dna, /datum/dna))
@@ -431,55 +432,6 @@ its easier to just keep the beam vertical.
if(!blood_DNA || !istype(blood_DNA, /list)) //if our list of DNA doesn't exist yet (or isn't a list) initialise it.
blood_DNA = list()
//adding blood to items
if (istype(src, /obj/item)&&!istype(src, /obj/item/weapon/melee/energy))//Only regular items. Energy melee weapon are not affected.
var/obj/item/O = src
//if we haven't made our blood_overlay already
if( !O.blood_overlay )
var/icon/I = new /icon(O.icon, O.icon_state)
I.Blend(new /icon('icons/effects/blood.dmi', rgb(255,255,255)),ICON_ADD) //fills the icon_state with white (except where it's transparent)
I.Blend(new /icon('icons/effects/blood.dmi', "itemblood"),ICON_MULTIPLY) //adds blood and the remaining white areas become transparant
//not sure if this is worth it. It attaches the blood_overlay to every item of the same type if they don't have one already made.
for(var/obj/item/A in world)
if(A.type == O.type && !A.blood_overlay)
A.blood_overlay = I
//apply the blood-splatter overlay if it isn't already in there
if(!blood_DNA.len)
O.overlays += O.blood_overlay
//if this blood isn't already in the list, add it
if(blood_DNA[M.dna.unique_enzymes])
return 0 //already bloodied with this blood. Cannot add more.
blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
return 1 //we applied blood to the item
//adding blood to turfs
else if (istype(src, /turf/simulated))
var/turf/simulated/T = src
//get one blood decal and infect it with virus from M.viruses
for(var/obj/effect/decal/cleanable/blood/B in T.contents)
if(!B.blood_DNA[M.dna.unique_enzymes])
B.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
/*for(var/datum/disease/D in M.viruses)
var/datum/disease/newDisease = D.Copy(1)
B.viruses += newDisease
newDisease.holder = B*/
return 1 //we bloodied the floor
//if there isn't a blood decal already, make one.
var/obj/effect/decal/cleanable/blood/newblood = new /obj/effect/decal/cleanable/blood(T)
newblood.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
/*for(var/datum/disease/D in M.viruses)
var/datum/disease/newDisease = D.Copy(1)
newblood.viruses += newDisease
newDisease.holder = newblood*/
return 1 //we bloodied the floor
//adding blood to humans
else if (istype(src, /mob/living/carbon/human))
var/mob/living/carbon/human/H = src
@@ -499,37 +451,6 @@ its easier to just keep the beam vertical.
if(toxvomit)
this.icon_state = "vomittox_[pick(1,4)]"
/*for(var/datum/disease/D in M.viruses)
var/datum/disease/newDisease = D.Copy(1)
this.viruses += newDisease
newDisease.holder = this*/
// Only adds blood on the floor -- Skie
/atom/proc/add_blood_floor(mob/living/carbon/M as mob)
if( istype(M, /mob/living/carbon/monkey) || istype(M, /mob/living/carbon/human))
if( istype(src, /turf/simulated) )
var/turf/simulated/source1 = src
var/obj/effect/decal/cleanable/blood/this = new /obj/effect/decal/cleanable/blood(source1)
this.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
/*for(var/datum/disease/D in M.viruses)
var/datum/disease/newDisease = D.Copy(1)
this.viruses += newDisease
newDisease.holder = this*/
else if( istype(M, /mob/living/carbon/alien ))
if( istype(src, /turf/simulated) )
var/turf/simulated/source2 = src
var/obj/effect/decal/cleanable/xenoblood/this = new /obj/effect/decal/cleanable/xenoblood(source2)
this.blood_DNA["UNKNOWN BLOOD"] = "X*"
/*for(var/datum/disease/D in M.viruses)
var/datum/disease/newDisease = D.Copy(1)
this.viruses += newDisease
newDisease.holder = this*/
else if( istype(M, /mob/living/silicon/robot ))
if( istype(src, /turf/simulated) )
var/turf/simulated/source2 = src
new /obj/effect/decal/cleanable/oil(source2)
/atom/proc/clean_blood()
src.germ_level = 0
+38 -2
View File
@@ -338,8 +338,8 @@
M.take_organ_damage(power)
if (prob(33)) // Added blood for whacking non-humans too
var/turf/location = M.loc
if (istype(location, /turf/simulated))
var/turf/simulated/location = M.loc
if (istype(location))
location.add_blood_floor(M)
if("fire")
if (!(COLD_RESISTANCE in M.mutations))
@@ -700,3 +700,39 @@
if(istype(src, /obj/item/clothing/gloves))
var/obj/item/clothing/gloves/G = src
G.transfer_blood = 0
/obj/item/add_blood(mob/living/carbon/human/M as mob)
if (!..())
return 0
if(istype(src, /obj/item/weapon/melee/energy))
return
//if we haven't made our blood_overlay already
if( !blood_overlay )
generate_blood_overlay()
//apply the blood-splatter overlay if it isn't already in there
if(!blood_DNA.len)
overlays += blood_overlay
//if this blood isn't already in the list, add it
if(blood_DNA[M.dna.unique_enzymes])
return 0 //already bloodied with this blood. Cannot add more.
blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
return 1 //we applied blood to the item
/obj/item/proc/generate_blood_overlay()
if(blood_overlay)
return
var/icon/I = new /icon(icon, icon_state)
I.Blend(new /icon('icons/effects/blood.dmi', rgb(255,255,255)),ICON_ADD) //fills the icon_state with white (except where it's transparent)
I.Blend(new /icon('icons/effects/blood.dmi', "itemblood"),ICON_MULTIPLY) //adds blood and the remaining white areas become transparant
//not sure if this is worth it. It attaches the blood_overlay to every item of the same type if they don't have one already made.
for(var/obj/item/A in world)
if(A.type == type && !A.blood_overlay)
A.blood_overlay = I
+30 -1
View File
@@ -72,4 +72,33 @@
playsound(src.loc, 'sound/misc/slip.ogg', 50, 1, -3)
M.Weaken(10)
..()
..()
//returns 1 if made bloody, returns 0 otherwise
/turf/simulated/add_blood(mob/living/carbon/human/M as mob)
if (!..())
return 0
for(var/obj/effect/decal/cleanable/blood/B in contents)
if(!B.blood_DNA[M.dna.unique_enzymes])
B.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
return 1 //we bloodied the floor
//if there isn't a blood decal already, make one.
var/obj/effect/decal/cleanable/blood/newblood = new /obj/effect/decal/cleanable/blood(src)
newblood.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
return 1 //we bloodied the floor
// Only adds blood on the floor -- Skie
/turf/simulated/proc/add_blood_floor(mob/living/carbon/M as mob)
if( istype(M, /mob/living/carbon/monkey) || istype(M, /mob/living/carbon/human))
var/obj/effect/decal/cleanable/blood/this = new /obj/effect/decal/cleanable/blood(src)
this.blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
else if( istype(M, /mob/living/carbon/alien ))
var/obj/effect/decal/cleanable/xenoblood/this = new /obj/effect/decal/cleanable/xenoblood(src)
this.blood_DNA["UNKNOWN BLOOD"] = "X*"
else if( istype(M, /mob/living/silicon/robot ))
new /obj/effect/decal/cleanable/oil(src)
+12 -1
View File
@@ -1084,4 +1084,15 @@
if (germs == 2500)
world << "Reached stage 3 in [ticks] ticks"
world << "Mob took [tdamage] tox damage"
*/
*/
//returns 1 if made bloody, returns 0 otherwise
/mob/living/carbon/human/add_blood(mob/living/carbon/human/M as mob)
if (!..())
return 0
//if this blood isn't already in the list, add it
if(blood_DNA[M.dna.unique_enzymes])
return 0 //already bloodied with this blood. Cannot add more.
blood_DNA[M.dna.unique_enzymes] = M.dna.b_type
src.update_inv_gloves() //handles bloody hands overlays and updating
return 1 //we applied blood to the item