Make more use of <tool>_act (#64375)

Replaces a bunch of tool behavior checks in attackby to instead use the respective procs.
For instance, the behavior under a if(I.tool_behaviour == TOOL_SCREWDRIVER) check in attackby() will instead be found under that same object's screwdriver_act() proc. This is the first of a few PRs that I'd like to make to address this, since there's going to be a lot of code shuffled around.

This shouldn't have any impact on players, though some super observant folks might notice that they don't bash some items with tools when they meant to interact with them. I've tested all of these in game and they seem to still have the same behavior as before.
This commit is contained in:
Luc
2022-01-25 10:17:30 -05:00
committed by GitHub
parent 4626105bf9
commit 4fd16bcbdb
29 changed files with 624 additions and 523 deletions
+34 -31
View File
@@ -45,6 +45,40 @@
active = FALSE
/obj/item/rcl/screwdriver_act(mob/living/user, obj/item/tool)
if(!loaded)
return FALSE
. = TRUE
if(ghetto && prob(10)) //Is it a ghetto RCL? If so, give it a 10% chance to fall apart
to_chat(user, span_warning("You attempt to loosen the securing screws on the side, but it falls apart!"))
while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89)
var/diff = loaded.amount % 30
if(diff)
loaded.use(diff)
new /obj/item/stack/pipe_cleaner_coil(get_turf(user), diff)
else
loaded.use(30)
new /obj/item/stack/pipe_cleaner_coil(get_turf(user), 30)
qdel(src)
return
tool.play_tool_sound(src)
to_chat(user, span_notice("You loosen the securing screws on the side, allowing you to lower the guiding edge and retrieve the wires."))
while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89)
var/diff = loaded.amount % 30
if(diff)
loaded.use(diff)
new /obj/item/stack/pipe_cleaner_coil(get_turf(user), diff)
else
loaded.use(30)
new /obj/item/stack/pipe_cleaner_coil(get_turf(user), 30)
loaded.max_amount = initial(loaded.max_amount)
if(!user.put_in_hands(loaded))
loaded.forceMove(get_turf(user))
loaded = null
update_appearance()
/obj/item/rcl/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/stack/pipe_cleaner_coil))
var/obj/item/stack/pipe_cleaner_coil/C = W
@@ -66,37 +100,6 @@
return
update_appearance()
to_chat(user, span_notice("You add the pipe cleaners to [src]. It now contains [loaded.amount]."))
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(!loaded)
return
if(ghetto && prob(10)) //Is it a ghetto RCL? If so, give it a 10% chance to fall apart
to_chat(user, span_warning("You attempt to loosen the securing screws on the side, but it falls apart!"))
while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89)
var/diff = loaded.amount % 30
if(diff)
loaded.use(diff)
new /obj/item/stack/pipe_cleaner_coil(get_turf(user), diff)
else
loaded.use(30)
new /obj/item/stack/pipe_cleaner_coil(get_turf(user), 30)
qdel(src)
return
to_chat(user, span_notice("You loosen the securing screws on the side, allowing you to lower the guiding edge and retrieve the wires."))
while(loaded.amount > 30) //There are only two kinds of situations: "nodiff" (60,90), or "diff" (31-59, 61-89)
var/diff = loaded.amount % 30
if(diff)
loaded.use(diff)
new /obj/item/stack/pipe_cleaner_coil(get_turf(user), diff)
else
loaded.use(30)
new /obj/item/stack/pipe_cleaner_coil(get_turf(user), 30)
loaded.max_amount = initial(loaded.max_amount)
if(!user.put_in_hands(loaded))
loaded.forceMove(get_turf(user))
loaded = null
update_appearance()
else
..()
+29 -32
View File
@@ -926,42 +926,39 @@ CIGARETTE PACKETS ARE IN FANCY.DM
user.visible_message(span_suicide("[user] is puffin hard on dat vape, [user.p_they()] trying to join the vape life on a whole notha plane!"))//it doesn't give you cancer, it is cancer
return (TOXLOSS|OXYLOSS)
/obj/item/clothing/mask/vape/attackby(obj/item/O, mob/user, params)
if(O.tool_behaviour == TOOL_SCREWDRIVER)
if(!screw)
screw = TRUE
to_chat(user, span_notice("You open the cap on [src]."))
reagents.flags |= OPENCONTAINER
if(obj_flags & EMAGGED)
add_overlay("vapeopen_high")
else if(super)
add_overlay("vapeopen_med")
else
add_overlay("vapeopen_low")
/obj/item/clothing/mask/vape/screwdriver_act(mob/living/user, obj/item/tool)
if(!screw)
screw = TRUE
to_chat(user, span_notice("You open the cap on [src]."))
reagents.flags |= OPENCONTAINER
if(obj_flags & EMAGGED)
add_overlay("vapeopen_high")
else if(super)
add_overlay("vapeopen_med")
else
screw = FALSE
to_chat(user, span_notice("You close the cap on [src]."))
reagents.flags &= ~(OPENCONTAINER)
add_overlay("vapeopen_low")
else
screw = FALSE
to_chat(user, span_notice("You close the cap on [src]."))
reagents.flags &= ~(OPENCONTAINER)
cut_overlays()
/obj/item/clothing/mask/vape/multitool_act(mob/living/user, obj/item/tool)
. = TRUE
if(screw && !(obj_flags & EMAGGED))//also kinky
if(!super)
cut_overlays()
if(O.tool_behaviour == TOOL_MULTITOOL)
if(screw && !(obj_flags & EMAGGED))//also kinky
if(!super)
cut_overlays()
super = TRUE
to_chat(user, span_notice("You increase the voltage of [src]."))
add_overlay("vapeopen_med")
else
cut_overlays()
super = FALSE
to_chat(user, span_notice("You decrease the voltage of [src]."))
add_overlay("vapeopen_low")
if(screw && (obj_flags & EMAGGED))
to_chat(user, span_warning("[src] can't be modified!"))
super = TRUE
to_chat(user, span_notice("You increase the voltage of [src]."))
add_overlay("vapeopen_med")
else
..()
cut_overlays()
super = FALSE
to_chat(user, span_notice("You decrease the voltage of [src]."))
add_overlay("vapeopen_low")
if(screw && (obj_flags & EMAGGED))
to_chat(user, span_warning("[src] can't be modified!"))
/obj/item/clothing/mask/vape/emag_act(mob/user)// I WON'T REGRET WRITTING THIS, SURLY.
if(screw)
+9 -7
View File
@@ -132,6 +132,15 @@
var/atom/movable/screen/inventory/hand/H = over_object
M.putItemFromInventoryInHandIfPossible(src, H.held_index)
/obj/item/defibrillator/screwdriver_act(mob/living/user, obj/item/tool)
if(cell)
cell.update_appearance()
cell.forceMove(get_turf(src))
cell = null
tool.play_tool_sound(src, 50)
to_chat(user, span_notice("You remove the cell from [src]."))
update_power()
/obj/item/defibrillator/attackby(obj/item/W, mob/user, params)
if(W == paddles)
toggle_paddles()
@@ -148,13 +157,6 @@
cell = W
to_chat(user, span_notice("You install a cell in [src]."))
update_power()
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(cell)
cell.update_appearance()
cell.forceMove(get_turf(src))
cell = null
to_chat(user, span_notice("You remove the cell from [src]."))
update_power()
else
return ..()
@@ -39,6 +39,14 @@
. = ..()
diode = new /obj/item/stock_parts/micro_laser/ultra
/obj/item/laser_pointer/screwdriver_act(mob/living/user, obj/item/tool)
if(diode)
tool.play_tool_sound(src)
to_chat(user, span_notice("You remove the [diode.name] from \the [src]."))
diode.forceMove(drop_location())
diode = null
return TRUE
/obj/item/laser_pointer/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stock_parts/micro_laser))
if(!diode)
@@ -48,12 +56,6 @@
to_chat(user, span_notice("You install a [diode.name] in [src]."))
else
to_chat(user, span_warning("[src] already has a diode installed!"))
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(diode)
to_chat(user, span_notice("You remove the [diode.name] from \the [src]."))
diode.forceMove(drop_location())
diode = null
else
return ..()
+25 -26
View File
@@ -74,35 +74,34 @@
update_appearance()
set_light(0)
/obj/item/powersink/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_WRENCH)
if(mode == DISCONNECTED)
var/turf/T = loc
if(isturf(T) && T.underfloor_accessibility >= UNDERFLOOR_INTERACTABLE)
attached = locate() in T
if(!attached)
to_chat(user, span_warning("\The [src] must be placed over an exposed, powered cable node!"))
else
set_mode(CLAMPED_OFF)
user.visible_message( \
"[user] attaches \the [src] to the cable.", \
span_notice("You bolt \the [src] into the floor and connect it to the cable."),
span_hear("You hear some wires being connected to something."))
else
/obj/item/powersink/wrench_act(mob/living/user, obj/item/tool)
. = TRUE
if(mode == DISCONNECTED)
var/turf/T = loc
if(isturf(T) && T.underfloor_accessibility >= UNDERFLOOR_INTERACTABLE)
attached = locate() in T
if(!attached)
to_chat(user, span_warning("\The [src] must be placed over an exposed, powered cable node!"))
else
set_mode(CLAMPED_OFF)
user.visible_message( \
"[user] attaches \the [src] to the cable.", \
span_notice("You bolt \the [src] into the floor and connect it to the cable."),
span_hear("You hear some wires being connected to something."))
else
set_mode(DISCONNECTED)
user.visible_message( \
"[user] detaches \the [src] from the cable.", \
span_notice("You unbolt \the [src] from the floor and detach it from the cable."),
span_hear("You hear some wires being disconnected from something."))
else if(I.tool_behaviour == TOOL_SCREWDRIVER)
user.visible_message( \
"[user] messes with \the [src] for a bit.", \
span_notice("You can't fit the screwdriver into \the [src]'s bolts! Try using a wrench."))
to_chat(user, span_warning("\The [src] must be placed over an exposed, powered cable node!"))
else
return ..()
set_mode(DISCONNECTED)
user.visible_message( \
"[user] detaches \the [src] from the cable.", \
span_notice("You unbolt \the [src] from the floor and detach it from the cable."),
span_hear("You hear some wires being disconnected from something."))
/obj/item/powersink/screwdriver_act(mob/living/user, obj/item/tool)
user.visible_message( \
"[user] messes with \the [src] for a bit.", \
span_notice("You can't fit the screwdriver into \the [src]'s bolts! Try using a wrench."))
return TRUE
/obj/item/powersink/attack_paw(mob/user, list/modifiers)
return
@@ -286,29 +286,32 @@ GLOBAL_LIST_INIT(channel_tokens, list(
keyslot2 = new /obj/item/encryptionkey/ai
command = TRUE
/obj/item/radio/headset/screwdriver_act(mob/living/user, obj/item/tool)
user.set_machine(src)
if(keyslot || keyslot2)
for(var/ch_name in channels)
SSradio.remove_object(src, GLOB.radiochannels[ch_name])
secure_radio_connections[ch_name] = null
if(keyslot)
user.put_in_hands(keyslot)
keyslot = null
if(keyslot2)
user.put_in_hands(keyslot2)
keyslot2 = null
recalculateChannels()
to_chat(user, span_notice("You pop out the encryption keys in the headset."))
else
to_chat(user, span_warning("This headset doesn't have any unique encryption keys! How useless..."))
tool.play_tool_sound(src, 10)
return TRUE
/obj/item/radio/headset/attackby(obj/item/W, mob/user, params)
user.set_machine(src)
if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(keyslot || keyslot2)
for(var/ch_name in channels)
SSradio.remove_object(src, GLOB.radiochannels[ch_name])
secure_radio_connections[ch_name] = null
if(keyslot)
user.put_in_hands(keyslot)
keyslot = null
if(keyslot2)
user.put_in_hands(keyslot2)
keyslot2 = null
recalculateChannels()
to_chat(user, span_notice("You pop out the encryption keys in the headset."))
else
to_chat(user, span_warning("This headset doesn't have any unique encryption keys! How useless..."))
else if(istype(W, /obj/item/encryptionkey))
if(istype(W, /obj/item/encryptionkey))
if(keyslot && keyslot2)
to_chat(user, span_warning("The headset can't hold another key!"))
return
@@ -31,32 +31,31 @@
else
. += span_notice("It's <i>unscrewed</i> from the wall, and can be <b>detached</b>.")
/obj/item/radio/intercom/attackby(obj/item/I, mob/living/user, params)
if(I.tool_behaviour == TOOL_SCREWDRIVER)
if(unscrewed)
user.visible_message(span_notice("[user] starts tightening [src]'s screws..."), span_notice("You start screwing in [src]..."))
if(I.use_tool(src, user, 30, volume=50))
user.visible_message(span_notice("[user] tightens [src]'s screws!"), span_notice("You tighten [src]'s screws."))
unscrewed = FALSE
else
user.visible_message(span_notice("[user] starts loosening [src]'s screws..."), span_notice("You start unscrewing [src]..."))
if(I.use_tool(src, user, 40, volume=50))
user.visible_message(span_notice("[user] loosens [src]'s screws!"), span_notice("You unscrew [src], loosening it from the wall."))
unscrewed = TRUE
/obj/item/radio/intercom/screwdriver_act(mob/living/user, obj/item/tool)
if(unscrewed)
user.visible_message(span_notice("[user] starts tightening [src]'s screws..."), span_notice("You start screwing in [src]..."))
if(tool.use_tool(src, user, 30, volume=50))
user.visible_message(span_notice("[user] tightens [src]'s screws!"), span_notice("You tighten [src]'s screws."))
unscrewed = FALSE
else
user.visible_message(span_notice("[user] starts loosening [src]'s screws..."), span_notice("You start unscrewing [src]..."))
if(tool.use_tool(src, user, 40, volume=50))
user.visible_message(span_notice("[user] loosens [src]'s screws!"), span_notice("You unscrew [src], loosening it from the wall."))
unscrewed = TRUE
return TRUE
/obj/item/radio/intercom/wrench_act(mob/living/user, obj/item/tool)
. = TRUE
if(!unscrewed)
to_chat(user, span_warning("You need to unscrew [src] from the wall first!"))
return
else if(I.tool_behaviour == TOOL_WRENCH)
if(!unscrewed)
to_chat(user, span_warning("You need to unscrew [src] from the wall first!"))
return
user.visible_message(span_notice("[user] starts unsecuring [src]..."), span_notice("You start unsecuring [src]..."))
I.play_tool_sound(src)
if(I.use_tool(src, user, 80))
user.visible_message(span_notice("[user] unsecures [src]!"), span_notice("You detach [src] from the wall."))
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
new/obj/item/wallframe/intercom(get_turf(src))
qdel(src)
return
return ..()
user.visible_message(span_notice("[user] starts unsecuring [src]..."), span_notice("You start unsecuring [src]..."))
tool.play_tool_sound(src)
if(tool.use_tool(src, user, 80))
user.visible_message(span_notice("[user] unsecures [src]!"), span_notice("You detach [src] from the wall."))
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
new/obj/item/wallframe/intercom(get_turf(src))
qdel(src)
/**
* Override attack_tk_grab instead of attack_tk because we actually want attack_tk's
@@ -422,12 +422,13 @@
else if(icon_state == "[initial_icon_state]_reverse") //so flipping doesn't overwrite an unexpected icon_state (e.g. an admin's)
icon_state = initial_icon_state
/obj/item/tape/attackby(obj/item/I, mob/user, params)
if(unspooled && (I.tool_behaviour == TOOL_SCREWDRIVER))
to_chat(user, span_notice("You start winding the tape back in..."))
if(I.use_tool(src, user, 120))
to_chat(user, span_notice("You wind the tape back in."))
respool()
/obj/item/tape/screwdriver_act(mob/living/user, obj/item/tool)
if(!unspooled)
return FALSE
to_chat(user, span_notice("You start winding the tape back in..."))
if(tool.use_tool(src, user, 120))
to_chat(user, span_notice("You wind the tape back in."))
respool()
//Random colour tapes
/obj/item/tape/random
+23 -18
View File
@@ -87,29 +87,34 @@
log_combat(user, target, "flamethrowered", src)
flame_turf(turflist)
/obj/item/flamethrower/attackby(obj/item/W, mob/user, params)
if(W.tool_behaviour == TOOL_WRENCH && !status)//Taking this apart
var/turf/T = get_turf(src)
if(weldtool)
weldtool.forceMove(T)
weldtool = null
if(igniter)
igniter.forceMove(T)
igniter = null
if(ptank)
ptank.forceMove(T)
ptank = null
new /obj/item/stack/rods(T)
qdel(src)
return
/obj/item/flamethrower/wrench_act(mob/living/user, obj/item/tool)
. = TRUE
if(status)
return FALSE
tool.play_tool_sound(src)
var/turf/T = get_turf(src)
if(weldtool)
weldtool.forceMove(T)
weldtool = null
if(igniter)
igniter.forceMove(T)
igniter = null
if(ptank)
ptank.forceMove(T)
ptank = null
new /obj/item/stack/rods(T)
qdel(src)
else if(W.tool_behaviour == TOOL_SCREWDRIVER && igniter && !lit)
/obj/item/flamethrower/screwdriver_act(mob/living/user, obj/item/tool)
if(igniter && !lit)
tool.play_tool_sound(src)
status = !status
to_chat(user, span_notice("[igniter] is now [status ? "secured" : "unsecured"]!"))
update_appearance()
return
return TRUE
else if(isigniter(W))
/obj/item/flamethrower/attackby(obj/item/W, mob/user, params)
if(isigniter(W))
var/obj/item/assembly/igniter/I = W
if(I.secured)
return
@@ -99,26 +99,56 @@
if(stage == GRENADE_WIRED)
wires.interact(user)
/obj/item/grenade/chem_grenade/screwdriver_act(mob/living/user, obj/item/tool)
. = TRUE
if(stage == GRENADE_WIRED)
if(beakers.len)
stage_change(GRENADE_READY)
to_chat(user, span_notice("You lock the [initial(name)] assembly."))
tool.play_tool_sound(src, 25)
else
to_chat(user, span_warning("You need to add at least one beaker before locking the [initial(name)] assembly!"))
else if(stage == GRENADE_READY)
det_time = det_time == 50 ? 30 : 50 //toggle between 30 and 50
if(landminemode)
landminemode.time = det_time * 0.1 //overwrites the proxy sensor activation timer
tool.play_tool_sound(src, 25)
to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)]."))
else
to_chat(user, span_warning("You need to add a wire!"))
return TRUE
/obj/item/grenade/chem_grenade/wirecutter_act(mob/living/user, obj/item/tool)
if(stage == GRENADE_READY && !active)
tool.play_tool_sound(src)
stage_change(GRENADE_WIRED)
to_chat(user, span_notice("You unlock the [initial(name)] assembly."))
return TRUE
/obj/item/grenade/chem_grenade/wrench_act(mob/living/user, obj/item/tool)
if(stage != GRENADE_WIRED)
return FALSE
if(beakers.len)
for(var/obj/beaker in beakers)
beaker.forceMove(drop_location())
if(!beaker.reagents)
continue
var/reagent_list = pretty_string_from_reagent_list(beaker.reagents)
user.log_message("removed [beaker] ([reagent_list]) from [src]", LOG_GAME)
beakers = list()
to_chat(user, span_notice("You open the [initial(name)] assembly and remove the payload."))
return
tool.play_tool_sound(src)
wires.detach_assembly(wires.get_wire(1))
new /obj/item/stack/cable_coil(get_turf(src), 1)
stage_change(GRENADE_EMPTY)
to_chat(user, span_notice("You remove the activation mechanism from the [initial(name)] assembly."))
/obj/item/grenade/chem_grenade/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/assembly) && stage == GRENADE_WIRED)
wires.interact(user)
if(item.tool_behaviour == TOOL_SCREWDRIVER)
if(stage == GRENADE_WIRED)
if(beakers.len)
stage_change(GRENADE_READY)
to_chat(user, span_notice("You lock the [initial(name)] assembly."))
item.play_tool_sound(src, 25)
else
to_chat(user, span_warning("You need to add at least one beaker before locking the [initial(name)] assembly!"))
else if(stage == GRENADE_READY)
det_time = det_time == 50 ? 30 : 50 //toggle between 30 and 50
if(landminemode)
landminemode.time = det_time * 0.1 //overwrites the proxy sensor activation timer
to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)]."))
else
to_chat(user, span_warning("You need to add a wire!"))
return
else if(stage == GRENADE_WIRED && is_type_in_list(item, allowed_containers))
. = TRUE //no afterattack
if(is_type_in_list(item, banned_containers))
@@ -147,26 +177,6 @@
else
to_chat(user, span_warning("You need one length of coil to wire the assembly!"))
return
else if(stage == GRENADE_READY && item.tool_behaviour == TOOL_WIRECUTTER && !active)
stage_change(GRENADE_WIRED)
to_chat(user, span_notice("You unlock the [initial(name)] assembly."))
else if(stage == GRENADE_WIRED && item.tool_behaviour == TOOL_WRENCH)
if(beakers.len)
for(var/obj/beaker in beakers)
beaker.forceMove(drop_location())
if(!beaker.reagents)
continue
var/reagent_list = pretty_string_from_reagent_list(beaker.reagents)
user.log_message("removed [beaker] ([reagent_list]) from [src]", LOG_GAME)
beakers = list()
to_chat(user, span_notice("You open the [initial(name)] assembly and remove the payload."))
return
wires.detach_assembly(wires.get_wire(1))
new /obj/item/stack/cable_coil(get_turf(src), 1)
stage_change(GRENADE_EMPTY)
to_chat(user, span_notice("You remove the activation mechanism from the [initial(name)] assembly."))
else
return ..()
+23 -17
View File
@@ -144,26 +144,32 @@
var/mob/mob = loc
mob.dropItemToGround(src)
/obj/item/grenade/attackby(obj/item/weapon, mob/user, params)
/obj/item/grenade/screwdriver_act(mob/living/user, obj/item/tool)
if(active)
return ..()
return FALSE
if(change_det_time())
tool.play_tool_sound(src)
to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)]."))
return TRUE
if(weapon.tool_behaviour == TOOL_MULTITOOL)
var/newtime = tgui_input_list(user, "Please enter a new detonation time", "Detonation Timer", list("Instant", 3, 4, 5))
if (isnull(newtime))
return
if(!user.canUseTopic(src, BE_CLOSE))
return
if(newtime == "Instant" && change_det_time(0))
to_chat(user, span_notice("You modify the time delay. It's set to be instantaneous."))
return
newtime = round(newtime)
if(change_det_time(newtime))
to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)]."))
/obj/item/grenade/multitool_act(mob/living/user, obj/item/tool)
. = ..()
if(active)
return FALSE
. = TRUE
var/newtime = tgui_input_list(user, "Please enter a new detonation time", "Detonation Timer", list("Instant", 3, 4, 5))
if (isnull(newtime))
return
else if(weapon.tool_behaviour == TOOL_SCREWDRIVER)
if(change_det_time())
to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)]."))
if(!user.canUseTopic(src, BE_CLOSE))
return
if(newtime == "Instant" && change_det_time(0))
to_chat(user, span_notice("You modify the time delay. It's set to be instantaneous."))
return
newtime = round(newtime)
if(change_det_time(newtime))
to_chat(user, span_notice("You modify the time delay. It's set for [DisplayTimeText(det_time)]."))
/obj/item/grenade/proc/change_det_time(time) //Time uses real time.
. = TRUE
+5 -3
View File
@@ -34,10 +34,12 @@
target = null
return ..()
/obj/item/grenade/c4/screwdriver_act(mob/living/user, obj/item/tool)
to_chat(user, span_notice("The wire panel can be accessed without a screwdriver."))
return TRUE
/obj/item/grenade/c4/attackby(obj/item/item, mob/user, params)
if(item.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, span_notice("The wire panel can be accessed without a screwdriver."))
else if(is_wire_tool(item))
if(is_wire_tool(item))
wires.interact(user)
else
return ..()
+13 -12
View File
@@ -59,20 +59,21 @@
return TRUE
return FALSE
/obj/item/inducer/screwdriver_act(mob/living/user, obj/item/tool)
. = TRUE
tool.play_tool_sound(src)
if(!opened)
to_chat(user, span_notice("You unscrew the battery compartment."))
opened = TRUE
update_appearance()
return
else
to_chat(user, span_notice("You close the battery compartment."))
opened = FALSE
update_appearance()
return
/obj/item/inducer/attackby(obj/item/W, mob/user)
if(W.tool_behaviour == TOOL_SCREWDRIVER)
W.play_tool_sound(src)
if(!opened)
to_chat(user, span_notice("You unscrew the battery compartment."))
opened = TRUE
update_appearance()
return
else
to_chat(user, span_notice("You close the battery compartment."))
opened = FALSE
update_appearance()
return
if(istype(W, /obj/item/stock_parts/cell))
if(opened)
if(!cell)
+7 -3
View File
@@ -427,6 +427,11 @@
else
. += span_warning("\The [src] does not have a power source installed.")
/obj/item/melee/baton/security/screwdriver_act(mob/living/user, obj/item/tool)
if(tryremovecell(user))
tool.play_tool_sound(src)
return TRUE
/obj/item/melee/baton/security/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/stock_parts/cell))
var/obj/item/stock_parts/cell/active_cell = item
@@ -441,9 +446,6 @@
cell = item
to_chat(user, span_notice("You install a cell in [src]."))
update_appearance()
else if(item.tool_behaviour == TOOL_SCREWDRIVER)
tryremovecell(user)
else
return ..()
@@ -451,6 +453,8 @@
if(cell && can_remove_cell)
cell.forceMove(drop_location())
to_chat(user, span_notice("You remove the cell from [src]."))
return TRUE
return FALSE
/obj/item/melee/baton/security/attack_self(mob/user)
if(cell?.charge >= cell_hit_cost)
+18 -3
View File
@@ -70,6 +70,24 @@
out += span_notice("[icon2html(tank, user)] It has \a [tank] mounted onto it.")
. += out.Join("\n")
/obj/item/pneumatic_cannon/screwdriver_act(mob/living/user, obj/item/tool)
if(tank)
tool.play_tool_sound(src)
updateTank(tank, 1, user)
return TRUE
/obj/item/pneumatic_cannon/wrench_act(mob/living/user, obj/item/tool)
playsound(src, 'sound/items/ratchet.ogg', 50, TRUE)
switch(pressureSetting)
if(1)
pressureSetting = 2
if(2)
pressureSetting = 3
if(3)
pressureSetting = 1
to_chat(user, span_notice("You tweak \the [src]'s pressure output to [pressureSetting]."))
return TRUE
/obj/item/pneumatic_cannon/attackby(obj/item/W, mob/living/user, params)
if(user.combat_mode)
return ..()
@@ -92,9 +110,6 @@
if(3)
pressureSetting = 1
to_chat(user, span_notice("You tweak \the [src]'s pressure output to [pressureSetting]."))
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(tank)
updateTank(tank, 1, user)
else if(loadedWeightClass >= maxWeightClass)
to_chat(user, span_warning("\The [src] can't hold any more items!"))
else if(isitem(W))
+16 -13
View File
@@ -28,6 +28,22 @@
if(tank)
. += span_notice("[icon2html(tank, user)] It has \a [tank] mounted onto it.")
/obj/item/melee/powerfist/wrench_act(mob/living/user, obj/item/tool)
switch(fisto_setting)
if(1)
fisto_setting = 2
if(2)
fisto_setting = 3
if(3)
fisto_setting = 1
tool.play_tool_sound(src)
to_chat(user, span_notice("You tweak \the [src]'s piston valve to [fisto_setting]."))
return TRUE
/obj/item/melee/powerfist/screwdriver_act(mob/living/user, obj/item/tool)
if(tank)
updateTank(tank, 1, user)
return TRUE
/obj/item/melee/powerfist/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/tank/internals))
@@ -37,19 +53,6 @@
to_chat(user, span_warning("\The [IT] is too small for \the [src]."))
return
updateTank(W, 0, user)
else if(W.tool_behaviour == TOOL_WRENCH)
switch(fisto_setting)
if(1)
fisto_setting = 2
if(2)
fisto_setting = 3
if(3)
fisto_setting = 1
W.play_tool_sound(src)
to_chat(user, span_notice("You tweak \the [src]'s piston valve to [fisto_setting]."))
else if(W.tool_behaviour == TOOL_SCREWDRIVER)
if(tank)
updateTank(tank, 1, user)
/obj/item/melee/powerfist/proc/updateTank(obj/item/tank/internals/thetank, removing = 0, mob/living/carbon/human/user)
if(removing)
+28 -25
View File
@@ -44,35 +44,38 @@
if(can_hack_open)
. += "The service panel is currently <b>[panel_open ? "unscrewed" : "screwed shut"]</b>."
/obj/item/storage/secure/attackby(obj/item/weapon, mob/user, params)
/obj/item/storage/secure/tool_act(mob/living/user, obj/item/tool)
if(can_hack_open && SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED))
if (weapon.tool_behaviour == TOOL_SCREWDRIVER)
if (weapon.use_tool(src, user, 20))
panel_open = !panel_open
to_chat(user, span_notice("You [panel_open ? "open" : "close"] the service panel."))
return
if (weapon.tool_behaviour == TOOL_WIRECUTTER)
to_chat(user, span_danger("[src] is protected from this sort of tampering, yet it appears the internal memory wires can still be <b>pulsed</b>."))
return
if (weapon.tool_behaviour == TOOL_MULTITOOL)
if(lock_hacking)
to_chat(user, span_danger("This safe is already being hacked."))
return
if(panel_open == TRUE)
to_chat(user, span_danger("Now attempting to reset internal memory, please hold."))
lock_hacking = TRUE
if (weapon.use_tool(src, user, 400))
to_chat(user, span_danger("Internal memory reset - lock has been disengaged."))
lock_set = FALSE
return ..()
else
return FALSE
lock_hacking = FALSE
return
/obj/item/storage/secure/wirecutter_act(mob/living/user, obj/item/tool)
to_chat(user, span_danger("[src] is protected from this sort of tampering, yet it appears the internal memory wires can still be <b>pulsed</b>."))
return
to_chat(user, span_warning("You must <b>unscrew</b> the service panel before you can pulse the wiring!"))
return
/obj/item/storage/secure/screwdriver_act(mob/living/user, obj/item/tool)
if(tool.use_tool(src, user, 20))
panel_open = !panel_open
to_chat(user, span_notice("You [panel_open ? "open" : "close"] the service panel."))
return TRUE
// -> storage/attackby() what with handle insertion, etc
return ..()
/obj/item/storage/secure/multitool_act(mob/living/user, obj/item/tool)
. = TRUE
if(lock_hacking)
to_chat(user, span_danger("This safe is already being hacked."))
return
if(panel_open == TRUE)
to_chat(user, span_danger("Now attempting to reset internal memory, please hold."))
lock_hacking = TRUE
if (tool.use_tool(src, user, 400))
to_chat(user, span_danger("Internal memory reset - lock has been disengaged."))
lock_set = FALSE
lock_hacking = FALSE
return
to_chat(user, span_warning("You must <b>unscrew</b> the service panel before you can pulse the wiring!"))
/obj/item/storage/secure/attack_self(mob/user)
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)