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

Add restricted roles for assassinate contract, add contracts number limit #12750

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 13 additions & 1 deletion code/game/gamemodes/traitor/contracts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ GLOBAL_LIST_INIT(syndicate_factions, list(
var/reason
var/list/reason_list = list()
var/datum/contract_organization/organization
var/list/wanted_jobs = list()

/datum/antag_contract/New(datum/contract_organization/contract_organization, reason, datum/mind/target)
ASSERT(intent)
Expand Down Expand Up @@ -103,6 +104,16 @@ GLOBAL_LIST_INIT(syndicate_factions, list(
return FALSE
return !!(H.species.species_flags & SPECIES_FLAG_NO_ANTAG_TARGET)

/datum/antag_contract/proc/skip_unwanted_job(datum/mind/H)
var/datum/job/title = job_master.GetJob(H.assigned_role)
if(wanted_jobs.len)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if(wanted_jobs.len)
if(length(wanted_jobs))

if(title in wanted_jobs)
return FALSE
else
return TRUE
else
return FALSE

/datum/antag_contract/proc/create_contract(new_reason, target)
return

Expand Down Expand Up @@ -400,6 +411,7 @@ GLOBAL_LIST_INIT(syndicate_factions, list(
var/weakref/alternative_target // obj/item
var/weakref/H // mob/living/carbon/human
var/full_reward_mod = 1.5
wanted_jobs = list(/datum/job/captain,/datum/job/hop,/datum/job/rd,/datum/job/chief_engineer,/datum/job/cmo,/datum/job/hos, /datum/job/warden, /datum/job/detective, /datum/job/qm)

/datum/antag_contract/item/assassinate/New(datum/contract_organization/contract_organization, reason, datum/mind/target)
organization = contract_organization
Expand Down Expand Up @@ -438,7 +450,7 @@ GLOBAL_LIST_INIT(syndicate_factions, list(

target_real_name = _H.real_name
target_mind = candidate_mind
if(skip_antag_role() || skip_unwanted_species(_H))
if(skip_antag_role() || skip_unwanted_species(_H) || skip_unwanted_job(_H))
target_mind = null
_H = null
continue
Expand Down
11 changes: 9 additions & 2 deletions code/game/gamemodes/traitor/fixer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@
set_next_think(world.time + time_to_next_contract)

/datum/contract_fixer/think()
create_random_contract(1)
set_next_think(world.time + time_to_next_contract)
if(!contract_list_overfilled())
create_random_contract(1)
set_next_think(world.time + time_to_next_contract)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
set_next_think(world.time + time_to_next_contract)
set_next_think(world.time + time_to_next_contract)


/datum/contract_fixer/proc/contract_list_overfilled()
if(GLOB.all_contracts.len > (6 + round(SSticker.minds.len / 5)))
Copy link
Member

Choose a reason for hiding this comment

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

Может переделаешь на то, что контракты закрыты?
И да length

return TRUE
else
return FALSE

/datum/contract_fixer/proc/create_random_contract(count = 1)
while(count--)
Expand Down
Loading