mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
Genpop for security
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#define ACCESS_MORGUE 6
|
||||
#define ACCESS_TOX 7 //R&D department, R&D console, burn chamber on some maps
|
||||
#define ACCESS_TOX_STORAGE 8 //Toxins storage, burn chamber on some maps
|
||||
#define ACCESS_GENETICS 9
|
||||
#define ACCESS_GENETICS 9
|
||||
#define ACCESS_ENGINE 10 //Engineering area, power monitor, power flow control console
|
||||
#define ACCESS_ENGINE_EQUIP 11 //APCs, EngiVend/YouTool, engineering equipment lockers
|
||||
#define ACCESS_MAINT_TUNNELS 12
|
||||
@@ -64,6 +64,8 @@
|
||||
#define ACCESS_WEAPONS 66 //Weapon authorization for secbots
|
||||
#define ACCESS_NETWORK 67 //NTnet diagnostics/monitoring software
|
||||
#define ACCESS_CLONING 68 //Cloning room and clone pod ejection
|
||||
#define ACCESS_ENTER_GENPOP 69
|
||||
#define ACCESS_LEAVE_GENPOP 70
|
||||
|
||||
//BEGIN CENTCOM ACCESS
|
||||
/*Should leave plenty of room if we need to add more access levels.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
area_type = /area
|
||||
protected_areas = list(/area/maintenance, /area/ai_monitored/turret_protected/ai_upload, /area/ai_monitored/turret_protected/ai_upload_foyer,
|
||||
/area/ai_monitored/turret_protected/ai, /area/storage/emergency/starboard, /area/storage/emergency/port, /area/shuttle)
|
||||
/area/ai_monitored/turret_protected/ai, /area/storage/emergency/starboard, /area/storage/emergency/port, /area/shuttle, /area/security/prison)
|
||||
target_trait = ZTRAIT_STATION
|
||||
|
||||
immunity_type = "rad"
|
||||
|
||||
84
code/game/machinery/turnstile.dm
Normal file
84
code/game/machinery/turnstile.dm
Normal file
@@ -0,0 +1,84 @@
|
||||
/obj/machinery/turnstile
|
||||
name = "turnstile"
|
||||
desc = "A mechanical door that permits one-way access and prevents tailgating."
|
||||
icon = 'icons/obj/turnstile.dmi'
|
||||
icon_state = "turnstile_map"
|
||||
density = FALSE
|
||||
armor = list(melee = 50, bullet = 50, laser = 50, energy = 50, bomb = 10, bio = 100, rad = 100, fire = 90, acid = 70)
|
||||
anchored = TRUE
|
||||
use_power = FALSE
|
||||
idle_power_usage = 2
|
||||
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
|
||||
layer = OPEN_DOOR_LAYER
|
||||
|
||||
/obj/machinery/turnstile/Initialize()
|
||||
. = ..()
|
||||
icon_state = "turnstile"
|
||||
|
||||
/obj/machinery/turnstile/CanAtmosPass(turf/T)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/turnstile/bullet_act(obj/item/projectile/P, def_zone)
|
||||
return -1 //Pass through!
|
||||
|
||||
/obj/machinery/turnstile/proc/allowed_access(var/mob/B)
|
||||
if(B.pulledby && ismob(B.pulledby))
|
||||
return allowed(B.pulledby) | allowed(B)
|
||||
else
|
||||
return allowed(B)
|
||||
|
||||
/obj/machinery/turnstile/CanPass(atom/movable/AM, turf/T)
|
||||
if(ismob(AM))
|
||||
var/mob/B = AM
|
||||
if(isliving(AM))
|
||||
var/mob/living/M = AM
|
||||
|
||||
if(world.time - M.last_bumped <= 5)
|
||||
return FALSE
|
||||
M.last_bumped = world.time
|
||||
|
||||
var/allowed_access = FALSE
|
||||
var/turf/behind = get_step(src, dir)
|
||||
|
||||
if(B in behind.contents)
|
||||
allowed_access = allowed_access(B)
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>\the [src] resists your efforts.</span>")
|
||||
return FALSE
|
||||
|
||||
if(allowed_access)
|
||||
flick("operate", src)
|
||||
playsound(src,'sound/items/ratchet.ogg',50,0,3)
|
||||
return TRUE
|
||||
else
|
||||
flick("deny", src)
|
||||
playsound(src,'sound/machines/deniedbeep.ogg',50,0,3)
|
||||
return FALSE
|
||||
if(ispath(AM, /obj/item/))
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/turnstile/CheckExit(atom/movable/AM as mob|obj, target)
|
||||
if(isliving(AM))
|
||||
var/mob/living/M = AM
|
||||
var/outdir = dir
|
||||
if(allowed_access(M))
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
outdir = SOUTH
|
||||
if(SOUTH)
|
||||
outdir = NORTH
|
||||
if(EAST)
|
||||
outdir = WEST
|
||||
if(WEST)
|
||||
outdir = EAST
|
||||
var/turf/outturf = get_step(src, outdir)
|
||||
var/canexit = (target == src.loc) | (target == outturf)
|
||||
|
||||
if(!canexit && world.time - M.last_bumped <= 5)
|
||||
to_chat(usr, "<span class='notice'>\the [src] resists your efforts.</span>")
|
||||
M.last_bumped = world.time
|
||||
return canexit
|
||||
else
|
||||
return TRUE
|
||||
@@ -354,12 +354,41 @@ update_label("John Doe", "Clowny")
|
||||
lefthand_file = 'icons/mob/inhands/equipment/idcards_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/idcards_righthand.dmi'
|
||||
assignment = "Prisoner"
|
||||
registered_name = "Scum"
|
||||
access = list(ACCESS_ENTER_GENPOP)
|
||||
|
||||
//Lavaland labor camp
|
||||
var/goal = 0 //How far from freedom?
|
||||
var/points = 0
|
||||
//Genpop
|
||||
var/sentence = 0 //When world.time is greater than this number, the card will have its ACCESS_ENTER_GENPOP access replaced with ACCESS_LEAVE_GENPOP the next time it's checked, unless this value is 0/null
|
||||
var/crime= "\[REDACTED\]"
|
||||
|
||||
/obj/item/card/id/prisoner/attack_self(mob/user)
|
||||
to_chat(usr, "<span class='notice'>You have accumulated [points] out of the [goal] points you need for freedom.</span>")
|
||||
/obj/item/card/id/prisoner/GetAccess()
|
||||
if((sentence && world.time >= sentence) || (goal && points >= goal))
|
||||
access = list(ACCESS_LEAVE_GENPOP)
|
||||
return ..()
|
||||
|
||||
/obj/item/card/id/prisoner/process()
|
||||
if(!sentence)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return
|
||||
if(world.time >= sentence)
|
||||
playsound(loc, 'sound/machines/ping.ogg', 50, 1)
|
||||
if(isliving(loc))
|
||||
to_chat(loc, "<span class='boldnotice'>[src]</span><span class='notice'> buzzes: You have served your sentence! You may now exit prison through the turnstiles and collect your belongings.</span>")
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return
|
||||
|
||||
/obj/item/card/id/prisoner/examine(mob/user)
|
||||
. = ..()
|
||||
if(sentence && world.time < sentence)
|
||||
to_chat(user, "<span class='notice'>You're currently serving a sentence for [crime]. <b>[DisplayTimeText(sentence - world.time)]</b> left.</span>")
|
||||
else if(goal)
|
||||
to_chat(user, "<span class='notice'>You have accumulated [points] out of the [goal] points you need for freedom.</span>")
|
||||
else if(!sentence)
|
||||
to_chat(user, "<span class='warning'>You are currently serving a permanent sentence for [crime].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>Your sentence is up! You're free!</span>")
|
||||
|
||||
/obj/item/card/id/prisoner/one
|
||||
name = "Prisoner #13-001"
|
||||
|
||||
117
code/game/objects/structures/crates_lockers/closets/genpop.dm
Normal file
117
code/game/objects/structures/crates_lockers/closets/genpop.dm
Normal file
@@ -0,0 +1,117 @@
|
||||
/obj/structure/closet/secure_closet/genpop
|
||||
desc = "It's a secure locker for inmates's personal belongings."
|
||||
var/default_desc = "It's a secure locker for the storage inmates's personal belongings during their time in prison."
|
||||
name = "prisoner closet"
|
||||
var/default_name = "prisoner closet"
|
||||
req_access = list(ACCESS_BRIG)
|
||||
var/obj/item/card/id/prisoner/registered_id = null
|
||||
icon_state = "prisoner"
|
||||
locked = FALSE
|
||||
anchored = TRUE
|
||||
opened = TRUE
|
||||
density = FALSE
|
||||
|
||||
/obj/structure/closet/secure_closet/genpop/attackby(obj/item/W, mob/user, params)
|
||||
if(!broken && locked && W == registered_id) //Prisoner opening
|
||||
handle_prisoner_id(user)
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/structure/closet/secure_closet/genpop/proc/handle_prisoner_id(mob/user)
|
||||
var/obj/item/card/id/prisoner/prisoner_id = null
|
||||
for(prisoner_id in user.held_items)
|
||||
if(prisoner_id != registered_id)
|
||||
prisoner_id = null
|
||||
else
|
||||
break
|
||||
|
||||
if(!prisoner_id)
|
||||
to_chat(user, "<span class='danger'>Access Denied.</span>")
|
||||
return FALSE
|
||||
|
||||
qdel(registered_id)
|
||||
registered_id = null
|
||||
locked = FALSE
|
||||
open(user)
|
||||
desc = "It's a secure locker for prisoner effects."
|
||||
to_chat(user, "<span class='notice'>You insert your prisoner id into \the [src] and it springs open!</span>")
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/structure/closet/secure_closet/genpop/proc/handle_edit_sentence(mob/user)
|
||||
var/prisoner_name = input(user, "Please input the name of the prisoner.", "Prisoner Name", registered_id.registered_name) as text|null
|
||||
if(prisoner_name == null | !user.Adjacent(src))
|
||||
return FALSE
|
||||
var/sentence_length = input(user, "Please input the length of their sentence in minutes (0 for perma).", "Sentence Length", registered_id.sentence) as num|null
|
||||
if(sentence_length == null | !user.Adjacent(src))
|
||||
return FALSE
|
||||
var/crimes = input(user, "Please input their crimes.", "Crimes", registered_id.crime) as text|null
|
||||
if(crimes == null | !user.Adjacent(src))
|
||||
return FALSE
|
||||
|
||||
registered_id.registered_name = prisoner_name
|
||||
var/filteredsentlength = text2num(sentence_length)
|
||||
registered_id.sentence = filteredsentlength ? (filteredsentlength MINUTES) + world.time : 0
|
||||
registered_id.crime = crimes
|
||||
registered_id.update_label(prisoner_name, registered_id.assignment)
|
||||
if(registered_id.sentence)
|
||||
START_PROCESSING(SSobj, registered_id)
|
||||
else
|
||||
STOP_PROCESSING(SSobj, registered_id)
|
||||
|
||||
name = "[default_name] ([prisoner_name])"
|
||||
desc = "[default_desc] It contains the personal effects of [prisoner_name]."
|
||||
|
||||
return TRUE
|
||||
|
||||
/obj/structure/closet/secure_closet/genpop/togglelock(mob/living/user)
|
||||
if(!allowed(user))
|
||||
return ..()
|
||||
|
||||
if(!broken && locked && registered_id != null)
|
||||
var/name = registered_id.registered_name
|
||||
var/result = alert(user, "This locker currently contains [name]'s personal belongings ","Locker In Use","Reset","Amend ID", "Open")
|
||||
if(!user.Adjacent(src))
|
||||
return
|
||||
if(result == "Reset")
|
||||
name = default_name
|
||||
desc = default_desc
|
||||
registered_id = null
|
||||
if(result == "Open" | result == "Reset")
|
||||
locked = FALSE
|
||||
open(user)
|
||||
if(result == "Amend ID")
|
||||
handle_edit_sentence(user)
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/structure/closet/secure_closet/genpop/close(mob/living/user)
|
||||
if(registered_id != null)
|
||||
locked = TRUE
|
||||
return ..()
|
||||
|
||||
/obj/structure/closet/secure_closet/genpop/attack_hand(mob/user)
|
||||
if(user.lying && get_dist(src, user) > 0)
|
||||
return
|
||||
|
||||
if(!broken && registered_id != null && registered_id in user.held_items)
|
||||
handle_prisoner_id(user)
|
||||
return
|
||||
|
||||
if(!broken && opened && !locked && allowed(user) && !registered_id) //Genpop setup
|
||||
|
||||
registered_id = new /obj/item/card/id/prisoner/(src.contents)
|
||||
if(handle_edit_sentence(user))
|
||||
close(user)
|
||||
locked = TRUE
|
||||
update_icon()
|
||||
registered_id.forceMove(src.loc)
|
||||
new /obj/item/clothing/under/rank/prisoner(src.loc)
|
||||
else
|
||||
qdel(registered_id)
|
||||
registered_id = null
|
||||
|
||||
return
|
||||
|
||||
..()
|
||||
@@ -121,7 +121,7 @@
|
||||
return list(ACCESS_CENT_GENERAL, ACCESS_CENT_LIVING, ACCESS_CENT_BAR)
|
||||
|
||||
/proc/get_all_accesses()
|
||||
return list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT,
|
||||
return list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP,
|
||||
ACCESS_MEDICAL, ACCESS_GENETICS, ACCESS_MORGUE, ACCESS_RD,
|
||||
ACCESS_TOX, ACCESS_TOX_STORAGE, ACCESS_CHEMISTRY, ACCESS_ENGINE, ACCESS_ENGINE_EQUIP, ACCESS_MAINT_TUNNELS,
|
||||
ACCESS_EXTERNAL_AIRLOCKS, ACCESS_CHANGE_IDS, ACCESS_AI_UPLOAD,
|
||||
@@ -157,7 +157,7 @@
|
||||
if(1) //station general
|
||||
return list(ACCESS_KITCHEN,ACCESS_BAR, ACCESS_HYDROPONICS, ACCESS_JANITOR, ACCESS_CHAPEL_OFFICE, ACCESS_CREMATORIUM, ACCESS_LIBRARY, ACCESS_THEATRE, ACCESS_LAWYER)
|
||||
if(2) //security
|
||||
return list(ACCESS_SEC_DOORS, ACCESS_WEAPONS, ACCESS_SECURITY, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT, ACCESS_HOS)
|
||||
return list(ACCESS_SEC_DOORS, ACCESS_WEAPONS, ACCESS_SECURITY, ACCESS_BRIG, ACCESS_ARMORY, ACCESS_FORENSICS_LOCKERS, ACCESS_COURT, ACCESS_HOS, ACCESS_ENTER_GENPOP, ACCESS_LEAVE_GENPOP,)
|
||||
if(3) //medbay
|
||||
return list(ACCESS_MEDICAL, ACCESS_GENETICS, ACCESS_CLONING, ACCESS_MORGUE, ACCESS_CHEMISTRY, ACCESS_VIROLOGY, ACCESS_SURGERY, ACCESS_CMO)
|
||||
if(4) //research
|
||||
@@ -312,6 +312,10 @@
|
||||
return "Gateway"
|
||||
if(ACCESS_SEC_DOORS)
|
||||
return "Brig"
|
||||
if(ACCESS_ENTER_GENPOP)
|
||||
return "Prison Turnstile Entrance"
|
||||
if(ACCESS_LEAVE_GENPOP)
|
||||
return "Prison Turnstile Exit"
|
||||
if(ACCESS_MINERAL_STOREROOM)
|
||||
return "Mineral Storage"
|
||||
if(ACCESS_MINISAT)
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
BIN
icons/obj/turnstile.dmi
Normal file
BIN
icons/obj/turnstile.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
@@ -609,6 +609,7 @@
|
||||
#include "code\game\machinery\syndicatebomb.dm"
|
||||
#include "code\game\machinery\teleporter.dm"
|
||||
#include "code\game\machinery\transformer.dm"
|
||||
#include "code\game\machinery\turnstile.dm"
|
||||
#include "code\game\machinery\washing_machine.dm"
|
||||
#include "code\game\machinery\wishgranter.dm"
|
||||
#include "code\game\machinery\camera\camera.dm"
|
||||
@@ -1020,6 +1021,7 @@
|
||||
#include "code\game\objects\structures\crates_lockers\closets\bodybag.dm"
|
||||
#include "code\game\objects\structures\crates_lockers\closets\cardboardbox.dm"
|
||||
#include "code\game\objects\structures\crates_lockers\closets\fitness.dm"
|
||||
#include "code\game\objects\structures\crates_lockers\closets\genpop.dm"
|
||||
#include "code\game\objects\structures\crates_lockers\closets\gimmick.dm"
|
||||
#include "code\game\objects\structures\crates_lockers\closets\job_closets.dm"
|
||||
#include "code\game\objects\structures\crates_lockers\closets\l3closet.dm"
|
||||
|
||||
Reference in New Issue
Block a user