Skip to content

Commit

Permalink
Merge branch 'cmss13-devs:master' into property_rebalance
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveloopers authored May 23, 2024
2 parents 184dba5 + 05f7bf1 commit 3a1387d
Show file tree
Hide file tree
Showing 10 changed files with 253 additions and 82 deletions.
45 changes: 24 additions & 21 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -176,43 +176,46 @@ Additional game mode variables.

if(pred_candidate) pred_candidate.moveToNullspace() //Nullspace it for garbage collection later.

#define calculate_pred_max (floor(length(GLOB.player_list) / pred_per_players) + pred_additional_max + pred_start_count)

/datum/game_mode/proc/check_predator_late_join(mob/pred_candidate, show_warning = 1)
/datum/game_mode/proc/calculate_pred_max()
return floor(length(GLOB.player_list) / pred_per_players) + pred_additional_max + pred_start_count

/datum/game_mode/proc/check_predator_late_join(mob/pred_candidate, show_warning = TRUE)
if(!pred_candidate.client)
return

var/datum/job/J = GLOB.RoleAuthority.roles_by_name[JOB_PREDATOR]
var/datum/job/pred_job = GLOB.RoleAuthority.roles_by_name[JOB_PREDATOR]

if(!J)
if(show_warning) to_chat(pred_candidate, SPAN_WARNING("Something went wrong!"))
return
if(!pred_job)
if(show_warning)
to_chat(pred_candidate, SPAN_WARNING("Something went wrong!"))
return FALSE

if(!(pred_candidate?.client.check_whitelist_status(WHITELIST_PREDATOR)))
if(show_warning) to_chat(pred_candidate, SPAN_WARNING("You are not whitelisted! You may apply on the forums to be whitelisted as a predator."))
return
if(show_warning)
to_chat(pred_candidate, SPAN_WARNING("You are not whitelisted! You may apply on the forums to be whitelisted as a predator."))
return FALSE

if(!(flags_round_type & MODE_PREDATOR))
if(show_warning) to_chat(pred_candidate, SPAN_WARNING("There is no Hunt this round! Maybe the next one."))
return
if(show_warning)
to_chat(pred_candidate, SPAN_WARNING("There is no Hunt this round! Maybe the next one."))
return FALSE

if(pred_candidate.ckey in predators)
if(show_warning)
to_chat(pred_candidate, SPAN_WARNING("You already were a Yautja! Give someone else a chance."))
return
return FALSE

if(show_warning && tgui_alert(pred_candidate, "Confirm joining the hunt. You will join as \a [lowertext(J.get_whitelist_status(pred_candidate.client))] predator", "Confirmation", list("Yes", "No"), 10 SECONDS) != "Yes")
return
if(J.get_whitelist_status(pred_candidate.client) == WHITELIST_NORMAL)
var/pred_max = calculate_pred_max
if(pred_current_num >= pred_max)
if(show_warning) to_chat(pred_candidate, SPAN_WARNING("Only [pred_max] predators may spawn this round, but Councillors and Ancients do not count."))
return
if(show_warning && tgui_alert(pred_candidate, "Confirm joining the hunt. You will join as \a [lowertext(pred_job.get_whitelist_status(pred_candidate.client))] predator", "Confirmation", list("Yes", "No"), 10 SECONDS) != "Yes")
return FALSE

return 1
if(pred_job.get_whitelist_status(pred_candidate.client) == WHITELIST_NORMAL)
var/pred_max = calculate_pred_max()
if(pred_current_num >= pred_max)
if(show_warning)
to_chat(pred_candidate, SPAN_WARNING("Only [pred_max] predators may spawn this round, but Councillors and Ancients do not count."))
return FALSE

#undef calculate_pred_max
return TRUE

/datum/game_mode/proc/transform_predator(mob/pred_candidate)
set waitfor = FALSE
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/telecomms/machine_interactions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
dat += "</font>"
temp = ""
show_browser(user, dat, "[src] Access", "tcommachine", "size=520x500;can_resize=0")
onclose(user, "dormitory")
onclose(user, "tcommachine")


// Off-Site Relays
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/circuitboards/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
t1 += text("<p><a href='?src=\ref[];close=1'>Close</a></p>\n", src)

