Skip to content

Commit 8be82a5

Browse files
authored
Mechs BLEED (oil) (#849)
* Mecha blood * Blood renaming * Fix * Fix
1 parent e5b2cd3 commit 8be82a5

21 files changed

Lines changed: 212 additions & 126 deletions

File tree

code/__DEFINES/mecha.dm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define MECHA_INT_SHORT_CIRCUIT (1<<2)
44
#define MECHA_CABIN_AIR_BREACH (1<<3)
55
#define MECHA_INT_CONTROL_LOST (1<<4)
6+
#define MECHA_INT_FUEL_LINE (1<<5)
67

78
#define PANEL_OPEN (1<<0)
89
#define ID_LOCK_ON (1<<1)
@@ -59,3 +60,8 @@
5960
#define MECHA_AMMO_PUNCHING_GLOVE "Punching glove"
6061
#define MECHA_AMMO_BANANA_PEEL "Banana peel"
6162
#define MECHA_AMMO_MOUSETRAP "Mousetrap"
63+
64+
// Flags for use_energy
65+
#define OIL_MODIFIED_DRAIN (1<<0)
66+
#define SERVO_MODIFIED_DRAIN (1<<1)
67+
#define CAPACITOR_MODIFIED_DRAIN (1<<2)

code/_globalvars/bitfields.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ DEFINE_BITFIELD(internal_damage, list(
241241
"MECHA_CABIN_AIR_BREACH" = MECHA_CABIN_AIR_BREACH,
242242
"MECHA_INT_CONTROL_LOST" = MECHA_INT_CONTROL_LOST,
243243
"MECHA_INT_SHORT_CIRCUIT" = MECHA_INT_SHORT_CIRCUIT,
244+
"MECHA_INT_FUEL_LINE" = MECHA_INT_FUEL_LINE,
244245
))
245246

246247
DEFINE_BITFIELD(mecha_flags, list(

code/datums/stock_market_events.dm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"MODular Solutions",
99
"SolGov",
1010
"Australicus Industrial Mining",
11-
"Vey-Medical",
11+
"Nanotrasen-DeForest Corporation",
1212
"Aussec Armory",
1313
"Dreamland Robotics"
1414
)
@@ -147,5 +147,3 @@
147147
SSstock_market.materials_quantity[mat] = initial(mat.tradable_base_quantity) //Force the material to be available again.
148148
SSstock_market.materials_prices[mat] = initial(mat.value_per_unit) * SHEET_MATERIAL_AMOUNT //Force the price to be reset once the lockdown is over.
149149
create_news()
150-
151-

code/datums/wounds/internal_bleeding.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
if(!victim || victim.stat == DEAD || HAS_TRAIT(victim, TRAIT_STASIS) || !victim.needs_heart())
6666
return
6767
var/severity_mod = (severity + 1)
68-
victim.bleed(bleed_amount * severity_mod * seconds_per_tick, drip = FALSE)
68+
victim.bleed(bleed_amount * severity_mod * seconds_per_tick, leave_pool = FALSE)
6969
if(severity == WOUND_SEVERITY_TRIVIAL)
7070
if(highest_severity == WOUND_SEVERITY_TRIVIAL)
7171
var/percent = 0.01

code/game/objects/effects/decals/cleanable/humans.dm

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,6 @@
570570

571571
/// The turf we just came from, so we can back up when we hit a wall
572572
var/turf/prev_loc
573-
/// The cached info about the blood
574-
var/list/blood_dna_info
575573
/// Skip making the final blood splatter when we're done, like if we're not in a turf
576574
var/skip = FALSE
577575
/// How many tiles/items/people we can paint red
@@ -592,7 +590,7 @@
592590
/obj/effect/decal/cleanable/blood/hitsplatter/proc/expire()
593591
if(isturf(loc) && !skip)
594592
playsound(src, 'sound/effects/wounds/splatter.ogg', 60, TRUE, -1)
595-
loc.add_blood_DNA(blood_dna_info)
593+
loc.add_blood_DNA(GET_ATOM_BLOOD_DNA(src))
596594
qdel(src)
597595

598596
/// Set the splatter up to fly through the air until it rounds out of steam or hits something
@@ -619,7 +617,7 @@
619617
continue
620618
if(splatter_strength <= 0)
621619
break
622-
iter_atom.add_blood_DNA(blood_dna_info)
620+
iter_atom.add_blood_DNA(GET_ATOM_BLOOD_DNA(src))
623621
if(isliving(iter_atom))
624622
var/mob/living/splatted = iter_atom
625623
splatted.add_mood_event("splattered_with_blood", /datum/mood_event/splattered_with_blood)
@@ -636,7 +634,7 @@
636634
fly_trail.transform = fly_trail.transform.Turn((flight_dir == NORTHEAST || flight_dir == SOUTHWEST) ? 135 : 45)
637635
fly_trail.icon_state = pick("trails_1", "trails2")
638636
fly_trail.adjust_bloodiness(fly_trail.bloodiness * -0.66)
639-
fly_trail.add_blood_DNA(blood_dna_info)
637+
fly_trail.add_blood_DNA(GET_ATOM_BLOOD_DNA(src))
640638

641639
/obj/effect/decal/cleanable/blood/hitsplatter/proc/loop_done(datum/source)
642640
SIGNAL_HANDLER
@@ -667,7 +665,6 @@
667665
final_splatter.pixel_x = (dir == EAST ? 32 : (dir == WEST ? -32 : 0))
668666
final_splatter.pixel_y = (dir == NORTH ? 32 : (dir == SOUTH ? -32 : 0))
669667
final_splatter.add_blood_DNA(GET_ATOM_BLOOD_DNA(src))
670-
final_splatter.add_blood_DNA(blood_dna_info)
671668
else // This will only happen if prev_loc is not even a turf, which is highly unlikely.
672669
abstract_move(bumped_atom)
673670
expire()
@@ -678,7 +675,6 @@
678675
return
679676
var/obj/effect/decal/cleanable/blood/splatter/over_window/final_splatter = new
680677
final_splatter.add_blood_DNA(GET_ATOM_BLOOD_DNA(src))
681-
final_splatter.add_blood_DNA(blood_dna_info)
682678
final_splatter.forceMove(the_window)
683679
the_window.vis_contents += final_splatter
684680
the_window.bloodied = TRUE

code/game/objects/effects/decals/cleanable/robots.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/obj/effect/decal/cleanable/robot_debris/Initialize(mapload)
1616
. = ..()
1717
RegisterSignal(src, COMSIG_MOVABLE_PIPE_EJECTING, PROC_REF(on_pipe_eject))
18-
add_blood_DNA(list("UNKNOWN DNA" = /datum/blood_type/oil)) // NON-MODULE CHANGE : For bloody shoes // Yeah don't think about it too much
18+
add_blood_DNA(list("CRUDE OIL" = /datum/blood_type/oil)) // NON-MODULE CHANGE : For bloody shoes // Yeah don't think about it too much
1919

2020
/obj/effect/decal/cleanable/robot_debris/proc/streak(list/directions, mapload=FALSE)
2121
var/direction = pick(directions)
@@ -87,7 +87,7 @@
8787
/obj/effect/decal/cleanable/oil/Initialize(mapload, list/datum/disease/diseases)
8888
. = ..()
8989
AddElement(/datum/element/easy_ignite) // NON-MODULE CHANGE
90-
add_blood_DNA(list("UNKNOWN DNA" = /datum/blood_type/oil)) // NON-MODULE CHANGE : For bloody shoes // Yeah don't think about it too much
90+
add_blood_DNA(list("CRUDE OIL" = /datum/blood_type/oil)) // NON-MODULE CHANGE : For bloody shoes // Yeah don't think about it too much
9191

9292
// /obj/effect/decal/cleanable/oil/attackby(obj/item/I, mob/living/user)
9393
// var/attacked_by_hot_thing = I.get_temperature()

code/modules/forensics/forensics_helpers.dm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,13 @@
123123
return FALSE
124124
if(dried)
125125
return TRUE
126-
// Imperfect, ends up with some blood types being double-set-up, but harmless (for now)
127-
for(var/new_blood in blood_DNA_to_add)
128-
var/datum/blood_type/blood = find_blood_type(blood_DNA_to_add[new_blood])
126+
var/list/unique_blood = list()
127+
for(var/some_dna, blood_type in blood_DNA_to_add)
128+
if(unique_blood[blood_type])
129+
continue
130+
var/datum/blood_type/blood = find_blood_type(blood_type)
129131
blood.set_up_blood(src, first_dna == 0)
132+
unique_blood[blood_type] = TRUE
130133
update_appearance()
131134
add_atom_colour(get_blood_dna_color(), FIXED_COLOUR_PRIORITY)
132135
return TRUE

code/modules/mob/living/blood.dm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,18 @@
119119
iter_part.update_part_wound_overlay()
120120

121121
/// Makes a blood drop, leaking amt units of blood from the mob
122-
/mob/living/proc/bleed(amt, drip = TRUE)
122+
/mob/living/proc/bleed(amt, leave_pool = TRUE)
123123
return
124124

125-
/mob/living/carbon/bleed(amt, drip = TRUE)
125+
/mob/living/carbon/bleed(amt, leave_pool = TRUE)
126126
if((status_flags & GODMODE) || HAS_TRAIT(src, TRAIT_NOBLOOD))
127127
return
128128
blood_volume = max(blood_volume - amt, 0)
129129

130-
if(drip && isturf(loc) && prob(sqrt(amt) * BLOOD_DRIP_RATE_MOD))
130+
if(leave_pool && isturf(loc) && prob(sqrt(amt) * BLOOD_DRIP_RATE_MOD))
131131
add_splatter_floor(loc, (amt <= 10))
132132

133-
/mob/living/carbon/human/bleed(amt, drip = TRUE)
133+
/mob/living/carbon/human/bleed(amt, leave_pool = TRUE)
134134
amt *= physiology.bleed_mod
135135
return ..()
136136

@@ -278,7 +278,7 @@
278278

279279
//to add a splatter of blood or other mob liquid.
280280
/mob/living/proc/add_splatter_floor(turf/blood_turf = get_turf(src), small_drip)
281-
return get_blood_type()?.make_blood_splatter(src, blood_turf, small_drip)
281+
return get_blood_type()?.make_blood_splatter(blood_turf, small_drip, get_blood_dna_list(), get_static_viruses())
282282

283283
/mob/living/proc/do_splatter_effect(splat_dir = pick(GLOB.cardinals))
284284
var/obj/effect/temp_visual/dir_setting/bloodsplatter/splatter = new(get_turf(src), splat_dir)

code/modules/mob/living/carbon/carbon.dm

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,22 +1388,33 @@
13881388
return FALSE
13891389

13901390
/**
1391-
* This proc is a helper for spraying blood for things like slashing/piercing wounds and dismemberment.
1391+
* Sprays out blood in a direction to a certain distance
13921392
*
1393-
* The strength of the splatter in the second argument determines how much it can dirty and how far it can go
1393+
* This is on atom so that arbitrary objects can also spray blood (like meat),
1394+
* you just need to pass a blood_dna.
13941395
*
13951396
* Arguments:
13961397
* * splatter_direction: Which direction the blood is flying
13971398
* * splatter_strength: How many tiles it can go, and how many items it can pass over and dirty
1399+
* * blood_dna: A list of DNA info to add to the blood decal. Autoset for mobs.
1400+
* * static_viruses: A list of viruses to add to the blood decal
13981401
*/
1399-
/mob/living/carbon/proc/spray_blood(splatter_direction, splatter_strength = 3)
1402+
/atom/proc/spray_blood(splatter_direction, splatter_strength = 3, blood_dna, list/static_viruses)
14001403
if(!isturf(loc))
14011404
return
1402-
var/obj/effect/decal/cleanable/blood/hitsplatter/our_splatter = new(loc, get_static_viruses(), splatter_strength)
1403-
our_splatter.add_blood_DNA(GET_ATOM_BLOOD_DNA(src))
1404-
our_splatter.blood_dna_info = get_blood_dna_list()
1405-
var/turf/targ = get_ranged_target_turf(src, splatter_direction, splatter_strength)
1406-
our_splatter.fly_towards(targ, splatter_strength)
1405+
if(!islist(blood_dna))
1406+
CRASH("spray_blood called without a valid blood_dna list!")
1407+
1408+
var/obj/effect/decal/cleanable/blood/hitsplatter/our_splatter = new(loc, static_viruses, splatter_strength)
1409+
our_splatter.add_blood_DNA(blood_dna)
1410+
our_splatter.fly_towards(get_ranged_target_turf(src, splatter_direction, splatter_strength), splatter_strength)
1411+
1412+
/mob/living/carbon/spray_blood(splatter_direction, splatter_strength = 3, blood_dna, list/static_viruses)
1413+
if(isnull(blood_dna))
1414+
blood_dna = get_blood_dna_list()
1415+
if(isnull(static_viruses))
1416+
static_viruses = get_static_viruses()
1417+
return ..()
14071418

14081419
/mob/living/carbon/dropItemToGround(obj/item/to_drop, force = FALSE, silent = FALSE, invdrop = TRUE, turf/newloc = null)
14091420
if((to_drop in organs) || (to_drop in bodyparts)) //let's not do this, aight?

code/modules/mob/living/living.dm

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,29 +1108,26 @@
11081108
/mob/living/carbon/alien/adult/lying_angle_on_movement(direct)
11091109
return
11101110

1111-
/mob/living/proc/make_blood_trail(turf/target_turf, turf/start, was_facing, movement_direction)
1112-
if(!has_gravity() || !isturf(start) || HAS_TRAIT(src, TRAIT_NOBLOOD)) // NON-MODULE CHANGE
1113-
return
1114-
1115-
var/base_bleed_rate = get_bleed_rate()
1116-
var/base_brute = getBruteLoss()
1117-
1118-
var/brute_ratio = round(base_brute / (maxHealth * 4), 0.1)
1119-
var/bleeding_rate = round(base_bleed_rate / 4, 0.1)
1120-
// we only leave a trail if we're below a certain blood threshold
1121-
// the more brute damage we have, or the more we're bleeding, the less blood we need to leave a trail
1122-
if(blood_volume < max(BLOOD_VOLUME_NORMAL * (1 - max(bleeding_rate, brute_ratio)), 0))
1111+
/**
1112+
* Leaves a trail of blood.
1113+
*
1114+
* This is on the atom level so you can have arbitrary objects leave "blood trails" if desired,
1115+
* you just need to pass a blood_dna.
1116+
*
1117+
* Arguments:
1118+
* * target_turf - The turf where the blood trail will be made
1119+
* * start - The turf where the mob started moving from
1120+
* * was_facing - The direction the mob was facing before moving
1121+
* * movement_direction - The direction the mob is moving towards
1122+
* * blood_to_add - The amount of blood to add to the trail
1123+
* * blood_dna - The DNA to add to the trail. Autoset for mobs.
1124+
* * static_viruses - The viruses to add to the trail
1125+
*/
1126+
/atom/proc/make_blood_trail(turf/target_turf, turf/start, was_facing, movement_direction, blood_to_add = BLOOD_AMOUNT_PER_DECAL * 0.1, blood_dna, list/static_viruses)
1127+
if(!has_gravity() || !isturf(start))
11231128
return
1124-
1125-
var/blood_to_add = BLOOD_AMOUNT_PER_DECAL * 0.1
1126-
if(body_position == LYING_DOWN)
1127-
blood_to_add += bleedDragAmount()
1128-
bleed(blood_to_add, drip = FALSE)
1129-
else
1130-
blood_to_add += base_bleed_rate
1131-
// if we're very damaged or bleeding a lot, add even more blood to the trail
1132-
if(base_brute >= 300 || base_bleed_rate >= 7)
1133-
blood_to_add *= 2
1129+
if(!islist(blood_dna))
1130+
CRASH("make_blood_trail called without a valid blood_dna list!")
11341131

11351132
var/trail_dir = REVERSE_DIR(movement_direction)
11361133
// the mob is performing a diagonal movement so we need to make a diagonal trail
@@ -1169,24 +1166,54 @@
11691166
break
11701167

11711168
if(isnull(trail))
1172-
trail = new(start, get_static_viruses())
1169+
trail = new(start, static_viruses)
11731170
if(QDELETED(trail))
11741171
return
11751172
trail.bloodiness = blood_to_add
11761173
else
1177-
trail.add_viruses(get_static_viruses())
1174+
trail.add_viruses(static_viruses)
11781175

11791176
// update the holder with our new dna and bloodiness
1180-
trail.add_mob_blood(src)
1177+
trail.add_blood_DNA(blood_dna)
11811178
trail.adjust_bloodiness(blood_to_add)
11821179
// also update the trail component, this is what matters for its appearance
11831180
var/obj/effect/decal/cleanable/blood/trail/trail_component = trail.add_dir_to_trail(trail_dir, blood_to_add)
11841181
if(isnull(trail_component))
11851182
return
1186-
trail_component.add_mob_blood(src)
1183+
trail_component.add_blood_DNA(blood_dna)
11871184
trail_component.adjust_bloodiness(blood_to_add)
11881185

1189-
/mob/living/carbon/human/make_blood_trail(turf/target_turf, turf/start, direction)
1186+
/mob/living/make_blood_trail(turf/target_turf, turf/start, was_facing, movement_direction, blood_to_add, blood_dna, list/static_viruses)
1187+
if(HAS_TRAIT(src, TRAIT_NOBLOOD))
1188+
return
1189+
var/base_bleed_rate = get_bleed_rate()
1190+
var/base_brute = getBruteLoss()
1191+
1192+
var/brute_ratio = round(base_brute / (maxHealth * 4), 0.1)
1193+
var/bleeding_rate = round(base_bleed_rate / 4, 0.1)
1194+
// we only leave a trail if we're below a certain blood threshold
1195+
// the more brute damage we have, or the more we're bleeding, the less blood we need to leave a trail
1196+
if(blood_volume < max(BLOOD_VOLUME_NORMAL * (1 - max(bleeding_rate, brute_ratio)), 0))
1197+
return
1198+
1199+
if(isnull(static_viruses))
1200+
static_viruses = get_static_viruses()
1201+
if(isnull(blood_dna))
1202+
blood_dna = get_blood_dna_list()
1203+
if(isnull(blood_to_add))
1204+
blood_to_add = BLOOD_AMOUNT_PER_DECAL * 0.1
1205+
blood_to_add += (body_position == LYING_DOWN) ? bleedDragAmount() : base_bleed_rate
1206+
// if we're very damaged or bleeding a lot, add even more blood to the trail
1207+
if(base_brute >= 300 || base_bleed_rate >= 7)
1208+
blood_to_add *= 2
1209+
1210+
// this is where people losing extra blood from being dragged is handled
1211+
if(body_position == LYING_DOWN)
1212+
bleed(blood_to_add, leave_pool = FALSE)
1213+
1214+
return ..()
1215+
1216+
/mob/living/carbon/human/make_blood_trail(turf/target_turf, turf/start, direction, blood_to_add, blood_dna, list/static_viruses)
11901217
if(!is_bleeding())
11911218
return
11921219
return ..()

0 commit comments

Comments
 (0)