Merge pull request #5648 from king5327/polarissciconfix

Prevents people from HREF exploiting around the R&D console lock.
This commit is contained in:
Atermonera
2018-10-13 14:13:45 -07:00
committed by VirgoBot
parent 54d0c23456
commit dde25a46f0

24
code/modules/research/rdconsole.dm Normal file → Executable file
View File

@@ -121,7 +121,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
//Loading a disk into it.
if(istype(D, /obj/item/weapon/disk))
if(t_disk || d_disk)
user << "A disk is already loaded into the machine."
to_chat(user, "A disk is already loaded into the machine.")
return
if(istype(D, /obj/item/weapon/disk/tech_disk))
@@ -129,11 +129,11 @@ won't update every console in existence) but it's more of a hassle to do. Also,
else if (istype(D, /obj/item/weapon/disk/design_disk))
d_disk = D
else
user << "<span class='notice'>Machine cannot accept disks in that format.</span>"
to_chat(user, "<span class='notice'>Machine cannot accept disks in that format.</span>")
return
user.drop_item()
D.loc = src
user << "<span class='notice'>You add \the [D] to the machine.</span>"
to_chat(user, "<span class='notice'>You add \the [D] to the machine.</span>")
else
//The construction/deconstruction of the console code.
..()
@@ -145,7 +145,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(!emagged)
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
emagged = 1
user << "<span class='notice'>You you disable the security protocols.</span>"
to_chat(user, "<span class='notice'>You you disable the security protocols.</span>")
return 1
/obj/machinery/computer/rdconsole/Topic(href, href_list)
@@ -155,12 +155,16 @@ won't update every console in existence) but it's more of a hassle to do. Also,
add_fingerprint(usr)
usr.set_machine(src)
if((screen < 1 || (screen == 1.6 && href_list["menu"] != "1.0")) && (!allowed(usr) && !emagged)) //Stops people from HREF exploiting out of the lock screen, but allow it if they have the access.
to_chat(usr, "Unauthorized Access")
return
if(href_list["menu"]) //Switches menu screens. Converts a sent text string into a number. Saves a LOT of code.
var/temp_screen = text2num(href_list["menu"])
if(temp_screen <= 1.1 || (3 <= temp_screen && 4.9 >= temp_screen) || allowed(usr) || emagged) //Unless you are making something, you need access.
screen = temp_screen
else
usr << "Unauthorized Access."
to_chat(usr, "Unauthorized Access.")
else if(href_list["updt_tech"]) //Update the research holder with information from the technology disk.
screen = 0.0
@@ -211,7 +215,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
else if(href_list["eject_item"]) //Eject the item inside the destructive analyzer.
if(linked_destroy)
if(linked_destroy.busy)
usr << "<span class='notice'>The destructive analyzer is busy at the moment.</span>"
to_chat(usr, "<span class='notice'>The destructive analyzer is busy at the moment.</span>")
else if(linked_destroy.loaded_item)
linked_destroy.loaded_item.loc = linked_destroy.loc
@@ -222,7 +226,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
else if(href_list["deconstruct"]) //Deconstruct the item in the destructive analyzer and update the research holder.
if(linked_destroy)
if(linked_destroy.busy)
usr << "<span class='notice'>The destructive analyzer is busy at the moment.</span>"
to_chat(usr, "<span class='notice'>The destructive analyzer is busy at the moment.</span>")
else
if(alert("Proceeding will destroy loaded item. Continue?", "Destructive analyzer confirmation", "Yes", "No") == "No" || !linked_destroy)
return
@@ -234,7 +238,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(linked_destroy)
linked_destroy.busy = 0
if(!linked_destroy.loaded_item)
usr <<"<span class='notice'>The destructive analyzer appears to be empty.</span>"
to_chat(usr, "<span class='notice'>The destructive analyzer appears to be empty.</span>")
screen = 1.0
return
@@ -270,12 +274,12 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(allowed(usr))
screen = text2num(href_list["lock"])
else
usr << "Unauthorized Access."
to_chat(usr, "Unauthorized Access.")
else if(href_list["sync"]) //Sync the research holder with all the R&D consoles in the game that aren't sync protected.
screen = 0.0
if(!sync)
usr << "<span class='notice'>You must connect to the network first.</span>"
to_chat(usr, "<span class='notice'>You must connect to the network first.</span>")
else
griefProtection() //Putting this here because I dont trust the sync process
spawn(30)