I'm about to go fucking APE

None of this is actually viable, Footprints aren't taking proper color, aren't updating their color. It's just default red. screm
This commit is contained in:
Poojawa
2019-08-16 04:58:16 -05:00
parent 264cbf8108
commit d71f37167f
8 changed files with 84 additions and 25 deletions

View File

@@ -9,6 +9,7 @@
/datum/component/decal/blood/generate_appearance(_icon, _icon_state, _dir, _layer, _color)
var/obj/item/I = parent
I.cut_overlays()
if(!_icon)
_icon = 'icons/effects/blood.dmi'
if(!_icon_state)
@@ -22,10 +23,12 @@
var/icon/blood_splatter_icon = icon(initial(I.icon), initial(I.icon_state), , 1) //we only want to apply blood-splatters to the initial icon_state for each object
blood_splatter_icon.Blend("#fff", ICON_ADD) //fills the icon_state with white (except where it's transparent)
blood_splatter_icon.Blend(icon(_icon, _icon_state), ICON_MULTIPLY) //adds blood and the remaining white areas become transparant
pic = mutable_appearance(blood_splatter_icon, initial(I.icon_state))
// pic = mutable_appearance(blood_splatter_icon, initial(I.icon_state))
I.blood_overlay = image(blood_splatter_icon)
I.blood_splatter_icon = blood_splatter_icon
I.blood_overlay = image(I.blood_splatter_icon)
I.blood_overlay.color = I.blood_DNA_to_color()
I.update_icon()
I.add_overlay(I.blood_overlay)
return TRUE

View File

@@ -17,6 +17,7 @@
reagents.add_reagent(gibs_reagent_id, 5)
if(gibs_bloodtype)
add_blood_DNA(list("Non-human DNA" = gibs_bloodtype))
Blood_DNA = add_blood_DNA(list("Non-human DNA" = gibs_bloodtype))
update_icon()

View File

