-
Notifications
You must be signed in to change notification settings - Fork 222
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
Damage propagation for stock_parts and SMES overload (fixes #3457) #3460
Conversation
code/game/objects/item_damage.dm
Outdated
@@ -18,9 +18,11 @@ | |||
return 0 //must return a number | |||
|
|||
//Apply damage | |||
var/damage_taken = health // Initialize with current health value... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem right to me - I feel like just doing damage = min(health, damage)
and otherwise leaving the logic unchanged would do the job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proc claims to return the damage taken by the object, not the amount of health left after taking damage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I'm doing here, but the min
is definitely more elegant.
On the other side, since we're already removed the <0
cases, even clamp
could be removed? But alright.
for(var/obj/machinery/power/terminal/T in powernet.nodes) | ||
var/obj/machinery/power/apc/A = T.master_machine() | ||
if(istype(A)) | ||
if (prob(overload_chance)) | ||
A.overload_lighting() | ||
if (prob(failure_chance)) | ||
A.set_broken(TRUE) | ||
if (!(A in apcs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apcs |= A
will do a non-duplicating add, for reference.
e4fed76
to
f7710a0
Compare
Description of changes
Changed APCs failure from plain
set_broken(TRUE)
to getting dealt electrocute damage in SMES failure procedures.To allow that to break more than a singular
stock_part
, damage returned fromtake_damage
should be changed from being reduced only by armor (unapplicable to stock parts) to keeping track of the health the item had before damage; thus, sufficient amount of damage to machinery will dismantle it in one hit.Why and what will this PR improve
Will make APCs repairable after SMES failures.
Authorship
Myself
Changelog
🆑
tweak: changed the SMES overloading APC failure damage
bugfix: fixed APCs being stuck irrepairable on overloading
bugfix: fixed clamping any machinery damage to one part per hit
/:cl: