Refactor /mob/unEquip. (#27720)

* Refactor /mob/unEquip.

* fix things found in testing

* more fixes from testing

* fix removal of hooded suits

* fix flayers inability to deploy swarmprod

* fix changeling blade activation

* unnecessary parens

* pass default unequip args to proc overrides

* fix belts being able to forceMove into full hands
This commit is contained in:
warriorstar-orion
2025-01-10 01:58:35 +00:00
committed by GitHub
parent 17602326bc
commit 0eafad8475
213 changed files with 587 additions and 585 deletions
@@ -424,7 +424,7 @@
..()
var/obj/item/projectile/bullet/reusable/foam_dart/FD = BB
if((is_pen(A)) && modified && !FD.pen)
if(!user.unEquip(A))
if(!user.unequip(A)) // forceMove happens in add_pen
return
add_pen(A)
to_chat(user, "<span class='notice'>You insert [A] into [src].</span>")
+1 -2
View File
@@ -349,14 +349,13 @@
var/obj/item/flashlight/seclite/S = I
if(can_flashlight)
if(!gun_light)
if(!user.unEquip(I))
if(!user.transfer_item_to(I, src))
return
to_chat(user, "<span class='notice'>You click [S] into place on [src].</span>")
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
if(S.on)
set_light(0)
gun_light = S
I.loc = src
update_icon()
update_gun_light(user)
var/datum/action/A = new /datum/action/item_action/toggle_gunlight(src)
+1 -1
View File
@@ -122,7 +122,7 @@
H.makeCluwne()
if("spaced")
for(var/obj/item/I in H)
H.unEquip(I, TRUE)
H.drop_item_to_ground(I, force = TRUE)
var/turf/T = safepick(get_area_turfs(/area/space/nearstation)) //Send in space next to the station
if(!T) //Shouldn't happen but just in case
T = safepick(get_area_turfs(/area/space))
@@ -343,7 +343,7 @@
if(.)
to_chat(user, "<span class='notice'>You install the modkit.</span>")
playsound(loc, usesound, 100, 1)
user.unEquip(src)
user.unequip(src)
forceMove(KA)
KA.modkits += src
else
@@ -1036,7 +1036,7 @@
user.flash_eyes(2, TRUE)
do_sparks(rand(5, 9), FALSE, src)
playsound(src, 'sound/effects/bang.ogg', 100, TRUE)
user.unEquip(src)
user.drop_item_to_ground(src)
cell.charge = 0 //ha ha you lose
update_icon()
return
@@ -21,9 +21,9 @@
/obj/item/gun/grenadelauncher/attackby__legacy__attackchain(obj/item/I as obj, mob/user as mob, params)
if((istype(I, /obj/item/grenade)))
if(length(grenades) < max_grenades)
if(!user.unEquip(I))
if(!user.unequip(I))
return
I.loc = src
I.forceMove(src)
grenades += I
to_chat(user, "<span class='notice'>You put the grenade in [src].</span>")
to_chat(user, "<span class='notice'>[length(grenades)] / [max_grenades] grenades.</span>")
@@ -50,7 +50,7 @@
to_chat(user, "<span class='notice'>You insert the magazine into \the [src].</span>")
if(alarmed)
alarmed = 0
user.remove_from_mob(AM)
user.unequip(AM)
magazine = AM
magazine.loc = src
chamber_round()
@@ -79,7 +79,7 @@
return !magazine
/obj/item/gun/projectile/proc/reload(obj/item/ammo_box/magazine/AM, mob/user)
user.remove_from_mob(AM)
user.unequip(AM)
magazine = AM
magazine.forceMove(src)
if(w_class >= WEIGHT_CLASS_NORMAL && !suppressed)
@@ -123,8 +123,9 @@
var/obj/item/suppressor/S = A
if(can_suppress)
if(!suppressed)
if(!user.unEquip(A))
if(!user.unequip(A))
return
A.forceMove(src)
to_chat(user, "<span class='notice'>You screw [S] onto [src].</span>")
playsound(src, 'sound/items/screwdriver.ogg', 40, 1)
suppressed = A
+1 -2
View File
@@ -30,8 +30,7 @@
if(!istype(I, /obj/item/ammo_casing/rocket))
return ..()
if(!chambered)
user.unEquip(I)
I.forceMove(src)
user.transfer_item_to(I, src)
chambered = I
to_chat(user, "<span class='notice'>You put the rocket in [src].</span>")
else
+7 -7
View File
@@ -73,13 +73,13 @@
return
var/in_clip = length(syringes) + (chambered.BB ? 1 : 0)
if(in_clip < max_syringes)
if(!user.unEquip(A))
if(user.transfer_item_to(A, src))
to_chat(user, "<span class='notice'>You load [A] into [src]!</span>")
syringes.Add(A)
process_chamber() // Chamber the syringe if none is already
return TRUE
else
return
to_chat(user, "<span class='notice'>You load [A] into [src]!</span>")
syringes.Add(A)
A.loc = src
process_chamber() // Chamber the syringe if none is already
return TRUE
else
to_chat(user, "<span class='notice'>[src] cannot hold more syringes.</span>")
else if(istype(A, /obj/item/dnainjector))
@@ -170,7 +170,7 @@
return FALSE
if(user)
if(!user.unEquip(new_syringe))
if(!user.drop_item_to_ground(new_syringe))
return
to_chat(user, "<span class='notice'>You load \the [new_syringe] into [src].</span>")
playsound(src, 'sound/weapons/gun_interactions/bulletinsert.ogg', 50, 1)
@@ -269,7 +269,7 @@ GLOBAL_LIST_INIT(wabbajack_docile_animals, list(
for(var/i in H.internal_organs)
qdel(i)
for(var/obj/item/W in M)
M.unEquip(W, 1)
M.unequip(W, force = TRUE)
qdel(W)
var/mob/living/new_mob