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

@@ -166,7 +166,7 @@
if(istype(O,/obj/item/kit/suit))
var/obj/item/kit/suit/kit = O
kit.customize(src, user)
return
return TRUE
return ..()
/obj/item/kit/suit/rig

View File

@@ -49,12 +49,12 @@
name = "dufflebag of holding"
icon_state = "holdingduffle"
/obj/item/storage/backpack/holding/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/storage/backpack/holding/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/storage/backpack/holding))
to_chat(user, "<span class='warning'>The Bluespace interfaces of the two devices conflict and malfunction.</span>")
qdel(W)
return
. = ..()
return TRUE
return ..()
//Please don't clutter the parent storage item with stupid hacks.
/obj/item/storage/backpack/holding/can_be_inserted(obj/item/W as obj, stop_messages = 0)
@@ -527,4 +527,4 @@
desc = "A satchel designed for the Go Go ERT Rangers series to allow for slightly bigger carry capacity for the ERT-Rangers.\
Unlike the show claims, it is not a phoron-enhanced satchel of holding with plot-relevant content."
icon = 'icons/obj/clothing/ranger.dmi'
icon_state = "ranger_satchel"
icon_state = "ranger_satchel"

View File

@@ -36,7 +36,7 @@
A.reagents.del_reagent("water")
A.reagents.add_reagent("holywater",water2holy)
/obj/item/storage/bible/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/storage/bible/attackby(obj/item/W, mob/user)
if (src.use_sound)
playsound(src, src.use_sound, 50, 1, -5)
..()
return ..()

View File

@@ -476,8 +476,9 @@
user.visible_message("<span class='notice'>[user] manages to light the match on the matchbox.</span>")
else
playsound(src, 'sound/items/cigs_lighters/matchstick_hit.ogg', 25, 0, -1)
W.update_icon()
return
W.update_icon()
return TRUE
return ..()
/obj/item/storage/box/autoinjectors
name = "box of injectors"

View File

