|
1108 | 1108 | /mob/living/carbon/alien/adult/lying_angle_on_movement(direct) |
1109 | 1109 | return |
1110 | 1110 |
|
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)) |
1123 | 1128 | 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!") |
1134 | 1131 |
|
1135 | 1132 | var/trail_dir = REVERSE_DIR(movement_direction) |
1136 | 1133 | // the mob is performing a diagonal movement so we need to make a diagonal trail |
|
1169 | 1166 | break |
1170 | 1167 |
|
1171 | 1168 | if(isnull(trail)) |
1172 | | - trail = new(start, get_static_viruses()) |
| 1169 | + trail = new(start, static_viruses) |
1173 | 1170 | if(QDELETED(trail)) |
1174 | 1171 | return |
1175 | 1172 | trail.bloodiness = blood_to_add |
1176 | 1173 | else |
1177 | | - trail.add_viruses(get_static_viruses()) |
| 1174 | + trail.add_viruses(static_viruses) |
1178 | 1175 |
|
1179 | 1176 | // update the holder with our new dna and bloodiness |
1180 | | - trail.add_mob_blood(src) |
| 1177 | + trail.add_blood_DNA(blood_dna) |
1181 | 1178 | trail.adjust_bloodiness(blood_to_add) |
1182 | 1179 | // also update the trail component, this is what matters for its appearance |
1183 | 1180 | var/obj/effect/decal/cleanable/blood/trail/trail_component = trail.add_dir_to_trail(trail_dir, blood_to_add) |
1184 | 1181 | if(isnull(trail_component)) |
1185 | 1182 | return |
1186 | | - trail_component.add_mob_blood(src) |
| 1183 | + trail_component.add_blood_DNA(blood_dna) |
1187 | 1184 | trail_component.adjust_bloodiness(blood_to_add) |
1188 | 1185 |
|
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) |
1190 | 1217 | if(!is_bleeding()) |
1191 | 1218 | return |
1192 | 1219 | return ..() |
|
0 commit comments