[MIRROR] Fixes OOC heart commendations (#6393)

* Fixes OOC heart commendations (#59543)

At some point in the last few weeks, the OOC heart commendations that players were polled for during the shuttle's return trip at the end of the round stopped appearing for people on the live servers, even though admin logs showed it was still calculating how many people were supposed to be asked, and it seemed to be working fine on my local server. My only guess is it might somehow be related to #58419 since that was the last PR to touch hearted.dm, even if it's not clear how it might've broken it.

I also neaten up the code for commendations a bit, making it so the procs are easier to follow and have less unnecessary checks. Also, the proc nominate_heart has been reworked to receive_heart, since it makes more sense for it to run on the person receiving the commendation as opposed to the person sending it. It will also properly cancel polling if the "how many to ask" check returns 0 people, rather than always polling at least one.

Edit: Figured it out, #58419 was indeed the culprit, it blindly replaced src with usr without considering that src and usr aren't necessarily the same thing (as it was here, since query_heart() was called by the ticker SS)

* Fixes OOC heart commendations

Co-authored-by: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-06-20 02:23:52 +01:00
committed by GitHub
co-authored by Ryll Ryll
parent 49e57c6423
commit 8fc7a3e8d8
2 changed files with 20 additions and 17 deletions
+2 -5
View File
@@ -1995,9 +1995,6 @@
poll_option_parse_href(href_list, poll, option)
else if(href_list["admincommend"])
if(!SSticker.IsRoundInProgress())
to_chat(usr, span_warning("The round must be in progress to use this!"))
return
var/mob/heart_recepient = locate(href_list["admincommend"])
if(!heart_recepient?.ckey)
to_chat(usr, span_warning("This mob either no longer exists or no longer is being controlled by someone!"))
@@ -2005,9 +2002,9 @@
switch(tgui_alert(usr, "Would you like the effects to apply immediately or at the end of the round? Applying them now will make it clear it was an admin commendation.", "<3?", list("Apply now", "Apply at round end", "Cancel")))
if("Apply now")
usr.nominate_heart(heart_recepient, instant = TRUE)
heart_recepient.receive_heart(usr, instant = TRUE)
if("Apply at round end")
usr.nominate_heart(heart_recepient)
heart_recepient.receive_heart(usr)
else
return