Skip to content

Commit

Permalink
Фикс черезмерного спавна противников выше капа
Browse files Browse the repository at this point in the history
  • Loading branch information
msw7007 committed Dec 20, 2024
1 parent c8fd363 commit c88d61f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
/datum/round_event/antagonist/solo/setup()
var/datum/round_event_control/antagonist/solo/cast_control = control
antag_count = cast_control.get_antag_amount()
if(!antag_count)
return

antag_flag = cast_control.antag_flag
antag_datum = cast_control.antag_datum
restricted_roles = cast_control.restricted_roles
Expand Down Expand Up @@ -168,6 +171,9 @@
/datum/round_event/antagonist/solo/ghost/setup()
var/datum/round_event_control/antagonist/solo/cast_control = control
antag_count = cast_control.get_antag_amount()
if(!antag_count)
return

antag_flag = cast_control.antag_flag
antag_datum = cast_control.antag_datum
restricted_roles = cast_control.restricted_roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,13 @@
return FALSE

/datum/round_event_control/antagonist/solo/proc/get_antag_amount()
var/people = SSgamemode.get_correct_popcount()
var/amount = base_antags + FLOOR(people / denominator, 1)
return min(amount, maximum_antags)
var/decided_count = rand(base_antags, maximum_antags)

var/gamemode_antags_left = SSgamemode.get_antag_cap() - SSgamemode.get_antag_count()
var/maximum_to_spawn = min(gamemode_antags_left, maximum_antags)

var/clamped_value = clamp(decided_count, 0, maximum_to_spawn)
return clamped_value

/datum/round_event_control/antagonist/solo/proc/get_candidates()
var/round_started = SSticker.HasRoundStarted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@
possible_spawns += find_maintenance_spawn(atmos_sensitive = TRUE, require_darkness = FALSE)
if(!possible_spawns.len)
return

var/datum/round_event_control/antagonist/solo/cast_control = control
antag_count = cast_control.get_antag_amount()
if(!antag_count)
return

antag_flag = cast_control.antag_flag
antag_datum = cast_control.antag_datum
restricted_roles = cast_control.restricted_roles
Expand Down

0 comments on commit c88d61f

Please sign in to comment.