mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
[MIRROR] Build mode fill tool asks for confirmation if filling area is large (#3497)
* Build mode fill tool asks for confirmation if filling area is large (#57007) Prompts admins to confirm their selection with the build mode fill tool if the selected area is over 150 tiles. I've seen this happen a few times now (to both myself and others), accidentally filling a massive area because they either forgot that the tool was still on or were moved unexpectedly. This should prevent these kinds of mistakes from happening easily. * Build mode fill tool asks for confirmation if filling area is large Co-authored-by: dragomagol <66640614+dragomagol@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#define FILL_WARNING_MIN 150
|
||||
|
||||
/datum/buildmode_mode/fill
|
||||
key = "fill"
|
||||
|
||||
|
||||
use_corner_selection = TRUE
|
||||
var/objholder = null
|
||||
|
||||
@@ -34,7 +36,7 @@
|
||||
|
||||
/datum/buildmode_mode/fill/handle_selected_area(client/c, params)
|
||||
var/list/modifiers = params2list(params)
|
||||
|
||||
|
||||
if(LAZYACCESS(modifiers, LEFT_CLICK)) //rectangular
|
||||
if(LAZYACCESS(modifiers, ALT_CLICK))
|
||||
var/list/deletion_area = block(get_turf(cornerA),get_turf(cornerB))
|
||||
@@ -51,6 +53,13 @@
|
||||
// if there's an analogous proc for this on tg lmk
|
||||
// empty_region(block(get_turf(cornerA),get_turf(cornerB)))
|
||||
else
|
||||
var/selection_size = abs(cornerA.x - cornerB.x) * abs(cornerA.y - cornerB.y)
|
||||
|
||||
if(selection_size > FILL_WARNING_MIN) // Confirm fill if the number of tiles in the selection is greater than FILL_WARNING_MIN
|
||||
var/choice = alert("Your selected area is [selection_size] tiles! Continue?", "Large Fill Confirmation", "Yes", "No")
|
||||
if(choice != "Yes")
|
||||
return
|
||||
|
||||
for(var/turf/T in block(get_turf(cornerA),get_turf(cornerB)))
|
||||
if(ispath(objholder,/turf))
|
||||
T.PlaceOnTop(objholder)
|
||||
@@ -58,3 +67,5 @@
|
||||
var/obj/A = new objholder(T)
|
||||
A.setDir(BM.build_dir)
|
||||
log_admin("Build Mode: [key_name(c)] with path [objholder], filled the region from [AREACOORD(cornerA)] through [AREACOORD(cornerB)]")
|
||||
|
||||
#undef FILL_WARNING_MIN
|
||||
|
||||
Reference in New Issue
Block a user