mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 17:45:02 +01:00
Fix modsuits and defibs (#93373)
## About The Pull Request Fixes #93359 Caused by #93165 Inventory screen elements were no longer considered reachable, which broke mousedrop handing on objects that check "is dragging into inventory slot" I don't know the best way to fix this yet but I figured the next best thing would be to make all of these use the `drag_pickup` element, which skips this reach-ability check Thus I refactored it slightly to accommodate for items which should contextually not be drag-pick-up-abble and bam, works like a charm ## Changelog 🆑 Melbert fix: Dragging defibs and modsuits off your back works again /🆑 --------- Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com> Co-authored-by: Xander3359 <66163761+Xander3359@users.noreply.github.com>
This commit is contained in:
@@ -72,17 +72,6 @@
|
||||
if(!icon_state)
|
||||
item_flags |= ABSTRACT
|
||||
|
||||
/obj/item/clothing/mouse_drop_dragged(atom/over_object, mob/user, src_location, over_location, params)
|
||||
var/mob/M = user
|
||||
|
||||
if(ismecha(M.loc)) // stops inventory actions in a mech
|
||||
return
|
||||
|
||||
if(loc == M && istype(over_object, /atom/movable/screen/inventory/hand))
|
||||
var/atom/movable/screen/inventory/hand/H = over_object
|
||||
if(M.putItemFromInventoryInHandIfPossible(src, H.held_index))
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/item/food/clothing
|
||||
name = "temporary moth clothing snack item"
|
||||
desc = "If you're reading this it means I messed up. This is related to moths eating clothes and I didn't know a better way to do it than making a new food object. <--- stinky idiot wrote this"
|
||||
|
||||
@@ -166,12 +166,10 @@
|
||||
return ..()
|
||||
attacking_item.forceMove(src)
|
||||
|
||||
/obj/item/clothing/shoes/sneakers/orange/allow_attack_hand_drop(mob/user)
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/C = user
|
||||
if(C.shoes == src && attached_cuffs)
|
||||
to_chat(user, span_warning("You need help taking these off!"))
|
||||
return FALSE
|
||||
/obj/item/clothing/shoes/sneakers/orange/can_mob_unequip(mob/user)
|
||||
if(user.get_item_by_slot(slot_flags) == src && attached_cuffs)
|
||||
to_chat(user, span_warning("You need help taking these off!"))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/shoes/sneakers/orange/mouse_drop_dragged(atom/over_object, mob/user)
|
||||
|
||||
@@ -257,13 +257,12 @@
|
||||
// chest maybe because getting slammed in the chest would knock it off your face while dead
|
||||
AddComponent(/datum/component/knockoff, knockoff_chance = 40, target_zones = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST), slots_knockoffable = slot_flags)
|
||||
|
||||
/obj/item/clothing/mask/facehugger/allow_attack_hand_drop(mob/living/carbon/human/user)
|
||||
if(!real || sterile || user.get_organ_by_type(/obj/item/organ/body_egg/alien_embryo))
|
||||
/obj/item/clothing/mask/facehugger/can_mob_unequip(mob/user)
|
||||
if(!real || sterile || stat == DEAD || user.get_organ_by_type(/obj/item/organ/body_egg/alien_embryo))
|
||||
return ..()
|
||||
if(istype(user) && ishuman(loc) && stat != DEAD)
|
||||
if(user == loc && user.get_item_by_slot(slot_flags) == src)
|
||||
to_chat(user, span_userdanger("[src] is latched on too tight! Get help or wait for it to let go!"))
|
||||
return FALSE
|
||||
if(user.get_item_by_slot(slot_flags) == src)
|
||||
to_chat(user, span_userdanger("[src] is latched on too tight! Get help or wait for it to let go!"))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/mask/facehugger/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
module = new module(src)
|
||||
install(module)
|
||||
START_PROCESSING(SSobj, src)
|
||||
AddElement(/datum/element/drag_pickup)
|
||||
|
||||
/obj/item/mod/control/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
@@ -212,14 +213,14 @@
|
||||
return
|
||||
clean_up()
|
||||
|
||||
/obj/item/mod/control/allow_attack_hand_drop(mob/user)
|
||||
/obj/item/mod/control/can_mob_unequip(mob/user)
|
||||
if(user != wearer)
|
||||
return ..()
|
||||
|
||||
if(active)
|
||||
balloon_alert(wearer, "unit active!")
|
||||
playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, FALSE, SILENCED_SOUND_EXTRARANGE)
|
||||
return
|
||||
return FALSE
|
||||
|
||||
for(var/obj/item/part as anything in get_parts())
|
||||
if(part.loc != src)
|
||||
@@ -229,23 +230,6 @@
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/mod/control/mouse_drop_dragged(atom/over_object, mob/user)
|
||||
if(user != wearer || !istype(over_object, /atom/movable/screen/inventory/hand))
|
||||
return
|
||||
if(active)
|
||||
balloon_alert(wearer, "unit active!")
|
||||
playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, FALSE, SILENCED_SOUND_EXTRARANGE)
|
||||
return
|
||||
for(var/obj/item/part as anything in get_parts())
|
||||
if(part.loc != src)
|
||||
balloon_alert(wearer, "parts extended!")
|
||||
playsound(src, 'sound/machines/scanner/scanbuzz.ogg', 25, FALSE, SILENCED_SOUND_EXTRARANGE)
|
||||
return
|
||||
if(!wearer.incapacitated)
|
||||
var/atom/movable/screen/inventory/hand/ui_hand = over_object
|
||||
if(wearer.putItemFromInventoryInHandIfPossible(src, ui_hand.held_index))
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/item/mod/control/wrench_act(mob/living/user, obj/item/wrench)
|
||||
if(seconds_electrified && get_charge() && shock(user))
|
||||
return ITEM_INTERACT_BLOCKING
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
if(start_open && !screen_on)
|
||||
toggle_open()
|
||||
RegisterSignal(src, COMSIG_SPEED_POTION_APPLIED, PROC_REF(on_speed_potioned))
|
||||
AddElement(/datum/element/drag_pickup)
|
||||
|
||||
/obj/item/modular_computer/laptop/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -76,16 +77,6 @@
|
||||
|
||||
try_toggle_open(usr)
|
||||
|
||||
/obj/item/modular_computer/laptop/mouse_drop_dragged(atom/over_object, mob/user, src_location, over_location, params)
|
||||
if(over_object == user || over_object == src)
|
||||
try_toggle_open(user)
|
||||
return
|
||||
if(istype(over_object, /atom/movable/screen/inventory/hand))
|
||||
var/atom/movable/screen/inventory/hand/H = over_object
|
||||
if(!isturf(loc))
|
||||
return
|
||||
user.put_in_hand(src, H.held_index)
|
||||
|
||||
/obj/item/modular_computer/laptop/proc/try_toggle_open(mob/living/user)
|
||||
if(issilicon(user))
|
||||
return
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
stored_blade = new /obj/item/hatchet/cutterblade(src)
|
||||
register_context()
|
||||
update_appearance()
|
||||
AddElement(/datum/element/drag_pickup)
|
||||
|
||||
/obj/item/papercutter/Destroy(force)
|
||||
if(!isnull(stored_paper))
|
||||
@@ -180,15 +181,6 @@
|
||||
new /obj/item/paper/paperslip(get_turf(src))
|
||||
update_appearance()
|
||||
|
||||
/obj/item/papercutter/mouse_drop_dragged(atom/over_object, mob/user)
|
||||
if(over_object == user)
|
||||
user.put_in_hands(src)
|
||||
|
||||
else if(istype(over_object, /atom/movable/screen/inventory/hand))
|
||||
var/atom/movable/screen/inventory/hand/target_hand = over_object
|
||||
user.putItemFromInventoryInHandIfPossible(src, target_hand.held_index)
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/item/paper/paperslip
|
||||
name = "paper slip"
|
||||
desc = "A little slip of paper left over after a larger piece was cut. Whoa."
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
gun = new(src)
|
||||
battery = new(src)
|
||||
START_PROCESSING(SSobj, src)
|
||||
AddElement(/datum/element/drag_pickup)
|
||||
|
||||
/obj/item/minigunpack/Destroy()
|
||||
if(!QDELETED(gun))
|
||||
@@ -64,15 +65,6 @@
|
||||
if(armed)
|
||||
user.dropItemToGround(gun, TRUE)
|
||||
|
||||
/obj/item/minigunpack/mouse_drop_dragged(atom/over_object, mob/user)
|
||||
if(armed)
|
||||
return
|
||||
|
||||
if(iscarbon(user))
|
||||
if(istype(over_object, /atom/movable/screen/inventory/hand))
|
||||
var/atom/movable/screen/inventory/hand/H = over_object
|
||||
user.putItemFromInventoryInHandIfPossible(src, H.held_index)
|
||||
|
||||
/obj/item/minigunpack/update_icon_state()
|
||||
icon_state = armed ? "notholstered" : "holstered"
|
||||
return ..()
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
/obj/item/storage/portable_chem_mixer/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
register_context()
|
||||
AddElement(/datum/element/drag_pickup)
|
||||
|
||||
/obj/item/storage/portable_chem_mixer/Destroy()
|
||||
dispensable_reagents.Cut()
|
||||
@@ -239,13 +239,6 @@
|
||||
update_appearance()
|
||||
return TRUE
|
||||
|
||||
/obj/item/storage/portable_chem_mixer/mouse_drop_dragged(atom/over_object)
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
if(istype(over_object, /atom/movable/screen/inventory/hand))
|
||||
var/atom/movable/screen/inventory/hand/H = over_object
|
||||
M.putItemFromInventoryInHandIfPossible(src, H.held_index)
|
||||
|
||||
/obj/item/storage/portable_chem_mixer/click_alt(mob/living/user)
|
||||
if(!atom_storage.locked)
|
||||
balloon_alert(user, "lock first to use alt eject!")
|
||||
|
||||
@@ -113,22 +113,10 @@ Slimecrossing Armor
|
||||
throw_speed = 1
|
||||
throw_range = 3
|
||||
|
||||
/obj/item/clothing/head/peaceflower/proc/at_peace_check(mob/user)
|
||||
if(iscarbon(user))
|
||||
var/mob/living/carbon/carbon_user = user
|
||||
if(src == carbon_user.head)
|
||||
to_chat(user, span_warning("You feel at peace. <b style='color:pink'>Why would you want anything else?</b>"))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/clothing/head/peaceflower/attack_hand(mob/user, list/modifiers)
|
||||
if(at_peace_check(user))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/head/peaceflower/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
|
||||
if(at_peace_check(user))
|
||||
return
|
||||
/obj/item/clothing/head/peaceflower/can_mob_unequip(mob/user)
|
||||
if(user.get_item_by_slot(slot_flags) == src)
|
||||
to_chat(user, span_warning("You feel at peace. <b style='color:pink'>Why would you want anything else?</b>"))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/obj/item/clothing/suit/armor/heavy/adamantine
|
||||
|
||||
@@ -322,6 +322,7 @@
|
||||
#include "trauma_granting.dm"
|
||||
#include "turf_icons.dm"
|
||||
#include "tutorial_sanity.dm"
|
||||
#include "unequip_defib.dm"
|
||||
#include "unit_test.dm"
|
||||
#include "verify_config_tags.dm"
|
||||
#include "verify_emoji_names.dm"
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// Test you can mouse-drop a defib off your back to unequip it
|
||||
/datum/unit_test/unequip_defib
|
||||
|
||||
/datum/unit_test/unequip_defib/Run()
|
||||
var/mob/living/carbon/human/consistent/dummy = EASY_ALLOCATE()
|
||||
dummy.mock_client = new()
|
||||
dummy.set_hud_used(new dummy.hud_type(dummy))
|
||||
var/obj/item/defibrillator/defib = EASY_ALLOCATE()
|
||||
dummy.equip_to_slot(defib, ITEM_SLOT_BACK)
|
||||
|
||||
var/old_usr = usr
|
||||
|
||||
usr = dummy // mouse drop still uses usr
|
||||
|
||||
defib.MouseDrop(dummy.hud_used.hand_slots["1"])
|
||||
if(!dummy.is_holding(defib))
|
||||
TEST_FAIL("The dummy failed to remove the defib from their back via mouse drop.")
|
||||
|
||||
usr = old_usr
|
||||
Reference in New Issue
Block a user