mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-22 19:47:47 +01:00
Refactors mob_can_equip(), adds unequip checks
This commit is contained in:
@@ -58,6 +58,10 @@ var/list/slot_equipment_priority = list( \
|
||||
slot_r_store\
|
||||
)
|
||||
|
||||
//Checks if a given slot can be accessed at this time, either to equip or unequip I
|
||||
/mob/proc/slot_is_accessible(var/slot, var/obj/item/I, mob/user=null)
|
||||
return 1
|
||||
|
||||
//puts the item "W" into an appropriate slot in a human's inventory
|
||||
//returns 0 if it cannot, 1 if successful
|
||||
/mob/proc/equip_to_appropriate_slot(obj/item/W)
|
||||
@@ -143,7 +147,8 @@ var/list/slot_equipment_priority = list( \
|
||||
W.dropped()
|
||||
return 0
|
||||
|
||||
// Removes an item from inventory and places it in the target atom
|
||||
// Removes an item from inventory and places it in the target atom.
|
||||
// If canremove or other conditions need to be checked then use unEquip instead.
|
||||
/mob/proc/drop_from_inventory(var/obj/item/W, var/atom/Target = null)
|
||||
if(W)
|
||||
if(!Target)
|
||||
@@ -201,7 +206,13 @@ var/list/slot_equipment_priority = list( \
|
||||
if(!I) //If there's nothing to drop, the drop is automatically successful.
|
||||
return 1
|
||||
|
||||
if(!I.canremove && !force)
|
||||
var/slot
|
||||
for(var/s in slot_back to slot_tie) //kind of worries me
|
||||
if(get_equipped_item(s) == I)
|
||||
slot = s
|
||||
break
|
||||
|
||||
if(slot && !I.mob_can_unequip(src, slot))
|
||||
return 0
|
||||
|
||||
remove_from_mob(I)
|
||||
@@ -220,6 +231,15 @@ var/list/slot_equipment_priority = list( \
|
||||
return 1
|
||||
|
||||
|
||||
//Returns the item equipped to the specified slot, if any.
|
||||
/mob/proc/get_equipped_item(var/slot)
|
||||
switch(slot)
|
||||
if(slot_l_hand) return l_hand
|
||||
if(slot_r_hand) return r_hand
|
||||
if(slot_back) return back
|
||||
if(slot_wear_mask) return wear_mask
|
||||
return null
|
||||
|
||||
//Outdated but still in use apparently. This should at least be a human proc.
|
||||
/mob/proc/get_equipped_items()
|
||||
var/list/items = new/list()
|
||||
|
||||
@@ -317,6 +317,48 @@ This saves us from having to call add_fingerprint() any time something is put in
|
||||
|
||||
return 1
|
||||
|
||||
//Checks if a given slot can be accessed at this time, either to equip or unequip I
|
||||
/mob/living/carbon/human/slot_is_accessible(var/slot, var/obj/item/I, mob/user=null)
|
||||
var/obj/item/covering = null
|
||||
var/check_flags = 0
|
||||
|
||||
switch(slot)
|
||||
if(slot_wear_mask)
|
||||
covering = src.head
|
||||
check_flags = HEADCOVERSMOUTH
|
||||
if(slot_glasses)
|
||||
covering = src.head
|
||||
check_flags = HEADCOVERSEYES
|
||||
if(slot_gloves, slot_w_uniform)
|
||||
covering = src.wear_suit
|
||||
|
||||
if(covering)
|
||||
if((covering.body_parts_covered & I.body_parts_covered) || (covering.flags & check_flags))
|
||||
user << "<span class='warning'>\The [covering] is in the way.</span>"
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/human/get_equipped_item(var/slot)
|
||||
switch(slot)
|
||||
if(slot_wear_suit) return wear_suit
|
||||
if(slot_gloves) return gloves
|
||||
if(slot_shoes) return shoes
|
||||
if(slot_belt) return belt
|
||||
if(slot_glasses) return glasses
|
||||
if(slot_head) return head
|
||||
if(slot_l_ear) return l_ear
|
||||
if(slot_r_ear) return r_ear
|
||||
if(slot_w_uniform) return w_uniform
|
||||
if(slot_wear_id) return wear_id
|
||||
if(slot_l_store) return l_store
|
||||
if(slot_r_store) return r_store
|
||||
if(slot_s_store) return s_store
|
||||
if(slot_handcuffed) return handcuffed
|
||||
if(slot_legcuffed) return legcuffed
|
||||
return ..()
|
||||
|
||||
///Bizarre equip effect system below
|
||||
|
||||
/*
|
||||
MouseDrop human inventory menu
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user