Cleaning up storage attackby.

This commit is contained in:
MistakeNot4892
2022-11-16 11:41:32 +11:00
parent 879be4d8c4
commit 9b7ba12c89
12 changed files with 80 additions and 86 deletions

View File

@@ -19,7 +19,7 @@
if (pockets.handle_mousedrop(usr, over_object))
..(over_object)
/obj/item/clothing/suit/storage/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/clothing/suit/storage/attackby(obj/item/W, mob/user)
. = ..()
if(!.)
return pockets.attackby(W, user)

View File

@@ -42,7 +42,7 @@
data["on"] = on
data["open"] = open
data["locked"] = locked
data["vocal"] = vocal
data["amount"] = amount
@@ -58,7 +58,7 @@
data["eattiles"] = eattiles
data["maketiles"] = maketiles
data["bmode"] = dir2text(targetdirection)
return data
/mob/living/bot/floorbot/attack_hand(var/mob/user)
@@ -76,7 +76,7 @@
/mob/living/bot/floorbot/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return TRUE
add_fingerprint(src)
switch(action)
@@ -86,7 +86,7 @@
else
turn_on()
. = TRUE
if(locked && !issilicon(usr))
return
@@ -344,13 +344,15 @@
/* Assembly */
/obj/item/storage/toolbox/mechanical/attackby(var/obj/item/stack/tile/floor/T, mob/living/user as mob)
/obj/item/storage/toolbox/mechanical/attackby(var/obj/item/stack/tile/floor/T, mob/living/user)
if(!istype(T, /obj/item/stack/tile/floor))
..()
return
return ..()
if(contents.len >= 1)
to_chat(user, "<span class='notice'>They wont fit in as there is already stuff inside.</span>")
return
return TRUE
if(user.s_active)
user.s_active.close(user)
if(T.use(10))
@@ -361,7 +363,7 @@
qdel(src)
else
to_chat(user, "<span class='warning'>You need 10 floor tiles for a floorbot.</span>")
return
return TRUE
/obj/item/toolbox_tiles
desc = "It's a toolbox with tiles sticking out the top"

View File

@@ -267,7 +267,7 @@
/mob/living/bot/medbot/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return TRUE
usr.set_machine(src)
add_fingerprint(usr)
@@ -470,16 +470,22 @@
/* Construction */
/obj/item/storage/firstaid/attackby(var/obj/item/robot_parts/S, mob/user as mob)
if ((!istype(S, /obj/item/robot_parts/l_arm)) && (!istype(S, /obj/item/robot_parts/r_arm)))
..()
return
/obj/item/storage/firstaid/attackby(var/obj/item/W, mob/user)
if(contents.len >= 1)
to_chat(user, "<span class='notice'>You need to empty [src] out first.</span>")
return
var/valid_for_construction = istype(W, /obj/item/robot_parts/l_arm) || istype(W, /obj/item/robot_parts/r_arm)
if(istype(W, /obj/item/organ/external/arm))
var/obj/item/organ/external/arm/arm = W
if(arm.robotic == ORGAN_ROBOT)
valid_for_construction = TRUE
var/obj/item/firstaid_arm_assembly/A = new /obj/item/firstaid_arm_assembly
if(!valid_for_construction)
return ..()
if(contents.len)
to_chat(user, SPAN_NOTICE("You need to empty [src] out first."))
return TRUE
var/obj/item/firstaid_arm_assembly/A = new /obj/item/firstaid_arm_assembly(get_turf(src))
if(istype(src, /obj/item/storage/firstaid/fire))
A.skin = "ointment"
else if(istype(src, /obj/item/storage/firstaid/toxin))
@@ -487,34 +493,12 @@
else if(istype(src, /obj/item/storage/firstaid/o2))
A.skin = "o2"
qdel(S)
qdel(W)
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You add the robot arm to the first aid kit.</span>")
user.drop_from_inventory(src)
qdel(src)
/obj/item/storage/firstaid/attackby(var/obj/item/organ/external/S, mob/user as mob)
if (!istype(S, /obj/item/organ/external/arm) || S.robotic != ORGAN_ROBOT)
..()
return
if(contents.len >= 1)
to_chat(user, "<span class='notice'>You need to empty [src] out first.</span>")
return
var/obj/item/firstaid_arm_assembly/A = new /obj/item/firstaid_arm_assembly
if(istype(src, /obj/item/storage/firstaid/fire))
A.skin = "ointment"
else if(istype(src, /obj/item/storage/firstaid/toxin))
A.skin = "tox"
else if(istype(src, /obj/item/storage/firstaid/o2))
A.skin = "o2"
qdel(S)
user.put_in_hands(A)
to_chat(user, "<span class='notice'>You add the robot arm to the first aid kit.</span>")
to_chat(user, SPAN_NOTICE("You add the robot arm to the first aid kit."))
user.drop_from_inventory(src)
qdel(src)
return TRUE
/obj/item/firstaid_arm_assembly
name = "first aid/robot arm assembly"