Moves most screwdriver checks to screwdriver_act (#19024)

* screwdriver_act my beloved

* convert to returns instead of . / lewcc review

* it will be done

* i'm a little bit stupid, but now time to test

* sometimes I get excited and press the commit

* The great test has been completed

* oh wow oh wow, lewc review

* found one last one

* Steel review

* Lewc review

* quick sirryan review

* removes stupid comments (old coders I blame)

* sirryan review two

* whoops...

* hal review

* the fix to the fix to the fix

* Revert "the fix to the fix to the fix"

FUCK I pushed to the wrong branch
This reverts commit a96fe98781.
This commit is contained in:
Contrabang
2022-10-06 09:30:33 +01:00
committed by GitHub
parent 6933ed99fd
commit 8418997ed8
39 changed files with 572 additions and 468 deletions
+11 -7
View File
@@ -33,13 +33,6 @@
/obj/item/flash/attackby(obj/item/I, mob/user, params)
if(can_overcharge)
if(istype(I, /obj/item/screwdriver))
if(battery_panel)
to_chat(user, "<span class='notice'>You close the battery compartment on [src].</span>")
battery_panel = FALSE
else
to_chat(user, "<span class='notice'>You open the battery compartment on [src].</span>")
battery_panel = TRUE
if(battery_panel && !overcharged)
if(istype(I, /obj/item/stock_parts/cell))
to_chat(user, "<span class='notice'>You jam [I] into the battery compartment on [src].</span>")
@@ -47,6 +40,17 @@
overcharged = TRUE
add_overlay("overcharge")
/obj/item/flash/screwdriver_act(mob/living/user, obj/item/I)
if(!can_overcharge)
return
if(battery_panel)
to_chat(user, "<span class='notice'>You close the battery compartment on [src].</span>")
else
to_chat(user, "<span class='notice'>You open the battery compartment on [src].</span>")
battery_panel = !battery_panel
return TRUE
/obj/item/flash/random/New()
..()
if(prob(25))
@@ -56,14 +56,14 @@
else
to_chat(user, "<span class='notice'>[src] already has a cell.</span>")
else if(istype(W, /obj/item/screwdriver))
if(diode)
to_chat(user, "<span class='notice'>You remove [diode] from [src].</span>")
diode.loc = get_turf(src.loc)
diode = null
return
..()
return
/obj/item/laser_pointer/screwdriver_act(mob/living/user, obj/item/I)
if(!diode)
return
to_chat(user, "<span class='notice'>You remove [diode] from [src].</span>")
diode.forceMove(get_turf(loc))
diode = null
return TRUE
/obj/item/laser_pointer/afterattack(atom/target, mob/living/user, flag, params)
if(flag) //we're placing the object on a table or in backpack
+12 -7
View File
@@ -98,16 +98,21 @@
cell = W
to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
if(istype(W, /obj/item/screwdriver))
if(cell)
cell.update_icon()
cell.loc = get_turf(loc)
cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
update_icon(UPDATE_OVERLAYS)
return
/obj/item/defibrillator/screwdriver_act(mob/living/user, obj/item/I)
if(!cell)
to_chat(user, "<span class='notice'>[src] doesn't have a cell.</span>")
return
cell.update_icon()
cell.forceMove(get_turf(loc))
cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
update_icon(UPDATE_OVERLAYS)
return TRUE
/obj/item/defibrillator/emag_act(user as mob)
if(safety)
safety = FALSE
@@ -25,8 +25,6 @@
for(var/j = 1, j <= rand(1, 3), j++)
step(x, pick(NORTH,SOUTH,EAST,WEST))
qdel(src)
return
@@ -34,26 +32,38 @@
name = "bananium casing"
desc = "A grenade casing made of bananium."
icon_state = "banana_casing"
var/fillamt = 0
deliveryamt = 0
/obj/item/grenade/bananade/casing/attack_hand()
return // No activating an empty grenade
/obj/item/grenade/bananade/casing/attackby(obj/item/I, mob/user as mob, params)
/obj/item/grenade/bananade/casing/attack_self()
return // Stop trying to break stuff
/obj/item/grenade/bananade/casing/prime()
return // The grenade isnt completed yet, dont even try to blow it up
/obj/item/grenade/bananade/casing/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/grown/bananapeel))
if(fillamt < 9)
to_chat(usr, "<span class='notice'>You add another banana peel to the assembly.</span>")
fillamt += 1
if(deliveryamt < 9)
to_chat(user, "<span class='notice'>You add another banana peel to the assembly.</span>")
deliveryamt += 1
qdel(I)
else
to_chat(usr, "<span class='notice'>The bananade is full, screwdriver it shut to lock it down.</span>")
if(istype(I, /obj/item/screwdriver))
if(fillamt)
var/obj/item/grenade/bananade/G = new /obj/item/grenade/bananade
user.unEquip(src)
user.put_in_hands(G)
G.deliveryamt = src.fillamt
to_chat(user, "<span class='notice'>You lock the assembly shut, readying it for HONK.</span>")
qdel(src)
else
to_chat(usr, "<span class='notice'>You need to add banana peels before you can ready the grenade!.</span>")
else
to_chat(usr, "<span class='notice'>Only banana peels fit in this assembly, up to 9.</span>")
to_chat(user, "<span class='notice'>The bananade is full, screwdriver it shut to ready it.</span>")
return
return ..()
/obj/item/grenade/bananade/casing/screwdriver_act(mob/living/user, obj/item/I)
if(!deliveryamt)
to_chat(user, "<span class='notice'>You need to add banana peels before you can ready the grenade!</span>")
return TRUE
var/obj/item/grenade/bananade/G = new /obj/item/grenade/bananade
user.unEquip(src)
user.put_in_hands(G)
G.deliveryamt = deliveryamt
to_chat(user, "<span class='notice'>You lock the assembly shut, readying it for HONK.</span>")
qdel(src)
return TRUE
@@ -78,7 +78,7 @@
else
icon_state += "_locked"
name = payload_name + "grenade" + label
underlays.Cut()
if(nadeassembly)
underlays += "[nadeassembly.a_left.icon_state]_left"
@@ -133,38 +133,6 @@
update_icon(UPDATE_ICON_STATE)
to_chat(user, "You remove the label from [src].")
return 1
if(istype(I, /obj/item/screwdriver))
if(stage == WIRED)
if(beakers.len)
to_chat(user, "<span class='notice'>You lock the assembly.</span>")
playsound(loc, prime_sound, 25, -3)
stage = READY
update_icon(UPDATE_ICON_STATE)
contained = ""
cores = "" // clear them out so no recursive logging by accidentally
for(var/obj/O in beakers)
if(!O.reagents) continue
if(istype(O,/obj/item/slime_extract))
cores += " [O]"
for(var/R in O.reagents.reagent_list)
var/datum/reagent/reagent = R
contained += "[reagent.volume] [reagent], "
if(contained)
if(cores)
contained = "\[[cores]; [contained]\]"
else
contained = "\[ [contained]\]"
var/turf/bombturf = get_turf(loc)
add_attack_logs(user, src, "has completed with [contained]", ATKLOG_MOST)
log_game("[key_name(usr)] has completed [name] at [bombturf.x], [bombturf.y], [bombturf.z]. [contained]")
else
to_chat(user, "<span class='notice'>You need to add at least one beaker before locking the assembly.</span>")
else if(stage == READY && !nadeassembly)
det_time = det_time == 50 ? 30 : 50 //toggle between 30 and 50
to_chat(user, "<span class='notice'>You modify the time delay. It's set for [det_time / 10] second\s.</span>")
else if(stage == EMPTY)
to_chat(user, "<span class='notice'>You need to add an activation mechanism.</span>")
else if(stage == WIRED && is_type_in_list(I, allowed_containers))
if(beakers.len == 2)
to_chat(user, "<span class='notice'>[src] can not hold more containers.</span>")
@@ -222,6 +190,44 @@
beakers = list()
update_icon(UPDATE_ICON_STATE)
/obj/item/grenade/chem_grenade/screwdriver_act(mob/living/user, obj/item/I)
if(stage == WIRED)
if(!length(beakers))
to_chat(user, "<span class='notice'>You need to add at least one beaker before locking the assembly.</span>")
return TRUE
to_chat(user, "<span class='notice'>You lock the assembly.</span>")
playsound(loc, prime_sound, 25, -3)
stage = READY
update_icon(UPDATE_ICON_STATE)
contained = ""
cores = "" // clear them out so no recursive logging by accidentally
for(var/obj/O in beakers)
if(!O.reagents)
continue
if(istype(O, /obj/item/slime_extract))
cores += " [O]"
for(var/R in O.reagents.reagent_list)
var/datum/reagent/reagent = R
contained += "[reagent.volume] [reagent], "
if(contained)
if(cores)
contained = "\[[cores]; [contained]\]"
else
contained = "\[ [contained]\]"
var/turf/bombturf = get_turf(loc)
add_attack_logs(user, src, "has completed with [contained]", ATKLOG_MOST)
log_game("[key_name(usr)] has completed [name] at [bombturf.x], [bombturf.y], [bombturf.z]. [contained]")
return TRUE
else if(stage == READY && !nadeassembly)
det_time = det_time == 50 ? 30 : 50 //toggle between 30 and 50
to_chat(user, "<span class='notice'>You modify the time delay. It's set for [det_time / 10] second\s.</span>")
return TRUE
else if(stage == EMPTY)
to_chat(user, "<span class='notice'>You need to add an activation mechanism.</span>")
return TRUE
//assembly stuff
/obj/item/grenade/chem_grenade/receive_signal()
@@ -88,24 +88,22 @@
var/mob/M = loc
M.unEquip(src)
/obj/item/grenade/attackby(obj/item/W as obj, mob/user as mob, params)
if(istype(W, /obj/item/screwdriver))
switch(det_time)
if("1")
det_time = 10
to_chat(user, "<span class='notice'>You set [src] for 1 second detonation time.</span>")
if("10")
det_time = 30
to_chat(user, "<span class='notice'>You set [src] for 3 second detonation time.</span>")
if("30")
det_time = 50
to_chat(user, "<span class='notice'>You set [src] for 5 second detonation time.</span>")
if("50")
det_time = 1
to_chat(user, "<span class='notice'>You set [src] for instant detonation.</span>")
add_fingerprint(user)
..()
/obj/item/grenade/screwdriver_act(mob/living/user, obj/item/I)
switch(det_time)
if(1)
det_time = 10
to_chat(user, "<span class='notice'>You set [src] for 1 second detonation time.</span>")
if(10)
det_time = 30
to_chat(user, "<span class='notice'>You set [src] for 3 second detonation time.</span>")
if(30)
det_time = 50
to_chat(user, "<span class='notice'>You set [src] for 5 second detonation time.</span>")
if(50)
det_time = 1
to_chat(user, "<span class='notice'>You set [src] for instant detonation.</span>")
add_fingerprint(user)
return TRUE
/obj/item/grenade/attack_hand()
walk(src, null, null)
+15 -12
View File
@@ -67,26 +67,29 @@
return
sig = I
if(sig.secured)
to_chat(user, "<span class='notice'>The signaler is secured.</span>")
to_chat(user, "<span class='warning'>The signaler is secured.</span>")
sig = null
return
user.drop_item()
I.forceMove(src)
to_chat(user, "<span class='notice'>You sneak [sig] underneath the pressure plate and connect the trigger wire.</span>")
desc = "A trap used to catch bears and other legged creatures. <span class='warning'>There is a remote signaler hooked up to it.</span>"
if(istype(I, /obj/item/screwdriver))
if(IED)
IED.forceMove(get_turf(src))
IED = null
to_chat(user, "<span class='notice'>You remove the IED from [src].</span>")
return
if(sig)
sig.forceMove(get_turf(src))
sig = null
to_chat(user, "<span class='notice'>You remove the signaler from [src].</span>")
return
..()
/obj/item/restraints/legcuffs/beartrap/screwdriver_act(mob/living/user, obj/item/I)
if(!IED && !sig)
return
if(IED)
IED.forceMove(get_turf(src))
IED = null
to_chat(user, "<span class='notice'>You remove the IED from [src].</span>")
if(sig)
sig.forceMove(get_turf(src))
sig = null
to_chat(user, "<span class='notice'>You remove the signaler from [src].</span>")
return TRUE
/obj/item/restraints/legcuffs/beartrap/Crossed(AM as mob|obj, oldloc)
if(armed && isturf(src.loc))
if( (iscarbon(AM) || isanimal(AM)) && !istype(AM, /mob/living/simple_animal/parrot) && !istype(AM, /mob/living/simple_animal/hostile/construct) && !istype(AM, /mob/living/simple_animal/shade) && !istype(AM, /mob/living/simple_animal/hostile/viscerator))
@@ -53,9 +53,6 @@
pressureSetting = 1
to_chat(user, "<span class='notice'>You tweak \the [src]'s pressure output to [pressureSetting].</span>")
return
if(istype(W, /obj/item/screwdriver) && tank)
updateTank(tank, 1, user)
return
if(loadedWeightClass >= maxWeightClass)
to_chat(user, "<span class='warning'>\The [src] can't hold any more items!</span>")
return
@@ -78,6 +75,12 @@
IW.loc = src
return
/obj/item/pneumatic_cannon/screwdriver_act(mob/living/user, obj/item/I)
if(!tank)
return
updateTank(tank, 1, user)
return TRUE
/obj/item/pneumatic_cannon/afterattack(atom/target, mob/living/carbon/human/user, flag, params)
if(istype(target, /obj/item/storage)) //So you can store it in backpacks
@@ -40,12 +40,6 @@
if((istype(W, /obj/item/melee/energy/blade)) && (!emagged))
emag_act(user, W)
if(istype(W, /obj/item/screwdriver))
if(do_after(user, 20 * W.toolspeed, target = src))
open = !open
user.show_message("<span class='notice'>You [open ? "open" : "close"] the service panel.</span>", 1)
return
if(istype(W, /obj/item/multitool) && open && !l_hacking)
user.show_message("<span class='danger'>Now attempting to reset internal memory, please hold.</span>", 1)
l_hacking = TRUE
@@ -69,6 +63,12 @@
return ..()
/obj/item/storage/secure/screwdriver_act(mob/living/user, obj/item/I)
if(do_after(user, 20 * I.toolspeed, target = src))
open = !open
user.visible_message("<span class='notice'>[user] [open ? "opens" : "closes"] the service panel on [src].</span>", "<span class='notice'>You [open ? "open" : "close"] the service panel.</span>")
return TRUE
/obj/item/storage/secure/emag_act(user as mob, weapon as obj)
if(!emagged)
emagged = TRUE
+17 -16
View File
@@ -89,22 +89,6 @@
pick_sign()
/obj/structure/sign/barsign/attackby(obj/item/I, mob/user)
if( istype(I, /obj/item/screwdriver))
if(!panel_open)
to_chat(user, "<span class='notice'>You open the maintenance panel.</span>")
set_sign(new /datum/barsign/hiddensigns/signoff)
panel_open = TRUE
else
to_chat(user, "<span class='notice'>You close the maintenance panel.</span>")
if(!broken && !emagged)
set_sign(prev_sign)
set_light(1, LIGHTING_MINIMUM_POWER)
else if(emagged)
set_sign(new /datum/barsign/hiddensigns/syndibarsign)
else
set_sign(new /datum/barsign/hiddensigns/empbarsign)
panel_open = FALSE
if(istype(I, /obj/item/stack/cable_coil) && panel_open)
var/obj/item/stack/cable_coil/C = I
if(emagged) //Emagged, not broken by EMP
@@ -122,6 +106,23 @@
else
return ..()
/obj/structure/sign/barsign/screwdriver_act(mob/user, obj/item/I)
if(!panel_open)
to_chat(user, "<span class='notice'>You open the maintenance panel.</span>")
prev_sign = current_sign
set_sign(new /datum/barsign/hiddensigns/signoff)
else
to_chat(user, "<span class='notice'>You close the maintenance panel.</span>")
if(!broken && !emagged)
set_sign(prev_sign)
set_light(1, LIGHTING_MINIMUM_POWER)
else if(emagged)
set_sign(new /datum/barsign/hiddensigns/syndibarsign)
else
set_sign(new /datum/barsign/hiddensigns/empbarsign)
panel_open = !panel_open
return TRUE
/obj/structure/sign/barsign/emp_act(severity)
set_sign(new /datum/barsign/hiddensigns/empbarsign)
broken = TRUE
+19 -14
View File
@@ -113,23 +113,28 @@
to_chat(user, "<span class='warning'>You must wait until the door has stopped moving.</span>")
return
if(density)
var/turf/T = get_turf(src)
if(T.density)
to_chat(user, "<span class='warning'>[src] is blocked!</span>")
return
if(istype(W, /obj/item/screwdriver))
if(!istype(T, /turf/simulated/floor))
to_chat(user, "<span class='warning'>[src] bolts must be tightened on the floor!</span>")
return
user.visible_message("<span class='notice'>[user] tightens some bolts on the wall.</span>", "<span class='warning'>You tighten the bolts on the wall.</span>")
ChangeToWall()
else
to_chat(user, "<span class='warning'>You can't reach, close it first!</span>")
if(istype(W, /obj/item/gun/energy/plasmacutter) || istype(W, /obj/item/pickaxe/drill/diamonddrill) || istype(W, /obj/item/pickaxe/drill/jackhammer) || istype(W, /obj/item/melee/energy/blade) || istype(W, /obj/item/twohanded/required/pyro_claws))
dismantle(user, TRUE)
/obj/structure/falsewall/screwdriver_act(mob/living/user, obj/item/I)
if(opening)
to_chat(user, "<span class='warning'>You must wait until the door has stopped moving.</span>")
return TRUE
if(!density)
to_chat(user, "<span class='warning'>You can't reach, close it first!</span>")
return TRUE
var/turf/T = get_turf(src)
if(T.density)
to_chat(user, "<span class='warning'>[src] is blocked!</span>")
return TRUE
if(!istype(T, /turf/simulated/floor))
to_chat(user, "<span class='warning'>[src] bolts must be tightened on the floor!</span>")
return TRUE
user.visible_message("<span class='notice'>[user] tightens some bolts on the wall.</span>", "<span class='warning'>You tighten the bolts on the wall.</span>")
ChangeToWall()
return TRUE
/obj/structure/falsewall/welder_act(mob/user, obj/item/I)
if(!density)
return
+28 -26
View File
@@ -59,32 +59,34 @@
resistance_flags = FLAMMABLE
var/sign_state = ""
/obj/item/sign/attackby(obj/item/tool as obj, mob/user as mob) //construction
if(istype(tool, /obj/item/screwdriver) && isturf(user.loc))
var/direction = input("In which direction?", "Select direction.") in list("North", "East", "South", "West", "Cancel")
if(direction == "Cancel")
return
if(QDELETED(src))
return
var/obj/structure/sign/S = new(user.loc)
switch(direction)
if("North")
S.pixel_y = 32
if("East")
S.pixel_x = 32
if("South")
S.pixel_y = -32
if("West")
S.pixel_x = -32
else
return
S.name = name
S.desc = desc
S.icon_state = sign_state
to_chat(user, "You fasten \the [S] with your [tool].")
qdel(src)
else
return ..()
/obj/item/sign/screwdriver_act(mob/living/user, obj/item/I)
if(!isturf(user.loc)) // Why does this use user? This should just be loc.
return
var/direction = input("In which direction?", "Select direction.") in list("North", "East", "South", "West", "Cancel")
if(direction == "Cancel")
return TRUE // These gotta be true or we stab the sign
if(QDELETED(src))
return TRUE // Unsure about this, but stabbing something that doesnt exist seems like a bad idea
var/obj/structure/sign/S = new(user.loc) //This is really awkward to use user.loc
switch(direction)
if("North")
S.pixel_y = 32
if("East")
S.pixel_x = 32
if("South")
S.pixel_y = -32
if("West")
S.pixel_x = -32
else
return TRUE // We dont want to stab it or place it, so we return
S.name = name
S.desc = desc
S.icon_state = sign_state
to_chat(user, "<span class='notice'>You fasten [S] with your [I].</span>")
qdel(src)
return TRUE
/obj/structure/sign/double/map
name = "station map"