mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 15:45:25 +01:00
Slightly refactors storage item insertion (#24429)
* everything is on fire * silent trait check * how did it even become CRLF * minor formatting * fix icon updating and adds silent insertion to global trait list * adds the new parameter to documentation - whoops! * pain * contra review * contra review again, reduces amount of checks for user in the loops --------- Co-authored-by: cybercapitalism <98280110+cybercapitalism@users.noreply.github.com>
This commit is contained in:
@@ -243,50 +243,50 @@
|
||||
/obj/item/proc/equip_to_best_slot(mob/M)
|
||||
if(src != M.get_active_hand())
|
||||
to_chat(M, "<span class='warning'>You are not holding anything to equip!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(M.equip_to_appropriate_slot(src))
|
||||
if(M.hand)
|
||||
M.update_inv_l_hand()
|
||||
else
|
||||
M.update_inv_r_hand()
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
if(M.s_active && M.s_active.can_be_inserted(src, 1)) //if storage active insert there
|
||||
M.s_active.handle_item_insertion(src)
|
||||
return 1
|
||||
if(M.s_active && M.s_active.can_be_inserted(src, TRUE)) //if storage active insert there
|
||||
M.s_active.handle_item_insertion(src, M)
|
||||
return TRUE
|
||||
|
||||
var/obj/item/storage/S = M.get_inactive_hand()
|
||||
if(istype(S) && S.can_be_inserted(src, 1)) //see if we have box in other hand
|
||||
S.handle_item_insertion(src)
|
||||
return 1
|
||||
if(istype(S) && S.can_be_inserted(src, M, TRUE)) //see if we have box in other hand
|
||||
S.handle_item_insertion(src, M)
|
||||
return TRUE
|
||||
|
||||
S = M.get_item_by_slot(SLOT_HUD_WEAR_ID)
|
||||
if(istype(S) && S.can_be_inserted(src, 1)) //else we put in a wallet
|
||||
S.handle_item_insertion(src)
|
||||
return 1
|
||||
if(istype(S) && S.can_be_inserted(src, TRUE)) //else we put in a wallet
|
||||
S.handle_item_insertion(src, M)
|
||||
return TRUE
|
||||
|
||||
S = M.get_item_by_slot(SLOT_HUD_BELT)
|
||||
if(istype(S) && S.can_be_inserted(src, 1)) //else we put in belt
|
||||
S.handle_item_insertion(src)
|
||||
return 1
|
||||
if(istype(S) && S.can_be_inserted(src, TRUE)) //else we put in belt
|
||||
S.handle_item_insertion(src, M)
|
||||
return TRUE
|
||||
|
||||
var/obj/item/O = M.get_item_by_slot(SLOT_HUD_BACK) //else we put in backpack
|
||||
if(istype(O, /obj/item/storage))
|
||||
S = O
|
||||
if(S.can_be_inserted(src, 1))
|
||||
S.handle_item_insertion(src)
|
||||
if(S.can_be_inserted(src, TRUE))
|
||||
S.handle_item_insertion(src, M)
|
||||
playsound(loc, "rustle", 50, TRUE, -5)
|
||||
return 1
|
||||
return TRUE
|
||||
if(ismodcontrol(O))
|
||||
var/obj/item/mod/control/C = O
|
||||
if(C.can_be_inserted(src, 1))
|
||||
C.handle_item_insertion(src)
|
||||
if(C.can_be_inserted(src, TRUE))
|
||||
C.handle_item_insertion(src, M)
|
||||
playsound(loc, "rustle", 50, TRUE, -5)
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
to_chat(M, "<span class='warning'>You are unable to equip that!</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
/mob/proc/get_all_slots()
|
||||
return list(wear_mask, back, l_hand, r_hand)
|
||||
|
||||
@@ -446,12 +446,12 @@
|
||||
return
|
||||
if(ismodcontrol(equipped_item)) // Check if the item is a MODsuit
|
||||
if(thing && equipped_item.can_be_inserted(thing)) // Check if the item can be inserted into the MODsuit
|
||||
equipped_item.handle_item_insertion(thing) // Insert the item into the MODsuit
|
||||
equipped_item.handle_item_insertion(thing, src) // Insert the item into the MODsuit
|
||||
playsound(loc, "rustle", 50, TRUE, -5)
|
||||
return
|
||||
if(!istype(equipped_item)) // We also let you equip things like this
|
||||
equip_to_slot_if_possible(thing, slot_item)
|
||||
return
|
||||
if(thing && equipped_item.can_be_inserted(thing)) // put thing in belt or bag
|
||||
equipped_item.handle_item_insertion(thing)
|
||||
equipped_item.handle_item_insertion(thing, src)
|
||||
playsound(loc, "rustle", 50, 1, -5)
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
// Convinience proc. Collects crap that fails to equip either onto the mob's back, or drops it.
|
||||
// Used in job equipping so shit doesn't pile up at the start loc.
|
||||
/mob/living/carbon/human/proc/equip_or_collect(obj/item/W, slot, initial = FALSE)
|
||||
if(W.mob_can_equip(src, slot, 1))
|
||||
if(W.mob_can_equip(src, slot, TRUE))
|
||||
//Mob can equip. Equip it.
|
||||
equip_to_slot_or_del(W, slot, initial)
|
||||
else
|
||||
@@ -280,12 +280,12 @@
|
||||
if(isstorage(back))
|
||||
var/obj/item/storage/S = back
|
||||
//Now, S represents a container we can insert W into.
|
||||
S.handle_item_insertion(W, TRUE, TRUE)
|
||||
S.handle_item_insertion(W, src, TRUE, TRUE)
|
||||
return S
|
||||
if(ismodcontrol(back))
|
||||
var/obj/item/mod/control/C = back
|
||||
if(C.bag)
|
||||
C.bag.handle_item_insertion(W, TRUE, TRUE)
|
||||
C.bag.handle_item_insertion(W, src, TRUE, TRUE)
|
||||
return C.bag
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
|
||||
Reference in New Issue
Block a user