Skip to content

Commit

Permalink
[s] Fix Sleeper Chemicals (#5717)
Browse files Browse the repository at this point in the history
# About the pull request

This PR adds a safety check to the sleeper console.

# Explain why it's good for the game

It just takes a little ⭐ imagination ⭐ to know why its good.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![image](https://github.com/cmss13-devs/cmss13/assets/76988376/c7dc7676-2321-49f3-b600-466674709c22)

</details>


# Changelog

No player facing changes.
  • Loading branch information
Drulikar authored Feb 15, 2024
1 parent 3d2d93a commit 476595c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions code/game/machinery/medical_pod/sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@
var/amount = text2num(params["amount"])
if(!length(chemical) || amount <= 0)
return
if(!(amount in connected.amounts))
log_debug("[amount] is an invalid amount to inject in [src]!")
return
if(!(chemical in connected.available_chemicals))
log_debug("[chemical] is not available to inject in [src]!")
return
if(connected.occupant.reagents && connected.occupant.reagents.get_reagent_amount(chemical) + amount > connected.max_chem)
return
if(connected.occupant.health > connected.min_health || (chemical in connected.emergency_chems))
connected.inject_chemical(usr, chemical, amount)
else
Expand Down

0 comments on commit 476595c

Please sign in to comment.