Blood now floats in zero G (#20993)

* Da Vlood

* removes_unused_icons

* Yep sprites

* fixes xeno blood and vomit

* Commit number x

* Steel Review Changes 1

* Henri Review Changes 1

* fixing vomit

🌋

* Haha haha ha ... ha

* fixing layering issueeee

* Sirryan2002 Review

THANKS

* implicit var/

* Sirryan Review 2

Electric Boogaloo

* Testmerge Update 1

gibs were still getting animated, blood drying while animated in space looked very jank.

all fixed

* unused variable

AHSDHASOIADGSOISA

* Testmerge Update 2

tracks floating annoyingly

* Improvements

-blood globules will now continue with the inertia of their emittor, instead of towards wherever they were facing
-drops will now have visible sprites after splatting
[running animate() still sometimes doesnt stop the animation annoyingly]

* errors

* Sirryan Review 3
This commit is contained in:
Kugamo
2023-06-14 21:17:08 -05:00
committed by GitHub
parent 3508ae1724
commit 094ca3c733
12 changed files with 263 additions and 24 deletions
@@ -1,4 +1,5 @@
#define DRYING_TIME 5 * 60 * 10 //for 1 unit of depth in puddle (amount var)
#define ALWAYS_IN_GRAVITY 2
GLOBAL_LIST_EMPTY(splatter_cache)
@@ -21,9 +22,12 @@ GLOBAL_LIST_EMPTY(splatter_cache)
var/amount = 5
var/dry_timer = 0
var/off_floor = FALSE
var/image/weightless_image
inertia_move_delay = 1 // so they dont collide with who emitted them
/obj/effect/decal/cleanable/blood/replace_decal(obj/effect/decal/cleanable/blood/C)
if(C == src)
return FALSE
if(C.blood_DNA)
blood_DNA |= C.blood_DNA.Copy()
if(bloodiness)
@@ -31,12 +35,15 @@ GLOBAL_LIST_EMPTY(splatter_cache)
C.bloodiness += bloodiness
return ..()
/obj/effect/decal/cleanable/blood/Initialize(mapload)
. = ..()
weightless_image = new()
update_icon()
if(type == /obj/effect/decal/cleanable/blood/gibs)
if(!gravity_check)
//weightless blood cannot dry
return
if(!.)
dry_timer = addtimer(CALLBACK(src, PROC_REF(dry)), DRYING_TIME * (amount+1), TIMER_STOPPABLE)
@@ -46,9 +53,37 @@ GLOBAL_LIST_EMPTY(splatter_cache)
return ..()
/obj/effect/decal/cleanable/blood/update_icon()
var/turf/T = get_turf(src)
check_gravity(T)
if((T && (T.density)) || !gravity_check || locate(/obj/structure/window/) in T || locate(/obj/structure/grille/) in T)
off_floor = TRUE
layer = ABOVE_MOB_LAYER
plane = GAME_PLANE
if(basecolor == "rainbow")
basecolor = "#[pick(list("FF0000","FF7F00","FFFF00","00FF00","0000FF","4B0082","8F00FF"))]"
color = basecolor
if(!gravity_check)
if(prob(50))
animate_float(src, -1, rand(30,120))
else
animate_levitate(src, -1, rand(30,120))
if(weightless_image.icon_state)
icon_state = weightless_image.icon_state
overlays -= weightless_image
color = "#FFFFFF"
icon = 'icons/effects/blood_weightless.dmi'
weightless_image = image(icon, icon_state)
icon_state = "empty"
weightless_image.icon += basecolor
overlays += weightless_image
else
overlays.Cut()
..()
/obj/effect/decal/cleanable/blood/proc/dry()
@@ -56,6 +91,88 @@ GLOBAL_LIST_EMPTY(splatter_cache)
desc = drydesc
color = adjust_brightness(color, -50)
amount = 0
gravity_check = ALWAYS_IN_GRAVITY
animate(src)
if(isspaceturf(loc))
var/turf/T = get_turf(src)
if(!locate(/obj/structure/grille/) in T && !locate(/obj/structure/window/) in T)
qdel(src) //no free floating dried blood in space, thatd look weird
/obj/effect/decal/cleanable/blood/ex_act()
. = ..()
update_icon()
/obj/effect/decal/cleanable/blood/proc/splat(atom/AT)
if(gravity_check) //only floating blood can splat :C
return
var/turf/T = get_turf(AT)
if(try_merging_decal(T))
return
if(loc != T)
forceMove(T) //move to the turf to splatter on
animate(src) //stop floating
gravity_check = ALWAYS_IN_GRAVITY
icon = initial(icon)
icon_state = weightless_image.icon_state
layer = initial(layer)
plane = initial(plane)
update_icon()
/obj/effect/decal/cleanable/blood/try_merging_decal(turf/T)
..()
/obj/effect/decal/cleanable/blood/Process_Spacemove(movement_dir)
if(gravity_check)
return TRUE
if(has_gravity(src))
if(!gravity_check)
splat(get_step(src, movement_dir))
return TRUE
if(pulledby && !pulledby.pulling)
return TRUE
if(throwing)
return TRUE
return FALSE
/obj/effect/decal/cleanable/blood/Bump(atom/A, yes)
if(gravity_check)
return ..()
if(iswallturf(A) || istype(A, /obj/structure/window))
splat(A)
return
else if(A.density)
splat(get_turf(A))
return
if(ishuman(A))
bloodyify_human(A)
return
..()
/obj/effect/decal/cleanable/blood/proc/bloodyify_human(mob/living/carbon/human/H)
if(inertia_dir && H.inertia_dir == inertia_dir) //if they are moving the same direction we are, no collison
return
var/list/obj/item/things_to_potentially_bloody = list()
var/count = amount + 1
for(var/obj/item/i in H.contents)
things_to_potentially_bloody += i
if(length(things_to_potentially_bloody))
for(var/i in 1 to count)
things_to_potentially_bloody[rand(1, length(things_to_potentially_bloody))].add_blood(blood_DNA, basecolor)
count--
qdel(src)
else
splat(get_turf(H))
/obj/effect/decal/cleanable/blood/attack_hand(mob/living/carbon/human/user)
..()
@@ -144,6 +261,7 @@ GLOBAL_LIST_EMPTY(splatter_cache)
mergeable_decal = FALSE
var/image/giblets
var/fleshcolor = "#FFFFFF"
gravity_check = ALWAYS_IN_GRAVITY
/obj/effect/decal/cleanable/blood/gibs/Destroy()
giblets = null
@@ -218,3 +336,4 @@ GLOBAL_LIST_EMPTY(splatter_cache)
return FALSE
#undef DRYING_TIME
#undef ALWAYS_IN_GRAVITY
@@ -1,3 +1,5 @@
#define ALWAYS_IN_GRAVITY 3
/obj/effect/decal/cleanable/generic
name = "clutter"
desc = "Someone should clean that up."
@@ -141,12 +143,74 @@
gender = PLURAL
density = FALSE
layer = TURF_LAYER
plane = FLOOR_PLANE
icon = 'icons/effects/blood.dmi'
icon_state = "vomit_1"
random_icon_states = list("vomit_1", "vomit_2", "vomit_3", "vomit_4")
no_clear = TRUE
scoop_reagents = list("vomit" = 5)
/obj/effect/decal/cleanable/vomit/Initialize(mapload)
. = ..()
var/turf/T = get_turf(src)
gravity_check = has_gravity(src, T)
if(loc != T)
forceMove(T)
if(!gravity_check)
layer = MOB_LAYER
plane = GAME_PLANE
if(prob(50))
animate_float(src, -1, rand(30, 120))
else
animate_levitate(src, -1, rand(30, 120))
icon = 'icons/effects/blood_weightless.dmi'
/obj/effect/decal/cleanable/vomit/Bump(atom/A, yes)
. = ..()
if(A.density)
splat(A)
/obj/effect/decal/cleanable/vomit/Crossed(atom/movable/AM, oldloc)
if(!gravity_check)
splat(AM)
..()
/obj/effect/decal/cleanable/vomit/proc/splat(atom/A)
if(gravity_check)
return
var/turf/T = get_turf(A)
if(try_merging_decal(T))
return
if(loc != T)
forceMove(T)
icon = initial(icon)
gravity_check = ALWAYS_IN_GRAVITY
if(T.density || locate(/obj/structure/window) in T)
layer = ABOVE_WINDOW_LAYER
plane = GAME_PLANE
else
layer = initial(layer)
plane = initial(plane)
animate(src)
/obj/effect/decal/cleanable/vomit/Process_Spacemove(movement_dir)
if(gravity_check)
return 1
if(has_gravity(src))
if(!gravity_check)
splat(get_step(src, movement_dir))
return 1
if(pulledby && !pulledby.pulling)
return 1
if(throwing)
return 1
return 0
/obj/effect/decal/cleanable/vomit/green
name = "green vomit"
desc = "It's all gummy. Ew."
@@ -229,3 +293,5 @@
icon = 'icons/effects/blood.dmi'
icon_state = "xfloor1"
random_icon_states = list("xfloor1", "xfloor2", "xfloor3", "xfloor4", "xfloor5", "xfloor6", "xfloor7")
#undef ALWAYS_IN_GRAVITY
@@ -1,5 +1,6 @@
// 5 seconds
#define TRACKS_CRUSTIFY_TIME 50
#define ALWAYS_IN_GRAVITY 2
// color-dir-dry
GLOBAL_LIST_EMPTY(fluidtrack_cache)
@@ -15,6 +16,7 @@ GLOBAL_LIST_EMPTY(fluidtrack_cache)
gender = PLURAL
random_icon_states = null
amount = 0
gravity_check = ALWAYS_IN_GRAVITY
//BLOODY FOOTPRINTS
/obj/effect/decal/cleanable/blood/footprints
@@ -28,7 +30,7 @@ GLOBAL_LIST_EMPTY(fluidtrack_cache)
var/exited_dirs = 0
var/base_alpha = BLOODY_FOOTPRINT_BASE_ALPHA
blood_state = BLOOD_STATE_HUMAN //the icon state to load images from
gravity_check = ALWAYS_IN_GRAVITY
/obj/effect/decal/cleanable/blood/footprints/Crossed(atom/movable/O, oldloc)
..()
@@ -146,3 +148,5 @@ GLOBAL_LIST_EMPTY(fluidtrack_cache)
if(basecolor == COLOR_BLOOD_MACHINE)
return FALSE
return TRUE
#undef ALWAYS_IN_GRAVITY
+40 -10
View File
@@ -1,8 +1,16 @@
#define ALWAYS_IN_GRAVITY 2
/obj/effect/decal/cleanable
///when Initialized() its icon_state will be chosen from this list
var/list/random_icon_states = list()
var/bloodiness = 0 //0-100, amount of blood in this decal, used for making footprints and affecting the alpha of bloody footprints
var/mergeable_decal = TRUE //when two of these are on a same tile or do we need to merge them into just one?
plane = FLOOR_PLANE //prevents Ambient Occlusion effects around it ; Set to GAME_PLANE in Initialize() if on a wall
///0-100, amount of blood in this decal, used for making footprints and affecting the alpha of bloody footprints
var/bloodiness = 0
///when another of the same type is made on the same tile will they merge --- YES=TRUE; NO=FLASE
var/mergeable_decal = TRUE
///prevents Ambient Occlusion effects around it ; Set to GAME_PLANE in Initialize() if on a wall
plane = FLOOR_PLANE
///for blood n vomit in zero G --- IN GRAVITY=TRUE; NO GRAVITY=FALSE
var/gravity_check = TRUE
/obj/effect/decal/cleanable/proc/replace_decal(obj/effect/decal/cleanable/C) // Returns true if we should give up in favor of the pre-existing decal
if(mergeable_decal)
@@ -20,7 +28,14 @@
//This is on /cleanable because fuck this ancient mess
/obj/effect/decal/cleanable/blood/Crossed(atom/movable/O)
..()
if(!off_floor && ishuman(O))
if(!ishuman(O))
return
if(!gravity_check && ishuman(O))
bloodyify_human(O)
if(!off_floor)
var/mob/living/carbon/human/H = O
var/obj/item/organ/external/l_foot = H.get_organ("l_foot")
var/obj/item/organ/external/r_foot = H.get_organ("r_foot")
@@ -71,12 +86,8 @@
/obj/effect/decal/cleanable/Initialize(mapload)
. = ..()
if(loc && isturf(loc))
for(var/obj/effect/decal/cleanable/C in loc)
if(C != src && C.type == type && !QDELETED(C))
if(replace_decal(C))
qdel(src)
return TRUE
if(try_merging_decal())
return TRUE
if(random_icon_states && length(src.random_icon_states) > 0)
src.icon_state = pick(src.random_icon_states)
if(smoothing_flags)
@@ -89,3 +100,22 @@
if(smoothing_flags)
QUEUE_SMOOTH_NEIGHBORS(src)
return ..()
/obj/effect/decal/cleanable/proc/try_merging_decal(turf/T)
if(!T)
T = loc
if(isturf(T))
for(var/obj/effect/decal/cleanable/C in T)
if(C != src && C.type == type && !QDELETED(C))
if(C.gravity_check && replace_decal(C))
qdel(src)
return TRUE
return FALSE
/obj/effect/decal/cleanable/proc/check_gravity(turf/T)
if(isnull(T))
T = get_turf(src)
if(gravity_check != ALWAYS_IN_GRAVITY)
gravity_check = has_gravity(src, T)
#undef ALWAYS_IN_GRAVITY