Skip to content

Commit

Permalink
Add: xeno whitelist panel, FBP whitelist (#1917)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimach authored Feb 27, 2024
1 parent bba33d6 commit 507b460
Show file tree
Hide file tree
Showing 12 changed files with 771 additions and 4 deletions.
8 changes: 6 additions & 2 deletions code/__defines/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
#define R_SOUNDS FLAG(11)
#define R_SPAWN FLAG(12)
#define R_MOD FLAG(13)
#define R_HOST FLAG(14)
// [SIERRA-EDIT] - XENO WHITELIST
//#define R_HOST FLAG(14) // SIERRA-EDIT - ORIGINAL
#define R_XENO FLAG(14)
#define R_HOST FLAG(15)
// [SIERRA-EDIT]
#define R_INVESTIGATE (R_ADMIN | R_MOD)
#define R_MAXPERMISSION R_HOST

Expand All @@ -44,4 +48,4 @@
#define TICKET_ASSIGNED 2 // An admin has assigned themself to the ticket and will respond

#define LAST_CKEY(M) (M.ckey || M.last_ckey)
#define LAST_KEY(M) (M.key || M.last_ckey)
#define LAST_KEY(M) (M.key || M.last_ckey)
2 changes: 2 additions & 0 deletions code/__defines/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@
#define SPECIES_NEAERA "Neaera"
#define SPECIES_STOK "Stok"

#define SPECIES_FBP "Full Body Prosthesis" //SIERRA-ADD XENO WHITELIST

#define UNRESTRICTED_SPECIES list(SPECIES_HUMAN, SPECIES_DIONA, SPECIES_IPC, SPECIES_UNATHI, SPECIES_YEOSA, SPECIES_SKRELL, SPECIES_TRITONIAN, SPECIES_SPACER, SPECIES_VATGROWN, SPECIES_GRAVWORLDER, SPECIES_MULE)
#define RESTRICTED_SPECIES list(SPECIES_VOX, SPECIES_ALIEN, SPECIES_GOLEM)
#define HUMAN_SPECIES list(SPECIES_HUMAN, SPECIES_VATGROWN, SPECIES_SPACER, SPECIES_GRAVWORLDER, SPECIES_MULE)
Expand Down
1 change: 1 addition & 0 deletions code/_helpers/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
if (rights & R_SOUNDS) . += "[seperator]+SOUND"
if (rights & R_SPAWN) . += "[seperator]+SPAWN"
if (rights & R_MOD) . += "[seperator]+MODERATOR"
if (rights & R_XENO) . += "[seperator]+XENOMODERATOR" //SIERRA-ADD XENO WHITELIST
return .

// heat2color functions. Adapted from: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code
Expand Down
6 changes: 5 additions & 1 deletion code/modules/admin/admin_ranks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ var/global/list/admin_ranks = list() //list of all ranks with associated
if("stealth") rights |= R_STEALTH
if("rejuv","rejuvinate") rights |= R_REJUVINATE
if("varedit") rights |= R_VAREDIT
if("everything","host","all") rights |= (R_HOST | R_BUILDMODE | R_ADMIN | R_BAN | R_FUN | R_SERVER | R_DEBUG | R_PERMISSIONS | R_POSSESS | R_STEALTH | R_REJUVINATE | R_VAREDIT | R_SOUNDS | R_SPAWN | R_MOD)
// [SIERRA-EDIT] - XENO WHITELIST
//if("everything","host","all") rights |= (R_HOST | R_BUILDMODE | R_ADMIN | R_BAN | R_FUN | R_SERVER | R_DEBUG | R_PERMISSIONS | R_POSSESS | R_STEALTH | R_REJUVINATE | R_VAREDIT | R_SOUNDS | R_SPAWN | R_MOD) //SIERRA-EDIT ORIGINAL
if("everything","host","all") rights |= (R_HOST | R_BUILDMODE | R_ADMIN | R_BAN | R_FUN | R_SERVER | R_DEBUG | R_PERMISSIONS | R_POSSESS | R_STEALTH | R_REJUVINATE | R_VAREDIT | R_SOUNDS | R_SPAWN | R_MOD | R_XENO)
// [/SIERRA-EDIT]
if("sound","sounds") rights |= R_SOUNDS
if("spawn","create") rights |= R_SPAWN
if("mod") rights |= R_MOD
if("xeno") rights |= R_XENO //SIERRA-ADD XENO WHITELIST

admin_ranks[rank] = rights
previous_rights = rights
Expand Down
5 changes: 5 additions & 0 deletions code/modules/client/preference_setup/general/02_body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,11 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
third_limb = BP_GROIN
choice_options = list("Normal","Prosthesis")

//[SIERRA-ADD] - XENO WHITELIST
if((!whitelist_lookup(SPECIES_FBP, user.ckey) && current_species.name != SPECIES_IPC) && !user.client.holder)
choice_options -= "Prosthesis"
//[/SIERRA-ADD]

var/new_state = input(user, "What state do you wish the limb to be in?") as null|anything in choice_options
if(!new_state || !CanUseTopic(user)) return TOPIC_NOACTION

Expand Down
14 changes: 14 additions & 0 deletions code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@
if(!check_species_allowed(S))
return 0

//[SIERRA-ADD] - XENO WHITELIST
if(client.prefs.organ_data[BP_CHEST] == "cyborg")
if(!whitelist_lookup(SPECIES_FBP, client.ckey) && client.prefs.species != SPECIES_IPC)
to_chat(usr, "Нельзя зайти за ППТ без вайтлиста.")
return FALSE
//[/SIERRA-ADD]

AttemptLateSpawn(job, client.prefs.spawnpoint)
return

Expand Down Expand Up @@ -461,6 +468,13 @@

/mob/new_player/proc/create_character(turf/spawn_turf)
spawning = 1
//[SIERRA-ADD] - XENO WHITELIST
if(client.prefs.organ_data[BP_CHEST] == "cyborg")
if(!whitelist_lookup(SPECIES_FBP, client.ckey) && client.prefs.species != SPECIES_IPC)
to_chat(src, "Нельзя зайти за ППТ без вайтлиста.")
spawning = 0
return null
//[/SIERRA-ADD]
close_spawn_windows()

var/mob/living/carbon/human/new_character
Expand Down
3 changes: 3 additions & 0 deletions mods/ex666_ecosystem/_ex666_ecosystem.dme
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
#include "code/experience/exp_species.dm"
#include "code/experience/subsystem.dm"
#include "code/experience/_undefines.dm" // Чтоб всё работало, он должен быть последним
#include "code/xeno_whitelist/_defines.dm"
#include "code/xeno_whitelist/xeno_whitelist.dm"
#include "code/xeno_whitelist/xeno_webhook.dm"

#endif
2 changes: 2 additions & 0 deletions mods/ex666_ecosystem/code/xeno_whitelist/_defines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define WEBHOOK_XENO_WHITELIST "webhook_xeno_whitelist"
#define COLOR_WEBHOOK_XENO 0xf2b000
88 changes: 88 additions & 0 deletions mods/ex666_ecosystem/code/xeno_whitelist/xeno_webhook.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/singleton/webhook/xeno_msg
id = WEBHOOK_XENO_WHITELIST

/singleton/webhook/xeno_msg/get_message(list/data)
. = ..()

if(!length(data))
.["content"] = "Тут должно быть сообщение о вайтлисте, но кто то вызвал вебхук вручную."
return

if(!data["grant"] && !data["revoke"])
return
if(!data["ckey"]) data["ckey"] = "ДАННЫЕ УДАЛЕНЫ"
if(!data["type"]) data["type"] = "ДАННЫЕ УДАЛЕНЫ"

var/list/desc = list()
desc["title"] = "Ксеномодератор - [data["ckey"]]"
desc["description"] = "Изменения внесены в [data["type"]]"
desc["color"] = COLOR_WEBHOOK_XENO
desc["author"] = list(
"name" = "Изменение вайтлиста на расы",
"icon_url" = "https://cdn.discordapp.com/emojis/244791612268347392.png") // :inf: emoji

var/list/grant = data["grant"]
var/list/revoke = data["revoke"]
var/icon = "https://cdn.discordapp.com/emojis/680793066415980576.png" // :SeemsRichKot: emoji
if(length(revoke) >= length(grant))
icon = "https://cdn.discordapp.com/emojis/601028456675016706.png" // :resomisad: emoji
desc["thumbnail"] = list("url" = icon)
/*
var/list/unite = list()
for(var/ckey in grant)
var/list/temp = list()
var/list/check = grant[ckey]
for(var/race in check)
temp += "++[race]"
unite[ckey] += list(temp)
for(var/ckey in revoke)
var/list/temp = list()
var/list/check = revoke[ckey]
for(var/race in check)
temp += "--[race]"
unite[ckey] += list(temp)
*/
var/list/A = list()
var/list/B = list()
for(var/ckey in grant)
var/list/check = grant[ckey]
for(var/race in check)
B += "+ [race]"
A[ckey] = B.Copy()
B.Cut()
grant = A.Copy()
A.Cut()
B.Cut()
for(var/ckey in revoke)
var/list/check = revoke[ckey]
for(var/race in check)
B += "- [race]"
A[ckey] = B.Copy()
B.Cut()
revoke = A.Copy()

var/list/unite = list()
for(var/ckey in grant)
unite[ckey] = grant[ckey]
for(var/ckey in revoke)
unite[ckey] += revoke[ckey]

if(!length(unite))
.["content"] = "Сюда пришло изменение вайтлиста, но мы потеряли список."
return
var/list/fields = list()
unite = sortAssoc(unite) //sorting by ckey
for(var/ckey2 in unite)
var/list/check = unite[ckey2]
check = sortList(check) //sorting by race
var/list/text = list("diff")
for(var/race in check)
text += race
fields[++length(fields)] = list(
"name" = ckey2,
"value" = "```[jointext(text, "\n")]```"
)
if(length(fields))
desc["fields"] = fields
.["embeds"] = list(desc)
Loading

0 comments on commit 507b460

Please sign in to comment.