Skip to content

Commit

Permalink
SCP whitelist system (SS13-SCP13#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
kachnov authored Dec 6, 2018
1 parent e50e09f commit d95300a
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 60 deletions.
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2243,6 +2243,7 @@
#include "code\modules\research\server.dm"
#include "code\modules\research\stock_parts.dm"
#include "code\modules\SCP\scp.dm"
#include "code\modules\SCP\whitelist.dm"
#include "code\modules\SCP\SCPs\SCP-012.dm"
#include "code\modules\SCP\SCPs\SCP-049.dm"
#include "code\modules\SCP\SCPs\SCP-106.dm"
Expand Down
6 changes: 6 additions & 0 deletions code/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@

#define isscp049_1(A) (istype(A, /mob/living/carbon/human) && istype(A:species, /datum/species/scp049_1))

#define isscp999(A) istype(A, /mob/living/simple_animal/scp_999)

#define isscp131(A) istype(A, /mob/living/simple_animal/scp_131)

#define isscp529(A) istype(A, /mob/living/simple_animal/cat/fluff/SCP529)

#define isscp173(A) istype(A, /mob/living/scp_173)

#define isunderwear(A) istype(A, /obj/item/underwear)
Expand Down
33 changes: 33 additions & 0 deletions code/modules/SCP/whitelist.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
GLOBAL_LIST_EMPTY(scp_whitelist)

/hook/startup/proc/loadSCPWhitelist()

GLOB.scp_whitelist.Cut()

//load text from file
var/list/lines = file2list("config/scp_whitelist.txt")

//process each line seperately
for(var/line in lines)
if(!length(line)) continue
if(copytext(line,1,2) == "#") continue

//Split the line at every "-"
var/list/L = splittext(line, " - ")
if(L.len < 2) continue

//ckey is before the first "-"
var/ckey = ckey(L[1])
if(!ckey) continue

//scp follows the first "-"
var/scp = ""
if(L.len >= 2)
scp = ckeyEx(L[2])

if (!GLOB.scp_whitelist[ckey])
GLOB.scp_whitelist[ckey] = list()

GLOB.scp_whitelist[ckey] |= scp

WRITE_LOG(world.log, "FINISHED LOADING THE SCP WHITELIST")
134 changes: 74 additions & 60 deletions code/modules/mob/observer/ghost/ghost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -332,68 +332,76 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
set desc = "Take control of a clientless SCP."

if (world.time - timeofdeath >= 5 MINUTES)
var/decl/security_state/security_state = decls_repository.get_decl(GLOB.using_map.security_state)
if (security_state.current_security_level.name in list("code red", "code delta", "code black"))
var/list/scps = list()
for (var/scp106 in GLOB.scp106s)
var/mob/M = scp106
if (!M.client)
scps += M
for (var/scp049 in GLOB.scp049s)
var/mob/M = scp049
if (!M.client)
scps += M
for (var/scp173 in GLOB.scp173s)
var/mob/M = scp173
if (!M.client)
scps += M
// add new humanoid SCPs here or they won't be playable - Kachnov
if (scps.len)
var/mob/living/scp = input(src, "Which Euclid/Keter SCP do you want to take control of?") as null|anything in scps
if (scp && !scp.client)
scp.do_possession(src)
if (ishuman(scp))
scp.verbs -= list(
/mob/living/carbon/human/verb/blink_t,
/mob/living/carbon/human/verb/bow,
/mob/living/carbon/human/verb/salute,
/mob/living/carbon/human/verb/hem,
/mob/living/carbon/human/verb/clap,
/mob/living/carbon/human/verb/eyebrow,
/mob/living/carbon/human/verb/cough,
/mob/living/carbon/human/verb/frown,
/mob/living/carbon/human/verb/nod,
/mob/living/carbon/human/verb/blush,
/mob/living/carbon/human/verb/wave,
/mob/living/carbon/human/verb/giggle,
/mob/living/carbon/human/verb/look,
/mob/living/carbon/human/verb/grin,
/mob/living/carbon/human/verb/cry,
/mob/living/carbon/human/verb/sigh,
/mob/living/carbon/human/verb/laugh,
/mob/living/carbon/human/verb/grumble,
/mob/living/carbon/human/verb/groan,
/mob/living/carbon/human/verb/mmoan,
/mob/living/carbon/human/verb/raise,
/mob/living/carbon/human/verb/shake,
/mob/living/carbon/human/verb/shrug,
/mob/living/carbon/human/verb/smile,
/mob/living/carbon/human/verb/whimper,
/mob/living/carbon/human/verb/wink,
/mob/living/carbon/human/verb/yawn,
/mob/living/carbon/human/verb/hug,
/mob/living/carbon/human/verb/scream,
/mob/living/carbon/human/verb/emoteclearthroat,
/mob/living/verb/lay_down
)
else
src << "<span class = 'danger'>This SCP has already been taken by someone else.</span>"

var/list/scps = list()

// no whitelist required
for (var/scp106 in GLOB.scp106s)
var/mob/M = scp106
if (!M.client)
scps += M

// whitelist required
for (var/scp049 in GLOB.scp049s)
var/mob/M = scp049
if (!M.client)
scps += M

// no whitelist required
for (var/scp173 in GLOB.scp173s)
var/mob/M = scp173
if (!M.client)
scps += M

// add new humanoid SCPs here or they won't be playable - Kachnov
if (scps.len)
var/mob/living/scp = input(src, "Which Euclid/Keter SCP do you want to take control of?") as null|anything in scps
if (isscp106(scp) && world.time < 60 MINUTES)
to_chat(src, "You cannot join as this SCP for [((60 MINUTES) - world.time)/600] more minutes.")
else if (isscp049(scp) && world.time < 15 MINUTES && !("049" in GLOB.scp_whitelist[ckey] ? GLOB.scp_whitelist[ckey] : list()))
to_chat(src, "You cannot join as this SCP for [((15 MINUTES) - world.time)/600] more minutes.")
else if (scp && !scp.client)
scp.do_possession(src)
if (ishuman(scp))
scp.verbs -= list(
/mob/living/carbon/human/verb/blink_t,
/mob/living/carbon/human/verb/bow,
/mob/living/carbon/human/verb/salute,
/mob/living/carbon/human/verb/hem,
/mob/living/carbon/human/verb/clap,
/mob/living/carbon/human/verb/eyebrow,
/mob/living/carbon/human/verb/cough,
/mob/living/carbon/human/verb/frown,
/mob/living/carbon/human/verb/nod,
/mob/living/carbon/human/verb/blush,
/mob/living/carbon/human/verb/wave,
/mob/living/carbon/human/verb/giggle,
/mob/living/carbon/human/verb/look,
/mob/living/carbon/human/verb/grin,
/mob/living/carbon/human/verb/cry,
/mob/living/carbon/human/verb/sigh,
/mob/living/carbon/human/verb/laugh,
/mob/living/carbon/human/verb/grumble,
/mob/living/carbon/human/verb/groan,
/mob/living/carbon/human/verb/mmoan,
/mob/living/carbon/human/verb/raise,
/mob/living/carbon/human/verb/shake,
/mob/living/carbon/human/verb/shrug,
/mob/living/carbon/human/verb/smile,
/mob/living/carbon/human/verb/whimper,
/mob/living/carbon/human/verb/wink,
/mob/living/carbon/human/verb/yawn,
/mob/living/carbon/human/verb/hug,
/mob/living/carbon/human/verb/scream,
/mob/living/carbon/human/verb/emoteclearthroat,
/mob/living/verb/lay_down
)
else
src << "<span class = 'danger'>There are no available Euclid/Keter SCPs.</span>"
to_chat(src, "<span class = 'danger'>This SCP has already been taken by someone else.</span>")
else
src << "<span class = 'danger'>You cannot take control of a Euclid/Keter SCP until the security level is Red, Delta, or Black.</span>"
to_chat(src, "<span class = 'danger'>There are no available Euclid/Keter SCPs.</span>")
else
src << "<span class = 'danger'>You cannot spawn as a Euclid/Keter SCP for [round(((5 MINUTES) - (world.time - timeofdeath))/600)] more minutes.</span>"
to_chat(src, "<span class = 'danger'>You cannot spawn as a Euclid/Keter SCP for [round(((5 MINUTES) - (world.time - timeofdeath))/600)] more minutes.</span>")


/mob/observer/ghost/proc/ghost_to_turf(var/turf/target_turf)
Expand Down Expand Up @@ -525,7 +533,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
scps += M
if (scps.len)
var/mob/living/scp = input(src, "Which Safe SCP do you want to take control of?") as null|anything in scps
if (scp && !scp.client)
if (isscp999(scp) && world.time < 5 MINUTES)
to_chat(src, "You cannot join as this SCP for [((5 MINUTES) - world.time)/600] more minutes.")
else if (isscp131(scp) && world.time < 5 MINUTES)
to_chat(src, "You cannot join as this SCP for [((5 MINUTES) - world.time)/600] more minutes.")
else if (isscp529(scp) && world.time < 5 MINUTES)
to_chat(src, "You cannot join as this SCP for [((5 MINUTES) - world.time)/600] more minutes.")
else if (scp && !scp.client)
scp.do_possession(src)
announce_ghost_joinleave(src, 0, "They are now a Safe SCP.")
if(src)
Expand Down
36 changes: 36 additions & 0 deletions html/changelogs/SCPwhitelist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################

# Your name.
author: Memeopolis

# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True

# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Added a SCP whitelist. SCP-049 is now whitelisted."

0 comments on commit d95300a

Please sign in to comment.