Pin removal recipe turned into proper tool_act. Has examine message informing you that you can do the thing. Now plays proper tool sounds. (#48461)

* Pin removal recipe turned into proper tool_act. Has examine message informing you that you can do the thing. Now plays proper tool sounds.

* fixed message
This commit is contained in:
ShizCalev
2019-12-31 09:18:33 -05:00
committed by Emmett Gaines
parent 0cade3dd7c
commit 9f532650b3
2 changed files with 52 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
#define DUALWIELD_PENALTY_EXTRA_MULTIPLIER 1.4
#define FIRING_PIN_REMOVAL_DELAY 50
/obj/item/gun
name = "gun"
@@ -107,19 +108,11 @@
clear_gunlight()
return ..()
/obj/item/gun/CheckParts(list/parts_list)
..()
var/obj/item/gun/G = locate(/obj/item/gun) in contents
if(G)
G.forceMove(loc)
QDEL_NULL(G.pin)
visible_message("<span class='notice'>[G] can now fit a new pin, but the old one was destroyed in the process.</span>", null, null, 3)
qdel(src)
/obj/item/gun/examine(mob/user)
. = ..()
if(pin)
. += "It has \a [pin] installed."
. += "<span class='info'>[pin] looks like it could be removed with some <b>tools</b>.</span>"
else
. += "It doesn't have a <b>firing pin</b> installed, and won't fire."
@@ -224,7 +217,7 @@
var/obj/item/bodypart/other_hand = user.has_hand_for_held_index(user.get_inactive_hand_index()) //returns non-disabled inactive hands
if(weapon_weight == WEAPON_HEAVY && (user.get_inactive_held_item() || !other_hand))
to_chat(user, "<span class='warning'>You need two hands to fire \the [src]!</span>")
to_chat(user, "<span class='warning'>You need two hands to fire [src]!</span>")
return
//DUAL (or more!) WIELDING
var/bonus_spread = 0
@@ -437,6 +430,52 @@
else if(bayonet && can_bayonet) //if it has a bayonet, and the bayonet can be removed
return remove_gun_attachment(user, I, bayonet, "unfix")
else if(pin && user.is_holding(src))
user.visible_message("<span class='warning'>[user] attempts to remove [pin] from [src] with [I].</span>",
"<span class='notice'>You attempt to remove [pin] from [src]. (It will take [DisplayTimeText(FIRING_PIN_REMOVAL_DELAY)].)</span>", null, 3)
if(I.use_tool(src, user, FIRING_PIN_REMOVAL_DELAY, volume = 50))
if(!pin) //check to see if the pin is still there, or we can spam messages by clicking multiple times during the tool delay
return
user.visible_message("<span class='notice'>[pin] was pried out of [src] by [user], destroying the pin in the process.</span>",
"<span class='warning'>You pried [pin] out with [I], destroying the pin in the process.</span>", null, 3)
QDEL_NULL(pin)
return TRUE
/obj/item/gun/welder_act(mob/living/user, obj/item/I)
. = ..()
if(.)
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
if(pin && user.is_holding(src))
user.visible_message("<span class='warning'>[user] attempts to remove [pin] from [src] with [I].</span>",
"<span class='notice'>You attempt to remove [pin] from [src]. (It will take [DisplayTimeText(FIRING_PIN_REMOVAL_DELAY)].)</span>", null, 3)
if(I.use_tool(src, user, FIRING_PIN_REMOVAL_DELAY, 5, volume = 50))
if(!pin) //check to see if the pin is still there, or we can spam messages by clicking multiple times during the tool delay
return
user.visible_message("<span class='notice'>[pin] was spliced out of [src] by [user], melting part of the pin in the process.</span>",
"<span class='warning'>You spliced [pin] out of [src] with [I], melting part of the pin in the process.</span>", null, 3)
QDEL_NULL(pin)
return TRUE
/obj/item/gun/wirecutter_act(mob/living/user, obj/item/I)
. = ..()
if(.)
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
if(pin && user.is_holding(src))
user.visible_message("<span class='warning'>[user] attempts to remove [pin] from [src] with [I].</span>",
"<span class='notice'>You attempt to remove [pin] from [src]. (It will take [DisplayTimeText(FIRING_PIN_REMOVAL_DELAY)].)</span>", null, 3)
if(I.use_tool(src, user, FIRING_PIN_REMOVAL_DELAY, volume = 50))
if(!pin) //check to see if the pin is still there, or we can spam messages by clicking multiple times during the tool delay
return
user.visible_message("<span class='notice'>[pin] was ripped out of [src] by [user], mangling the pin in the process.</span>",
"<span class='warning'>You ripped [pin] out of [src] with [I], mangling the pin in the process.</span>", null, 3)
QDEL_NULL(pin)
return TRUE
/obj/item/gun/proc/remove_gun_attachment(mob/living/user, obj/item/tool_item, obj/item/item_to_remove, removal_verb)
if(tool_item)
tool_item.play_tool_sound(src)
@@ -629,3 +668,6 @@
if(zoomable)
azoom = new()
azoom.gun = src
#undef FIRING_PIN_REMOVAL_DELAY
#undef DUALWIELD_PENALTY_EXTRA_MULTIPLIER