Remove spaces from module files

This commit is contained in:
Markolie
2015-09-27 07:32:07 +02:00
parent 4bf3bb9c31
commit 0b030a63bd
25 changed files with 385 additions and 1165 deletions
@@ -0,0 +1,186 @@
/obj/machinery/keycard_auth
name = "Keycard Authentication Device"
desc = "This device is used to trigger station functions, which require more than one ID card to authenticate."
icon = 'icons/obj/monitors.dmi'
icon_state = "auth_off"
var/active = 0 //This gets set to 1 on all devices except the one where the initial request was made.
var/event = ""
var/screen = 1
var/list/ert_chosen = list()
var/confirmed = 0 //This variable is set by the device that confirms the request.
var/confirm_delay = 20 //(2 seconds)
var/busy = 0 //Busy when waiting for authentication or an event request has been sent from this device.
var/obj/machinery/keycard_auth/event_source
var/mob/event_triggered_by
var/mob/event_confirmed_by
var/ert_reason = "Reason for ERT"
//1 = select event
//2 = authenticate
anchored = 1.0
use_power = 1
idle_power_usage = 2
active_power_usage = 6
power_channel = ENVIRON
/obj/machinery/keycard_auth/attack_ai(mob/user as mob)
user << "The station AI is not to interact with these devices."
return
/obj/machinery/keycard_auth/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
if(stat & (NOPOWER|BROKEN))
user << "This device is not powered."
return
if(istype(W,/obj/item/weapon/card/id))
var/obj/item/weapon/card/id/ID = W
if(access_keycard_auth in ID.access)
if(active == 1)
//This is not the device that made the initial request. It is the device confirming the request.
if(event_source)
event_source.confirmed = 1
event_source.event_confirmed_by = usr
else if(screen == 2)
if(event == "Emergency Response Team" && ert_reason == "Reason for ERT")
user << "<span class='notice'>Supply a reason for calling the ERT first!</span>"
return
event_triggered_by = usr
broadcast_request() //This is the device making the initial event request. It needs to broadcast to other devices
/obj/machinery/keycard_auth/power_change()
if(powered(ENVIRON))
stat &= ~NOPOWER
icon_state = "auth_off"
else
stat |= NOPOWER
/obj/machinery/keycard_auth/attack_hand(mob/user as mob)
if(!user.IsAdvancedToolUser())
return 0
ui_interact(user)
/obj/machinery/keycard_auth/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(user.stat || stat & (NOPOWER|BROKEN))
user << "This device is not powered."
return
if(busy)
user << "This device is busy."
return
user.set_machine(src)
var/data[0]
data["screen"] = screen
data["event"] = event
data["ertreason"] = ert_reason
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "keycard_auth.tmpl", "Keycard Authentication Device UI", 520, 320)
ui.set_initial_data(data)
ui.open()
/obj/machinery/keycard_auth/Topic(href, href_list)
if(..())
return
if(busy)
usr << "This device is busy."
return
if(usr.stat || stat & (BROKEN|NOPOWER))
usr << "This device is without power."
return
if(href_list["triggerevent"])
event = href_list["triggerevent"]
screen = 2
if(href_list["reset"])
reset()
if(href_list["ert"])
ert_reason = input(usr, "Reason for ERT Call:", "", "")
nanomanager.update_uis(src)
add_fingerprint(usr)
return
/obj/machinery/keycard_auth/proc/reset()
active = 0
event = ""
screen = 1
confirmed = 0
event_source = null
icon_state = "auth_off"
event_triggered_by = null
event_confirmed_by = null
/obj/machinery/keycard_auth/proc/broadcast_request()
icon_state = "auth_on"
for(var/obj/machinery/keycard_auth/KA in world)
if(KA == src) continue
KA.reset()
spawn()
KA.receive_request(src)
sleep(confirm_delay)
if(confirmed)
confirmed = 0
trigger_event(event)
log_game("[key_name(event_triggered_by)] triggered and [key_name(event_confirmed_by)] confirmed event [event]")
message_admins("[key_name_admin(event_triggered_by)] triggered and [key_name_admin(event_confirmed_by)] confirmed event [event]", 1)
reset()
/obj/machinery/keycard_auth/proc/receive_request(var/obj/machinery/keycard_auth/source)
if(stat & (BROKEN|NOPOWER))
return
event_source = source
busy = 1
active = 1
icon_state = "auth_on"
sleep(confirm_delay)
event_source = null
icon_state = "auth_off"
active = 0
busy = 0
/obj/machinery/keycard_auth/proc/trigger_event()
switch(event)
if("Red Alert")
set_security_level(SEC_LEVEL_RED)
feedback_inc("alert_keycard_auth_red",1)
if("Grant Emergency Maintenance Access")
make_maint_all_access()
feedback_inc("alert_keycard_auth_maintGrant",1)
if("Revoke Emergency Maintenance Access")
revoke_maint_all_access()
feedback_inc("alert_keycard_auth_maintRevoke",1)
if("Emergency Response Team")
if(is_ert_blocked())
usr << "\red All Emergency Response Teams are dispatched and can not be called at this time."
return
usr << "<span class = 'notice'>ERT request transmitted.</span>"
if(admins.len)
ERT_Announce(ert_reason , event_triggered_by)
ert_reason = "Reason for ERT"
feedback_inc("alert_keycard_auth_ert",1)
else
trigger_armed_response_team(new /datum/response_team/amber) // No admins? No problem. Automatically send a code amber ERT.
/obj/machinery/keycard_auth/proc/is_ert_blocked()
return ticker.mode && ticker.mode.ert_disabled
var/global/maint_all_access = 0
/proc/make_maint_all_access()
for(var/area/maintenance/A in world)
for(var/obj/machinery/door/airlock/D in A)
D.emergency = 1
D.update_icon(0)
minor_announcement.Announce("The maintenance access requirement has been revoked on all airlocks.")
maint_all_access = 1
/proc/revoke_maint_all_access()
for(var/area/maintenance/A in world)
for(var/obj/machinery/door/airlock/D in A)
D.emergency = 0
D.update_icon(0)
minor_announcement.Announce("The maintenance access requirement has been readded on all maintenance airlocks.")
maint_all_access = 0
@@ -0,0 +1,184 @@
/var/security_level = 0
//0 = code green
//1 = code blue
//2 = code red
//3 = gamma
//4 = epsilon
//5 = code delta
//config.alert_desc_blue_downto
/var/datum/announcement/priority/security/security_announcement_up = new(do_log = 0, do_newscast = 1, new_sound = sound('sound/misc/notice1.ogg'))
/var/datum/announcement/priority/security/security_announcement_down = new(do_log = 0, do_newscast = 1)
/proc/set_security_level(var/level)
switch(level)
if("green")
level = SEC_LEVEL_GREEN
if("blue")
level = SEC_LEVEL_BLUE
if("red")
level = SEC_LEVEL_RED
if("gamma")
level = SEC_LEVEL_GAMMA
if("epsilon")
level = SEC_LEVEL_EPSILON
if("delta")
level = SEC_LEVEL_DELTA
//Will not be announced if you try to set to the same level as it already is
if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_DELTA && level != security_level)
switch(level)
if(SEC_LEVEL_GREEN)
security_announcement_down.Announce("All threats to the station have passed. All weapons need to be holstered and privacy laws are once again fully enforced.","Attention! Security level lowered to green.")
security_level = SEC_LEVEL_GREEN
for(var/obj/machinery/firealarm/FA in world)
if((FA.z in config.contact_levels))
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_green")
if(SEC_LEVEL_BLUE)
if(security_level < SEC_LEVEL_BLUE)
security_announcement_up.Announce("The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible and random searches are permitted.","Attention! Security level elevated to blue.")
else
security_announcement_down.Announce("The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed.","Attention! Security level lowered to blue.")
security_level = SEC_LEVEL_BLUE
for(var/obj/machinery/firealarm/FA in world)
if((FA.z in config.contact_levels))
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_blue")
if(SEC_LEVEL_RED)
if(security_level < SEC_LEVEL_RED)
security_announcement_up.Announce("There is an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.","Attention! Code Red!")
else
security_announcement_down.Announce("The station's self-destruct mechanism has been deactivated, but there is still an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.","Attention! Code Red!")
security_level = SEC_LEVEL_RED
var/obj/machinery/door/airlock/highsecurity/red/R = locate(/obj/machinery/door/airlock/highsecurity/red) in world
if(R && (R.z in config.station_levels))
R.locked = 0
R.update_icon()
var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world)
if(CC)
CC.post_status("alert", "redalert")
for(var/obj/machinery/firealarm/FA in world)
if((FA.z in config.contact_levels))
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_red")
if(SEC_LEVEL_GAMMA)
security_announcement_up.Announce("Central Command has ordered the Gamma security level on the station. Security is to have weapons equipped at all times, and all civilians are to immediately seek their nearest head for transportation to a secure location. The station's Gamma armory has been unlocked and is ready for use.","Attention! Gamma security level activated!")
security_level = SEC_LEVEL_GAMMA
move_gamma_ship()
if(security_level < SEC_LEVEL_RED)
for(var/obj/machinery/door/airlock/highsecurity/red/R in world)
if((R.z in config.station_levels))
R.locked = 0
R.update_icon()
for(var/obj/machinery/door/airlock/hatch/gamma/H in world)
if((H.z in config.station_levels))
H.locked = 0
H.update_icon()
var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world)
if(CC)
CC.post_status("alert", "redalert")
for(var/obj/machinery/firealarm/FA in world)
if((FA.z in config.contact_levels))
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_gamma")
FA.update_icon()
if(SEC_LEVEL_EPSILON)
security_announcement_up.Announce("Central Command has ordered the Epsilon security level on the station. Consider all contracts terminated.","Attention! Epsilon security level activated!")
security_level = SEC_LEVEL_EPSILON
var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world)
if(CC)
CC.post_status("alert", "redalert")
for(var/obj/machinery/firealarm/FA in world)
if((FA.z in config.contact_levels))
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_epsilon")
if(SEC_LEVEL_DELTA)
security_announcement_up.Announce("The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.","Attention! Delta security level reached!")
security_level = SEC_LEVEL_DELTA
var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world)
if(CC)
CC.post_status("alert", "redalert")
for(var/obj/machinery/firealarm/FA in world)
if((FA.z in config.contact_levels))
FA.overlays = list()
FA.overlays += image('icons/obj/monitors.dmi', "overlay_delta")
else
return
/proc/get_security_level()
switch(security_level)
if(SEC_LEVEL_GREEN)
return "green"
if(SEC_LEVEL_BLUE)
return "blue"
if(SEC_LEVEL_RED)
return "red"
if(SEC_LEVEL_GAMMA)
return "gamma"
if(SEC_LEVEL_EPSILON)
return "epsilon"
if(SEC_LEVEL_DELTA)
return "delta"
/proc/num2seclevel(var/num)
switch(num)
if(SEC_LEVEL_GREEN)
return "green"
if(SEC_LEVEL_BLUE)
return "blue"
if(SEC_LEVEL_RED)
return "red"
if(SEC_LEVEL_GAMMA)
return "gamma"
if(SEC_LEVEL_EPSILON)
return "epsilon"
if(SEC_LEVEL_DELTA)
return "delta"
/proc/seclevel2num(var/seclevel)
switch( lowertext(seclevel) )
if("green")
return SEC_LEVEL_GREEN
if("blue")
return SEC_LEVEL_BLUE
if("red")
return SEC_LEVEL_RED
if("gamma")
return SEC_LEVEL_GAMMA
if("epsilon")
return SEC_LEVEL_EPSILON
if("delta")
return SEC_LEVEL_DELTA
/*DEBUG
/mob/verb/set_thing0()
set_security_level(0)
/mob/verb/set_thing1()
set_security_level(1)
/mob/verb/set_thing2()
set_security_level(2)
/mob/verb/set_thing3()
set_security_level(3)
*/