From 5b737098d9fb99fd32a3c4f5f98134f3c8133114 Mon Sep 17 00:00:00 2001 From: Lohikar Date: Sun, 5 Mar 2017 14:03:59 -0600 Subject: [PATCH] do_after progress bars (#1857) Adds the do_after progress bars that were originally going to be added with lighting, but got scrapped due to PR-bloat. changes: do_after actions now have a progress bar. Added a changelog for directional lighting as I apparently forgot it. The do_after proc's required arguments are unchanged, however it now accepts the argument act_target, which allows the caller to specify what object the progress bar should appear over. Defaults to user. --- .../components/binary_devices/passive_gate.dm | 2 +- .../components/binary_devices/pump.dm | 2 +- .../components/omni_devices/omni_base.dm | 2 +- .../components/portables_connector.dm | 2 +- .../components/trinary_devices/filter.dm | 2 +- .../components/trinary_devices/mixer.dm | 2 +- code/ATMOSPHERICS/components/tvalve.dm | 2 +- .../components/unary/heat_exchanger.dm | 2 +- .../components/unary/vent_scrubber.dm | 4 +- code/ATMOSPHERICS/components/valve.dm | 2 +- code/ATMOSPHERICS/pipes.dm | 2 +- code/_helpers/unsorted.dm | 108 ++++++++++++++---- code/modules/clothing/spacesuits/rig/rig.dm | 4 +- code/modules/effects/sparks/visuals.dm | 2 +- html/changelogs/lohikar-doafter.yml | 4 + html/changelogs/lohikar-lighting.yml | 2 +- html/changelogs/lohikar-pr-1726.yml | 4 + icons/effects/doafter_icon.dmi | Bin 0 -> 587 bytes 18 files changed, 110 insertions(+), 38 deletions(-) create mode 100644 html/changelogs/lohikar-doafter.yml create mode 100644 html/changelogs/lohikar-pr-1726.yml create mode 100644 icons/effects/doafter_icon.dmi diff --git a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm index a032b747d96..05488c719af 100644 --- a/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm +++ b/code/ATMOSPHERICS/components/binary_devices/passive_gate.dm @@ -250,7 +250,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/components/binary_devices/pump.dm b/code/ATMOSPHERICS/components/binary_devices/pump.dm index 1832ea8784e..c6ef3e201da 100644 --- a/code/ATMOSPHERICS/components/binary_devices/pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/pump.dm @@ -229,7 +229,7 @@ Thus, the two variables affect pump operation are set in New(): return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/components/omni_devices/omni_base.dm b/code/ATMOSPHERICS/components/omni_devices/omni_base.dm index ac7d88301af..b62a63da903 100644 --- a/code/ATMOSPHERICS/components/omni_devices/omni_base.dm +++ b/code/ATMOSPHERICS/components/omni_devices/omni_base.dm @@ -92,7 +92,7 @@ return 1 user << "You begin to unfasten \the [src]..." playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) - if(do_after(user, 40)) + if(do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/components/portables_connector.dm b/code/ATMOSPHERICS/components/portables_connector.dm index 4f6473fccf3..72eedd3d7f1 100644 --- a/code/ATMOSPHERICS/components/portables_connector.dm +++ b/code/ATMOSPHERICS/components/portables_connector.dm @@ -146,7 +146,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm index e78d777cabc..3506c3a2a75 100755 --- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm @@ -139,7 +139,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm index a163c122f01..48accdd6dbd 100644 --- a/code/ATMOSPHERICS/components/trinary_devices/mixer.dm +++ b/code/ATMOSPHERICS/components/trinary_devices/mixer.dm @@ -114,7 +114,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/components/tvalve.dm b/code/ATMOSPHERICS/components/tvalve.dm index f93970a93fd..c3592deb365 100644 --- a/code/ATMOSPHERICS/components/tvalve.dm +++ b/code/ATMOSPHERICS/components/tvalve.dm @@ -358,7 +358,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/components/unary/heat_exchanger.dm b/code/ATMOSPHERICS/components/unary/heat_exchanger.dm index 79e43a8e1c3..b6014ff34f5 100644 --- a/code/ATMOSPHERICS/components/unary/heat_exchanger.dm +++ b/code/ATMOSPHERICS/components/unary/heat_exchanger.dm @@ -80,7 +80,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index 6e445bed48a..3cb91710571 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -275,7 +275,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ @@ -290,7 +290,7 @@ user << "\The [WT] must be turned on!" else if (WT.remove_fuel(0,user)) user << "Now welding \the [src]." - if(do_after(user, 20)) + if(do_after(user, 20, act_target = src)) if(!src || !WT.isOn()) return playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1) if(!welded) diff --git a/code/ATMOSPHERICS/components/valve.dm b/code/ATMOSPHERICS/components/valve.dm index 94d583c721c..121d58e186e 100644 --- a/code/ATMOSPHERICS/components/valve.dm +++ b/code/ATMOSPHERICS/components/valve.dm @@ -315,7 +315,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/ATMOSPHERICS/pipes.dm b/code/ATMOSPHERICS/pipes.dm index d5656f75fc0..ee9d9ee0afb 100644 --- a/code/ATMOSPHERICS/pipes.dm +++ b/code/ATMOSPHERICS/pipes.dm @@ -93,7 +93,7 @@ return 1 playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You begin to unfasten \the [src]..." - if (do_after(user, 40)) + if (do_after(user, 40, act_target = src)) user.visible_message( \ "\The [user] unfastens \the [src].", \ "You have unfastened \the [src].", \ diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 4b7e24a93f7..d928ce9ab13 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -646,45 +646,109 @@ proc/GaussRandRound(var/sigma,var/roundto) else return get_step(ref, base_dir) -/proc/do_mob(var/mob/user, var/mob/target, var/delay = 30, var/numticks = 5, var/needhand = 1) //This is quite an ugly solution but i refuse to use the old request system. - if(!user || !target) return 0 - if(numticks == 0) return 0 - - var/delayfraction = round(delay/numticks) - var/original_user_loc = user.loc - var/original_target_loc = target.loc +/proc/do_mob(mob/user , mob/target, delay = 30, numticks = 10, needhand = TRUE, display_progress = TRUE) //This is quite an ugly solution but i refuse to use the old request system. + if(!user || !target) + return 0 + var/user_loc = user.loc + var/target_loc = target.loc var/holding = user.get_active_hand() - - for(var/i = 0, i[wearer]'s suit emits a quiet hum as it begins to adjust its seals.","With a quiet hum, the suit begins running checks and adjusting components.") - if(seal_delay && !do_after(wearer,seal_delay)) + if(seal_delay && !do_after(wearer, seal_delay, act_target = src)) if(wearer) wearer << "You must remain still while the suit is adjusting the components." failed_to_seal = 1 @@ -244,7 +244,7 @@ if(!failed_to_seal && wearer.back == src && piece == compare_piece) - if(seal_delay && !instant && !do_after(wearer,seal_delay,needhand=0)) + if(seal_delay && !instant && !do_after(wearer,seal_delay,needhand=0, act_target = src)) failed_to_seal = 1 piece.icon_state = "[initial(icon_state)][!seal_target ? "_sealed" : ""]" diff --git a/code/modules/effects/sparks/visuals.dm b/code/modules/effects/sparks/visuals.dm index 684cb3d78b1..7e55170e3d1 100644 --- a/code/modules/effects/sparks/visuals.dm +++ b/code/modules/effects/sparks/visuals.dm @@ -12,7 +12,7 @@ /obj/visual_effect/sparks/tick() . = ..() - var/turf/T = loc + var/turf/T = get_turf(src) if(T) T.hotspot_expose(1000, 100) diff --git a/html/changelogs/lohikar-doafter.yml b/html/changelogs/lohikar-doafter.yml new file mode 100644 index 00000000000..9ca31ec08ca --- /dev/null +++ b/html/changelogs/lohikar-doafter.yml @@ -0,0 +1,4 @@ +author: Lohikar +delete-after: True +changes: + - rscadd: "A progress bar is now shown when you start an action which takes time." diff --git a/html/changelogs/lohikar-lighting.yml b/html/changelogs/lohikar-lighting.yml index d79fb92bd7a..b5169786f3a 100644 --- a/html/changelogs/lohikar-lighting.yml +++ b/html/changelogs/lohikar-lighting.yml @@ -1,7 +1,7 @@ author: Lohikar delete-after: True changes: - - rscadd: "Ported over /vg/'s smooth lighting system." + - rscadd: "Ported over and improved /vg/'s smooth lighting system." - rscadd: "Tweaked the emission color of station lighting." - rscadd: "Glowing slime cores now emit colored light instead of white light." - rscadd: "Space tiles are now darker." diff --git a/html/changelogs/lohikar-pr-1726.yml b/html/changelogs/lohikar-pr-1726.yml new file mode 100644 index 00000000000..1a29432244c --- /dev/null +++ b/html/changelogs/lohikar-pr-1726.yml @@ -0,0 +1,4 @@ +author: Lohikar +delete-after: True +changes: + - tweak: "Flashlights, Floodlights, and Synthetic Integrated lights are now directional." diff --git a/icons/effects/doafter_icon.dmi b/icons/effects/doafter_icon.dmi new file mode 100644 index 0000000000000000000000000000000000000000..5910ccf2c005057b53e9a1ee5489b2b034a2e209 GIT binary patch literal 587 zcmV-R0<`^!P)|rL?yL!2(b^bia|EGdr3xX{Pwj$V?V7COj zBiM#u_oQF^#?gHNd{&%5IspkQumUTv0xPfrE3ksIxPnrTYoPi7EeVPFztA>cAC7DLaHkXi z0Bp#?S=R@Mc_r@@XcosO1(L}-g_uV`gpdR9`6=)zLkQ)pvnXf3a(FOL>^>XIwR#kN7k&P~}lj}6|;g9*rgd^V!QvEsqa1Wk$5M2|# zQ}TQT0001BQ`T0ZpZ&p_TKL@`l(yVT^_30w+TeOU=?};je5wDk!QL2LZzlagXa>P| z5c~=N006+h^#?6ut8Z&J*gL`XZY=LTW9xr!H`pJ7>yK=k4A36{00016^9&8}+C77P Zc>`G$|4S{!RXG3v002ovPDHLkV1f^`0PX+) literal 0 HcmV?d00001