@@ -130,16 +130,17 @@
add_overlay(image('icons/obj/crayons.dmi',crayon.colourName))
appearance = ma
/obj/item/storage/fancy/crayons/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/storage/fancy/crayons/attackby(obj/item/W, mob/user)
if(istype(W,/obj/item/pen/crayon))
switch(W:colourName)
var/obj/item/pen/crayon/crayon = W
switch(crayon.colourName)
if("mime")
to_chat(user, "This crayon is too sad to be contained in this box.")
return
return TRUE
if("rainbow")
to_chat(user, "This crayon is too powerful to be contained in this box.")
return
..()
return TRUE
return ..()
/obj/item/storage/fancy/markers
name = "box of markers"
@@ -172,16 +173,17 @@
ma.add_overlay(image('icons/obj/crayons.dmi',"m"+marker.colourName))
appearance = ma
/obj/item/storage/fancy/markers/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/storage/fancy/markers/attackby(obj/item/W, mob/user)
if(istype(W,/obj/item/pen/crayon/marker))
switch(W:colourName)
var/obj/item/pen/crayon/marker/marker = W
switch(marker.colourName)
if("mime")
to_chat(user, "This marker is too depressing to be contained in this box.")
return
return TRUE
if("rainbow")
to_chat(user, "This marker is too childish to be contained in this box.")
return
..()
return TRUE
return ..()
/*
* Cracker Packet
@@ -407,9 +409,10 @@
else
add_overlay("ledb")
/obj/item/storage/lockbox/vials/attackby(obj/item/W as obj, mob/user as mob)
..()
update_icon()
/obj/item/storage/lockbox/vials/attackby(obj/item/W, mob/user)
. = ..()
if(.)
update_icon()
/*
* Box of Chocolates/Heart Box

View File

@@ -204,7 +204,7 @@
I.color = wrapper_color
add_overlay(I)
/obj/item/storage/pill_bottle/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/storage/pill_bottle/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/pen) || istype(W, /obj/item/flashlight/pen))
var/tmp_label = sanitizeSafe(input(user, "Enter a label for [name]", "Label", label_text), MAX_NAME_LEN)
if(length(tmp_label) > 50)
@@ -217,8 +217,8 @@
to_chat(user, "<span class='notice'>You set the label to \"[tmp_label]\".</span>")
label_text = tmp_label
update_name_label()
else
..()
return TRUE
return ..()
/obj/item/storage/pill_bottle/proc/update_name_label()
if(!label_text)

View File

@@ -17,7 +17,8 @@
var/icon_broken = "lockbox+b"
/obj/item/storage/lockbox/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/storage/lockbox/attackby(obj/item/W, mob/user)
if (istype(W, /obj/item/card/id))
if(src.broken)
to_chat(user, "<span class='warning'>It appears to be broken.</span>")
@@ -28,25 +29,26 @@
src.icon_state = src.icon_locked
to_chat(user, "<span class='notice'>You lock \the [src]!</span>")
close_all()
return
else
src.icon_state = src.icon_closed
to_chat(user, "<span class='notice'>You unlock \the [src]!</span>")
return
else
to_chat(user, "<span class='warning'>Access Denied</span>")
else if(istype(W, /obj/item/melee/energy/blade))
return TRUE
if(istype(W, /obj/item/melee/energy/blade))
if(emag_act(INFINITY, user, W, "The locker has been sliced open by [user] with an energy blade!", "You hear metal being sliced and sparks flying."))
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(5, 0, src.loc)
spark_system.start()
playsound(src, 'sound/weapons/blade1.ogg', 50, 1)
playsound(src, "sparks", 50, 1)
if(!locked)
..()
else
if(locked)
to_chat(user, "<span class='warning'>It's locked!</span>")
return
return TRUE
return ..()
/obj/item/storage/lockbox/show_to(mob/user as mob)

View File

@@ -33,7 +33,8 @@
if(Adjacent(user))
. += "The service panel is [src.open ? "open" : "closed"]."
/obj/item/storage/secure/attackby(obj/item/W as obj, mob/user as mob)
/obj/item/storage/secure/attackby(obj/item/W, mob/user)
if(locked)
if (istype(W, /obj/item/melee/energy/blade) && emag_act(INFINITY, user, "You slice through the lock of \the [src]"))
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread()
@@ -41,14 +42,15 @@
spark_system.start()
playsound(src, 'sound/weapons/blade1.ogg', 50, 1)
playsound(src, "sparks", 50, 1)
return
return TRUE
if (W.is_screwdriver())
if (do_after(user, 20 * W.toolspeed))
src.open =! src.open
playsound(src, W.usesound, 50, 1)
user.show_message(text("<span class='notice'>You [] the service panel.</span>", (src.open ? "open" : "close")))
return
return TRUE
if (istype(W, /obj/item/multitool) && (src.open == 1)&& (!src.l_hacking))
user.show_message("<span class='notice'>Now attempting to reset internal memory, please hold.</span>", 1)
src.l_hacking = 1
@@ -64,15 +66,15 @@
else
user.show_message("<span class='warning'>Unable to reset internal memory.</span>", 1)
src.l_hacking = 0
else src.l_hacking = 0
return
else
src.l_hacking = 0
return TRUE
//At this point you have exhausted all the special things to do when locked
// ... but it's still locked.
return
return TRUE
// -> storage/attackby() what with handle insertion, etc
..()
return ..()
/obj/item/storage/secure/MouseDrop(over_object, src_location, over_location)
if (locked)

View File

@@ -420,7 +420,7 @@
return 1
//This proc is called when you want to place an item into the storage item.
/obj/item/storage/attackby(obj/item/W as obj, mob/user as mob, silent)
/obj/item/storage/attackby(obj/item/W, mob/user, silent)
. = ..()
if(.)