@@ -7,8 +7,19 @@
blood_state = BLOOD_STATE_BLOOD
bloodiness = MAX_SHOE_BLOODINESS
color = BLOOD_COLOR_HUMAN //default so we don't have white splotches everywhere.
var/list/Blood_DNA = list()
/obj/effect/decal/cleanable/blood/Initialize(mapload, list/datum/disease/diseases)
..()
get_blood_lists()
/obj/effect/decal/cleanable/blood/proc/get_blood_lists()
if(!Blood_DNA.len)
Blood_DNA = return_blood_DNA()
/obj/effect/decal/cleanable/blood/replace_decal(obj/effect/decal/cleanable/blood/C)
if(C.Blood_DNA)
Blood_DNA |= C.Blood_DNA.Copy()
C.add_blood_DNA(return_blood_DNA())
if (bloodiness)
if (C.bloodiness < MAX_SHOE_BLOODINESS)
@@ -51,6 +62,7 @@
desc = "Your instincts say you shouldn't be following these."
random_icon_states = null
var/list/existing_dirs = list()
var/list/Blood_DNA = list()
/obj/effect/decal/cleanable/trail_holder/update_icon()
color = blood_DNA_to_color()
@@ -81,6 +93,7 @@
var/exited_dirs = 0
blood_state = BLOOD_STATE_BLOOD //the icon state to load images from
var/list/shoe_types = list()
var/list/shoe_printer = list()
/obj/effect/decal/cleanable/blood/footprints/Crossed(atom/movable/O)
if(ishuman(O))
@@ -112,6 +125,9 @@
..()
cut_overlays()
if(shoe_printer)
color = shoeblood_DNA_to_color(shoe_printer)
for(var/Ddir in GLOB.cardinals)
if(entered_dirs & Ddir)
var/image/bloodstep_overlay = GLOB.bloody_footprints_cache["entered-[blood_state]-[Ddir]"]
@@ -149,6 +165,29 @@
return TRUE
return FALSE
/obj/effect/decal/cleanable/blood/footprints/proc/shoeblood_DNA_to_color(list/blood_dna) //handles RGB colorings of bloody shoes
var/list/colors = list()//first we make a list of all bloodtypes present
for(var/bloop in shoe_printer)
if(colors[shoe_printer[bloop]])
colors[shoe_printer[bloop]]++
else
colors[shoe_printer[bloop]] = 1
var/final_rgb = BLOOD_COLOR_HUMAN
if(colors.len)
var/sum = 0 //this is all shitcode, but it works; trust me
final_rgb = bloodtype_to_color(colors[1])
sum = colors[colors[1]]
if(colors.len > 1)
var/i = 2
while(i <= colors.len)
var/tmp = colors[colors[i]]
final_rgb = BlendRGB(final_rgb, bloodtype_to_color(colors[i]), tmp/(tmp+sum))
sum += tmp
i++
return final_rgb
/* Eventually TODO: make snowflake trails like baycode's
/obj/effect/decal/cleanable/blood/footprints/tracks/shoe
name = "footprints"

View File

@@ -41,6 +41,10 @@
var/dynamic_hair_suffix = ""//head > mask for head hair
var/dynamic_fhair_suffix = ""//mask > head for facial hair
//for blood coloration memes
var/last_bloodtype //used to track the last bloodtype to have graced these shoes; makes for better performing footprint shenanigans
var/last_blood_DNA //same as last one
/obj/item/clothing/Initialize()
. = ..()
if(CHECK_BITFIELD(clothing_flags, VOICEBOX_TOGGLABLE))
@@ -339,3 +343,10 @@ BLIND // can't see anything
deconstruct(FALSE)
else
..()
/obj/item/clothing/transfer_blood_dna(list/blood_dna)
..()
var/list/blood_list = list(return_blood_DNA())
if(blood_list.len)
last_bloodtype = blood_list[blood_list[blood_list.len]]//trust me this works
last_blood_DNA = blood_list[blood_list.len]

View File

@@ -19,9 +19,6 @@
var/adjusted = NORMAL_STYLE
mutantrace_variation = MUTANTRACE_VARIATION
var/last_bloodtype = ""//used to track the last bloodtype to have graced these shoes; makes for better performing footprint shenanigans
var/last_blood_DNA = ""//same as last one
/obj/item/clothing/shoes/ComponentInitialize()
. = ..()
AddComponent(/datum/component/redirect, list(COMSIG_COMPONENT_CLEAN_ACT = CALLBACK(src, .proc/clean_blood)))
@@ -107,9 +104,3 @@
/obj/item/proc/negates_gravity()
return FALSE
/obj/item/clothing/shoes/transfer_blood_dna(list/blood_dna)
..()
if(blood_dna.len)
last_bloodtype = blood_dna[blood_dna[blood_dna.len]]//trust me this works
last_blood_DNA = blood_dna[blood_dna.len]

View File

@@ -55,9 +55,9 @@
. += mutable_appearance('icons/effects/item_damage.dmi', "damaged[blood_overlay_type]")
IF_HAS_BLOOD_DNA(src)
if(taurmode >= SNEK_TAURIC)
. += mutable_appearance('modular_citadel/icons/mob/64x32_effects.dmi', "[blood_overlay_type]blood")
. += mutable_appearance('modular_citadel/icons/mob/64x32_effects.dmi', "[blood_overlay_type]blood", color = blood_DNA_to_color())
else
. += mutable_appearance('icons/effects/blood.dmi', "[blood_overlay_type]blood")
. += mutable_appearance('icons/effects/blood.dmi', "[blood_overlay_type]blood", color = blood_DNA_to_color())
var/mob/living/carbon/human/M = loc
if(ishuman(M) && M.w_uniform)
var/obj/item/clothing/under/U = M.w_uniform

View File

@@ -78,6 +78,7 @@
if(!B)
B = new /obj/effect/decal/cleanable/blood/splatter(src, diseases)
B.add_blood_DNA(blood_dna) //give blood info to the blood decal.
B.update_icon()
return TRUE //we bloodied the floor
/mob/living/carbon/human/add_blood_DNA(list/blood_dna, list/datum/disease/diseases)
@@ -112,25 +113,29 @@
//to add blood dna info to the object's blood_DNA list
/atom/proc/transfer_blood_dna(list/blood_dna)
var/list/dna = blood_DNA_length()
if(!dna)
dna = list()
var/old_length = dna.len
dna |= blood_dna
if(dna.len > old_length)
var/list/blood_DNA = return_blood_DNA()
if(!blood_DNA)
blood_DNA = list()
var/old_length = blood_DNA.len
blood_DNA |= blood_dna
if(blood_DNA.len > old_length)
return TRUE//some new blood DNA was added
/atom/proc/blood_DNA_to_color() //handles RGB colorings of blood
var/list/dna = blood_DNA_length()
/atom/proc/blood_DNA_to_color()
return
/obj/effect/decal/cleanable/blood/blood_DNA_to_color()
to_chat(world, "blood dna to color called by [src]")
var/list/colors = list()//first we make a list of all bloodtypes present
for(var/bloop in dna)
if(colors[dna[bloop]])
colors[dna[bloop]]++
for(var/bloop in Blood_DNA)
if(colors[Blood_DNA[bloop]])
colors[Blood_DNA[bloop]]++
else
colors[dna[bloop]] = 1
colors[Blood_DNA[bloop]] = 1
var/final_rgb = BLOOD_COLOR_HUMAN
to_chat(world, "colors has [colors.len] bloodtypes in it")
if(colors.len)
var/sum = 0 //this is all shitcode, but it works; trust me
final_rgb = bloodtype_to_color(colors[1])
@@ -144,3 +149,9 @@
i++
return final_rgb
/obj/item/clothing/blood_DNA_to_color()
var/final_rgb = BLOOD_COLOR_HUMAN
if(last_bloodtype)
final_rgb = bloodtype_to_color(last_bloodtype)
return final_rgb

View File

@@ -64,6 +64,9 @@
FP.blood_state = S.blood_state
FP.entered_dirs |= dir
FP.bloodiness = S.bloody_shoes[S.blood_state]
if(S.last_blood_DNA && S.last_bloodtype)
FP.shoe_printer += list(S.last_blood_DNA = S.last_bloodtype)
//hacky as heck; we need to move the LAST entry to there, otherwise we mix all the blood
FP.add_blood_DNA(S.return_blood_DNA())
FP.update_icon()
update_inv_shoes()