mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-26 17:41:05 +00:00
* Add the system for managed global variables * Travis ban old globals * So you CAN inline proccall, that's neat * Fix that * master.dm * Remove the hack procs * Move InitGlobals to the proper spot * configuration.dm * Fix the missing pre-slash * clockcult.dm * This is probably for the best * Doy * Fix shit * Rest of the DEFINES tree * Fix * Use global. for access * Update find_references_in_globals Always hated that proc Whoever made it must've bee a r e a l idiot... * __HELPERS tree * Move global initialization to master. Fix the declaration * database.dm * Dat newline * I said DECLARATIVE order! * Here's something you can chew on @Iamgoofball * game_modes.dm * Fix this * genetics.dm * flavor_misc.dm * More stuff * Do it mso's way. Keep the controllers as global * Make master actually see it * Fix * Finish _globalvars/lists * Finish the rest of the _globalvars tree * This is weird * Migrate the controllers * SLOTH -> GLOB * Lighting globals * round_start_time -> ticker * PAI card list -> pai SS * record_id_num -> static * Diseases list -> SSdisease * More disease globals to the SS * More disease stuff * Emote list * Better and better * Bluh * So much stuff * Ahh * Wires * dview * station_areas * Teleportlocs * blood_splatter_icons * Stuff and such * More stuff * RAD IO * More stuff and such * Blob shit * Changeling stuff * Add "Balance" to changelogs * Balance for changelog compiler + Auto Tagging * Update the PR template * hivemind_bank * Bip * sacrificed * Good shit * Better define * More cult shit * Devil shit * Gang shit * > borers Fix shit * Rename the define * Nuke * Objectives * Sandbox * Multiverse sword * Announce systems * Stuff and such * TC con * Airlock * doppllllerrrrrr * holopads * Shut up byond you inconsistent fuck * Sneaky fuck * Burp * Bip * Fixnshit * Port without regard * askdlfjs; * asdfjasoidojfi * Protected globals and more * SO MANY * ajsimkvahsaoisd * akfdsiaopwimfeoiwafaw * gsdfigjosidjfgiosdg * AHHHHHHHHHHHHHHHHHHHHHHH!!!!! * facerolll * ASDFASDFASDF * Removes the unused parts of dmm_suite * WIP * Fix quote * asdfjauwfnkjs * afwlunhskjfda * asfjlaiwuefhaf * SO CLOSE * wwwweeeeeewwwww * agdgmoewranwg * HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!? * Fix syntax errors * 100 errors * Another 100 * So many... * Ugh * More shit * kilme * Stuuuuuufffff * ajrgmrlshio;djfa;sdkl * jkbhkhjbmjvjmh * soi soi soi * butt * TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING * lllllllllllllllllllllllllllllllllllllllllll * afsdijfiawhnflnjhnwsdfs * yugykihlugk,kj * time to go * STUFFF!!! * AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!! * ngoaijdjlfkamsdlkf * Break time * aufjsdklfalsjfi * CONTROL KAY AND PRAY * IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Goteem * Fix testing mode * This does not belong in this PR * Convert it to a controller * Eh, fuck this option * Revert controllerization Ill do it some other time * Fix * Working controllerization * FOR THE LOVE OF CHRIST PROTECT THE LOGS * Protect admins and deadmins * Use the inbuilt proc
116 lines
3.3 KiB
Plaintext
116 lines
3.3 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"
|
|
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
|
origin_tech = "magnets=1;engineering=1"
|
|
attachable = 1
|
|
|
|
var/timing = 0
|
|
var/time = 5
|
|
var/saved_time = 5
|
|
var/loop = 0
|
|
|
|
|
|
/obj/item/device/assembly/timer/New()
|
|
..()
|
|
START_PROCESSING(SSobj, src)
|
|
|
|
/obj/item/device/assembly/timer/describe()
|
|
if(timing)
|
|
return "The timer is counting down from [time]!"
|
|
return "The timer is set for [time] seconds."
|
|
|
|
|
|
/obj/item/device/assembly/timer/activate()
|
|
if(!..())
|
|
return 0//Cooldown check
|
|
timing = !timing
|
|
update_icon()
|
|
return 1
|
|
|
|
|
|
/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 || next_activate > world.time)
|
|
return FALSE
|
|
pulse(0)
|
|
audible_message("\icon[src] *beep* *beep*", null, 3)
|
|
if(loop)
|
|
timing = 1
|
|
update_icon()
|
|
|
|
|
|
/obj/item/device/assembly/timer/process()
|
|
if(timing)
|
|
time--
|
|
if(time <= 0)
|
|
timing = 0
|
|
timer_end()
|
|
time = saved_time
|
|
|
|
|
|
/obj/item/device/assembly/timer/update_icon()
|
|
cut_overlays()
|
|
attached_overlays = list()
|
|
if(timing)
|
|
add_overlay("timer_timing")
|
|
attached_overlays += "timer_timing"
|
|
if(holder)
|
|
holder.update_icon()
|
|
|
|
|
|
/obj/item/device/assembly/timer/interact(mob/user)//TODO: Have this use the wires
|
|
if(is_secured(user))
|
|
var/second = time % 60
|
|
var/minute = (time - second) / 60
|
|
var/dat = "<TT><B>Timing Unit</B>\n[(timing ? "<A href='?src=\ref[src];time=0'>Timing</A>" : "<A href='?src=\ref[src];time=1'>Not Timing</A>")] [minute]:[second]\n<A href='?src=\ref[src];tp=-30'>-</A> <A href='?src=\ref[src];tp=-1'>-</A> <A href='?src=\ref[src];tp=1'>+</A> <A href='?src=\ref[src];tp=30'>+</A>\n</TT>"
|
|
dat += "<BR><BR><A href='?src=\ref[src];repeat=[(loop ? "0'>Stop repeating" : "1'>Set to repeat")]</A>"
|
|
dat += "<BR><BR><A href='?src=\ref[src];refresh=1'>Refresh</A>"
|
|
dat += "<BR><BR><A href='?src=\ref[src];close=1'>Close</A>"
|
|
var/datum/browser/popup = new(user, "timer", name)
|
|
popup.set_content(dat)
|
|
popup.open()
|
|
|
|
|
|
/obj/item/device/assembly/timer/Topic(href, href_list)
|
|
..()
|
|
if(usr.incapacitated() || !in_range(loc, usr))
|
|
usr << browse(null, "window=timer")
|
|
onclose(usr, "timer")
|
|
return
|
|
|
|
if(href_list["time"])
|
|
timing = text2num(href_list["time"])
|
|
if(timing && istype(holder, /obj/item/device/transfer_valve))
|
|
var/timer_message = "[key_name_admin(usr)](<A HREF='?_src_=holder;adminmoreinfo=\ref[usr]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[usr]'>FLW</A>) activated [src] attachment on [holder]."
|
|
message_admins(timer_message)
|
|
GLOB.bombers += timer_message
|
|
log_game("[key_name(usr)] activated [src] attachment for [loc]")
|
|
update_icon()
|
|
if(href_list["repeat"])
|
|
loop = text2num(href_list["repeat"])
|
|
|
|
if(href_list["tp"])
|
|
var/tp = text2num(href_list["tp"])
|
|
time += tp
|
|
time = min(max(round(time), 1), 600)
|
|
saved_time = time
|
|
|
|
if(href_list["close"])
|
|
usr << browse(null, "window=timer")
|
|
return
|
|
|
|
if(usr)
|
|
attack_self(usr)
|