Skip to content

Commit

Permalink
Adds a warning to potentially-laggy uses of drop-bomb (#6434)
Browse files Browse the repository at this point in the history
# About the pull request

Bombs with linear falloff, power >= 500, and falloff <= 5% of power have
an extra confirmation before dropping.

# Explain why it's good for the game

While there is an existing bomb cap (5000), this confirmation just makes
sure admins know what they're doing before dropping the bomb.

~~no this has nothing to do with me bringing the server to a halt~~

# Changelog
:cl:
admin: Potentially laggy uses of the drop-bomb verb now have a
confirmation warning.
/:cl:

---------

Co-authored-by: John Doe <[email protected]>
  • Loading branch information
Zonespace27 and johndoe2013 authored Jun 12, 2024
1 parent ea2141b commit 4c37391
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions code/modules/admin/tabs/event_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@

/client/proc/handle_bomb_drop(atom/epicenter)
var/custom_limit = 5000
var/power_warn_threshold = 500
var/falloff_warn_threshold = 0.05
var/list/choices = list("Small Bomb", "Medium Bomb", "Big Bomb", "Custom Bomb")
var/list/falloff_shape_choices = list("CANCEL", "Linear", "Exponential")
var/choice = tgui_input_list(usr, "What size explosion would you like to produce?", "Drop Bomb", choices)
Expand Down Expand Up @@ -113,6 +115,11 @@

if(power > custom_limit)
return

if((power >= power_warn_threshold) && ((1 / (power / falloff)) <= falloff_warn_threshold) && (explosion_shape == EXPLOSION_FALLOFF_SHAPE_LINEAR)) // The lag can be a bit situational, but a large-power explosion with minimal (linear) falloff can absolutely bring the server to a halt in certain cases.
if(tgui_input_list(src, "This bomb has the potential to lag the server. Are you sure you wish to drop it?", "Drop confirm", list("Yes", "No")) != "Yes")
return

cell_explosion(epicenter, power, falloff, explosion_shape, null, cause_data)
message_admins("[key_name(src, TRUE)] dropped a custom cell bomb with power [power], falloff [falloff] and falloff_shape [shape_choice]!")
message_admins("[ckey] used 'Drop Bomb' at [epicenter.loc].")
Expand Down

0 comments on commit 4c37391

Please sign in to comment.