Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Antag xeno restrictions #312

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/game/gamemodes/blob/blob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ var/list/blob_nodes = list()

return 1

/datum/game_mode/blob/check_species_restriction(var/mob/dead/new_player/player)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var/ - объявление того что аргумент переданный в функцию - переменная?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Спиздил и не заметил, во как бывает

var/datum/species/S = all_species[player.client.prefs.species]
if(S)
return S.restricted_roles.Find(ROLE_BLOB) ? 0 : 1
Miracler112 marked this conversation as resolved.
Show resolved Hide resolved
return 1
Miracler112 marked this conversation as resolved.
Show resolved Hide resolved

/datum/game_mode/blob/announce()
to_chat(world, "<B>The current game mode is - <font color='green'>Blob</font>!</B>")
Expand Down
5 changes: 5 additions & 0 deletions code/game/gamemodes/changeling/changeling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ var/list/possible_changeling_IDs = list("Alpha","Beta","Gamma","Delta","Epsilon"

return ..()

/datum/game_mode/changeling/check_species_restriction(var/mob/dead/new_player/player)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообще некрасиво выходит как-то каждый раз перезаписывать функцию. Почему нельзя у гейммода объявить переменную типо role_type, и в общей функции родителя проверять return S.restricted_roles[role_type]?

var/datum/species/S = all_species[player.client.prefs.species]
if(S)
return S.restricted_roles.Find(ROLE_CHANGELING) ? 0 : 1
return 1

/datum/game_mode/proc/forge_changeling_objectives(datum/mind/changeling)
//OBJECTIVES - Always absorb 5 genomes, plus random traitor objectives.
Expand Down
5 changes: 5 additions & 0 deletions code/game/gamemodes/cult/cult.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@

return (cult.len >= required_enemies)

/datum/game_mode/changeling/check_species_restriction(var/mob/dead/new_player/player)
var/datum/species/S = all_species[player.client.prefs.species]
if(S)
return S.restricted_roles.Find(ROLE_CULTIST) ? 0 : 1
return 1

/datum/game_mode/cult/post_setup()
modePlayer += cult
Expand Down
3 changes: 3 additions & 0 deletions code/game/gamemodes/cult/cult_datums.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ var/list/cult_runes = list()
for(var/mob/living/carbon/M in get_turf(holder))
if(iscultist(M) || M.stat == DEAD)
continue
var/mob/living/carbon/human/MM = M
Miracler112 marked this conversation as resolved.
Show resolved Hide resolved
if(MM.species && MM.species.restricted_roles.Find(ROLE_CULTIST))
continue
user.say("Mah[pick("'","`")]weyh pleggh at e'ntrath!")
M.visible_message("<span class='userdanger'>[M] writhes in pain as the markings below him glow a bloody red.</span>", \
"<span class='cult'>AAAAAAHHHH!</span>", \
Expand Down
5 changes: 4 additions & 1 deletion code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ Implants;
if(security_level < SEC_LEVEL_BLUE)
set_security_level(SEC_LEVEL_BLUE)*/

/datum/game_mode/proc/check_species_restriction(var/mob/dead/new_player/player)
return 1

/datum/game_mode/proc/get_players_for_role(role)
var/list/players = list()
Expand All @@ -300,7 +302,8 @@ Implants;
if(player.client && player.ready)
if(role in player.client.prefs.be_role)
if(!jobban_isbanned(player, "Syndicate") && !jobban_isbanned(player, role) && !role_available_in_minutes(player, role))
players += player
if(check_species_restriction(player)) // Remove candidates with inappropriate species for role
players += player

// Shuffle the players list so that it becomes ping-independent.
players = shuffle(players)
Expand Down
7 changes: 7 additions & 0 deletions code/game/gamemodes/shadowling/shadowling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ Made by Xhuis

return ..()

/datum/game_mode/shadowling/check_species_restriction(var/mob/dead/new_player/player)
var/datum/species/S = all_species[player.client.prefs.species]
if(S)
return S.restricted_roles.Find(ROLE_SHADOWLING) ? 0 : 1
return 1


/datum/game_mode/proc/greet_shadow(datum/mind/shadow)
to_chat(shadow.current, "<b>Currently, you are disguised as an employee aboard [world.name].</b>")
to_chat(shadow.current, "<b>In your limited state, you have three abilities: Enthrall, Hatch, and Hivemind Commune.</b>")
Expand Down
6 changes: 6 additions & 0 deletions code/game/gamemodes/wizard/wizard.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@

return ..()

/datum/game_mode/wizard/check_species_restriction(var/mob/dead/new_player/player)
var/datum/species/S = all_species[player.client.prefs.species]
if(S)
return S.restricted_roles.Find(ROLE_WIZARD) ? 0 : 1
return 1


/datum/game_mode/proc/forge_wizard_objectives(datum/mind/wizard)
if (config.objectives_disabled)
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/captain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
access_theatre, access_chapel_office, access_library, access_research, access_mining, access_heads_vault, access_mining_station,
access_clown, access_mime, access_hop, access_RC_announce, access_keycard_auth, access_gateway, access_recycler, access_detective, access_barber
)
restricted_species = list(UNATHI, TAJARAN, DIONA, IPC)


/datum/job/hop/equip(mob/living/carbon/human/H, visualsOnly = FALSE)
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/engineering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)
minimal_player_age = 7
minimal_player_ingame_minutes = 1400
restricted_species = list(UNATHI, TAJARAN, DIONA, IPC)

/datum/job/chief_engineer/equip(mob/living/carbon/human/H, visualsOnly = FALSE)
if(!H) return 0
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
)
minimal_player_age = 10
minimal_player_ingame_minutes = 5000
restricted_species = list(UNATHI, TAJARAN, DIONA, IPC)

/datum/job/cmo/equip(mob/living/carbon/human/H, visualsOnly = FALSE)
if(!H) return 0
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/science.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)
minimal_player_age = 30
minimal_player_ingame_minutes = 2000
restricted_species = list(UNATHI, TAJARAN, DIONA, IPC)

/datum/job/rd/equip(mob/living/carbon/human/H, visualsOnly = FALSE)
if(!H) return 0
Expand Down
2 changes: 1 addition & 1 deletion code/game/jobs/job/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
minimal_player_age = 30
minimal_player_ingame_minutes = 8000
restricted_species = list(TAJARAN, DIONA)
restricted_species = list(UNATHI, TAJARAN, DIONA, IPC)

/datum/job/hos/equip(mob/living/carbon/human/H, visualsOnly = FALSE)
if(!H) return 0
Expand Down
3 changes: 3 additions & 0 deletions code/modules/mob/living/carbon/species.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
var/flesh_color = "#FFC896" //Pink.
var/base_color //Used when setting species.

var/list/restricted_roles = list()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ты объявил список запрещённых ролей, но нигде его не наполняешь. М?


//Used in icon caching.
var/race_key = 0
var/icon/icon_template
Expand Down Expand Up @@ -316,6 +318,7 @@

eyes = "skrell_eyes"
blood_color = /datum/dirt_cover/purple_blood

flesh_color = "#8CD7A3"

/datum/species/skrell/call_digest_proc(mob/living/M, datum/reagent/R)
Expand Down