Merge pull request #14602 from BlueWildrose/YoHoYoHofuckoff

Pirate related fixes and communication console fixes
This commit is contained in:
Lin
2021-04-14 21:39:06 -05:00
committed by GitHub
4 changed files with 18 additions and 6 deletions

View File

@@ -102,8 +102,14 @@
if ("answerMessage")
if (!authenticated(usr))
return
var/answer_index = text2num(params["answer"])
var/message_index = text2num(params["message"])
var/answer_index = params["answer"]
var/message_index = params["message"]
// If either of these aren't numbers, then bad voodoo.
if(!isnum(answer_index) || !isnum(message_index))
message_admins("[ADMIN_LOOKUPFLW(usr)] provided an invalid index type when replying to a message on [src] [ADMIN_JMP(src)]. This should not happen. Please check with a maintainer and/or consult tgui logs.")
CRASH("Non-numeric index provided when answering comms console message.")
if (!answer_index || !message_index || answer_index < 1 || message_index < 1)
return
var/datum/comm_message/message = messages[message_index]
@@ -156,7 +162,11 @@
if ("deleteMessage")
if (!authenticated(usr))
return
var/message_index = text2num(params["message"])
var/message_index = params["message"]
if(!isnum(message_index))
message_admins("[ADMIN_LOOKUPFLW(usr)] provided an invalid index type when deleting a message on [src] [ADMIN_JMP(src)]. This should not happen. Please check with a maintainer and/or consult tgui logs.")
CRASH("Non-numeric index provided when deleting comms console message.")
if (!message_index)
return
LAZYREMOVE(messages, LAZYACCESS(messages, message_index))

View File

@@ -66,7 +66,7 @@
SScommunications.send_message(threat_msg,unique = TRUE)
/datum/round_event/pirates/proc/answered()
if(threat_msg && threat_msg.answered == 1)
if(threat_msg?.answered == 1)
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_CAR)
if(D)
if(D.adjust_money(-payoff))
@@ -75,6 +75,8 @@
return
else
priority_announce("Trying to cheat us? You'll regret this!",sender_override = ship_name)
else if(threat_msg?.answered == 2)
priority_announce("You won't pay? Fine then, we'll take those credits by force!",sender_override = ship_name)
if(!shuttle_spawned)
spawn_shuttle()
else

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@@ -641,7 +641,7 @@ export const PageMessages = (props, context) => {
color={message.answered === answerIndex + 1 ? "good" : undefined}
key={answerIndex}
onClick={message.answered ? undefined : () => act("answerMessage", {
message: messageIndex + 1,
message: parseInt(messageIndex, 10) + 1,
answer: answerIndex + 1,
})}
/>
@@ -664,7 +664,7 @@ export const PageMessages = (props, context) => {
content="Delete"
color="red"
onClick={() => act("deleteMessage", {
message: messageIndex + 1,
message: parseInt(messageIndex, 10) + 1,
})}
/>
)}>