Build Mode Preview + better help text (#76095)

## About The Pull Request
Gives `Adv Build Mode` and `Fill` an item preview, and puts the help
text for build mode modes into an examine block.


https://github.com/tgstation/tgstation/assets/66640614/6751c721-6ddd-4761-8311-fb002ea905ac


![image](https://github.com/tgstation/tgstation/assets/66640614/3f6fe986-1767-4639-94d3-523f1039c947)


![image](https://github.com/tgstation/tgstation/assets/66640614/a7eae938-a575-46bd-b00e-865f04e0de20)


## Why It's Good For The Game
It's good to see what you're doing. 

## Changelog
🆑 Tattle
admin: build mode help text is in an examine block
admin: adv build mode and fill now have item previews
/🆑

---------

Co-authored-by: tattle <article.disaster@gmail.com>
Co-authored-by: san7890 <the@san7890.com>
This commit is contained in:
tattle
2023-06-23 20:04:18 -06:00
committed by GitHub
co-authored by tattle san7890
parent 014872f051
commit d81eaae90c
16 changed files with 129 additions and 89 deletions
+34
View File
@@ -22,6 +22,8 @@
// dirswitch UI
var/atom/movable/screen/buildmode/bdir/dirbutton
var/list/dirswitch_buttons = list()
/// item preview for selected item
var/atom/movable/screen/buildmode/preview_item/preview
/datum/buildmode/New(client/c)
mode = new /datum/buildmode_mode/basic(src)
@@ -44,6 +46,7 @@
/datum/buildmode/Destroy()
close_switchstates()
close_preview()
holder.player_details.post_login_callbacks -= li_cb
li_cb = null
holder = null
@@ -126,10 +129,41 @@
switch_state = BM_SWITCHSTATE_NONE
holder.screen -= dirswitch_buttons
/datum/buildmode/proc/preview_selected_item(atom/typepath)
close_preview()
preview = new /atom/movable/screen/buildmode/preview_item(src)
preview.name = initial(typepath.name)
// Scale the preview if it's bigger than one tile
var/mutable_appearance/preview_overlay = new(typepath)
var/icon/size_check = icon(initial(typepath.icon), icon_state = initial(typepath.icon_state))
var/scale = 1
var/width = size_check.Width()
var/height = size_check.Height()
if(width > world.icon_size || height > world.icon_size)
if(width >= height)
scale = world.icon_size / width
else
scale = world.icon_size / height
preview_overlay.transform = preview_overlay.transform.Scale(scale)
preview_overlay.appearance_flags |= TILE_BOUND
preview_overlay.layer = FLOAT_LAYER
preview_overlay.plane = FLOAT_PLANE
preview.add_overlay(preview_overlay)
holder.screen += preview
/datum/buildmode/proc/close_preview()
if(isnull(preview))
return
holder.screen -= preview
QDEL_NULL(preview)
/datum/buildmode/proc/change_mode(newmode)
mode.exit_mode(src)
QDEL_NULL(mode)
close_switchstates()
close_preview()
mode = new newmode(src)
mode.enter_mode(src)
modebutton.update_appearance()
+5
View File
@@ -89,3 +89,8 @@
/atom/movable/screen/buildmode/quit/Click()
bd.quit()
return 1
/atom/movable/screen/buildmode/preview_item
name = "Selected Item"
icon_state = "template"
screen_loc = "NORTH,WEST+4"
+11 -12
View File
@@ -2,18 +2,15 @@
key = "advanced"
var/atom/objholder = null
// FIXME: add logic which adds a button displaying the icon
// of the currently selected path
/datum/buildmode_mode/advanced/show_help(client/c)
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Set object type"))
to_chat(c, span_notice("Left Mouse Button + alt on turf/obj = Copy object type"))
to_chat(c, span_notice("Left Mouse Button on turf/obj = Place objects"))
to_chat(c, span_notice("Right Mouse Button = Delete objects"))
to_chat(c, span_notice("\nUse the button in the upper left corner to"))
to_chat(c, span_notice("change the direction of built objects."))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/advanced/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Set object type")] -> Right Mouse Button on buildmode button\n\
[span_bold("Copy object type")] -> Left Mouse Button + Alt on turf/obj\n\
[span_bold("Place objects")] -> Left Mouse Button on turf/obj\n\
[span_bold("Delete objects")] -> Right Mouse Button\n\
\n\
Use the button in the upper left corner to change the direction of built objects."))
)
/datum/buildmode_mode/advanced/change_settings(client/c)
var/target_path = input(c, "Enter typepath:", "Typepath", "/obj/structure/closet")
@@ -27,6 +24,7 @@
objholder = null
tgui_alert(usr,"That path is not allowed.")
return
BM.preview_selected_item(objholder)
/datum/buildmode_mode/advanced/handle_click(client/c, params, obj/object)
var/list/modifiers = params2list(params)
@@ -38,6 +36,7 @@
if (istype(object, /turf) || isobj(object) || istype(object, /mob))
objholder = object.type
to_chat(c, span_notice("[initial(object.name)] ([object.type]) selected."))
BM.preview_selected_item(objholder)
else
to_chat(c, span_notice("[initial(object.name)] is not a turf, object, or mob! Please select again."))
else if(left_click)
+8 -8
View File
@@ -8,6 +8,14 @@
areaimage = image('icons/area/areas_misc.dmi', null, "yellow")
..()
/datum/buildmode_mode/area_edit/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Select corner")] -> Left Mouse Button on obj/turf/mob\n\
[span_bold("Paint area")] -> Left Mouse Button + Alt on turf/obj/mob\n\
[span_bold("Select area to paint")] -> Right Mouse Button on obj/turf/mob\n\
[span_bold("Create new area")] -> Right Mouse Button on buildmode button"))
)
/datum/buildmode_mode/area_edit/enter_mode(datum/buildmode/BM)
BM.holder.images += areaimage
@@ -21,14 +29,6 @@
storedarea = null
return ..()
/datum/buildmode_mode/area_edit/show_help(client/c)
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button on obj/turf/mob = Select corner"))
to_chat(c, "<span class='notice'>Left Mouse Button + Alt on turf/obj/mob = Paint area/span>")
to_chat(c, span_notice("Right Mouse Button on obj/turf/mob = Select area to paint"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Create new area"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/area_edit/change_settings(client/c)
var/target_path = input(c, "Enter typepath:", "Typepath", "/area")
var/areatype = text2path(target_path)
+9 -9
View File
@@ -1,15 +1,15 @@
/datum/buildmode_mode/basic
key = "basic"
/datum/buildmode_mode/basic/show_help(client/c)
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button = Construct / Upgrade"))
to_chat(c, span_notice("Right Mouse Button = Deconstruct / Delete / Downgrade"))
to_chat(c, span_notice("Left Mouse Button + ctrl = R-Window"))
to_chat(c, span_notice("Left Mouse Button + alt = Airlock"))
to_chat(c, span_notice("\nUse the button in the upper left corner to"))
to_chat(c, span_notice("change the direction of built objects."))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/basic/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Construct / Upgrade")] -> Left Mouse Button\n\
[span_bold("Deconstruct / Delete / Downgrade")] -> Right Mouse Button\n\
[span_bold("R-Window")] -> Left Mouse Button + Ctrl\n\
[span_bold("Airlock")] -> Left Mouse Button + Alt \n\
\n\
Use the button in the upper left corner to change the direction of built objects."))
)
/datum/buildmode_mode/basic/handle_click(client/c, params, obj/object)
var/list/modifiers = params2list(params)
+8 -7
View File
@@ -12,14 +12,15 @@
BOOM_HEAVY = 0,
BOOM_LIGHT = 0,
BOOM_FLASH = 0,
BOOM_FLAMES = 0
)
BOOM_FLAMES = 0,
)
/datum/buildmode_mode/boom/show_help(client/c)
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Mouse Button on obj = Kaboom"))
to_chat(c, span_notice("NOTE: Using the \"Config/Launch Supplypod\" verb allows you to do this in an IC way (i.e., making a cruise missile come down from the sky and explode wherever you click!)"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/boom/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Set explosion destructiveness")] -> Right Mouse Button on buildmode button\n\
[span_bold("Kaboom")] -> Mouse Button on obj\n\n\
[span_warning("NOTE:")] Using the \"Config/Launch Supplypod\" verb allows you to do this in an IC way (i.e., making a cruise missile come down from the sky and explode wherever you click!)"))
)
/datum/buildmode_mode/boom/change_settings(client/c)
for (var/explosion_level in explosions)
+5 -5
View File
@@ -6,11 +6,11 @@
stored = null
return ..()
/datum/buildmode_mode/copy/show_help(client/c)
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button on obj/turf/mob = Spawn a Copy of selected target"))
to_chat(c, span_notice("Right Mouse Button on obj/mob = Select target to copy"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/copy/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Spawn a copy of selected target")] -> Left Mouse Button on obj/turf/mob\n\
[span_bold("Select target to copy")] -> Right Mouse Button on obj/mob"))
)
/datum/buildmode_mode/copy/handle_click(client/c, params, obj/object)
var/list/modifiers = params2list(params)
+5 -5
View File
@@ -1,11 +1,11 @@
/datum/buildmode_mode/delete
key = "delete"
/datum/buildmode_mode/delete/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************\n\
Left Mouse Button on anything to delete it. If you break it, you buy it.\n\
Right Mouse Button on anything to delete everything of the type. Probably don\'t do this unless you know what you are doing.\n\
***********************************************************</span>")
/datum/buildmode_mode/delete/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Delete an object")] -> Left Mouse Button on obj/turf/mob\n\
[span_bold("Delete all objects of a type")] -> Right Mouse Button on obj/turf/mob"))
)
/datum/buildmode_mode/delete/handle_click(client/c, params, object)
var/list/modifiers = params2list(params)
+7 -6
View File
@@ -6,12 +6,12 @@
use_corner_selection = TRUE
var/atom/objholder = null
/datum/buildmode_mode/fill/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("Left Mouse Button + Alt on turf/obj/mob = Delete region"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Select object type"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/fill/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Select corner")] -> Left Mouse Button on turf/obj/mob\n\
[span_bold("Delete region")] -> Left Mouse Button + Alt on turf/obj/mob\n\
[span_bold("Select object type")] -> Right Mouse Button on buildmode button"))
)
/datum/buildmode_mode/fill/change_settings(client/c)
var/target_path = input(c, "Enter typepath:" ,"Typepath","/obj/structure/closet")
@@ -25,6 +25,7 @@
objholder = null
tgui_alert(usr,"Area paths are not supported for this mode, use the area edit mode instead.")
return
BM.preview_selected_item(objholder)
deselect_region()
/datum/buildmode_mode/fill/handle_click(client/c, params, obj/object)
+5 -5
View File
@@ -4,11 +4,11 @@
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/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Select corner")] -> Left Mouse Button on turf/obj/mob\n\
[span_bold("Select generator")] -> Right Mouse Button on buildmode button"))
)
/datum/buildmode_mode/mapgen/change_settings(client/c)
var/list/gen_paths = subtypesof(/datum/map_generator)
+6 -6
View File
@@ -6,12 +6,12 @@
dressuptime = null
return ..()
/datum/buildmode_mode/outfit/show_help(client/c)
to_chat(c, "<span class='notice'>***********************************************************\n\
Right Mouse Button on buildmode button = Select outfit to equip.\n\
Left Mouse Button on mob/living/carbon/human = Equip the selected outfit.\n\
Right Mouse Button on mob/living/carbon/human = Strip and delete current outfit.\n\
***********************************************************</span>")
/datum/buildmode_mode/outfit/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Select outfit to equip")] -> Right Mouse Button on buildmode button\n\
[span_bold("Equip the selected outfit")] -> Left Mouse Button on mob/living/carbon/human\n\
[span_bold("Strip and delete current outfit")] -> Right Mouse Button on mob/living/carbon/human"))
)
/datum/buildmode_mode/outfit/Reset()
. = ..()
+5 -5
View File
@@ -5,11 +5,11 @@
///The list of arguments for the procedure. They may not be. They are selected in the same way in the game, and can be a datum, and other types.
var/list/proc_args = null
/datum/buildmode_mode/proccall/show_help(client/target_client)
to_chat(target_client, span_notice("***********************************************************\n\
Right Mouse Button on buildmode button = Choose procedure and arguments\n\
Left Mouse Button on machinery = Apply procedure on object.\n\
***********************************************************"))
/datum/buildmode_mode/proccall/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Choose procedure and arguments")] -> Right Mouse Button on buildmode button\n\
[span_bold("Apply procedure on object")] -> Left Mouse Button on machinery"))
)
/datum/buildmode_mode/proccall/change_settings(client/target_client)
if(!check_rights_for(target_client, R_DEBUG))
+5 -5
View File
@@ -6,11 +6,11 @@
selected_smite = null
return ..()
/datum/buildmode_mode/smite/show_help(client/user)
to_chat(user, "<span class='notice'>***********************************************************\n\
Right Mouse Button on buildmode button = Select smite to use.\n\
Left Mouse Button on mob/living = Smite the mob.\n\
***********************************************************</span>")
/datum/buildmode_mode/smite/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Select smite to use")] -> Right Mouse Button on buildmode button\n\
[span_bold("Smite the mob")] -> Left Mouse Button on mob/living"))
)
/datum/buildmode_mode/smite/change_settings(client/user)
var/punishment = input(user, "Choose a punishment", "DIVINE SMITING") as null|anything in GLOB.smites
+5 -5
View File
@@ -7,11 +7,11 @@
throw_atom = null
return ..()
/datum/buildmode_mode/throwing/show_help(client/c)
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Left Mouse Button on turf/obj/mob = Select"))
to_chat(c, span_notice("Right Mouse Button on turf/obj/mob = Throw"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/throwing/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Select")] -> Left Mouse Button on turf/obj/mob\n\
[span_bold("Throw")] -> Right Mouse Button on turf/obj/mob"))
)
/datum/buildmode_mode/throwing/handle_click(client/c, params, obj/object)
var/list/modifiers = params2list(params)
@@ -3,11 +3,11 @@
/// This variable is responsible for the rating of the components themselves. Literally tiers of components, where 1 is standard, 4 is bluespace.
var/rating = null
/datum/buildmode_mode/tweakcomps/show_help(client/target_client)
to_chat(target_client, span_notice("***********************************************************\n\
Right Mouse Button on buildmode button = Choose the rating of the components.\n\
Left Mouse Button on machinery = Sets the chosen rating of the components on the machinery.\n\
***********************************************************"))
/datum/buildmode_mode/tweakcomps/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Choose the rating of the components")] -> Right Mouse Button on buildmode button\n\
[span_bold("Sets the chosen rating of the components on the machinery")] -> Left Mouse Button on machinery"))
)
/datum/buildmode_mode/tweakcomps/change_settings(client/target_client)
var/rating_to_choose = input(target_client, "Enter number of rating", "Number", "1")
@@ -9,12 +9,12 @@
valueholder = null
return ..()
/datum/buildmode_mode/varedit/show_help(client/c)
to_chat(c, span_notice("***********************************************************"))
to_chat(c, span_notice("Right Mouse Button on buildmode button = Select var(type) & value"))
to_chat(c, span_notice("Left Mouse Button on turf/obj/mob = Set var(type) & value"))
to_chat(c, span_notice("Right Mouse Button on turf/obj/mob = Reset var's value"))
to_chat(c, span_notice("***********************************************************"))
/datum/buildmode_mode/varedit/show_help(client/builder)
to_chat(builder, span_purple(examine_block(
"[span_bold("Select var(type) & value")] -> Right Mouse Button on buildmode button\n\
[span_bold("Set var(type) & value")] -> Left Mouse Button on turf/obj/mob\n\
[span_bold("Reset var's value")] -> Right Mouse Button on turf/obj/mob"))
)
/datum/buildmode_mode/varedit/Reset()
. = ..()