From 4afceebcc13f31de32105c8c71fe97d3d47a70cf Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Tue, 20 Oct 2020 02:11:08 +0100
Subject: [PATCH] critical
---
code/game/gamemodes/gangs/gang.dm | 8 +++----
code/game/gamemodes/objective.dm | 4 ++--
code/modules/antagonists/cult/cult.dm | 2 +-
.../eldritch_cult/eldritch_antag.dm | 2 +-
.../antagonists/overthrow/overthrow.dm | 4 ++--
.../antagonists/revolution/revolution.dm | 2 +-
.../antagonists/traitor/datum_traitor.dm | 2 +-
code/modules/mob/living/carbon/inventory.dm | 21 ++++++++++++++++++-
8 files changed, 32 insertions(+), 13 deletions(-)
diff --git a/code/game/gamemodes/gangs/gang.dm b/code/game/gamemodes/gangs/gang.dm
index a766dda57c..a4483ca3b8 100644
--- a/code/game/gamemodes/gangs/gang.dm
+++ b/code/game/gamemodes/gangs/gang.dm
@@ -197,7 +197,7 @@
if(gangtool)//Here is where all of the text occurs when a gang boss first spawns in.
var/obj/item/device/gangtool/G = new()
- var/where = H.equip_in_one_of_slots(G, slots)
+ var/where = H.equip_in_one_of_slots(G, slots, critical = TRUE)
if (!where)
to_chat(H, "Your Syndicate benefactors were unfortunately unable to get you a Gangtool.")
else
@@ -207,7 +207,7 @@
if(pen)
var/obj/item/pen/gang/T = new()
- var/where2 = H.equip_in_one_of_slots(T, slots)
+ var/where2 = H.equip_in_one_of_slots(T, slots, critical = TRUE)
if (!where2)
to_chat(H, "Your Syndicate benefactors were unfortunately unable to get you a recruitment pen to start.")
else
@@ -215,7 +215,7 @@
if(spraycan)
var/obj/item/toy/crayon/spraycan/gang/SC = new(null,gang)
- var/where3 = H.equip_in_one_of_slots(SC, slots)
+ var/where3 = H.equip_in_one_of_slots(SC, slots, critical = TRUE)
if (!where3)
to_chat(H, "Your Syndicate benefactors were unfortunately unable to get you a territory spraycan to start.")
else
@@ -223,7 +223,7 @@
if(hud)
var/obj/item/clothing/glasses/hud/security/chameleon/C = new(null,gang)
- var/where4 = H.equip_in_one_of_slots(C, slots)
+ var/where4 = H.equip_in_one_of_slots(C, slots, critical = TRUE)
if (!where4)
to_chat(H, "Your Syndicate benefactors were unfortunately unable to get you a chameleon security HUD.")
else
diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm
index a8ed4611eb..d8617e0b48 100644
--- a/code/game/gamemodes/objective.dm
+++ b/code/game/gamemodes/objective.dm
@@ -166,7 +166,7 @@ If not set, defaults to check_completion instead. Set it. It's used by cryo.
var/list/slots = list("backpack" = SLOT_IN_BACKPACK)
for(var/eq_path in special_equipment)
var/obj/O = new eq_path
- H.equip_in_one_of_slots(O, slots)
+ H.equip_in_one_of_slots(O, slots, critical = TRUE)
/datum/objective/assassinate
name = "assasinate"
@@ -1152,7 +1152,7 @@ GLOBAL_LIST_EMPTY(cult_contraband)
I.forceMove(get_turf(owner))
if(ishuman(owner))
var/mob/living/carbon/human/H = owner
- H.equip_in_one_of_slots(I, list("backpack" = SLOT_IN_BACKPACK))
+ H.equip_in_one_of_slots(I, list("backpack" = SLOT_IN_BACKPACK), critical = TRUE)
hoarded_item = I
diff --git a/code/modules/antagonists/cult/cult.dm b/code/modules/antagonists/cult/cult.dm
index 61f6ec9998..6e3fcfae2a 100644
--- a/code/modules/antagonists/cult/cult.dm
+++ b/code/modules/antagonists/cult/cult.dm
@@ -100,7 +100,7 @@
var/T = new item_path(mob)
var/item_name = initial(item_path.name)
- var/where = mob.equip_in_one_of_slots(T, slots)
+ var/where = mob.equip_in_one_of_slots(T, slots, critical = TRUE)
if(!where)
to_chat(mob, "Unfortunately, you weren't able to get a [item_name]. This is very bad and you should adminhelp immediately (press F1).")
return 0
diff --git a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm
index 81bc090460..25602c8588 100644
--- a/code/modules/antagonists/eldritch_cult/eldritch_antag.dm
+++ b/code/modules/antagonists/eldritch_cult/eldritch_antag.dm
@@ -75,7 +75,7 @@
var/T = new item_path(H)
var/item_name = initial(item_path.name)
- var/where = H.equip_in_one_of_slots(T, slots)
+ var/where = H.equip_in_one_of_slots(T, slots, critical = TRUE)
if(!where)
to_chat(H, "Unfortunately, you weren't able to get a [item_name]. This is very bad and you should adminhelp immediately (press F1).")
return FALSE
diff --git a/code/modules/antagonists/overthrow/overthrow.dm b/code/modules/antagonists/overthrow/overthrow.dm
index 0e8c4a35e0..8fa5517b4f 100644
--- a/code/modules/antagonists/overthrow/overthrow.dm
+++ b/code/modules/antagonists/overthrow/overthrow.dm
@@ -131,14 +131,14 @@
"left pocket" = SLOT_L_STORE,
"right pocket" = SLOT_R_STORE
)
- var/where = H.equip_in_one_of_slots(O, slots)
+ var/where = H.equip_in_one_of_slots(O, slots, critical = TRUE)
if (!where)
to_chat(H, "The Syndicate were unfortunately unable to get you the AI module.")
else
to_chat(H, "Use the AI board in your [where] to take control of the AI, as requested by the Syndicate.")
// Give the implant converter
var/obj/item/overthrow_converter/I = new(H)
- where = H.equip_in_one_of_slots(I, slots)
+ where = H.equip_in_one_of_slots(I, slots, critical = TRUE)
if (!where)
to_chat(H, "The Syndicate were unfortunately unable to get you a converter implant.")
else
diff --git a/code/modules/antagonists/revolution/revolution.dm b/code/modules/antagonists/revolution/revolution.dm
index 4f308cc4c0..c23523cc6b 100644
--- a/code/modules/antagonists/revolution/revolution.dm
+++ b/code/modules/antagonists/revolution/revolution.dm
@@ -251,7 +251,7 @@
"left pocket" = SLOT_L_STORE,
"right pocket" = SLOT_R_STORE
)
- var/where = H.equip_in_one_of_slots(T, slots)
+ var/where = H.equip_in_one_of_slots(T, slots, critical = TRUE)
if (!where)
to_chat(H, "The Syndicate were unfortunately unable to get you a flash.")
else
diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm
index 0309b7e826..47a9c59274 100644
--- a/code/modules/antagonists/traitor/datum_traitor.dm
+++ b/code/modules/antagonists/traitor/datum_traitor.dm
@@ -212,7 +212,7 @@
)
var/where = "At your feet"
- var/equipped_slot = mob.equip_in_one_of_slots(folder, slots)
+ var/equipped_slot = mob.equip_in_one_of_slots(folder, slots, critical = TRUE)
if (equipped_slot)
where = "In your [equipped_slot]"
to_chat(mob, "
[where] is a folder containing secret documents that another Syndicate group wants. We have set up a meeting with one of their agents on station to make an exchange. Exercise extreme caution as they cannot be trusted and may be hostile.
")
diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm
index 50801e1c0d..96dab9e95d 100644
--- a/code/modules/mob/living/carbon/inventory.dm
+++ b/code/modules/mob/living/carbon/inventory.dm
@@ -14,10 +14,29 @@
return legcuffed
return null
-/mob/living/carbon/proc/equip_in_one_of_slots(obj/item/I, list/slots, qdel_on_fail = 1)
+/mob/living/carbon/proc/equip_in_one_of_slots(obj/item/I, list/slots, qdel_on_fail = 1, critical = FALSE)
for(var/slot in slots)
if(equip_to_slot_if_possible(I, slots[slot], qdel_on_fail = 0, disable_warning = TRUE))
return slot
+ if(critical) //it is CRITICAL they get this item, no matter what
+ //do they have a backpack?
+ var/obj/item/backpack = get_item_by_slot(SLOT_BACK)
+ if(!backpack)
+ //nothing on their back
+ backpack = new /obj/item/storage/backpack(get_turf(src))
+ if(equip_to_slot(backpack, SLOT_BACK)) //worst-case-scenario, something that shouldnt wear a backpack gets one
+ I.forceMove(backpack)
+ return SLOT_BACK
+ else if(istype(backpack) && SEND_SIGNAL(backpack, COMSIG_CONTAINS_STORAGE))
+ //place it in here, regardless of storage capacity
+ I.forceMove(backpack)
+ return SLOT_BACK
+ else
+ //this should NEVER happen, but if it does, report it with the appropriate information
+ var/conclusion = qdel_on_fail ? "deleted" : "not moved, staying at current position [I.x], [I.y], [I.z]"
+ message_admins("User [src] failed to get item of critical importance: [I]. Result: item is [conclusion]")
+ //it's not dropped at their turf as this is generally un-safe for midround antags and we don't know their status
+
if(qdel_on_fail)
qdel(I)
return null