Implement usesound/toolspeed

This commit is contained in:
Markolie
2017-03-07 16:46:28 +01:00
parent 3b73053bc4
commit 3aa1399995
179 changed files with 875 additions and 764 deletions
+16 -13
View File
@@ -126,6 +126,8 @@
w_class = 2
item_state = "electronic"
flags = CONDUCT
usesound = 'sound/items/Deconstruct.ogg'
toolspeed = 1
/obj/machinery/power/apc/connect_to_network()
//Override because the APC does not directly connect to the network; it goes through a terminal.
@@ -431,10 +433,10 @@
if(terminal)
to_chat(user, "<span class='warning'>Disconnect wires first.</span>")
return
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "You are trying to remove the power control board...")//lpeters - fixed grammar issues
if(do_after(user, 50, target = src))
if(do_after(user, 50 * W.toolspeed, target = src))
if(has_electronics==1)
has_electronics = 0
if((stat & BROKEN) || malfhack)
@@ -472,6 +474,7 @@
user.visible_message(\
"<span class='warning'>[user.name] has inserted the power cell to [src.name]!</span>",\
"You insert the power cell.")
playsound(loc, W.usesound, 50, 1)
chargecount = 0
update_icon()
else if(istype(W, /obj/item/weapon/screwdriver)) // haxing
@@ -484,12 +487,12 @@
if(has_electronics==1 && terminal)
has_electronics = 2
stat &= ~MAINT
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "You screw the circuit electronics into place.")
else if(has_electronics==2)
has_electronics = 1
stat |= MAINT
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(src.loc, W.usesound, 50, 1)
to_chat(user, "You unfasten the electronics.")
else /* has_electronics==0 */
to_chat(user, "<span class='warning'>There is nothing to secure.</span>")
@@ -527,8 +530,8 @@
to_chat(user, "<span class='warning'>You need more wires.</span>")
return
to_chat(user, "You start adding cables to the APC frame...")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20, target = src))
playsound(src.loc, C.usesound, 50, 1)
if(do_after(user, 20 * C.toolspeed, target = src))
if(C.amount >= 10 && !terminal && opened && has_electronics != 2)
var/turf/T = get_turf(src)
var/obj/structure/cable/N = T.get_cable_node()
@@ -548,8 +551,8 @@
to_chat(user, "<span class='warning'>You must remove the floor plating in front of the APC first.</span>")
return
to_chat(user, "You begin to cut the cables...")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 50, target = src))
playsound(src.loc, W.usesound, 50, 1)
if(do_after(user, 50 * W.toolspeed, target = src))
if(terminal && opened && has_electronics!=2)
if(prob(50) && electrocute_mob(usr, terminal.powernet, terminal))
var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread
@@ -561,8 +564,8 @@
qdel(terminal) // qdel
else if(istype(W, /obj/item/weapon/apc_electronics) && opened && has_electronics==0 && !((stat & BROKEN) || malfhack))
to_chat(user, "You trying to insert the power control board into the frame...")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 10, target = src))
playsound(src.loc, W.usesound, 50, 1)
if(do_after(user, 10 * W.toolspeed, target = src))
if(has_electronics==0)
has_electronics = 1
to_chat(user, "<span class='notice'>You place the power control board inside the frame.</span>")
@@ -578,8 +581,8 @@
user.visible_message("<span class='warning'>[user.name] welds [src].</span>", \
"You start welding the APC frame...", \
"You hear welding.")
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
if(do_after(user, 50, target = src))
playsound(src.loc, WT.usesound, 50, 1)
if(do_after(user, 50 * WT.toolspeed, target = src))
if(!src || !WT.remove_fuel(3, user)) return
if(emagged || malfhack || (stat & BROKEN) || opened==2)
new /obj/item/stack/sheet/metal(loc)
@@ -609,7 +612,7 @@
to_chat(user, "You cannot repair this APC until you remove the electronics still inside.")
return
to_chat(user, "You begin to replace the damaged APC frame...")
if(do_after(user, 50, target = src))
if(do_after(user, 50 * W.toolspeed, target = src))
user.visible_message(\
"<span class='notice'>[user.name] has replaced the damaged APC frame with new one.</span>",\
"You replace the damaged APC frame with new one.")
+2
View File
@@ -480,6 +480,8 @@ var/global/list/datum/stack_recipe/cable_coil_recipes = list(
slot_flags = SLOT_BELT
item_state = "coil"
attack_verb = list("whipped", "lashed", "disciplined", "flogged")
usesound = 'sound/items/Deconstruct.ogg'
toolspeed = 1
/obj/item/stack/cable_coil/suicide_act(mob/user)
if(locate(/obj/structure/stool) in user.loc)
+1 -1
View File
@@ -166,7 +166,7 @@
power_change()
else
connect()
playsound(loc, 'sound/items/Ratchet.ogg', 50, 1)
playsound(loc, W.usesound, 50, 1)
to_chat(user, "<span class='notice'>You [anchored ? "secure" : "unsecure"] the bolts holding [src] to the floor.</span>")
else if(ismultitool(W))
if(cold_dir == WEST)
+4 -4
View File
@@ -184,14 +184,14 @@ var/const/GRAV_NEEDS_WRENCH = 3
if(GRAV_NEEDS_SCREWDRIVER)
if(istype(I, /obj/item/weapon/screwdriver))
to_chat(user, "<span class='notice'>You secure the screws of the framework.</span>")
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(src.loc, I.usesound, 50, 1)
broken_state++
if(GRAV_NEEDS_WELDING)
if(istype(I, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = I
if(WT.remove_fuel(1, user))
to_chat(user, "<span class='notice'>You mend the damaged framework.</span>")
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(src.loc, WT.usesound, 50, 1)
broken_state++
if(GRAV_NEEDS_PLASTEEL)
if(istype(I, /obj/item/stack/sheet/plasteel))
@@ -199,14 +199,14 @@ var/const/GRAV_NEEDS_WRENCH = 3
if(PS.amount >= 10)
PS.use(10)
to_chat(user, "<span class='notice'>You add the plating to the framework.</span>")
playsound(src.loc, 'sound/machines/click.ogg', 75, 1)
playsound(src.loc, PS.usesound, 75, 1)
broken_state++
else
to_chat(user, "<span class='notice'>You need 10 sheets of plasteel.</span>")
if(GRAV_NEEDS_WRENCH)
if(istype(I, /obj/item/weapon/wrench))
to_chat(user, "<span class='notice'>You secure the plating to the framework.</span>")
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src.loc, I.usesound, 75, 1)
set_fix()
else
..()
+7 -6
View File
@@ -40,14 +40,14 @@
src.add_fingerprint(user)
if(istype(W, /obj/item/weapon/wrench))
if(src.stage == 1)
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src.loc, W.usesound, 75, 1)
to_chat(usr, "You begin deconstructing [src].")
if(!do_after(usr, 30, target = src))
if(!do_after(usr, 30 * W.toolspeed, target = src))
return
new /obj/item/stack/sheet/metal( get_turf(src.loc), sheets_refunded )
user.visible_message("[user.name] deconstructs [src].", \
"You deconstruct [src].", "You hear a noise.")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 75, 1)
playsound(src.loc, W.usesound, 75, 1)
qdel(src)
if(src.stage == 2)
to_chat(usr, "You have to remove the wires first.")
@@ -68,7 +68,7 @@
new /obj/item/stack/cable_coil(get_turf(src.loc), 1, COLOR_RED)
user.visible_message("[user.name] removes the wiring from [src].", \
"You remove the wiring from [src].", "You hear a noise.")
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
playsound(loc, W.usesound, 100, 1)
return
if(istype(W, /obj/item/stack/cable_coil))
@@ -81,6 +81,7 @@
if("bulb")
src.icon_state = "bulb-construct-stage2"
src.stage = 2
playsound(loc, coil.usesound, 50, 1)
user.visible_message("[user.name] adds wires to [src].", \
"You add wires to [src].")
return
@@ -95,7 +96,7 @@
src.stage = 3
user.visible_message("[user.name] closes [src]'s casing.", \
"You close [src]'s casing.", "You hear a noise.")
playsound(src.loc, 'sound/items/Screwdriver.ogg', 75, 1)
playsound(src.loc, W.usesound, 75, 1)
switch(fixture_type)
@@ -348,7 +349,7 @@
// attempt to stick weapon into light socket
else if(status == LIGHT_EMPTY)
if(istype(W, /obj/item/weapon/screwdriver)) //If it's a screwdriver open it.
playsound(src.loc, 'sound/items/Screwdriver.ogg', 75, 1)
playsound(src.loc, W.usesound, 75, 1)
user.visible_message("[user.name] opens [src]'s casing.", \
"You open [src]'s casing.", "You hear a noise.")
var/obj/machinery/light_construct/newlight = null
+2 -2
View File
@@ -288,12 +288,12 @@
disconnect_from_network()
to_chat(user, "<span class='notice'>You unsecure the generator from the floor.</span>")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
playsound(src.loc, O.usesound, 50, 1)
anchored = !anchored
else if(istype(O, /obj/item/weapon/screwdriver))
panel_open = !panel_open
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
playsound(src.loc, O.usesound, 50, 1)
if(panel_open)
to_chat(user, "<span class='notice'>You open the access panel.</span>")
else
+1 -1
View File
@@ -74,7 +74,7 @@ var/global/list/rad_collectors = list()
if(P)
to_chat(user, "\blue Remove the plasma tank first.")
return 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src.loc, W.usesound, 75, 1)
src.anchored = !src.anchored
user.visible_message("[user.name] [anchored? "secures":"unsecures"] the [src.name].", \
"You [anchored? "secure":"undo"] the external bolts.", \
+6 -6
View File
@@ -236,14 +236,14 @@
switch(state)
if(0)
state = 1
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src.loc, W.usesound, 75, 1)
user.visible_message("[user.name] secures [src.name] to the floor.", \
"You secure the external reinforcing bolts to the floor.", \
"You hear a ratchet")
src.anchored = 1
if(1)
state = 0
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src.loc,W.usesound, 75, 1)
user.visible_message("[user.name] unsecures [src.name] reinforcing bolts from the floor.", \
"You undo the external reinforcing bolts.", \
"You hear a ratchet")
@@ -262,11 +262,11 @@
to_chat(user, "\red The [src.name] needs to be wrenched to the floor.")
if(1)
if(WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(src.loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if(do_after(user,20, target = src))
if(do_after(user, 20 * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
state = 2
to_chat(user, "You weld the [src] to the floor.")
@@ -275,11 +275,11 @@
to_chat(user, "\red You need more welding fuel to complete this task.")
if(2)
if(WT.remove_fuel(0,user))
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(src.loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if(do_after(user,20, target = src))
if(do_after(user, 20 * WT.toolspeed, target = src))
if(!src || !WT.isOn()) return
state = 1
to_chat(user, "You cut the [src] free from the floor.")
@@ -87,14 +87,14 @@ field_generator power level display
if(FG_UNSECURED)
if(isinspace()) return
state = FG_SECURED
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(loc, W.usesound, 75, 1)
user.visible_message("[user.name] secures [name] to the floor.", \
"<span class='notice'>You secure the external reinforcing bolts to the floor.</span>", \
"<span class='italics'>You hear ratchet.</span>")
anchored = 1
if(FG_SECURED)
state = FG_UNSECURED
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(loc, W.usesound, 75, 1)
user.visible_message("[user.name] unsecures [name] reinforcing bolts from the floor.", \
"<span class='notice'>You undo the external reinforcing bolts.</span>", \
"<span class='italics'>You hear ratchet.</span>")
@@ -110,11 +110,11 @@ field_generator power level display
if(FG_SECURED)
if(WT.remove_fuel(0,user))
playsound(loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to weld the [name] to the floor.", \
"<span class='notice'>You start to weld \the [src] to the floor...</span>", \
"<span class='italics'>You hear welding.</span>")
if(do_after(user,20, target = src))
if(do_after(user, 20 * WT.toolspeed, target = src))
if(!src || !WT.isOn())
return
state = FG_WELDED
@@ -122,11 +122,11 @@ field_generator power level display
if(FG_WELDED)
if(WT.remove_fuel(0,user))
playsound(loc, 'sound/items/Welder2.ogg', 50, 1)
playsound(loc, WT.usesound, 50, 1)
user.visible_message("[user.name] starts to cut the [name] free from the floor.", \
"<span class='notice'>You start to cut \the [src] free from the floor...</span>", \
"<span class='italics'>You hear welding.</span>")
if(do_after(user,20, target = src))
if(do_after(user, 20 * WT.toolspeed, target = src))
if(!src || !WT.isOn())
return
state = FG_SECURED
+1 -1
View File
@@ -23,7 +23,7 @@
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weapon/wrench))
anchored = !anchored
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src.loc, W.usesound, 75, 1)
if(anchored)
user.visible_message("[user.name] secures [src.name] to the floor.", \
"You secure the [src.name] to the floor.", \
@@ -214,7 +214,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return 0
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/O, var/mob/user)
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
if(!(O) || !(user))
return 0
if(!ismob(user) || !isobj(O))
@@ -224,14 +224,14 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
switch(construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(iswrench(O) && !isinspace())
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(loc, O.usesound, 50, 1)
anchored = 1
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
temp_state++
if(1)
if(iswrench(O))
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(loc, O.usesound, 50, 1)
anchored = 0
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
@@ -239,6 +239,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
else if(iscoil(O))
var/obj/item/stack/cable_coil/C = O
if(C.use(1))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] adds wires to the [name].", \
"You add some wires.")
temp_state++
@@ -247,15 +248,18 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return
if(2)
if(iswirecutter(O))//TODO:Shock user if its on?
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] removes some wires from the [name].", \
"You remove some wires.")
temp_state--
else if(isscrewdriver(O))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] closes the [name]'s access panel.", \
"You close the access panel.")
temp_state++
if(3)
if(isscrewdriver(O))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] opens the [name]'s access panel.", \
"You open the access panel.")
temp_state--
@@ -352,7 +356,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return 0
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/O, var/mob/user)
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
if(!(O) || !(user))
return 0
if(!ismob(user) || !isobj(O))
@@ -361,7 +365,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
switch(construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(iswrench(O))
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(loc, O.usesound, 50, 1)
anchored = 1
user.visible_message("[user.name] secures the [name] to the floor.", \
"You secure the external bolts.")
@@ -369,7 +373,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
power_change()
if(1)
if(iswrench(O))
playsound(loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(loc, O.usesound, 50, 1)
anchored = 0
user.visible_message("[user.name] detaches the [name] from the floor.", \
"You remove the external bolts.")
@@ -377,20 +381,24 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
power_change()
else if(iscoil(O))
if(O:use(1))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] adds wires to the [name].", \
"You add some wires.")
temp_state++
if(2)
if(iswirecutter(O))//TODO:Shock user if its on?
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] removes some wires from the [name].", \
"You remove some wires.")
temp_state--
else if(isscrewdriver(O))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] closes the [name]'s access panel.", \
"You close the access panel.")
temp_state++
if(3)
if(isscrewdriver(O))
playsound(loc, O.usesound, 50, 1)
user.visible_message("[user.name] opens the [name]'s access panel.", \
"You open the access panel.")
temp_state--
+2 -2
View File
@@ -180,9 +180,9 @@
return
to_chat(user, "<span class='notice'>You begin to dismantle the power terminal...</span>")
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
playsound(src.loc, I.usesound, 50, 1)
if(do_after(user, 50, target = src))
if(do_after(user, 50 * I.toolspeed, target = src))
if(prob(50) && electrocute_mob(usr, terminal.powernet, terminal)) //animate the electrocution if uncautious and unlucky
var/datum/effect/system/spark_spread/s = new /datum/effect/system/spark_spread
s.set_up(5, 1, src)
+9 -8
View File
@@ -60,12 +60,12 @@
if(istype(W, /obj/item/weapon/crowbar))
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user.visible_message("[user] begins to take the glass off the solar panel.", "<span class='notice'>You begin to take the glass off the solar panel...</span>")
if(do_after(user, 50, target = src))
if(do_after(user, 50 * W.toolspeed, target = src))
var/obj/item/solar_assembly/S = locate() in src
if(S)
S.loc = src.loc
S.give_glass()
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
playsound(src.loc, W.usesound, 50, 1)
user.visible_message("[user] takes the glass off the solar panel.", "<span class='notice'>You take the glass off the solar panel.</span>")
qdel(src)
return
@@ -227,20 +227,20 @@
if(istype(W, /obj/item/weapon/wrench))
anchored = 1
user.visible_message("[user] wrenches the solar assembly into place.", "<span class='notice'>You wrench the solar assembly into place.</span>")
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src.loc, W.usesound, 50, 1)
return 1
else
if(istype(W, /obj/item/weapon/wrench))
anchored = 0
user.visible_message("[user] unwrenches the solar assembly from its place.", "<span class='notice'>You unwrench the solar assembly from its place.</span>")
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
playsound(src.loc, W.usesound, 50, 1)
return 1
if(istype(W, /obj/item/stack/sheet/glass) || istype(W, /obj/item/stack/sheet/rglass))
var/obj/item/stack/sheet/S = W
if(S.use(2))
glass_type = W.type
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
playsound(loc, S.usesound, 50, 1)
user.visible_message("[user] places the glass on the solar assembly.", "<span class='notice'>You place the glass on the solar assembly.</span>")
if(tracker)
new /obj/machinery/power/tracker(get_turf(src), src)
@@ -263,6 +263,7 @@
if(istype(W, /obj/item/weapon/crowbar))
new /obj/item/weapon/tracker_electronics(src.loc)
tracker = 0
playsound(loc, W.usesound, 50, 1)
user.visible_message("[user] takes out the electronics from the solar assembly.", "<span class='notice'>You take out the electronics from the solar assembly.</span>")
return 1
..()
@@ -411,10 +412,10 @@
return data
/obj/machinery/power/solar_control/attackby(I as obj, user as mob, params)
/obj/machinery/power/solar_control/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/screwdriver))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
if(do_after(user, 20, target = src))
playsound(src.loc, I.usesound, 50, 1)
if(do_after(user, 20 * I.toolspeed, target = src))
if(src.stat & BROKEN)
to_chat(user, "<span class='notice'>The broken glass falls out.</span>")
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
+2 -2
View File
@@ -63,12 +63,12 @@
if(istype(W, /obj/item/weapon/crowbar))
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] begins to take the glass off the solar tracker.</span>")
if(do_after(user, 50, target = src))
if(do_after(user, 50 * W.toolspeed, target = src))
var/obj/item/solar_assembly/S = locate() in src
if(S)
S.loc = src.loc
S.give_glass()
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
playsound(src.loc, W.usesound, 50, 1)
user.visible_message("<span class='notice'>[user] takes the glass off the tracker.</span>")
qdel(src) // qdel
return