mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-20 14:04:43 +00:00
This removes code/__DEFINES/misc.dm and moves all the defines to either: another existing define file new define file local .dm file if the define was only used in one file I also deleted defines that were not being used and added documentation to all of the ones that were moved out of misc.dm Why was this needed? People were basically using the misc.dm file as a dumpster to toss all their defines into that was creating one giant mess. The defines have been organized into their proper groups and files now.
99 lines
2.5 KiB
Plaintext
99 lines
2.5 KiB
Plaintext
/// Corner A area section for buildmode
|
|
#define AREASELECT_CORNERA "corner A"
|
|
/// Corner B area selection for buildmode
|
|
#define AREASELECT_CORNERB "corner B"
|
|
|
|
/datum/buildmode_mode
|
|
var/key = "oops"
|
|
|
|
var/datum/buildmode/BM
|
|
|
|
// would corner selection work better as a component?
|
|
var/use_corner_selection = FALSE
|
|
var/list/preview
|
|
var/turf/cornerA
|
|
var/turf/cornerB
|
|
|
|
/datum/buildmode_mode/New(datum/buildmode/BM)
|
|
src.BM = BM
|
|
preview = list()
|
|
return ..()
|
|
|
|
/datum/buildmode_mode/Destroy()
|
|
cornerA = null
|
|
cornerB = null
|
|
QDEL_LIST(preview)
|
|
preview = null
|
|
return ..()
|
|
|
|
/datum/buildmode_mode/proc/enter_mode(datum/buildmode/BM)
|
|
return
|
|
|
|
/datum/buildmode_mode/proc/exit_mode(datum/buildmode/BM)
|
|
return
|
|
|
|
/datum/buildmode_mode/proc/get_button_iconstate()
|
|
return "buildmode_[key]"
|
|
|
|
/datum/buildmode_mode/proc/show_help(client/c)
|
|
CRASH("No help defined, yell at a coder")
|
|
|
|
/datum/buildmode_mode/proc/change_settings(client/c)
|
|
to_chat(c, span_warning("There is no configuration available for this mode"))
|
|
return
|
|
|
|
/datum/buildmode_mode/proc/Reset()
|
|
deselect_region()
|
|
|
|
/datum/buildmode_mode/proc/select_tile(turf/T, corner_to_select)
|
|
var/overlaystate
|
|
BM.holder.images -= preview
|
|
switch(corner_to_select)
|
|
if(AREASELECT_CORNERA)
|
|
overlaystate = "greenOverlay"
|
|
if(AREASELECT_CORNERB)
|
|
overlaystate = "blueOverlay"
|
|
|
|
var/image/I = image('icons/turf/overlays.dmi', T, overlaystate)
|
|
I.plane = ABOVE_LIGHTING_PLANE
|
|
preview += I
|
|
BM.holder.images += preview
|
|
return T
|
|
|
|
/datum/buildmode_mode/proc/highlight_region(region)
|
|
BM.holder.images -= preview
|
|
for(var/t in region)
|
|
var/image/I = image('icons/turf/overlays.dmi', t, "redOverlay")
|
|
I.plane = ABOVE_LIGHTING_PLANE
|
|
preview += I
|
|
BM.holder.images += preview
|
|
|
|
/datum/buildmode_mode/proc/deselect_region()
|
|
BM.holder.images -= preview
|
|
preview.Cut()
|
|
cornerA = null
|
|
cornerB = null
|
|
|
|
/datum/buildmode_mode/proc/handle_click(client/c, params, object)
|
|
var/list/modifiers = params2list(params)
|
|
if(use_corner_selection)
|
|
if(LAZYACCESS(modifiers, LEFT_CLICK))
|
|
if(!cornerA)
|
|
cornerA = select_tile(get_turf(object), AREASELECT_CORNERA)
|
|
return
|
|
if(cornerA && !cornerB)
|
|
cornerB = select_tile(get_turf(object), AREASELECT_CORNERB)
|
|
to_chat(c, span_boldwarning("Region selected, if you're happy with your selection left click again, otherwise right click."))
|
|
return
|
|
handle_selected_area(c, params)
|
|
deselect_region()
|
|
else
|
|
to_chat(c, span_notice("Region selection canceled!"))
|
|
deselect_region()
|
|
return
|
|
|
|
/datum/buildmode_mode/proc/handle_selected_area(client/c, params)
|
|
|
|
#undef AREASELECT_CORNERA
|
|
#undef AREASELECT_CORNERB
|