Skip to content

Commit

Permalink
[MIRROR] Fix rat heart (#2175)
Browse files Browse the repository at this point in the history
* Fix rat heart (#81698)

## About The Pull Request

Fixes #81696

`on_mob_insert` doesn't return a truthy value from parent call, it
returns null / nothing

Also patches a potential exploit involving that can mutate check 

## Changelog

:cl: Melbert
fix: Rat hearts apply their damage modifier malus correctly
/:cl:

* Fix rat heart

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: Iajret <[email protected]>
  • Loading branch information
4 people authored Mar 1, 2024
1 parent c218229 commit 843b138
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions code/game/machinery/dna_infuser/organ_sets/rat_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,22 @@

/obj/item/organ/internal/heart/rat/on_mob_insert(mob/living/carbon/receiver)
. = ..()
if(!. || !ishuman(receiver))
if(!ishuman(receiver))
return
var/mob/living/carbon/human/human_receiver = receiver
if(!human_receiver.can_mutate())
return
human_receiver.dna.add_mutation(/datum/mutation/human/dwarfism)
if(human_receiver.can_mutate())
human_receiver.dna.add_mutation(/datum/mutation/human/dwarfism)
//but 1.5 damage
if(human_receiver.physiology)
human_receiver.physiology.damage_resistance -= 50
human_receiver.physiology?.damage_resistance -= 50

/obj/item/organ/internal/heart/rat/on_mob_remove(mob/living/carbon/heartless, special)
. = ..()
if(!ishuman(heartless))
return
var/mob/living/carbon/human/human_heartless = heartless
if(!human_heartless.can_mutate())
return
human_heartless.dna.remove_mutation(/datum/mutation/human/dwarfism)
if(human_heartless.physiology)
human_heartless.physiology.damage_resistance += 50
if(human_heartless.can_mutate())
human_heartless.dna.remove_mutation(/datum/mutation/human/dwarfism)
human_heartless.physiology?.damage_resistance += 50

/// you occasionally squeak, and have some rat related verbal tics
/obj/item/organ/internal/tongue/rat
Expand Down

0 comments on commit 843b138

Please sign in to comment.