mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
Blood_DNA fixes.
Bloodied icons rewritten to be overlays, not replacing the icons. Hopefully this should fix \icon[src] breaking everything. Bloodied hands/gloves don't transfer blood to infinite amounts of touched items. Please report any bugs! git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3290 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
+1
-1
@@ -270,7 +270,7 @@
|
||||
/obj/item
|
||||
name = "item"
|
||||
icon = 'items.dmi'
|
||||
var/icon_old = null//For when weapons get bloodied this saves their old icon.
|
||||
var/icon/blood_overlay = null //this saves our blood splatter overlay, which will be processed not to go over the edges of the sprite
|
||||
var/abstract = 0
|
||||
var/force = 0
|
||||
var/item_state = null
|
||||
|
||||
+89
-85
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/atom/proc/MouseDrop_T()
|
||||
return
|
||||
|
||||
@@ -166,7 +164,7 @@
|
||||
src.fingerprintslast = M.key
|
||||
return
|
||||
|
||||
|
||||
//returns 1 if made bloody, returns 0 otherwise
|
||||
/atom/proc/add_blood(mob/living/carbon/human/M as mob)
|
||||
if (!( istype(M, /mob/living/carbon/human) ))
|
||||
return 0
|
||||
@@ -174,66 +172,71 @@
|
||||
M.dna = new /datum/dna(null)
|
||||
M.check_dna()
|
||||
if (!( src.flags ) & 256)
|
||||
return
|
||||
if(!blood_DNA)
|
||||
return 0
|
||||
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()
|
||||
if (blood_DNA.len)
|
||||
if (istype(src, /obj/item)&&!istype(src, /obj/item/weapon/melee/energy))//Only regular items. Energy melee weapon are not affected.
|
||||
var/obj/item/source2 = src
|
||||
source2.icon_old = src.icon
|
||||
var/icon/I = new /icon(src.icon, src.icon_state)
|
||||
I.Blend(new /icon('blood.dmi', "thisisfuckingstupid"),ICON_ADD)
|
||||
I.Blend(new /icon('blood.dmi', "itemblood"),ICON_MULTIPLY)
|
||||
I.Blend(new /icon(src.icon, src.icon_state),ICON_UNDERLAY)
|
||||
src.icon = I
|
||||
var/inthere = 0
|
||||
for(var/i = 1, i <= src.blood_DNA.len, i++)
|
||||
var/list/templist = src.blood_DNA[i]
|
||||
if(templist[1] == M.dna.unique_enzymes && templist[2] == M.dna.b_type)
|
||||
inthere = 1
|
||||
break
|
||||
if(!inthere)
|
||||
src.blood_DNA.len++
|
||||
src.blood_DNA[src.blood_DNA.len] = list(M.dna.unique_enzymes,M.dna.b_type)
|
||||
else if (istype(src, /turf/simulated))
|
||||
var/turf/simulated/source2 = src
|
||||
var/list/objsonturf = range(0,src)
|
||||
if(objsonturf)
|
||||
for(var/i=1, i<=objsonturf.len, i++)
|
||||
if(istype(objsonturf[i],/obj/effect/decal/cleanable/blood))
|
||||
var/obj/effect/decal/cleanable/blood/this = objsonturf[i]
|
||||
this.blood_DNA.len++
|
||||
this.blood_DNA[this.blood_DNA.len] = list(M.dna.unique_enzymes, M.dna.b_type)
|
||||
for(var/datum/disease/D in M.viruses)
|
||||
var/datum/disease/newDisease = new D.type
|
||||
this.viruses += newDisease
|
||||
newDisease.holder = this
|
||||
return
|
||||
var/obj/effect/decal/cleanable/blood/this = new /obj/effect/decal/cleanable/blood(source2)
|
||||
var/list/blood_DNA_temp[1]
|
||||
blood_DNA_temp[1] = list(M.dna.unique_enzymes, M.dna.b_type)
|
||||
this.blood_DNA = blood_DNA_temp
|
||||
this.blood_owner = M
|
||||
|
||||
//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('blood.dmi', rgb(255,255,255)),ICON_ADD) //fills the icon_state with white (except where it's transparent)
|
||||
I.Blend(new /icon('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
|
||||
for(var/i = 1, i <= O.blood_DNA.len, i++)
|
||||
if((O.blood_DNA[i][1] == M.dna.unique_enzymes) && (O.blood_DNA[i][2] == M.dna.b_type))
|
||||
return 0 //already bloodied with this blood. Cannot add more.
|
||||
O.blood_DNA.len++
|
||||
O.blood_DNA[O.blood_DNA.len] = list(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)
|
||||
B.blood_DNA.len++
|
||||
B.blood_DNA[B.blood_DNA.len] = list(M.dna.unique_enzymes,M.dna.b_type)
|
||||
for(var/datum/disease/D in M.viruses)
|
||||
var/datum/disease/newDisease = new D.type
|
||||
this.viruses += newDisease
|
||||
newDisease.holder = this
|
||||
else if (istype(src, /mob/living/carbon/human))
|
||||
var/inthere = 0
|
||||
for(var/i = 1, i <= src.blood_DNA.len, i++)
|
||||
var/list/templist = src.blood_DNA[i]
|
||||
if(templist[1] == M.dna.unique_enzymes && templist[2] == M.dna.b_type)
|
||||
inthere = 1
|
||||
break
|
||||
if(!inthere)
|
||||
src.blood_DNA.len++
|
||||
src.blood_DNA[src.blood_DNA.len] = list(M.dna.unique_enzymes,M.dna.b_type)
|
||||
else
|
||||
return
|
||||
else
|
||||
var/list/blood_DNA_temp[1]
|
||||
blood_DNA_temp[1] = list(M.dna.unique_enzymes, M.dna.b_type)
|
||||
src.blood_DNA = blood_DNA_temp
|
||||
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 = list(list(M.dna.unique_enzymes, M.dna.b_type))
|
||||
newblood.blood_owner = M
|
||||
for(var/datum/disease/D in M.viruses)
|
||||
var/datum/disease/newDisease = new D.type
|
||||
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
|
||||
//if this blood isn't already in the list, add it
|
||||
for(var/i = 1, i <= H.blood_DNA.len, i++)
|
||||
if((H.blood_DNA[i][1] == M.dna.unique_enzymes) && (H.blood_DNA[i][2] == M.dna.b_type))
|
||||
return 0 //already bloodied with this blood. Cannot add more.
|
||||
H.blood_DNA.len++
|
||||
H.blood_DNA[H.blood_DNA.len] = list(M.dna.unique_enzymes,M.dna.b_type)
|
||||
return 1 //we applied blood to the item
|
||||
return
|
||||
|
||||
/atom/proc/add_vomit_floor(mob/living/carbon/M as mob, var/toxvomit = 0)
|
||||
@@ -286,36 +289,37 @@
|
||||
if (!( src.flags ) & 256)
|
||||
return
|
||||
if ( src.blood_DNA )
|
||||
|
||||
//Cleaning blood off of mobs
|
||||
if (istype (src, /mob/living/carbon))
|
||||
var/obj/item/source2 = src
|
||||
del(source2.blood_DNA)
|
||||
//var/icon/I = new /icon(source2.icon_old, source2.icon_state) //doesnt have icon_old
|
||||
//source2.icon = I
|
||||
var/mob/living/carbon/M = src
|
||||
del(M.blood_DNA)
|
||||
if(ishuman(src))
|
||||
var/mob/living/carbon/human/M = src
|
||||
M.bloody_hands = 0
|
||||
if (istype (src, /obj/item))
|
||||
var/obj/item/source2 = src
|
||||
del(source2.blood_DNA)
|
||||
// var/icon/I = new /icon(source2.icon_old, source2.icon_state)
|
||||
if(source2.icon_old)
|
||||
source2.icon = source2.icon_old
|
||||
source2.update_icon()
|
||||
else
|
||||
source2.icon = initial(icon)
|
||||
source2.update_icon()
|
||||
var/mob/living/carbon/human/H = src
|
||||
H.bloody_hands = 0
|
||||
|
||||
//Cleaning blood off of items
|
||||
else if (istype (src, /obj/item))
|
||||
var/obj/item/O = src
|
||||
del(O.blood_DNA)
|
||||
if(O.blood_overlay)
|
||||
O.overlays.Remove(O.blood_overlay)
|
||||
|
||||
if(istype(src, /obj/item/clothing/gloves))
|
||||
var/obj/item/clothing/gloves/G = src
|
||||
G.transfer_blood = 0
|
||||
if (istype(src, /turf/simulated))
|
||||
var/obj/item/source2 = src
|
||||
del(source2.blood_DNA)
|
||||
if(source2.icon_old)
|
||||
var/icon/I = new /icon(source2.icon_old, source2.icon_state)
|
||||
source2.icon = I
|
||||
|
||||
//Cleaning blood off of turfs
|
||||
else if (istype(src, /turf/simulated))
|
||||
var/turf/simulated/T = src
|
||||
del(T.blood_DNA)
|
||||
if(T.icon_old)
|
||||
var/icon/I = new /icon(T.icon_old, T.icon_state)
|
||||
T.icon = I
|
||||
else
|
||||
source2.icon = initial(icon)
|
||||
if(blood_DNA && !blood_DNA.len)
|
||||
T.icon = initial(icon)
|
||||
|
||||
if(blood_DNA && istype(blood_DNA, /list) && !blood_DNA.len)
|
||||
del(blood_DNA)
|
||||
if(src.fingerprints && src.fingerprints.len)
|
||||
var/done = 0
|
||||
@@ -1049,7 +1053,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
|
||||
src.Topic(nhref, params2list(nhref), src, 1)
|
||||
return
|
||||
|
||||
/atom/proc/AICtrlClick() // Bolts doors.
|
||||
/atom/proc/AICtrlClick() // Bolts doors.
|
||||
if(istype(src , /obj/machinery/door/airlock))
|
||||
if(src:locked)
|
||||
var/nhref = "src=\ref[src];aiEnable=4"
|
||||
|
||||
@@ -4,8 +4,8 @@ atom/var/list/suit_fibers
|
||||
|
||||
atom/proc/add_fibers(mob/living/carbon/human/M)
|
||||
if(M.gloves)
|
||||
if(M.gloves.transfer_blood)
|
||||
if(add_blood(M.gloves.bloody_hands_mob))
|
||||
if(M.gloves.transfer_blood) //bloodied gloves transfer blood to touched objects
|
||||
if(add_blood(M.gloves.bloody_hands_mob)) //only reduces the bloodiness of our gloves if the item wasn't already bloody
|
||||
M.gloves.transfer_blood--
|
||||
//world.log << "[M.gloves] added blood to [src] from [M.gloves.bloody_hands_mob]"
|
||||
else if(M.bloody_hands)
|
||||
|
||||
@@ -98,6 +98,9 @@ should be listed in the changelog upon commit tho. Thanks. -->
|
||||
<ul class="changes bgimages16">
|
||||
<li class="imageadd">Added 6 female hairstyles -- credits go to Erthilo of Baystation. Added a male hairstyle -- credits go to WJohnston of TG. If you can sprite some unique and decent-looking hair sprites, feel free to PM me on the TG forums.</li>
|
||||
</ul>
|
||||
<ul class="changes bgimages16">
|
||||
<li class="bugfix">The way objects appear to be splattered with blood has been rewritten in an effort to fix stupid things happening with icons. It should be called far less frequently now. PLEASE, if you experience crashes that could in anyway be related to blood, report them with DETAILED information. Thanks</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="commit sansserif">
|
||||
|
||||
Reference in New Issue
Block a user