mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Spiritual successor and extension to #17798, an almost entire rebuild of the SQL ban system backend and interface. Bantypes are removed per #8584 and #6174. All bans are now 'role bans', server bans are when a ban's role is server. Admin bans are a column, meaning it's possible to ban admins from jobs. Bans now have only an expiry datetime, duration is calculated from this when queried. unbanned column is removed as it's superfluous, checking unban status is now done through checking unban_datetime. unban_round_id column added. Each ip and computerid columns rearranged so ip is always first, like in other tables. Bans now permit a null ckey, ip and computerid. Ban checking is split into two procs now is_banned_from() does a check if a ckey is banned from one or more roles and returns true or false. This effectively replaces jobban_isbanned() used in simple if() statements. If connected a client's ban cache is checked rather than querying the DB. This makes it possible for a client connected to two or more servers to ignore any bans made on one server until their ban cache is rebuilt on the others. Could be avoided with cross-server calls to update ban caches or just the removal of the ban cache but as is I've done neither since I think it's enough of an edge case to not be worth it. The second proc is is_banned_from_with_details(), this queries the DB for a role ban on a player's ckey, ip or CID and returns the details. This replaces direct queries in IsBanned.dm and the preferences menu. The legacy ban system is removed. The interfaces for banning, unbanning and editing bans have been remade to require less clicking and easier simultaneous operations. The banning and jobban panel are combined. They also store player connection details when opened so a client disconnecting no longer stops a ban being placed. New banning panel: Key, IP and CID can all be toggled to allow excluding them from a ban. Checking Use IP and CID from last connection lets you enter only a ckey and have the DB fill these fields in for you, if possible. Temporary bans have a drop-menu which lets you select between seconds, minutes, hours, days, weeks, months and years so you don't need to calculate how many minutes a long ban would be. The ban is still converted into minutes on the DB however. Checking any of the head roles will check both of the boxes for you. The red role box indicates there is already a ban on that role for this ckey. You can apply additional role bans to stack them. New unbanning panel: Unbanning panel is now separate from the banning panel but otherwise functionally the same. Ban editing panel: Actually just a modified banning panel, all the features from it work the same here. You can now edit almost all parameters of a ban instead of just the reason. You can't edit severity as it's not really part of the ban. The panels have been tested but I've not been able to get my local server to be accessible so ban functionality isn't properly confirmed. Plenty of testing will be required as I'd rather not break bans. cl admin: Ban interface rework. The banning and unbanning panels have received a new design which is easier to use and allows multiple role bans to be made at once. prefix: Ban search and unbanning moved to unbanning panel, which is now a separate panel to the old banning panel. /cl
139 lines
6.7 KiB
Plaintext
139 lines
6.7 KiB
Plaintext
GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","Epsilon","Zeta","Eta","Theta","Iota","Kappa","Lambda","Mu","Nu","Xi","Omicron","Pi","Rho","Sigma","Tau","Upsilon","Phi","Chi","Psi","Omega"))
|
|
GLOBAL_LIST_INIT(slots, list("head", "wear_mask", "back", "wear_suit", "w_uniform", "shoes", "belt", "gloves", "glasses", "ears", "wear_id", "s_store"))
|
|
GLOBAL_LIST_INIT(slot2slot, list("head" = SLOT_HEAD, "wear_mask" = SLOT_WEAR_MASK, "neck" = SLOT_NECK, "back" = SLOT_BACK, "wear_suit" = SLOT_WEAR_SUIT, "w_uniform" = SLOT_W_UNIFORM, "shoes" = SLOT_SHOES, "belt" = SLOT_BELT, "gloves" = SLOT_GLOVES, "glasses" = SLOT_GLASSES, "ears" = SLOT_EARS, "wear_id" = SLOT_WEAR_ID, "s_store" = SLOT_S_STORE))
|
|
GLOBAL_LIST_INIT(slot2type, list("head" = /obj/item/clothing/head/changeling, "wear_mask" = /obj/item/clothing/mask/changeling, "back" = /obj/item/changeling, "wear_suit" = /obj/item/clothing/suit/changeling, "w_uniform" = /obj/item/clothing/under/changeling, "shoes" = /obj/item/clothing/shoes/changeling, "belt" = /obj/item/changeling, "gloves" = /obj/item/clothing/gloves/changeling, "glasses" = /obj/item/clothing/glasses/changeling, "ears" = /obj/item/changeling, "wear_id" = /obj/item/changeling, "s_store" = /obj/item/changeling))
|
|
GLOBAL_VAR(changeling_team_objective_type) //If this is not null, we hand our this objective to all lings
|
|
|
|
|
|
/datum/game_mode/changeling
|
|
name = "changeling"
|
|
config_tag = "changeling"
|
|
report_type = "changeling"
|
|
antag_flag = ROLE_CHANGELING
|
|
false_report_weight = 10
|
|
restricted_jobs = list("AI", "Cyborg")
|
|
protected_jobs = list("Security Officer", "Warden", "Detective", "Head of Security", "Captain", "Head of Personnel") //YOGS - added hop
|
|
required_players = 15
|
|
required_enemies = 1
|
|
recommended_enemies = 4
|
|
reroll_friendly = 1
|
|
|
|
announce_span = "green"
|
|
announce_text = "Alien changelings have infiltrated the crew!\n\
|
|
<span class='green'>Changelings</span>: Accomplish the objectives assigned to you.\n\
|
|
<span class='notice'>Crew</span>: Root out and eliminate the changeling menace."
|
|
|
|
var/const/changeling_amount = 4 //hard limit on changelings if scaling is turned off
|
|
var/list/changelings = list()
|
|
|
|
/datum/game_mode/changeling/pre_setup()
|
|
|
|
if(CONFIG_GET(flag/protect_roles_from_antagonist))
|
|
restricted_jobs += protected_jobs
|
|
|
|
if(CONFIG_GET(flag/protect_assistant_from_antagonist))
|
|
restricted_jobs += "Assistant"
|
|
|
|
var/num_changelings = 1
|
|
|
|
var/csc = CONFIG_GET(number/changeling_scaling_coeff)
|
|
if(csc)
|
|
num_changelings = max(1, min(round(num_players() / (csc * 2)) + 2, round(num_players() / csc)))
|
|
else
|
|
num_changelings = max(1, min(num_players(), changeling_amount))
|
|
|
|
if(antag_candidates.len>0)
|
|
for(var/i = 0, i < num_changelings, i++)
|
|
if(!antag_candidates.len)
|
|
break
|
|
var/datum/mind/changeling = antag_pick(antag_candidates)
|
|
antag_candidates -= changeling
|
|
changelings += changeling
|
|
changeling.special_role = ROLE_CHANGELING
|
|
changeling.restricted_roles = restricted_jobs
|
|
return 1
|
|
else
|
|
setup_error = "Not enough changeling candidates"
|
|
return 0
|
|
|
|
/datum/game_mode/changeling/post_setup()
|
|
//Decide if it's ok for the lings to have a team objective
|
|
//And then set it up to be handed out in forge_changeling_objectives
|
|
var/list/team_objectives = subtypesof(/datum/objective/changeling_team_objective)
|
|
var/list/possible_team_objectives = list()
|
|
for(var/T in team_objectives)
|
|
var/datum/objective/changeling_team_objective/CTO = T
|
|
|
|
if(changelings.len >= initial(CTO.min_lings))
|
|
possible_team_objectives += T
|
|
|
|
if(possible_team_objectives.len && prob(20*changelings.len))
|
|
GLOB.changeling_team_objective_type = pick(possible_team_objectives)
|
|
|
|
for(var/datum/mind/changeling in changelings)
|
|
//log_game("[key_name(changeling)] has been selected as a changeling") | yogs - redundant
|
|
var/datum/antagonist/changeling/new_antag = new()
|
|
//new_antag.team_mode = TRUE //yogs - lol
|
|
changeling.add_antag_datum(new_antag)
|
|
..()
|
|
|
|
/datum/game_mode/changeling/make_antag_chance(mob/living/carbon/human/character) //Assigns changeling to latejoiners
|
|
var/csc = CONFIG_GET(number/changeling_scaling_coeff)
|
|
var/changelingcap = min(round(GLOB.joined_player_list.len / (csc * 2)) + 2, round(GLOB.joined_player_list.len / csc))
|
|
if(changelings.len >= changelingcap) //Caps number of latejoin antagonists
|
|
return
|
|
if(changelings.len <= (changelingcap - 2) || prob(100 - (csc * 2)))
|
|
if(ROLE_CHANGELING in character.client.prefs.be_special)
|
|
if(!is_banned_from(character.ckey, list(ROLE_CHANGELING, ROLE_SYNDICATE)) && !QDELETED(character))
|
|
if(age_check(character.client))
|
|
if(!(character.job in restricted_jobs))
|
|
character.mind.make_Changeling()
|
|
changelings += character.mind
|
|
|
|
/datum/game_mode/changeling/generate_report()
|
|
return "The Gorlex Marauders have announced the successful raid and destruction of Central Command containment ship #S-[rand(1111, 9999)]. This ship housed only a single prisoner - \
|
|
codenamed \"Thing\", and it was highly adaptive and extremely dangerous. We have reason to believe that the Thing has allied with the Syndicate, and you should note that likelihood \
|
|
of the Thing being sent to a station in this sector is highly likely. It may be in the guise of any crew member. Trust nobody - suspect everybody. Do not announce this to the crew, \
|
|
as paranoia may spread and inhibit workplace efficiency."
|
|
|
|
/proc/changeling_transform(mob/living/carbon/human/user, datum/changelingprofile/chosen_prof)
|
|
var/datum/dna/chosen_dna = chosen_prof.dna
|
|
user.real_name = chosen_prof.name
|
|
user.underwear = chosen_prof.underwear
|
|
user.undershirt = chosen_prof.undershirt
|
|
user.socks = chosen_prof.socks
|
|
|
|
chosen_dna.transfer_identity(user, 1)
|
|
user.updateappearance(mutcolor_update=1)
|
|
user.update_body()
|
|
user.domutcheck()
|
|
|
|
//vars hackery. not pretty, but better than the alternative.
|
|
for(var/slot in GLOB.slots)
|
|
if(istype(user.vars[slot], GLOB.slot2type[slot]) && !(chosen_prof.exists_list[slot])) //remove unnecessary flesh items
|
|
qdel(user.vars[slot])
|
|
continue
|
|
|
|
if((user.vars[slot] && !istype(user.vars[slot], GLOB.slot2type[slot])) || !(chosen_prof.exists_list[slot]))
|
|
continue
|
|
|
|
var/obj/item/C
|
|
var/equip = 0
|
|
if(!user.vars[slot])
|
|
var/thetype = GLOB.slot2type[slot]
|
|
equip = 1
|
|
C = new thetype(user)
|
|
|
|
else if(istype(user.vars[slot], GLOB.slot2type[slot]))
|
|
C = user.vars[slot]
|
|
|
|
C.appearance = chosen_prof.appearance_list[slot]
|
|
C.name = chosen_prof.name_list[slot]
|
|
C.flags_cover = chosen_prof.flags_cover_list[slot]
|
|
C.item_color = chosen_prof.item_color_list[slot]
|
|
C.item_state = chosen_prof.item_state_list[slot]
|
|
if(equip)
|
|
user.equip_to_slot_or_del(C, GLOB.slot2slot[slot])
|
|
|
|
user.regenerate_icons()
|