Files
Polaris/code/modules/assembly/timer.dm
Aronai Sieyes 715de43f35 VChat: Redone chat output done in Vue.js (#6761)
* Better notifications

* Add buttons to del/move tabs in edit mode

* Add a <span> to emotes

* Fix duplicate IDs in VChat and add more logging

* VChat: Redone chat output in Vue.js

* Ported tg asset cache

* VChat DME Update

* Replace \image macro with bicon()

* NanoUI Subsystem Fixes

Don't do this, the asset subsystem does this for you

* Allow narrate/globalnarrate shenanigans

Allows HTML if your entire thing is HTML

* Disable bicon() icon object cache, and create text tag cache

* Ore Scanner is written incorrectly

Only revealed by vchat

* Fixes 2 VChat bugs

* Underline links in VChat

* Fix LOOC color

* VChat Improvements

Hopefully, anyway.
- Arbitrary font size setting
- Line height setting
- Multiple crush settings
- Rewrote how tabs work hopefully for performance
- Hidden messages are actually put elsewhere
- Attempts to correct chat backlog restore on rejoin

* Surgery steps to use <span>

* Some VChat Tweaks

- Chat remains between client reconnects if your client didn't close (so things like using the reconnect button, or autoreconnects at round end when that feels like working)
- The client doesn't send pings to the server, the server sends pings to the client. This fixes AFK measurements for AFK kick purposes.
- Turn latency indicator into a green/red indicator to show if you're connected, and when clicked will perform a one-time ping (and block doing it again for 10 seconds). It will display '?ms' if it never got a reply, or '999ms' if it did, but it was over 1s.

* Include date in filename for VChat log save

* Merge pull request #6767 from Cyantime/patch-2

Change chat export naming scheme

* Adds VChat tab saving

Saves every time you enter/exit edit mode. Persists between rounds, VChat reloads via verb, etc.

* Fix chat exporting when someone has used unicode

Only affects clients still using 512

* Use CLIENT_FROM_VAR for ease of code reading

* Update code/modules/client/asset_cache.dm

Co-Authored-By: Novacat <35587478+Novacat@users.noreply.github.com>

* Fix runtime when client disconnects before vchat loads

* Fix polaris version of command reports

* Fix LOOC color in oldchat

* Put some styles in various adminpm messages

* Round info and advanced who spans

* Fix missing tag-end

* Maybe fix images for linux and statpanel but also doom everyone

Co-authored-by: ShadowLarkens <ShadowLarkens@users.noreply.github.com>
Co-authored-by: Novacat <35587478+Novacat@users.noreply.github.com>
2020-03-27 14:07:28 -07:00

106 lines
2.6 KiB
Plaintext

/obj/item/device/assembly/timer
name = "timer"
desc = "Used to time things. Works well with contraptions which has to count down. Tick tock."
icon_state = "timer"
origin_tech = list(TECH_MAGNET = 1)
matter = list(DEFAULT_WALL_MATERIAL = 500, "glass" = 50, "waste" = 10)
wires = WIRE_PULSE
secured = 0
var/timing = 0
var/time = 10
/obj/item/device/assembly/timer/activate()
if(!..()) return 0//Cooldown check
timing = !timing
update_icon()
return 0
/obj/item/device/assembly/timer/toggle_secure()
secured = !secured
if(secured)
START_PROCESSING(SSobj, src)
else
timing = 0
STOP_PROCESSING(SSobj, src)
update_icon()
return secured
/obj/item/device/assembly/timer/proc/timer_end()
if(!secured) return 0
pulse(0)
if(!holder)
visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*")
cooldown = 2
spawn(10)
process_cooldown()
return
/obj/item/device/assembly/timer/process()
if(timing && (time > 0))
time--
if(timing && time <= 0)
timing = 0
timer_end()
time = 10
return
/obj/item/device/assembly/timer/update_icon()
overlays.Cut()
attached_overlays = list()
if(timing)
overlays += "timer_timing"
attached_overlays += "timer_timing"
if(holder)
holder.update_icon()
return
/obj/item/device/assembly/timer/interact(mob/user as mob)//TODO: Have this use the wires
if(!secured)
user.show_message("<font color='red'>The [name] is unsecured!</font>")
return 0
var/second = time % 60
var/minute = (time - second) / 60
var/dat = text("<TT><B>Timing Unit</B>\n[] []:[]\n<A href='?src=\ref[];tp=-30'>-</A> <A href='?src=\ref[];tp=-1'>-</A> <A href='?src=\ref[];tp=1'>+</A> <A href='?src=\ref[];tp=30'>+</A>\n</TT>", (timing ? text("<A href='?src=\ref[];time=0'>Timing</A>", src) : text("<A href='?src=\ref[];time=1'>Not Timing</A>", src)), minute, second, src, src, src, src)
dat += "<BR><BR><A href='?src=\ref[src];refresh=1'>Refresh</A>"
dat += "<BR><BR><A href='?src=\ref[src];close=1'>Close</A>"
user << browse(dat, "window=timer")
onclose(user, "timer")
return
/obj/item/device/assembly/timer/Topic(href, href_list, state = deep_inventory_state)
if(..()) return 1
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
usr << browse(null, "window=timer")
onclose(usr, "timer")
return
if(href_list["time"])
timing = text2num(href_list["time"])
update_icon()
if(href_list["tp"])
var/tp = text2num(href_list["tp"])
time += tp
time = min(max(round(time), 0), 600)
if(href_list["close"])
usr << browse(null, "window=timer")
return
if(usr)
attack_self(usr)
return