mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-30 23:48:28 +01:00
Fix up a number of ID checks
This commit is contained in:
@@ -129,7 +129,6 @@ var/const/access_trade_sol = 160
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
/obj/item/proc/GetAccess()
|
||||
return list()
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
|
||||
#define COMM_SCREEN_MAIN 1
|
||||
#define COMM_SCREEN_STAT 2
|
||||
#define COMM_SCREEN_MESSAGES 3
|
||||
#define COMM_SCREEN_SECLEVEL 4
|
||||
|
||||
#define COMM_AUTHENTICATION_NONE 0
|
||||
#define COMM_AUTHENTICATION_MIN 1
|
||||
#define COMM_AUTHENTICATION_MAX 2
|
||||
|
||||
// The communications computer
|
||||
/obj/machinery/computer/communications
|
||||
name = "communications console"
|
||||
@@ -13,7 +16,7 @@
|
||||
req_access = list(access_heads)
|
||||
circuit = /obj/item/weapon/circuitboard/communications
|
||||
var/prints_intercept = 1
|
||||
var/authenticated = 0
|
||||
var/authenticated = COMM_AUTHENTICATION_NONE
|
||||
var/list/messagetitle = list()
|
||||
var/list/messagetext = list()
|
||||
var/currmsg = 0
|
||||
@@ -39,16 +42,16 @@
|
||||
crew_announcement.newscast = 1
|
||||
|
||||
/obj/machinery/computer/communications/proc/is_authenticated(var/mob/user, var/message = 1)
|
||||
if(authenticated == 2)
|
||||
return 2
|
||||
if(authenticated == COMM_AUTHENTICATION_MAX)
|
||||
return COMM_AUTHENTICATION_MAX
|
||||
else if(user.can_admin_interact())
|
||||
return 2
|
||||
return COMM_AUTHENTICATION_MAX
|
||||
else if(authenticated)
|
||||
return 1
|
||||
return COMM_AUTHENTICATION_MIN
|
||||
else
|
||||
if(message)
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return 0
|
||||
return COMM_AUTHENTICATION_NONE
|
||||
|
||||
/obj/machinery/computer/communications/Topic(href, href_list)
|
||||
if(..(href, href_list))
|
||||
@@ -62,23 +65,23 @@
|
||||
if(!ishuman(usr))
|
||||
to_chat(usr, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
var/mob/living/carbon/human/M = usr
|
||||
var/obj/item/card = M.get_active_hand()
|
||||
var/obj/item/weapon/card/id/I = (card && card.GetID())||M.wear_id||M.wear_pda
|
||||
if(istype(I, /obj/item/device/pda))
|
||||
var/obj/item/device/pda/pda = I
|
||||
I = pda.id
|
||||
if(I && istype(I))
|
||||
if(src.check_access(I))
|
||||
authenticated = 1
|
||||
if(access_captain in I.access)
|
||||
authenticated = 2
|
||||
crew_announcement.announcer = GetNameAndAssignmentFromId(I)
|
||||
|
||||
var/list/access = usr.get_access()
|
||||
if(allowed(usr))
|
||||
authenticated = COMM_AUTHENTICATION_MIN
|
||||
|
||||
if(access_captain in access)
|
||||
authenticated = COMM_AUTHENTICATION_MAX
|
||||
var/mob/living/carbon/human/H = usr
|
||||
var/obj/item/weapon/card/id = H.get_idcard(TRUE)
|
||||
if(istype(id))
|
||||
crew_announcement.announcer = GetNameAndAssignmentFromId(id)
|
||||
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
|
||||
if(href_list["logout"])
|
||||
authenticated = 0
|
||||
authenticated = COMM_AUTHENTICATION_NONE
|
||||
crew_announcement.announcer = ""
|
||||
setMenuState(usr,COMM_SCREEN_MAIN)
|
||||
nanomanager.update_uis(src)
|
||||
@@ -131,13 +134,13 @@
|
||||
to_chat(usr, "<span class='warning'>You need to swipe your ID.</span>")
|
||||
|
||||
if("announce")
|
||||
if(is_authenticated(usr) == 2)
|
||||
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
|
||||
if(message_cooldown)
|
||||
to_chat(usr, "<span class='warning'>Please allow at least one minute to pass between announcements.</span>")
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
var/input = input(usr, "Please write a message to announce to the station crew.", "Priority Announcement")
|
||||
if(!input || message_cooldown || ..() || !(is_authenticated(usr) == 2))
|
||||
if(!input || message_cooldown || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
crew_announcement.Announce(input)
|
||||
@@ -213,13 +216,13 @@
|
||||
setMenuState(usr,COMM_SCREEN_STAT)
|
||||
|
||||
if("nukerequest")
|
||||
if(is_authenticated(usr) == 2)
|
||||
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
|
||||
if(centcomm_message_cooldown)
|
||||
to_chat(usr, "<span class='warning'>Arrays recycling. Please stand by.</span>")
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","") as text|null
|
||||
if(!input || ..() || !(is_authenticated(usr) == 2))
|
||||
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
Nuke_request(input, usr)
|
||||
@@ -232,13 +235,13 @@
|
||||
setMenuState(usr,COMM_SCREEN_MAIN)
|
||||
|
||||
if("MessageCentcomm")
|
||||
if(is_authenticated(usr) == 2)
|
||||
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
|
||||
if(centcomm_message_cooldown)
|
||||
to_chat(usr, "<span class='warning'>Arrays recycling. Please stand by.</span>")
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") as text|null
|
||||
if(!input || ..() || !(is_authenticated(usr) == 2))
|
||||
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
Centcomm_announce(input, usr)
|
||||
@@ -251,13 +254,13 @@
|
||||
|
||||
// OMG SYNDICATE ...LETTERHEAD
|
||||
if("MessageSyndicate")
|
||||
if((is_authenticated(usr) == 2) && (src.emagged))
|
||||
if((is_authenticated(usr) == COMM_AUTHENTICATION_MAX) && (src.emagged))
|
||||
if(centcomm_message_cooldown)
|
||||
to_chat(usr, "Arrays recycling. Please stand by.")
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "") as text|null
|
||||
if(!input || ..() || !(is_authenticated(usr) == 2))
|
||||
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
|
||||
nanomanager.update_uis(src)
|
||||
return
|
||||
Syndicate_announce(input, usr)
|
||||
@@ -518,7 +521,7 @@
|
||||
return ..()
|
||||
|
||||
shuttle_master.emergency.request(null, 0.3, null, "All communication consoles, boards, and AI's have been destroyed.")
|
||||
log_game("All the AIs, comm consoles and boards are destroyed. Shuttle called.")
|
||||
message_admins("All the AIs, comm consoles and boards are destroyed. Shuttle called.", 1)
|
||||
log_game("All the AI's, communication consoles and boards are destroyed. Shuttle called.")
|
||||
message_admins("All the AI's, communication consoles and boards are destroyed. Shuttle called.", 1)
|
||||
|
||||
return ..()
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
name = "airlock electronics"
|
||||
icon = 'icons/obj/doors/door_assembly.dmi'
|
||||
icon_state = "door_electronics"
|
||||
w_class = 2 //It should be tiny! -Agouri
|
||||
w_class = 2
|
||||
materials = list(MAT_METAL=50, MAT_GLASS=50)
|
||||
|
||||
req_access = list(access_engine)
|
||||
@@ -12,101 +12,96 @@
|
||||
var/list/conf_access = null
|
||||
var/one_access = 0 //if set to 1, door would receive req_one_access instead of req_access
|
||||
var/last_configurator = null
|
||||
var/locked = 1
|
||||
var/locked = TRUE
|
||||
var/const/max_brain_damage = 60 // Maximum brain damage a mob can have until it can't use the electronics
|
||||
|
||||
attack_self(mob/user as mob)
|
||||
if(!ishuman(user) && !istype(user,/mob/living/silicon/robot))
|
||||
return ..(user)
|
||||
/obj/item/weapon/airlock_electronics/attack_self(mob/user)
|
||||
if(!ishuman(user) && !isrobot(user))
|
||||
return ..()
|
||||
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.getBrainLoss() >= 60)
|
||||
if(H.getBrainLoss() >= max_brain_damage)
|
||||
to_chat(user, "<span class='warning'>You forget how to use \the [src].</span>")
|
||||
return
|
||||
|
||||
var/t1 = text("<B>Access control</B><br>\n")
|
||||
var/t1 = text("<B>Access control</B><br>\n")
|
||||
|
||||
if(last_configurator)
|
||||
t1 += "Operator: [last_configurator]<br>"
|
||||
|
||||
if(last_configurator)
|
||||
t1 += "Operator: [last_configurator]<br>"
|
||||
if(locked)
|
||||
t1 += "<a href='?src=[UID()];login=1'>Swipe ID</a><hr>"
|
||||
else
|
||||
t1 += "<a href='?src=[UID()];logout=1'>Block</a><hr>"
|
||||
|
||||
if(locked)
|
||||
t1 += "<a href='?src=[UID()];login=1'>Swipe ID</a><hr>"
|
||||
t1 += "Access requirement is set to "
|
||||
t1 += one_access ? "<a style='color: green' href='?src=[UID()];one_access=1'>ONE</a><hr>" : "<a style='color: red' href='?src=[UID()];one_access=1'>ALL</a><hr>"
|
||||
|
||||
t1 += conf_access == null ? "<font color=red>All</font><br>" : "<a href='?src=[UID()];access=all'>All</a><br>"
|
||||
|
||||
t1 += "<br>"
|
||||
|
||||
var/list/accesses = get_all_accesses()
|
||||
for(var/acc in accesses)
|
||||
var/aname = get_access_desc(acc)
|
||||
|
||||
if(!conf_access || !conf_access.len || !(acc in conf_access))
|
||||
t1 += "<a href='?src=[UID()];access=[acc]'>[aname]</a><br>"
|
||||
else if(one_access)
|
||||
t1 += "<a style='color: green' href='?src=[UID()];access=[acc]'>[aname]</a><br>"
|
||||
else
|
||||
t1 += "<a style='color: red' href='?src=[UID()];access=[acc]'>[aname]</a><br>"
|
||||
|
||||
t1 += "<p><a href='?src=[UID()];close=1'>Close</a></p>\n"
|
||||
|
||||
var/datum/browser/popup = new(user, "airlock_electronics", name, 400, 400)
|
||||
popup.set_content(t1)
|
||||
popup.open(0)
|
||||
onclose(user, "airlock")
|
||||
|
||||
/obj/item/weapon/airlock_electronics/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if(usr.incapacitated() || (!ishuman(usr) && !isrobot(usr)))
|
||||
return 1
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=airlock")
|
||||
return
|
||||
|
||||
if(href_list["login"])
|
||||
if(allowed(usr))
|
||||
locked = FALSE
|
||||
last_configurator = usr.name
|
||||
|
||||
if(locked)
|
||||
return
|
||||
|
||||
if(href_list["logout"])
|
||||
locked = TRUE
|
||||
|
||||
if(href_list["one_access"])
|
||||
one_access = !one_access
|
||||
|
||||
if(href_list["access"])
|
||||
toggle_access(href_list["access"])
|
||||
|
||||
attack_self(usr)
|
||||
|
||||
/obj/item/weapon/airlock_electronics/proc/toggle_access(var/access)
|
||||
if(access == "all")
|
||||
conf_access = null
|
||||
else
|
||||
var/req = text2num(access)
|
||||
|
||||
if(conf_access == null)
|
||||
conf_access = list()
|
||||
|
||||
if(!(req in conf_access))
|
||||
conf_access += req
|
||||
else
|
||||
t1 += "<a href='?src=[UID()];logout=1'>Block</a><hr>"
|
||||
|
||||
t1 += "Access requirement is set to "
|
||||
t1 += one_access ? "<a style='color: green' href='?src=[UID()];one_access=1'>ONE</a><hr>" : "<a style='color: red' href='?src=[UID()];one_access=1'>ALL</a><hr>"
|
||||
|
||||
t1 += conf_access == null ? "<font color=red>All</font><br>" : "<a href='?src=[UID()];access=all'>All</a><br>"
|
||||
|
||||
t1 += "<br>"
|
||||
|
||||
var/list/accesses = get_all_accesses()
|
||||
for(var/acc in accesses)
|
||||
var/aname = get_access_desc(acc)
|
||||
|
||||
if(!conf_access || !conf_access.len || !(acc in conf_access))
|
||||
t1 += "<a href='?src=[UID()];access=[acc]'>[aname]</a><br>"
|
||||
else if(one_access)
|
||||
t1 += "<a style='color: green' href='?src=[UID()];access=[acc]'>[aname]</a><br>"
|
||||
else
|
||||
t1 += "<a style='color: red' href='?src=[UID()];access=[acc]'>[aname]</a><br>"
|
||||
|
||||
t1 += "<p><a href='?src=[UID()];close=1'>Close</a></p>\n"
|
||||
|
||||
var/datum/browser/popup = new(user, "airlock_electronics", name, 400, 400)
|
||||
popup.set_content(t1)
|
||||
popup.open(0)
|
||||
onclose(user, "airlock")
|
||||
|
||||
Topic(href, href_list)
|
||||
..()
|
||||
if(usr.stat || usr.restrained() || (!ishuman(usr) && !istype(usr,/mob/living/silicon)))
|
||||
return
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=airlock")
|
||||
return
|
||||
|
||||
if(href_list["login"])
|
||||
if(istype(usr,/mob/living/silicon))
|
||||
src.locked = 0
|
||||
src.last_configurator = usr.name
|
||||
else
|
||||
var/obj/item/I = usr.get_active_hand()
|
||||
if(istype(I, /obj/item/device/pda))
|
||||
var/obj/item/device/pda/pda = I
|
||||
I = pda.id
|
||||
if(I && src.check_access(I))
|
||||
src.locked = 0
|
||||
src.last_configurator = I:registered_name
|
||||
|
||||
if(locked)
|
||||
return
|
||||
|
||||
if(href_list["logout"])
|
||||
locked = 1
|
||||
|
||||
if(href_list["one_access"])
|
||||
one_access = !one_access
|
||||
|
||||
if(href_list["access"])
|
||||
toggle_access(href_list["access"])
|
||||
|
||||
attack_self(usr)
|
||||
|
||||
proc
|
||||
toggle_access(var/acc)
|
||||
if(acc == "all")
|
||||
conf_access -= req
|
||||
if(!conf_access.len)
|
||||
conf_access = null
|
||||
else
|
||||
var/req = text2num(acc)
|
||||
|
||||
if(conf_access == null)
|
||||
conf_access = list()
|
||||
|
||||
if(!(req in conf_access))
|
||||
conf_access += req
|
||||
else
|
||||
conf_access -= req
|
||||
if(!conf_access.len)
|
||||
conf_access = null
|
||||
|
||||
|
||||
@@ -16,41 +16,41 @@
|
||||
var/icon_closed = "lockbox"
|
||||
var/icon_broken = "lockbox+b"
|
||||
|
||||
|
||||
attackby(obj/item/weapon/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/weapon/card/id))
|
||||
if(src.broken)
|
||||
to_chat(user, "<span class='warning'>It appears to be broken.</span>")
|
||||
return
|
||||
if(src.allowed(user))
|
||||
src.locked = !( src.locked )
|
||||
if(src.locked)
|
||||
src.icon_state = src.icon_locked
|
||||
to_chat(user, "<span class='warning'>You lock the [src.name]!</span>")
|
||||
return
|
||||
else
|
||||
src.icon_state = src.icon_closed
|
||||
to_chat(user, "<span class='warning'>You unlock the [src.name]!</span>")
|
||||
origin_tech = null //wipe out any origin tech if it's unlocked in any way so you can't double-dip tech levels at R&D.
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Access Denied</span>")
|
||||
else if((istype(W, /obj/item/weapon/card/emag) || istype(W, /obj/item/weapon/melee/energy/blade)) && !broken)
|
||||
emag_act(user)
|
||||
/obj/item/weapon/storage/lockbox/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda))
|
||||
if(broken)
|
||||
to_chat(user, "<span class='warning'>It appears to be broken.</span>")
|
||||
return
|
||||
if(!locked)
|
||||
..()
|
||||
if(check_access(W))
|
||||
locked = !locked
|
||||
if(locked)
|
||||
icon_state = icon_locked
|
||||
to_chat(user, "<span class='warning'>You lock \the [src]!</span>")
|
||||
return
|
||||
else
|
||||
icon_state = icon_closed
|
||||
to_chat(user, "<span class='warning'>You unlock \the [src]!</span>")
|
||||
origin_tech = null //wipe out any origin tech if it's unlocked in any way so you can't double-dip tech levels at R&D.
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>It's locked!</span>")
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return
|
||||
else if((istype(W, /obj/item/weapon/card/emag) || (istype(W, /obj/item/weapon/melee/energy/blade)) && !broken))
|
||||
emag_act(user)
|
||||
return
|
||||
if(!locked)
|
||||
..()
|
||||
else
|
||||
to_chat(user, "<span class='warning'>It's locked!</span>")
|
||||
return
|
||||
|
||||
|
||||
show_to(mob/user as mob)
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>It's locked!</span>")
|
||||
else
|
||||
..()
|
||||
return
|
||||
/obj/item/weapon/storage/lockbox/show_to(mob/user as mob)
|
||||
if(locked)
|
||||
to_chat(user, "<span class='warning'>It's locked!</span>")
|
||||
else
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/lockbox/can_be_inserted(obj/item/W as obj, stop_messages = 0)
|
||||
if(!locked)
|
||||
@@ -64,7 +64,7 @@
|
||||
broken = 1
|
||||
locked = 0
|
||||
desc = "It appears to be broken."
|
||||
icon_state = src.icon_broken
|
||||
icon_state = icon_broken
|
||||
to_chat(user, "<span class='notice'>You unlock \the [src].</span>")
|
||||
origin_tech = null //wipe out any origin tech if it's unlocked in any way so you can't double-dip tech levels at R&D.
|
||||
return
|
||||
@@ -84,23 +84,21 @@
|
||||
name = "Lockbox (Mindshield Implants)"
|
||||
req_access = list(access_security)
|
||||
|
||||
New()
|
||||
..()
|
||||
new /obj/item/weapon/implantcase/loyalty(src)
|
||||
new /obj/item/weapon/implantcase/loyalty(src)
|
||||
new /obj/item/weapon/implantcase/loyalty(src)
|
||||
new /obj/item/weapon/implanter/loyalty(src)
|
||||
|
||||
/obj/item/weapon/storage/lockbox/loyalty/New()
|
||||
..()
|
||||
new /obj/item/weapon/implantcase/loyalty(src)
|
||||
new /obj/item/weapon/implantcase/loyalty(src)
|
||||
new /obj/item/weapon/implantcase/loyalty(src)
|
||||
new /obj/item/weapon/implanter/loyalty(src)
|
||||
|
||||
/obj/item/weapon/storage/lockbox/clusterbang
|
||||
name = "lockbox (clusterbang)"
|
||||
desc = "You have a bad feeling about opening this."
|
||||
req_access = list(access_security)
|
||||
|
||||
New()
|
||||
..()
|
||||
new /obj/item/weapon/grenade/clusterbuster(src)
|
||||
|
||||
/obj/item/weapon/storage/lockbox/clusterbang/New()
|
||||
..()
|
||||
new /obj/item/weapon/grenade/clusterbuster(src)
|
||||
|
||||
/obj/item/weapon/storage/lockbox/medal
|
||||
name = "medal box"
|
||||
@@ -116,14 +114,14 @@
|
||||
icon_closed = "medalbox"
|
||||
icon_broken = "medalbox+b"
|
||||
|
||||
New()
|
||||
..()
|
||||
new /obj/item/clothing/accessory/medal/gold/heroism(src)
|
||||
new /obj/item/clothing/accessory/medal/silver/security(src)
|
||||
new /obj/item/clothing/accessory/medal/silver/valor(src)
|
||||
new /obj/item/clothing/accessory/medal/nobel_science(src)
|
||||
new /obj/item/clothing/accessory/medal/bronze_heart(src)
|
||||
new /obj/item/clothing/accessory/medal/conduct(src)
|
||||
new /obj/item/clothing/accessory/medal/conduct(src)
|
||||
new /obj/item/clothing/accessory/medal/conduct(src)
|
||||
new /obj/item/clothing/accessory/medal/gold/captain(src)
|
||||
/obj/item/weapon/storage/lockbox/medal/New()
|
||||
..()
|
||||
new /obj/item/clothing/accessory/medal/gold/heroism(src)
|
||||
new /obj/item/clothing/accessory/medal/silver/security(src)
|
||||
new /obj/item/clothing/accessory/medal/silver/valor(src)
|
||||
new /obj/item/clothing/accessory/medal/nobel_science(src)
|
||||
new /obj/item/clothing/accessory/medal/bronze_heart(src)
|
||||
new /obj/item/clothing/accessory/medal/conduct(src)
|
||||
new /obj/item/clothing/accessory/medal/conduct(src)
|
||||
new /obj/item/clothing/accessory/medal/conduct(src)
|
||||
new /obj/item/clothing/accessory/medal/gold/captain(src)
|
||||
|
||||
Reference in New Issue
Block a user