mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 20:11:56 +00:00
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs. Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines. Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing. Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc. (Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
49 lines
1.9 KiB
Plaintext
49 lines
1.9 KiB
Plaintext
/datum/buildmode_mode/mapgen
|
|
key = "mapgen"
|
|
|
|
use_corner_selection = TRUE
|
|
var/generator_path
|
|
|
|
/datum/buildmode_mode/mapgen/show_help(client/c)
|
|
to_chat(c, span_notice("***********************************************************"))
|
|
to_chat(c, span_notice("Left Mouse Button on turf/obj/mob = Select corner"))
|
|
to_chat(c, span_notice("Right Mouse Button on buildmode button = Select generator"))
|
|
to_chat(c, span_notice("***********************************************************"))
|
|
|
|
/datum/buildmode_mode/mapgen/change_settings(client/c)
|
|
var/list/gen_paths = subtypesof(/datum/map_generator)
|
|
var/list/options = list()
|
|
for(var/path in gen_paths)
|
|
var/datum/map_generator/MP = path
|
|
options[initial(MP.buildmode_name)] = path
|
|
var/type = input(c,"Select Generator Type","Type") as null|anything in options
|
|
if(!type)
|
|
return
|
|
|
|
generator_path = options[type]
|
|
deselect_region()
|
|
|
|
/datum/buildmode_mode/mapgen/handle_click(client/c, params, obj/object)
|
|
if(isnull(generator_path))
|
|
to_chat(c, span_warning("Select generator type first."))
|
|
deselect_region()
|
|
return
|
|
..()
|
|
|
|
/datum/buildmode_mode/mapgen/handle_selected_area(client/c, params)
|
|
var/list/modifiers = params2list(params)
|
|
|
|
if(LAZYACCESS(modifiers, LEFT_CLICK))
|
|
var/datum/map_generator/G = new generator_path
|
|
if(istype(G, /datum/map_generator/repair/reload_station_map))
|
|
if(GLOB.reloading_map)
|
|
to_chat(c, span_boldwarning("You are already reloading an area! Please wait for it to fully finish loading before trying to load another!"))
|
|
deselect_region()
|
|
return
|
|
G.defineRegion(cornerA, cornerB, 1)
|
|
highlight_region(G.map)
|
|
var/confirm = tgui_alert(usr,"Are you sure you want to run the map generator?", "Run generator", list("Yes", "No"))
|
|
if(confirm == "Yes")
|
|
G.generate()
|
|
log_admin("Build Mode: [key_name(c)] ran the map generator '[G.buildmode_name]' in the region from [AREACOORD(cornerA)] to [AREACOORD(cornerB)]")
|