show_browser(user, t1, "Access Control", "airlock_electronics")
onclose(user, "airlock")
onclose(user, "airlock_electronics")


/obj/item/circuitboard/airlock/Topic(href, href_list)
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/devices/dummy_tablet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=reset'>Reset</A> \]"
dat += "<BR><hr>"

show_browser(user, dat, "Professor DUMMY Control Tablet", window_options="size=400x500")
onclose(user, "communications")
show_browser(user, dat, "Professor DUMMY Control Tablet", "dummytablet", window_options="size=400x500")
onclose(user, "dummytablet")
updateDialog()
return

Expand Down
41 changes: 28 additions & 13 deletions code/modules/admin/tabs/round_tab.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
/client/proc/adjust_predator_round()
set name = "Adjust Predator Round"
set desc = "Adjust the number of predators present in a predator round."
set name = "Adjust Predator Slots"
set desc = "Adjust the extra slots for predators."
set category = "Server.Round"

if(admin_holder)
if(!SSticker || !SSticker.mode)
to_chat(src, SPAN_WARNING("The game hasn't started yet!"))
return
if(!admin_holder)
return

var/value = tgui_input_number(src,"How many additional predators can join? Decreasing the value is not recommended. Current predator count: [SSticker.mode.pred_current_num]","Input:", 0, (SSticker.mode.pred_additional_max - SSticker.mode.pred_current_num))
if(!SSticker?.mode)
to_chat(src, SPAN_WARNING("The game hasn't started yet!"))
return

if(value < SSticker.mode.pred_current_num)
to_chat(src, SPAN_NOTICE("Aborting. Number cannot be lower than the current pred count. (current: [SSticker.mode.pred_current_num], attempted: [value])"))
return
var/cur_extra = SSticker.mode.pred_additional_max
var/cur_count = SSticker.mode.pred_current_num
var/cur_max = SSticker.mode.calculate_pred_max()
var/value = tgui_input_number(src, "How many additional predators can join? Current predator count: [cur_count]/[cur_max] Current setting: [cur_extra]", "Input:", default = cur_extra, min_value = 0, integer_only = TRUE)

if(isnull(value))
return

if(value == cur_extra)
return

cur_count = SSticker.mode.pred_current_num // values could have changed since asking
cur_max = SSticker.mode.calculate_pred_max()
var/free_extra = max(min(cur_extra, cur_max - cur_count), 0) // how much we could potentionally reduce pred_additional_max

// If we are reducing the count and that exceeds how much we could reduce it by
if(value < cur_extra && (cur_extra - value) > free_extra)
to_chat(src, SPAN_NOTICE("Aborting. Number cannot result in a max less than current pred count. (current: [cur_count]/[cur_max], current extra: [cur_extra], attempted: [value])"))
return

if(value)
SSticker.mode.pred_additional_max = abs(value)
message_admins("[key_name_admin(usr)] adjusted the additional pred amount to [abs(value)].")
SSticker.mode.pred_additional_max = value
message_admins("[key_name_admin(usr)] adjusted the additional pred amount from [cur_extra] to [value].")

/datum/admins/proc/force_predator_round()
set name = "Toggle Predator Round"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
dat += "</div></body>"

winshow(user, "preferencewindow", TRUE)
show_browser(user, dat, "Preferences", "preferencebrowser")
show_browser(user, dat, "Preferences", "preferencewindow")
onclose(user, "preferencewindow", src)

/**
Expand Down
4 changes: 4 additions & 0 deletions html/changelogs/AutoChangeLog-pr-6289.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
author: "Drathek"
delete-after: True
changes:
- admin: "Fixed the adjust_predator_round verb"
4 changes: 4 additions & 0 deletions html/changelogs/AutoChangeLog-pr-6309.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
author: "TheGamerdk"
delete-after: True
changes:
- rscadd: "Adds a sensor tower to the far East of Shivas, between Med-Sec and the Research labs"
4 changes: 4 additions & 0 deletions html/changelogs/AutoChangeLog-pr-6319.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
author: "Drathek"
delete-after: True
changes:
- bugfix: "Fixed some winset errors with some nanoui windows"
Loading

0 comments on commit 3a1387d

Please sign in to comment.