Progress bars + Wall Rationalization

This commit does the following:
 - Ports progress bars from -tg- (tgstation/-tg-station#9921)
 - Refactors wall attackby code to make it 100% less insane; Instead of
   manually checking every little thing, it uses do_after,
   consequentially, making the new progress bars affect dealing with walls
   as well.

Wall code makes a tiger sad.
This commit is contained in:
Tigercat2000
2015-08-31 13:38:51 -07:00
parent 18bf116b86
commit 7f4ac72910
139 changed files with 458 additions and 464 deletions
@@ -25,7 +25,7 @@
if(istype(O, /obj/item/device/multitool))
user << "\red Resetting circuitry..."
playsound(user, 'sound/machines/lockreset.ogg', 50, 1)
if(do_after(user, 20))
if(do_after(user, 20, target = src))
src.locked = 0
user << "<span class = 'caution'> You disable the locking modules.</span>"
update_icon()
@@ -89,7 +89,7 @@
src.locked = 1
user << "\blue You re-enable the locking modules."
playsound(user, 'sound/machines/lockenable.ogg', 50, 1)
if(do_after(user,20))
if(do_after(user,20, target = src))
src.locked = 1
user << "<span class = 'caution'> You re-enable the locking modules.</span>"
return
+11 -11
View File
@@ -155,7 +155,7 @@ obj/structure/door_assembly
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
if(istext(glass))
user.visible_message("[user] welds the [glass] plating off the airlock assembly.", "You start to weld the [glass] plating off the airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || !WT.isOn()) return
user << "\blue You welded the [glass] plating off!"
var/M = text2path("/obj/item/stack/sheet/mineral/[glass]")
@@ -163,14 +163,14 @@ obj/structure/door_assembly
glass = 0
else if(glass == 1)
user.visible_message("[user] welds the glass panel out of the airlock assembly.", "You start to weld the glass panel out of the airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || !WT.isOn()) return
user << "\blue You welded the glass panel out!"
new /obj/item/stack/sheet/rglass(src.loc)
glass = 0
else if(!anchored)
user.visible_message("[user] dissassembles the airlock assembly.", "You start to dissassemble the airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || !WT.isOn()) return
user << "\blue You dissasembled the airlock assembly!"
new /obj/item/stack/sheet/metal(src.loc, 4)
@@ -186,7 +186,7 @@ obj/structure/door_assembly
else
user.visible_message("[user] secures the airlock assembly to the floor.", "You start to secure the airlock assembly to the floor.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src) return
user << "\blue You [anchored? "un" : ""]secured the airlock assembly!"
anchored = !anchored
@@ -194,7 +194,7 @@ obj/structure/door_assembly
else if(istype(W, /obj/item/stack/cable_coil) && state == 0 && anchored )
var/obj/item/stack/cable_coil/coil = W
user.visible_message("[user] wires the airlock assembly.", "You start to wire the airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src) return
coil.use(1)
src.state = 1
@@ -204,7 +204,7 @@ obj/structure/door_assembly
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src) return
user << "\blue You cut the airlock wires.!"
new/obj/item/stack/cable_coil(src.loc, 1)
@@ -216,7 +216,7 @@ obj/structure/door_assembly
user.drop_item()
W.loc = src
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src) return
user << "\blue You installed the airlock electronics!"
src.state = 2
@@ -229,7 +229,7 @@ obj/structure/door_assembly
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to install electronics into the airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src) return
user << "\blue You removed the airlock electronics!"
src.state = 1
@@ -249,7 +249,7 @@ obj/structure/door_assembly
if(istype(S, /obj/item/stack/sheet/rglass))
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
user << "\blue You installed reinforced glass windows into the airlock assembly!"
S.use(1)
glass = 1
@@ -258,7 +258,7 @@ obj/structure/door_assembly
if(S.amount>=2)
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
user << "\blue You installed [M] plating into the airlock assembly!"
S.use(2)
glass = "[M]"
@@ -267,7 +267,7 @@ obj/structure/door_assembly
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
user << "\blue Now finishing the airlock."
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src) return
user << "\blue You finish the airlock!"
var/path
+11 -11
View File
@@ -11,7 +11,7 @@
if(anchored && !istype(src,/obj/structure/girder/displaced))
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "\blue Now disassembling the girder"
if(do_after(user,40))
if(do_after(user,40, target = src))
if(!src) return
user << "\blue You dissasembled the girder!"
new /obj/item/stack/sheet/metal(get_turf(src))
@@ -26,7 +26,7 @@
else if(istype(W, /obj/item/weapon/gun/energy/plasmacutter))
user << "\blue Now slicing apart the girder"
if(do_after(user,30))
if(do_after(user,30, target = src))
if(!src) return
user << "\blue You slice apart the girder!"
new /obj/item/stack/sheet/metal(get_turf(src))
@@ -40,7 +40,7 @@
else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 && istype(src,/obj/structure/girder/reinforced))
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
user << "\blue Now unsecuring support struts"
if(do_after(user,40))
if(do_after(user,40, target = src))
if(!src) return
user << "\blue You unsecured the support struts!"
state = 1
@@ -48,7 +48,7 @@
else if(istype(W, /obj/item/weapon/wirecutters) && istype(src,/obj/structure/girder/reinforced) && state == 1)
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
user << "\blue Now removing support struts"
if(do_after(user,40))
if(do_after(user,40, target = src))
if(!src) return
user << "\blue You removed the support struts!"
new/obj/structure/girder( src.loc )
@@ -57,7 +57,7 @@
else if(istype(W, /obj/item/weapon/crowbar) && state == 0 && anchored )
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user << "\blue Now dislodging the girder"
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src) return
user << "\blue You dislodged the girder!"
new/obj/structure/girder/displaced( src.loc )
@@ -78,7 +78,7 @@
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if (do_after(user,40, target = src))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
@@ -100,7 +100,7 @@
if (src.icon_state == "reinforced") //I cant believe someone would actually write this line of code...
if(S.amount < 1) return ..()
user << "\blue Now finalising reinforced wall."
if(do_after(user, 50))
if(do_after(user, 50, target = src))
if(!src || !S || S.amount < 1) return
S.use(1)
user << "\blue Wall fully reinforced!"
@@ -113,7 +113,7 @@
else
if(S.amount < 1) return ..()
user << "\blue Now reinforcing girders"
if (do_after(user,60))
if (do_after(user,60, target = src))
if(!src || !S || S.amount < 1) return
S.use(1)
user << "\blue Girders reinforced!"
@@ -133,7 +133,7 @@
else
if(S.amount < 2) return ..()
user << "\blue Now adding plating..."
if (do_after(user,40))
if (do_after(user,40, target = src))
if(!src || !S || S.amount < 2) return
S.use(2)
user << "\blue You added the plating!"
@@ -214,13 +214,13 @@
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user << "\blue Now disassembling the girder"
if(do_after(user,40))
if(do_after(user,40, target = src))
user << "\blue You dissasembled the girder!"
dismantle()
else if(istype(W, /obj/item/weapon/gun/energy/plasmacutter))
user << "\blue Now slicing apart the girder"
if(do_after(user,30))
if(do_after(user,30, target = src))
user << "\blue You slice apart the girder!"
dismantle()
+1 -1
View File
@@ -174,7 +174,7 @@
user << "<span class='notice'>There is already a window facing this way there.</span>"
return
user << "<span class='notice'>You start placing the window.</span>"
if(do_after(user,20))
if(do_after(user,20, target = src))
if(!src) return //Grille destroyed while waiting
for(var/obj/structure/window/WINDOW in loc)
if(WINDOW.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting.
+1 -1
View File
@@ -484,7 +484,7 @@
user << "<span class='notice'>[src] can't hold any more signs.</span>"
else if(istype(I, /obj/item/weapon/crowbar))
user.visible_message("<span class='warning'>[user] begins to empty the contents of [src].</span>")
if(do_after(user, 30))
if(do_after(user, 30, target = src))
usr << "<span class='notice'>You empty the contents of [src]'s bucket onto the floor.</span>"
reagents.reaction(src.loc)
src.reagents.clear_reagents()
@@ -112,7 +112,7 @@
if(istype(W,/obj/item/weapon/pickaxe))
var/obj/item/weapon/pickaxe/digTool = W
user << "You start digging the [name]."
if(do_after(user,digTool.digspeed*hardness) && src)
if(do_after(user,digTool.digspeed*hardness, target = src) && src)
user << "You finished digging."
Dismantle()
else if(istype(W,/obj/item/weapon)) //not sure, can't not just weapons get passed to this proc?
+2 -2
View File
@@ -337,7 +337,7 @@
if (!anchored && !isinspace())
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'> You begin to tighten \the [src] to the floor...</span>"
if (do_after(user, 20))
if (do_after(user, 20, target = src))
user.visible_message( \
"[user] tightens \the [src]'s casters.", \
"<span class='notice'> You have tightened \the [src]'s casters. Now it can be played again.</span>", \
@@ -346,7 +346,7 @@
else if(anchored)
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
user << "<span class='notice'> You begin to loosen \the [src]'s casters...</span>"
if (do_after(user, 40))
if (do_after(user, 40, target = src))
user.visible_message( \
"[user] loosens \the [src]'s casters.", \
"<span class='notice'> You have loosened \the [src]. Now it can be pulled somewhere else.</span>", \
+5 -5
View File
@@ -420,7 +420,7 @@
if (istype(W, /obj/item/weapon/wrench))
user << "\blue Now disassembling table"
playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
if(do_after(user,50))
if(do_after(user,50, target = src))
destroy()
return
@@ -696,7 +696,7 @@
var/obj/item/stack/sheet/glass/G = I
if(G.amount >= 2)
user << "<span class='notice'>You start to add the glass to \the [src].</span>"
if(do_after(user, 10))
if(do_after(user, 10, target = src))
G.use(2)
user << "<span class='notice'>You add the glass to \the [src].</span>"
playsound(get_turf(src), 'sound/items/Deconstruct.ogg', 50, 1)
@@ -709,7 +709,7 @@
if(iswrench(I))
user << "<span class='notice'>You start to deconstruct \the [src].</span>"
playsound(src.loc, 'sound/items/Ratchet.ogg', 75, 1)
if(do_after(user, 10))
if(do_after(user, 10, target = src))
playsound(src.loc, 'sound/items/Deconstruct.ogg', 75, 1)
user << "<span class='notice'>You dismantle \the [src].</span>"
new /obj/item/stack/sheet/metal(loc)
@@ -816,14 +816,14 @@
if(src.status == 2)
user << "\blue Now weakening the reinforced table"
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
if (do_after(user, 50))
if (do_after(user, 50, target = src))
if(!src || !WT.isOn()) return
user << "\blue Table weakened"
src.status = 1
else
user << "\blue Now strengthening the reinforced table"
playsound(src.loc, 'sound/items/Welder.ogg', 50, 1)
if (do_after(user, 50))
if (do_after(user, 50, target = src))
if(!src || !WT.isOn()) return
user << "\blue Table strengthened"
src.status = 2
@@ -53,7 +53,7 @@
else if(icon_state == "open")
if(pod.contents.len && user.loc != pod)
user.visible_message("<span class='warning'>[user] starts emptying [pod]'s contents onto the floor!</span>")
if(do_after(user, 40)) //So it doesn't default to close_animation() on fail
if(do_after(user, 40, target = src)) //So it doesn't default to close_animation() on fail
if(pod.loc == loc)
for(var/atom/movable/AM in pod)
AM.loc = get_turf(user)
@@ -73,7 +73,7 @@
var/mob/GM = G.affecting
for(var/obj/structure/transit_tube_pod/pod in loc)
pod.visible_message("<span class='warning'>[user] starts putting [GM] into the [pod]!</span>")
if(do_after(user, 60) && GM && G && G.affecting == GM)
if(do_after(user, 60, target = GM) && GM && G && G.affecting == GM)
GM.Weaken(5)
src.Bumped(GM)
qdel(G)
+3 -3
View File
@@ -46,7 +46,7 @@
if(istype(I, /obj/item/weapon/crowbar))
user << "<span class='notice'>You start to [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"].</span>"
playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1)
if(do_after(user, 30))
if(do_after(user, 30, target = src))
user.visible_message("<span class='notice'>[user] [cistern ? "replaces the lid on the cistern" : "lifts the lid off the cistern"]!</span>", "<span class='notice'>You [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]!</span>", "You hear grinding porcelain.")
cistern = !cistern
update_icon()
@@ -65,7 +65,7 @@
if(open && !swirlie)
user.visible_message("<span class='danger'>[user] starts to give [GM.name] a swirlie!</span>", "<span class='notice'>You start to give [GM.name] a swirlie!</span>")
swirlie = GM
if(do_after(user, 30, 5, 0))
if(do_after(user, 30, 5, 0, target = src))
user.visible_message("<span class='danger'>[user] gives [GM.name] a swirlie!</span>", "<span class='notice'>You give [GM.name] a swirlie!</span>", "You hear a toilet flushing.")
if(!GM.internal)
GM.adjustOxyLoss(5)
@@ -156,7 +156,7 @@
user << "<span class='notice'>The water temperature seems to be [watertemp].</span>"
if(istype(I, /obj/item/weapon/wrench))
user << "<span class='notice'>You begin to adjust the temperature valve with the [I].</span>"
if(do_after(user, 50))
if(do_after(user, 50, target = src))
switch(watertemp)
if("normal")
watertemp = "freezing"
@@ -80,7 +80,7 @@ obj/structure/windoor_assembly/Destroy()
user.visible_message("<span class='warning'>[user] dissassembles the windoor assembly.</span>", "<span class='notice'>You start to dissassemble the windoor assembly.</span>")
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || !WT.isOn()) return
user << "<span class='notice'>You dissasembled the windoor assembly!</span>"
var/obj/item/stack/sheet/rglass/RG = new (get_turf(src), 5)
@@ -101,7 +101,7 @@ obj/structure/windoor_assembly/Destroy()
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user.visible_message("[user] secures the windoor assembly to the floor.", "You start to secure the windoor assembly to the floor.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || src.anchored)
return
for(var/obj/machinery/door/window/WD in src.loc)
@@ -120,7 +120,7 @@ obj/structure/windoor_assembly/Destroy()
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user.visible_message("[user] unsecures the windoor assembly to the floor.", "You start to unsecure the windoor assembly to the floor.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || !src.anchored)
return
user << "<span class='notice'>You've unsecured the windoor assembly!</span>"
@@ -138,7 +138,7 @@ obj/structure/windoor_assembly/Destroy()
return
user << "<span class='notice'>You start to reinforce the windoor with plasteel.</span>"
if(do_after(user,40))
if(do_after(user,40, target = src))
if(!src || secure)
return
@@ -154,7 +154,7 @@ obj/structure/windoor_assembly/Destroy()
else if(istype(W, /obj/item/stack/cable_coil) && anchored)
user.visible_message("[user] wires the windoor assembly.", "You start to wire the windoor assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || !src.anchored || src.state != "01")
return
var/obj/item/stack/cable_coil/CC = W
@@ -175,7 +175,7 @@ obj/structure/windoor_assembly/Destroy()
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || src.state != "02")
return
@@ -194,7 +194,7 @@ obj/structure/windoor_assembly/Destroy()
user.drop_item()
W.loc = src
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || src.electronics)
W.loc = src.loc
return
@@ -212,7 +212,7 @@ obj/structure/windoor_assembly/Destroy()
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to uninstall electronics from the airlock assembly.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(!src || !electronics)
return
user << "<span class='notice'>You've removed the airlock electronics!</span>"
@@ -242,7 +242,7 @@ obj/structure/windoor_assembly/Destroy()
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] pries the windoor into the frame.", "You start prying the windoor into the frame.")
if(do_after(user, 40))
if(do_after(user, 40, target = src))
if(src.loc && src.electronics)