Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PORT] Gore update #597

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@
apply_damage(damage, attacking_item.damtype, attacking_item = attacking_item)
if(attacking_item.damtype == BRUTE && prob(33))
attacking_item.add_mob_blood(src)
var/turf/location = get_turf(src)
add_splatter_floor(location)
blood_particles(amount = rand(0,1), angle = (user == src ? rand(0, 360) : get_angle(user, src)))
if(get_dist(user, src) <= 1) //people with TK won't get smeared with blood
user.add_mob_blood(src)
return TRUE //successful attack
Expand Down
25 changes: 17 additions & 8 deletions code/datums/components/movable_physics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@
var/bounce_sound
/// If we have this callback, it gets invoked when bouncing on the floor
var/datum/callback/bounce_callback
/// If we have this callback, it gets invoked when bumping on another atom
var/datum/callback/bump_callback
/// If we have this callback, it gets invoked when stopping movement
var/datum/callback/stop_callback

/**
* The cached animate_movement of the parent
* Any kind of gliding when doing Move() makes the physics look derpy, so we'll just make Move() be instant
* Any kind of gliding when doing Move() makes the physics look derpy, so we'll just make Move() be "instant"
*/
var/cached_animate_movement
/// Cached transform of the parent, in case some fucking idiot decides its a good idea to make the damn movable spin forever
Expand All @@ -94,6 +96,7 @@
bounce_spin_clockwise = 0,
bounce_sound,
bounce_callback,
bump_callback,
stop_callback,
)
if(!ismovable(parent))
Expand All @@ -117,6 +120,7 @@
src.bounce_spin_clockwise = bounce_spin_clockwise
src.bounce_sound = bounce_sound
src.bounce_callback = bounce_callback
src.bump_callback = bump_callback
src.stop_callback = stop_callback
set_angle(angle)

Expand Down Expand Up @@ -174,6 +178,10 @@
else if(moving_atom.pixel_z <= z_floor && vertical_velocity)
z_floor_bounce(moving_atom)

// z_floor_bounce could have deleted us
if(QDELETED(src))
return

visual_angle_velocity = max(0, visual_angle_velocity - visual_angle_friction)

var/move_direction = NONE
Expand Down Expand Up @@ -232,7 +240,7 @@
var/atom/movable/moving_atom = parent
cached_animate_movement = moving_atom.animate_movement
moving_atom.animate_movement = NO_STEPS
if(!spin_speed || visual_angle_velocity || visual_angle_friction)
if(!spin_speed || !spin_loops || visual_angle_velocity || visual_angle_friction)
return
moving_atom.SpinAnimation(speed = spin_speed, loops = spin_loops)
if(spin_loops == INFINITE)
Expand Down Expand Up @@ -277,11 +285,12 @@
var/incidence = GET_ANGLE_OF_INCIDENCE(face_angle, angle + 180)
var/new_angle = SIMPLIFY_DEGREES(face_angle + incidence)
set_angle(new_angle)
if(!visual_angle_velocity)
return
incidence = GET_ANGLE_OF_INCIDENCE(face_angle, source.visual_angle + 180)
new_angle = SIMPLIFY_DEGREES(face_angle + incidence)
source.set_visual_angle(new_angle)
if(visual_angle_velocity)
incidence = GET_ANGLE_OF_INCIDENCE(face_angle, source.visual_angle + 180)
new_angle = SIMPLIFY_DEGREES(face_angle + incidence)
source.set_visual_angle(new_angle)
if(bump_callback)
bump_callback.Invoke(bumped_atom)

