Skip to content

Commit

Permalink
[MIRROR] Removes duplicate atom break calls on atoms taking damage [M…
Browse files Browse the repository at this point in the history
…DB IGNORE] (#604)

* Removes duplicate atom break calls on atoms taking damage (#79667)

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: distributivgesetz <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2023
1 parent d3478da commit 2c00b72
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions code/game/atom_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@

. = damage_amount

var/previous_atom_integrity = atom_integrity

update_integrity(atom_integrity - damage_amount)

var/integrity_failure_amount = integrity_failure * max_integrity

//BREAKING FIRST
if(integrity_failure && atom_integrity <= integrity_failure * max_integrity)
if(integrity_failure && previous_atom_integrity > integrity_failure_amount && atom_integrity <= integrity_failure_amount)
atom_break(damage_flag)

//DESTROYING SECOND
if(atom_integrity <= 0)
if(atom_integrity <= 0 && previous_atom_integrity > 0)
atom_destruction(damage_flag)

/// Proc for recovering atom_integrity. Returns the amount repaired by
Expand Down

0 comments on commit 2c00b72

Please sign in to comment.