mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
Fix rare runtime if there are no available organs to take (#87671)
## About The Pull Request This PR fixes a rare runtime error, regarding lost crew members, that occurs when there are no organs in the `organs_we_can_take` list, which causes an exception due to an attempt to `pick()` from an empty list. ## Why It's Good For The Game The less exceptions exists, the better. ## Changelog 🆑 fix: fixed a rare runtime with lost crew having no organs /🆑 --------- Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
var/organs_to_take = round(min_organs + (max_organs - min_organs) * severity)
|
||||
var/list/organs_we_can_take = body.organs - body.get_organ_slot(ORGAN_SLOT_BRAIN)
|
||||
|
||||
if (!length(organs_we_can_take))
|
||||
return
|
||||
for(var/i in 1 to organs_to_take)
|
||||
var/obj/organ = pick(organs_we_can_take)
|
||||
if(prob(organ_save_chance) && saved_movables) //if lucky, we can save the organ and have it be delivered with the body
|
||||
|
||||
Reference in New Issue
Block a user