/// Stops movement for pesky items when they get picked up, as that essentially invalidates this component
/datum/component/movable_physics/proc/on_item_pickup(obj/item/source)
Expand All @@ -300,7 +309,7 @@
var/angle_of_movement = angle_to_target
if(deviation)
angle_of_movement += SIMPLIFY_DEGREES(rand(-deviation * 100, deviation * 100) * 0.01)
AddComponent(/datum/component/movable_physics, \
return AddComponent(/datum/component/movable_physics, \
angle = angle_of_movement, \
horizontal_velocity = rand(4.5 * 100, 5.5 * 100) * 0.01, \
vertical_velocity = rand(4 * 100, 4.5 * 100) * 0.01, \
Expand Down
2 changes: 1 addition & 1 deletion code/datums/mutable_appearance.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Mutable appearances erase template vars on new, because they accept an appearance to copy as an arg
// If we have nothin to copy, we set the float plane
/mutable_appearance/New(mutable_appearance/to_copy)
..()
. = ..()
if(!to_copy)
plane = FLOAT_PLANE

Expand Down
2 changes: 1 addition & 1 deletion code/datums/mutations/body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@
owner.visible_message(span_warning("[owner]'s head splatters with a sickening crunch!"), ignored_mobs = list(owner))
new /obj/effect/gibspawner/generic(get_turf(owner), owner)
head.dismember(BRUTE)
head.drop_organs()
head.drop_organs(violent_removal = TRUE)
qdel(head)
owner.regenerate_icons()
RegisterSignal(owner, COMSIG_ATTEMPT_CARBON_ATTACH_LIMB, PROC_REF(abortattachment))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/wounds/_wounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@

/// Used when we're being dragged while bleeding, the value we return is how much bloodloss this wound causes from being dragged. Since it's a proc, you can let bandages soak some of the blood
/datum/wound/proc/drag_bleed_amount()
return
return 0

/**
* get_bleed_rate_of_change() is used in [/mob/living/carbon/proc/bleed_warn] to gauge whether this wound (if bleeding) is becoming worse, better, or staying the same over time
Expand Down
35 changes: 18 additions & 17 deletions code/datums/wounds/bones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,30 +143,31 @@


/datum/wound/blunt/bone/receive_damage(wounding_type, wounding_dmg, wound_bonus)
if(!victim || wounding_dmg < WOUND_MINIMUM_DAMAGE)
if(!victim || (wounding_dmg < WOUND_MINIMUM_DAMAGE) || (victim.blood_volume <= 0) || !prob(internal_bleeding_chance + wounding_dmg))
return
if(ishuman(victim))
var/mob/living/carbon/human/human_victim = victim
if(HAS_TRAIT(human_victim, TRAIT_NOBLOOD))
return

if(limb.body_zone == BODY_ZONE_CHEST && victim.blood_volume && prob(internal_bleeding_chance + wounding_dmg))
var/blood_bled = rand(1, wounding_dmg * (severity == WOUND_SEVERITY_CRITICAL ? 2 : 1.5)) // 12 brute toolbox can cause up to 18/24 bleeding with a severe/critical chest wound
if(limb.body_zone == BODY_ZONE_CHEST)
var/blood_bled = rand(1, round(wounding_dmg * (severity == WOUND_SEVERITY_CRITICAL ? 2 : 1.5))) // 12 brute toolbox can cause up to 18/24 bleeding with a severe/critical chest wound
switch(blood_bled)
if(1 to 6)
victim.bleed(blood_bled, TRUE)
victim.bleed(blood_bled)
if(7 to 13)
victim.visible_message("<span class='smalldanger'>A thin stream of blood drips from [victim]'s mouth from the blow to [victim.p_their()] chest.</span>", span_danger("You cough up a bit of blood from the blow to your chest."), vision_distance=COMBAT_MESSAGE_RANGE)
victim.bleed(blood_bled, TRUE)
if(14 to 19)
victim.visible_message("<span class='smalldanger'>Blood spews out of [victim]'s mouth from the blow to [victim.p_their()] chest!</span>", span_danger("You spit out a string of blood from the blow to your chest!"), vision_distance=COMBAT_MESSAGE_RANGE)
new /obj/effect/temp_visual/dir_setting/bloodsplatter(victim.loc, victim.dir)
victim.visible_message(span_danger("A thin stream of blood drips from [victim]'s mouth from the blow to [victim.p_their()] chest."), \
span_danger("You cough up a bit of blood from the blow to your chest."), \
vision_distance = COMBAT_MESSAGE_RANGE)
victim.bleed(blood_bled)
if(14 to 19)
victim.visible_message(span_danger("Blood spews out of [victim]'s mouth from the blow to [victim.p_their()] chest!"), \
span_danger("You spit out a string of blood from the blow to your chest!"), \
vision_distance = COMBAT_MESSAGE_RANGE)
victim.bleed(blood_bled, no_visual = TRUE)
victim.blood_particles(amount = 1)
if(20 to INFINITY)
victim.visible_message(span_danger("Blood spurts out of [victim]'s mouth from the blow to [victim.p_their()] chest!"), span_danger("<b>You choke up on a spray of blood from the blow to your chest!</b>"), vision_distance=COMBAT_MESSAGE_RANGE)
victim.bleed(blood_bled)
new /obj/effect/temp_visual/dir_setting/bloodsplatter(victim.loc, victim.dir)
victim.add_splatter_floor(get_step(victim.loc, victim.dir))
victim.visible_message(span_danger("Blood spurts out of [victim]'s mouth from the blow to [victim.p_their()] chest!"), \
span_danger("<b>You choke up on a spray of blood from the blow to your chest!</b>"), \
vision_distance = COMBAT_MESSAGE_RANGE)
victim.bleed(blood_bled, no_visual = TRUE)
victim.blood_particles(amount = rand(0, 1))

/datum/wound/blunt/bone/modify_desc_before_span(desc)
. = ..()
Expand Down
3 changes: 2 additions & 1 deletion code/datums/wounds/loss.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@
set_limb(dismembered_part)
second_wind()
log_wound(victim, src)
if(dismembered_part.can_bleed() && wounding_type != WOUND_BURN && victim.blood_volume)
if(dismembered_part.can_bleed() && wounding_type != WOUND_BURN)
victim.spray_blood(attack_direction, severity)
victim.blood_particles(amount = rand(1, 3), angle = 0, min_deviation = 0, max_deviation = 360)
dismembered_part.dismember(wounding_type == WOUND_BURN ? BURN : BRUTE, wounding_type = wounding_type)
qdel(src)
return TRUE
Expand Down
12 changes: 9 additions & 3 deletions code/datums/wounds/pierce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,20 @@
if(1 to 6)
victim.bleed(blood_bled, TRUE)
if(7 to 13)
victim.visible_message("<span class='smalldanger'>Blood droplets fly from the hole in [victim]'s [limb.plaintext_zone].</span>", span_danger("You cough up a bit of blood from the blow to your [limb.plaintext_zone]."), vision_distance=COMBAT_MESSAGE_RANGE)
victim.visible_message("<span class='smalldanger'>Blood droplets fly from the hole in [victim]'s [limb.plaintext_zone].</span>", \
span_danger("You cough up a bit of blood from the blow to your [limb.plaintext_zone]."), \
vision_distance = COMBAT_MESSAGE_RANGE)
victim.bleed(blood_bled, TRUE)
if(14 to 19)
victim.visible_message("<span class='smalldanger'>A small stream of blood spurts from the hole in [victim]'s [limb.plaintext_zone]!</span>", span_danger("You spit out a string of blood from the blow to your [limb.plaintext_zone]!"), vision_distance=COMBAT_MESSAGE_RANGE)
victim.visible_message("<span class='smalldanger'>A small stream of blood spurts from the hole in [victim]'s [limb.plaintext_zone]!</span>", \
span_danger("You spit out a string of blood from the blow to your [limb.plaintext_zone]!"), \
vision_distance = COMBAT_MESSAGE_RANGE)
new /obj/effect/temp_visual/dir_setting/bloodsplatter(victim.loc, victim.dir)
victim.bleed(blood_bled)
if(20 to INFINITY)
victim.visible_message(span_danger("A spray of blood streams from the gash in [victim]'s [limb.plaintext_zone]!"), span_danger("<b>You choke up on a spray of blood from the blow to your [limb.plaintext_zone]!</b>"), vision_distance=COMBAT_MESSAGE_RANGE)
victim.visible_message(span_danger("A spray of blood streams from the gash in [victim]'s [limb.plaintext_zone]!"), \
span_danger("<b>You choke up on a spray of blood from the blow to your [limb.plaintext_zone]!</b>"), \
vision_distance = COMBAT_MESSAGE_RANGE)
victim.bleed(blood_bled)
new /obj/effect/temp_visual/dir_setting/bloodsplatter(victim.loc, victim.dir)
victim.add_splatter_floor(get_step(victim.loc, victim.dir))
Expand Down
19 changes: 9 additions & 10 deletions code/datums/wounds/slash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
old_wound.clear_highest_scar()
else
set_blood_flow(initial_flow)
if(limb.can_bleed() && attack_direction && victim.blood_volume > BLOOD_VOLUME_OKAY)
if(limb.can_bleed() && attack_direction)
victim.spray_blood(attack_direction, severity)

if(!highest_scar)
Expand Down Expand Up @@ -105,16 +105,17 @@
if (!victim) // if we are dismembered, we can still take damage, its fine to check here
return

if(victim.stat != DEAD && wound_bonus != CANT_WOUND && wounding_type == WOUND_SLASH) // can't stab dead bodies to make it bleed faster this way
adjust_blood_flow(WOUND_SLASH_DAMAGE_FLOW_COEFF * wounding_dmg)
// can't stab dead bodies to make it bleed faster this way
if(victim.stat == DEAD || wound_bonus == CANT_WOUND || (wounding_type != WOUND_SLASH))
return
adjust_blood_flow(WOUND_SLASH_DAMAGE_FLOW_COEFF * wounding_dmg)

return ..()

/datum/wound/slash/flesh/drag_bleed_amount()
// say we have 3 severe cuts with 3 blood flow each, pretty reasonable
// compare with being at 100 brute damage before, where you bled (brute/100 * 2), = 2 blood per tile
var/bleed_amt = min(blood_flow * 0.1, 1) // 3 * 3 * 0.1 = 0.9 blood total, less than before! the share here is .3 blood of course.

if(limb.current_gauze) // gauze stops all bleeding from dragging on this limb, but wears the gauze out quicker
limb.seep_gauze(bleed_amt * 0.33)
return
Expand Down Expand Up @@ -189,26 +190,24 @@
return suture(I, user)

/datum/wound/slash/flesh/try_handling(mob/living/carbon/human/user)
if(user.pulling != victim || user.zone_selected != limb.body_zone || !isfelinid(user) || !victim.try_inject(user, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))
if(user.pulling != victim || user.zone_selected != limb.body_zone || !victim.try_inject(user, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))
return FALSE
if(!istype(user.getorganslot(ORGAN_SLOT_TONGUE), /obj/item/organ/internal/tongue/cat))
return FALSE
if(DOING_INTERACTION_WITH_TARGET(user, victim))
to_chat(user, span_warning("You're already interacting with [victim]!"))
return
if(user.is_mouth_covered())
to_chat(user, span_warning("Your mouth is covered, you can't lick [victim]'s wounds!"))
return
if(!user.getorganslot(ORGAN_SLOT_TONGUE))
to_chat(user, span_warning("You can't lick wounds without a tongue!")) // f in chat
return

lick_wounds(user)
return TRUE

/// if a felinid is licking this cut to reduce bleeding
/datum/wound/slash/flesh/proc/lick_wounds(mob/living/carbon/human/user)
// transmission is one way patient -> felinid since google said cat saliva is antiseptic or whatever, and also because felinids are already risking getting beaten for this even without people suspecting they're spreading a deathvirus
for(var/i in victim.diseases)
var/datum/disease/iter_disease = i
for(var/datum/disease/iter_disease as anything in victim.diseases)
if(iter_disease.spread_flags & (DISEASE_SPREAD_SPECIAL | DISEASE_SPREAD_NON_CONTAGIOUS))
continue
user.ForceContractDisease(iter_disease)
Expand Down
5 changes: 4 additions & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,11 @@
* Default behaviour is to move back from the item that hit us
*/
/atom/proc/hitby_react(atom/movable/harmed_atom)
if(harmed_atom && isturf(harmed_atom.loc))
if(QDELETED(harmed_atom))
return FALSE
if(isturf(harmed_atom.loc))
step(harmed_atom, turn(harmed_atom.dir, 180))
return TRUE

///Handle the atom being slipped over
/atom/proc/handle_slip(mob/living/carbon/slipped_carbon, knockdown_amount, obj/slipping_object, lube, paralyze, force_drop)
Expand Down
55 changes: 37 additions & 18 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@
return throw_at(target, range, speed, thrower, spin, diagonals_first, callback, force, gentle)

///If this returns FALSE then callback will not be called.
/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower, spin = TRUE, diagonals_first = FALSE, datum/callback/callback, force = MOVE_FORCE_STRONG, gentle = FALSE, quickstart = TRUE)
/atom/movable/proc/throw_at(atom/target, range, speed, mob/thrower, spin = FALSE, diagonals_first = FALSE, datum/callback/callback, force = MOVE_FORCE_STRONG, gentle = FALSE, quickstart = TRUE)
. = FALSE

if(QDELETED(src))
Expand Down Expand Up @@ -1270,32 +1270,51 @@
return


/atom/movable/proc/do_attack_animation(atom/attacked_atom, visual_effect_icon, obj/item/used_item, no_effect)
/atom/movable/proc/do_attack_animation(atom/attacked_atom, visual_effect_icon, obj/item/used_item, no_effect = FALSE, angled = FALSE)
if(!no_effect && (visual_effect_icon || used_item))
do_item_attack_animation(attacked_atom, visual_effect_icon, used_item)

if(attacked_atom == src)
return //don't do an animation if attacking self

var/pixel_x_diff = 0
var/pixel_y_diff = 0
var/turn_dir = 1

var/direction = get_dir(src, attacked_atom)
if(direction & NORTH)
pixel_y_diff = 8
turn_dir = prob(50) ? -1 : 1
else if(direction & SOUTH)
pixel_y_diff = -8
turn_dir = prob(50) ? -1 : 1

if(direction & EAST)
pixel_x_diff = 8
else if(direction & WEST)
pixel_x_diff = -8
turn_dir = -1
var/turn_angle = 0
if(angled)
var/angle = get_angle(src, attacked_atom)
pixel_x_diff = round(sin(angle) * (world.icon_size/4))
pixel_y_diff = round(cos(angle) * (world.icon_size/4))
if(angle <= 15)
turn_angle = angle
else if(angle <= 165)
turn_angle = 15
else if(angle <= 180)
turn_angle = 15 - (angle - 165)
else if(angle <= 195)
turn_angle = -(angle - 180)
else if(angle <= 345)
turn_angle = -15
else
turn_angle = angle-360
turn_angle = round(turn_angle)
else
var/direction = get_dir(src, attacked_atom)
if(direction & NORTH)
pixel_y_diff = world.icon_size/4
turn_angle = 0
else if(direction & SOUTH)
pixel_y_diff = -world.icon_size/4
turn_angle = 0

if(direction & EAST)
pixel_x_diff = world.icon_size/4
turn_angle = 15
else if(direction & WEST)
pixel_x_diff = -world.icon_size/4
turn_angle = -15

var/matrix/initial_transform = matrix(transform)
var/matrix/rotated_transform = transform.Turn(15 * turn_dir)
var/matrix/rotated_transform = transform.Turn(turn_angle)
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff, transform=rotated_transform, time = 1, easing=BACK_EASING|EASE_IN, flags = ANIMATION_PARALLEL)
animate(pixel_x = pixel_x - pixel_x_diff, pixel_y = pixel_y - pixel_y_diff, transform=initial_transform, time = 2, easing=SINE_EASING, flags = ANIMATION_PARALLEL)

Expand Down
Loading
Loading