Merge pull request #8555 from Ghommie/Ghommie-cit32
Updates radials, makes RCD and RCL use em.
This commit is contained in:
+58
-17
@@ -1,4 +1,7 @@
|
||||
#define NEXT_PAGE_ID "__next__"
|
||||
#define DEFAULT_CHECK_DELAY 20
|
||||
|
||||
GLOBAL_LIST_EMPTY(radial_menus)
|
||||
|
||||
/obj/screen/radial
|
||||
icon = 'icons/mob/radial.dmi'
|
||||
@@ -10,14 +13,19 @@
|
||||
icon_state = "radial_slice"
|
||||
var/choice
|
||||
var/next_page = FALSE
|
||||
var/tooltips = FALSE
|
||||
|
||||
/obj/screen/radial/slice/MouseEntered(location, control, params)
|
||||
. = ..()
|
||||
icon_state = "radial_slice_focus"
|
||||
if(tooltips)
|
||||
openToolTip(usr, src, params, title = name)
|
||||
|
||||
/obj/screen/radial/slice/MouseExited(location, control, params)
|
||||
. = ..()
|
||||
icon_state = "radial_slice"
|
||||
if(tooltips)
|
||||
closeToolTip(usr)
|
||||
|
||||
/obj/screen/radial/slice/Click(location, control, params)
|
||||
if(usr.client == parent.current_user)
|
||||
@@ -30,6 +38,14 @@
|
||||
name = "Close Menu"
|
||||
icon_state = "radial_center"
|
||||
|
||||
/obj/screen/radial/center/MouseEntered(location, control, params)
|
||||
. = ..()
|
||||
icon_state = "radial_center_focus"
|
||||
|
||||
/obj/screen/radial/center/MouseExited(location, control, params)
|
||||
. = ..()
|
||||
icon_state = "radial_center"
|
||||
|
||||
/obj/screen/radial/center/Click(location, control, params)
|
||||
if(usr.client == parent.current_user)
|
||||
parent.finished = TRUE
|
||||
@@ -48,6 +64,9 @@
|
||||
var/atom/anchor
|
||||
var/image/menu_holder
|
||||
var/finished = FALSE
|
||||
var/datum/callback/custom_check_callback
|
||||
var/next_check = 0
|
||||
var/check_delay = DEFAULT_CHECK_DELAY
|
||||
|
||||
var/radius = 32
|
||||
var/starting_angle = 0
|
||||
@@ -57,7 +76,7 @@
|
||||
var/max_elements
|
||||
var/pages = 1
|
||||
var/current_page = 1
|
||||
|
||||
|
||||
var/hudfix_method = TRUE //TRUE to change anchor to user, FALSE to shift by py_shift
|
||||
var/py_shift = 0
|
||||
var/entry_animation = TRUE
|
||||
@@ -75,7 +94,7 @@
|
||||
restrict_to_dir(NORTH) //I was going to parse screen loc here but that's more effort than it's worth.
|
||||
|
||||
//Sets defaults
|
||||
//These assume 45 deg min_angle
|
||||
//These assume 45 deg min_angle
|
||||
/datum/radial_menu/proc/restrict_to_dir(dir)
|
||||
switch(dir)
|
||||
if(NORTH)
|
||||
@@ -91,18 +110,19 @@
|
||||
starting_angle = 180
|
||||
ending_angle = 45
|
||||
|
||||
/datum/radial_menu/proc/setup_menu()
|
||||
/datum/radial_menu/proc/setup_menu(use_tooltips)
|
||||
if(ending_angle > starting_angle)
|
||||
zone = ending_angle - starting_angle
|
||||
else
|
||||
zone = 360 - starting_angle + ending_angle
|
||||
|
||||
|
||||
max_elements = round(zone / min_angle)
|
||||
var/paged = max_elements < choices.len
|
||||
if(elements.len < max_elements)
|
||||
var/elements_to_add = max_elements - elements.len
|
||||
for(var/i in 1 to elements_to_add) //Create all elements
|
||||
var/obj/screen/radial/new_element = new /obj/screen/radial/slice
|
||||
var/obj/screen/radial/slice/new_element = new /obj/screen/radial/slice
|
||||
new_element.tooltips = use_tooltips
|
||||
new_element.parent = src
|
||||
elements += new_element
|
||||
|
||||
@@ -163,7 +183,7 @@
|
||||
else
|
||||
E.pixel_y = py
|
||||
E.pixel_x = px
|
||||
|
||||
|
||||
//Visuals
|
||||
E.alpha = 255
|
||||
E.mouse_opacity = MOUSE_OPACITY_ICON
|
||||
@@ -183,7 +203,7 @@
|
||||
E.next_page = FALSE
|
||||
if(choices_icons[choice_id])
|
||||
E.add_overlay(choices_icons[choice_id])
|
||||
|
||||
|
||||
/datum/radial_menu/New()
|
||||
close_button = new
|
||||
close_button.parent = src
|
||||
@@ -200,7 +220,7 @@
|
||||
/datum/radial_menu/proc/get_next_id()
|
||||
return "c_[choices.len]"
|
||||
|
||||
/datum/radial_menu/proc/set_choices(list/new_choices)
|
||||
/datum/radial_menu/proc/set_choices(list/new_choices, use_tooltips)
|
||||
if(choices.len)
|
||||
Reset()
|
||||
for(var/E in new_choices)
|
||||
@@ -211,7 +231,7 @@
|
||||
var/I = extract_image(new_choices[E])
|
||||
if(I)
|
||||
choices_icons[id] = I
|
||||
setup_menu()
|
||||
setup_menu(use_tooltips)
|
||||
|
||||
|
||||
/datum/radial_menu/proc/extract_image(E)
|
||||
@@ -220,7 +240,7 @@
|
||||
MA.layer = ABOVE_HUD_LAYER
|
||||
MA.appearance_flags |= RESET_TRANSFORM
|
||||
return MA
|
||||
|
||||
|
||||
|
||||
/datum/radial_menu/proc/next_page()
|
||||
if(pages > 1)
|
||||
@@ -243,28 +263,49 @@
|
||||
if(current_user)
|
||||
current_user.images -= menu_holder
|
||||
|
||||
/datum/radial_menu/proc/wait()
|
||||
/datum/radial_menu/proc/wait(atom/user, atom/anchor, require_near = FALSE)
|
||||
while (current_user && !finished && !selected_choice)
|
||||
if(require_near && !in_range(anchor, user))
|
||||
return
|
||||
if(custom_check_callback && next_check < world.time)
|
||||
if(!custom_check_callback.Invoke())
|
||||
return
|
||||
else
|
||||
next_check = world.time + check_delay
|
||||
stoplag(1)
|
||||
|
||||
/datum/radial_menu/Destroy()
|
||||
Reset()
|
||||
hide()
|
||||
QDEL_NULL(custom_check_callback)
|
||||
. = ..()
|
||||
|
||||
/*
|
||||
Presents radial menu to user anchored to anchor (or user if the anchor is currently in users screen)
|
||||
Presents radial menu to user anchored to anchor (or user if the anchor is currently in users screen)
|
||||
Choices should be a list where list keys are movables or text used for element names and return value
|
||||
and list values are movables/icons/images used for element icons
|
||||
*/
|
||||
/proc/show_radial_menu(mob/user,atom/anchor,list/choices)
|
||||
/proc/show_radial_menu(mob/user, atom/anchor, list/choices, uniqueid, radius, datum/callback/custom_check, require_near = FALSE, tooltips = FALSE)
|
||||
if(!user || !anchor || !length(choices))
|
||||
return
|
||||
if(!uniqueid)
|
||||
uniqueid = "defmenu_[REF(user)]_[REF(anchor)]"
|
||||
|
||||
if(GLOB.radial_menus[uniqueid])
|
||||
return
|
||||
|
||||
var/datum/radial_menu/menu = new
|
||||
if(!user)
|
||||
user = usr
|
||||
GLOB.radial_menus[uniqueid] = menu
|
||||
if(radius)
|
||||
menu.radius = radius
|
||||
if(istype(custom_check))
|
||||
menu.custom_check_callback = custom_check
|
||||
menu.anchor = anchor
|
||||
menu.check_screen_border(user) //Do what's needed to make it look good near borders or on hud
|
||||
menu.set_choices(choices)
|
||||
menu.set_choices(choices, tooltips)
|
||||
menu.show_to(user)
|
||||
menu.wait()
|
||||
menu.wait(user, anchor, require_near)
|
||||
var/answer = menu.selected_choice
|
||||
qdel(menu)
|
||||
GLOB.radial_menus -= uniqueid
|
||||
return answer
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
A derivative of radial menu which persists onscreen until closed and invokes a callback each time an element is clicked
|
||||
*/
|
||||
|
||||
/obj/screen/radial/persistent/center
|
||||
name = "Close Menu"
|
||||
icon_state = "radial_center"
|
||||
|
||||
/obj/screen/radial/persistent/center/Click(location, control, params)
|
||||
if(usr.client == parent.current_user)
|
||||
parent.element_chosen(null,usr)
|
||||
|
||||
/obj/screen/radial/persistent/center/MouseEntered(location, control, params)
|
||||
. = ..()
|
||||
icon_state = "radial_center_focus"
|
||||
|
||||
/obj/screen/radial/persistent/center/MouseExited(location, control, params)
|
||||
. = ..()
|
||||
icon_state = "radial_center"
|
||||
|
||||
|
||||
|
||||
/datum/radial_menu/persistent
|
||||
var/uniqueid
|
||||
var/datum/callback/select_proc_callback
|
||||
|
||||
/datum/radial_menu/persistent/New()
|
||||
close_button = new /obj/screen/radial/persistent/center
|
||||
close_button.parent = src
|
||||
|
||||
|
||||
/datum/radial_menu/persistent/element_chosen(choice_id,mob/user)
|
||||
select_proc_callback.Invoke(choices_values[choice_id])
|
||||
|
||||
|
||||
/datum/radial_menu/persistent/proc/change_choices(list/newchoices, tooltips)
|
||||
if(!newchoices.len)
|
||||
return
|
||||
Reset()
|
||||
set_choices(newchoices,tooltips)
|
||||
|
||||
/datum/radial_menu/persistent/Destroy()
|
||||
QDEL_NULL(select_proc_callback)
|
||||
GLOB.radial_menus -= uniqueid
|
||||
Reset()
|
||||
hide()
|
||||
. = ..()
|
||||
|
||||
/*
|
||||
Creates a persistent radial menu and shows it to the user, anchored to anchor (or user if the anchor is currently in users screen).
|
||||
Choices should be a list where list keys are movables or text used for element names and return value
|
||||
and list values are movables/icons/images used for element icons
|
||||
Select_proc is the proc to be called each time an element on the menu is clicked, and should accept the chosen element as its final argument
|
||||
Clicking the center button will return a choice of null
|
||||
*/
|
||||
/proc/show_radial_menu_persistent(mob/user, atom/anchor, list/choices, datum/callback/select_proc, uniqueid, radius, tooltips = FALSE)
|
||||
if(!user || !anchor || !length(choices) || !select_proc)
|
||||
return
|
||||
if(!uniqueid)
|
||||
uniqueid = "defmenu_[REF(user)]_[REF(anchor)]"
|
||||
|
||||
if(GLOB.radial_menus[uniqueid])
|
||||
return
|
||||
|
||||
var/datum/radial_menu/persistent/menu = new
|
||||
menu.uniqueid = uniqueid
|
||||
GLOB.radial_menus[uniqueid] = menu
|
||||
if(radius)
|
||||
menu.radius = radius
|
||||
menu.select_proc_callback = select_proc
|
||||
menu.anchor = anchor
|
||||
menu.check_screen_border(user) //Do what's needed to make it look good near borders or on hud
|
||||
menu.set_choices(choices, tooltips)
|
||||
menu.show_to(user)
|
||||
return menu
|
||||
|
||||
@@ -195,11 +195,16 @@
|
||||
/datum/action/item_action/toggle_firemode
|
||||
name = "Toggle Firemode"
|
||||
|
||||
/datum/action/item_action/rcl
|
||||
/datum/action/item_action/rcl_col
|
||||
name = "Change Cable Color"
|
||||
icon_icon = 'icons/mob/actions/actions_items.dmi'
|
||||
button_icon_state = "rcl_rainbow"
|
||||
|
||||
/datum/action/item_action/rcl_gui
|
||||
name = "Toggle Fast Wiring Gui"
|
||||
icon_icon = 'icons/mob/actions/actions_items.dmi'
|
||||
button_icon_state = "rcl_gui"
|
||||
|
||||
/datum/action/item_action/startchainsaw
|
||||
name = "Pull The Starting Cord"
|
||||
|
||||
|
||||
+131
-40
@@ -161,13 +161,18 @@ RLD
|
||||
user.visible_message("<span class='suicide'>[user] sets the RCD to 'Wall' and points it down [user.p_their()] throat! It looks like [user.p_theyre()] trying to commit suicide..</span>")
|
||||
return (BRUTELOSS)
|
||||
|
||||
/obj/item/construction/rcd/verb/toggle_window_type()
|
||||
set name = "Toggle Window Type"
|
||||
/obj/item/construction/rcd/verb/toggle_window_type_verb()
|
||||
set name = "RCD : Toggle Window Type"
|
||||
set category = "Object"
|
||||
set src in usr // What does this do?
|
||||
set src in view(1)
|
||||
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
|
||||
toggle_window_type(usr)
|
||||
|
||||
/obj/item/construction/rcd/proc/toggle_window_type(mob/user)
|
||||
var/window_type_name
|
||||
|
||||
if (window_type == /obj/structure/window/fulltile)
|
||||
window_type = /obj/structure/window/reinforced/fulltile
|
||||
window_type_name = "reinforced glass"
|
||||
@@ -175,17 +180,14 @@ RLD
|
||||
window_type = /obj/structure/window/fulltile
|
||||
window_type_name = "glass"
|
||||
|
||||
to_chat(usr, "<span class='notice'>You change \the [src]'s window mode to [window_type_name].</span>")
|
||||
to_chat(user, "<span class='notice'>You change \the [src]'s window mode to [window_type_name].</span>")
|
||||
|
||||
/obj/item/construction/rcd/verb/change_airlock_access()
|
||||
set name = "Change Airlock Access"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
/obj/item/construction/rcd/verb/change_airlock_access(mob/user)
|
||||
|
||||
if (!ishuman(usr) && !usr.has_unlimited_silicon_privilege)
|
||||
return ..(usr)
|
||||
if (!ishuman(user) && !user.has_unlimited_silicon_privilege)
|
||||
return
|
||||
|
||||
var/t1 = text("")
|
||||
var/t1 = ""
|
||||
|
||||
|
||||
if(use_one_access)
|
||||
@@ -216,24 +218,23 @@ RLD
|
||||
|
||||
t1 += "<p><a href='?src=[REF(src)];close=1'>Close</a></p>\n"
|
||||
|
||||
var/datum/browser/popup = new(usr, "airlock_electronics", "Access Control", 900, 500)
|
||||
var/datum/browser/popup = new(user, "rcd_access", "Access Control", 900, 500)
|
||||
popup.set_content(t1)
|
||||
popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.set_title_image(user.browse_rsc_icon(icon, icon_state))
|
||||
popup.open()
|
||||
onclose(usr, "airlock")
|
||||
onclose(user, "rcd_access")
|
||||
|
||||
/obj/item/construction/rcd/Topic(href, href_list)
|
||||
..()
|
||||
if (usr.stat || usr.restrained())
|
||||
return
|
||||
if (href_list["close"])
|
||||
usr << browse(null, "window=airlock")
|
||||
usr << browse(null, "window=rcd_access")
|
||||
return
|
||||
|
||||
if (href_list["access"])
|
||||
toggle_access(href_list["access"])
|
||||
|
||||
change_airlock_access()
|
||||
change_airlock_access(usr)
|
||||
|
||||
/obj/item/construction/rcd/proc/toggle_access(acc)
|
||||
if (acc == "all")
|
||||
@@ -253,16 +254,77 @@ RLD
|
||||
if (!conf_access.len)
|
||||
conf_access = null
|
||||
|
||||
/obj/item/construction/rcd/verb/change_airlock_setting()
|
||||
set name = "Change Airlock Setting"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
/obj/item/construction/rcd/proc/get_airlock_image(airlock_type)
|
||||
var/obj/machinery/door/airlock/proto = airlock_type
|
||||
var/ic = initial(proto.icon)
|
||||
var/mutable_appearance/MA = mutable_appearance(ic, "closed")
|
||||
if(!initial(proto.glass))
|
||||
MA.overlays += "fill_closed"
|
||||
//Not scaling these down to button size because they look horrible then, instead just bumping up radius.
|
||||
return MA
|
||||
|
||||
var/airlockcat = input(usr, "Select whether the airlock is solid or glass.") in list("Solid", "Glass")
|
||||
/obj/item/construction/rcd/proc/check_menu(mob/living/user)
|
||||
if(!istype(user))
|
||||
return FALSE
|
||||
if(user.incapacitated() || !user.Adjacent(src))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/construction/rcd/proc/change_airlock_setting(mob/user)
|
||||
if(!user)
|
||||
return
|
||||
|
||||
var/list/solid_or_glass_choices = list(
|
||||
"Solid" = get_airlock_image(/obj/machinery/door/airlock),
|
||||
"Glass" = get_airlock_image(/obj/machinery/door/airlock/glass)
|
||||
)
|
||||
|
||||
var/list/solid_choices = list(
|
||||
"Standard" = get_airlock_image(/obj/machinery/door/airlock),
|
||||
"Public" = get_airlock_image(/obj/machinery/door/airlock/public),
|
||||
"Engineering" = get_airlock_image(/obj/machinery/door/airlock/engineering),
|
||||
"Atmospherics" = get_airlock_image(/obj/machinery/door/airlock/atmos),
|
||||
"Security" = get_airlock_image(/obj/machinery/door/airlock/security),
|
||||
"Command" = get_airlock_image(/obj/machinery/door/airlock/command),
|
||||
"Medical" = get_airlock_image(/obj/machinery/door/airlock/medical),
|
||||
"Research" = get_airlock_image(/obj/machinery/door/airlock/research),
|
||||
"Freezer" = get_airlock_image(/obj/machinery/door/airlock/freezer),
|
||||
"Science" = get_airlock_image(/obj/machinery/door/airlock/science),
|
||||
"Virology" = get_airlock_image(/obj/machinery/door/airlock/virology),
|
||||
"Mining" = get_airlock_image(/obj/machinery/door/airlock/mining),
|
||||
"Maintenance" = get_airlock_image(/obj/machinery/door/airlock/maintenance),
|
||||
"External" = get_airlock_image(/obj/machinery/door/airlock/external),
|
||||
"External Maintenance" = get_airlock_image(/obj/machinery/door/airlock/maintenance/external),
|
||||
"Airtight Hatch" = get_airlock_image(/obj/machinery/door/airlock/hatch),
|
||||
"Maintenance Hatch" = get_airlock_image(/obj/machinery/door/airlock/maintenance_hatch)
|
||||
)
|
||||
|
||||
var/list/glass_choices = list(
|
||||
"Standard" = get_airlock_image(/obj/machinery/door/airlock/glass),
|
||||
"Public" = get_airlock_image(/obj/machinery/door/airlock/public/glass),
|
||||
"Engineering" = get_airlock_image(/obj/machinery/door/airlock/engineering/glass),
|
||||
"Atmospherics" = get_airlock_image(/obj/machinery/door/airlock/atmos/glass),
|
||||
"Security" = get_airlock_image(/obj/machinery/door/airlock/security/glass),
|
||||
"Command" = get_airlock_image(/obj/machinery/door/airlock/command/glass),
|
||||
"Medical" = get_airlock_image(/obj/machinery/door/airlock/medical/glass),
|
||||
"Research" = get_airlock_image(/obj/machinery/door/airlock/research/glass),
|
||||
"Science" = get_airlock_image(/obj/machinery/door/airlock/science/glass),
|
||||
"Virology" = get_airlock_image(/obj/machinery/door/airlock/virology/glass),
|
||||
"Mining" = get_airlock_image(/obj/machinery/door/airlock/mining/glass),
|
||||
"Maintenance" = get_airlock_image(/obj/machinery/door/airlock/maintenance/glass),
|
||||
"External" = get_airlock_image(/obj/machinery/door/airlock/external/glass),
|
||||
"External Maintenance" = get_airlock_image(/obj/machinery/door/airlock/maintenance/external/glass)
|
||||
)
|
||||
|
||||
var/airlockcat = show_radial_menu(user, src, solid_or_glass_choices, custom_check = CALLBACK(src, .proc/check_menu, user), require_near = TRUE)
|
||||
if(!check_menu(user))
|
||||
return
|
||||
switch(airlockcat)
|
||||
if("Solid")
|
||||
if(advanced_airlock_setting == 1)
|
||||
var/airlockpaint = input(usr, "Select the type of the airlock.") in list("Standard", "Public", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Freezer", "Science", "Virology", "Mining", "Maintenance", "External", "External Maintenance", "Airtight Hatch", "Maintenance Hatch")
|
||||
var/airlockpaint = show_radial_menu(user, src, solid_choices, radius = 42, custom_check = CALLBACK(src, .proc/check_menu, user), require_near = TRUE)
|
||||
if(!check_menu(user))
|
||||
return
|
||||
switch(airlockpaint)
|
||||
if("Standard")
|
||||
airlock_type = /obj/machinery/door/airlock
|
||||
@@ -305,7 +367,9 @@ RLD
|
||||
|
||||
if("Glass")
|
||||
if(advanced_airlock_setting == 1)
|
||||
var/airlockpaint = input(usr, "Select the type of the airlock.") in list("Standard", "Public", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Science", "Virology", "Mining", "Maintenance", "External", "External Maintenance")
|
||||
var/airlockpaint = show_radial_menu(user, src , glass_choices, radius = 42, custom_check = CALLBACK(src, .proc/check_menu, user), require_near = TRUE)
|
||||
if(!check_menu(user))
|
||||
return
|
||||
switch(airlockpaint)
|
||||
if("Standard")
|
||||
airlock_type = /obj/machinery/door/airlock/glass
|
||||
@@ -356,8 +420,8 @@ RLD
|
||||
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
|
||||
return TRUE
|
||||
|
||||
/obj/item/construction/rcd/New()
|
||||
..()
|
||||
/obj/item/construction/rcd/Initialize()
|
||||
. = ..()
|
||||
GLOB.rcd_list += src
|
||||
|
||||
/obj/item/construction/rcd/Destroy()
|
||||
@@ -366,19 +430,46 @@ RLD
|
||||
|
||||
/obj/item/construction/rcd/attack_self(mob/user)
|
||||
..()
|
||||
switch(mode)
|
||||
if(1)
|
||||
mode = 2
|
||||
to_chat(user, "<span class='notice'>You change RCD's mode to 'Airlock'.</span>")
|
||||
if(2)
|
||||
mode = 3
|
||||
to_chat(user, "<span class='notice'>You change RCD's mode to 'Deconstruct'.</span>")
|
||||
if(3)
|
||||
mode = 4
|
||||
to_chat(user, "<span class='notice'>You change RCD's mode to 'Grilles & Windows'.</span>")
|
||||
if(4)
|
||||
mode = 1
|
||||
to_chat(user, "<span class='notice'>You change RCD's mode to 'Floor & Walls'.</span>")
|
||||
var/list/choices = list(
|
||||
"Airlock" = image(icon = 'icons/mob/radial.dmi', icon_state = "airlock"),
|
||||
"Deconstruct" = image(icon= 'icons/mob/radial.dmi', icon_state = "delete"),
|
||||
"Grilles & Windows" = image(icon = 'icons/mob/radial.dmi', icon_state = "grillewindow"),
|
||||
"Floors & Walls" = image(icon = 'icons/mob/radial.dmi', icon_state = "wallfloor")
|
||||
)
|
||||
if(mode == RCD_AIRLOCK)
|
||||
choices += list(
|
||||
"Change Access" = image(icon = 'icons/mob/radial.dmi', icon_state = "access"),
|
||||
"Change Airlock Type" = image(icon = 'icons/mob/radial.dmi', icon_state = "airlocktype")
|
||||
)
|
||||
else if(mode == RCD_WINDOWGRILLE)
|
||||
choices += list(
|
||||
"Change Window Type" = image(icon = 'icons/mob/radial.dmi', icon_state = "windowtype")
|
||||
)
|
||||
var/choice = show_radial_menu(user,src,choices, custom_check = CALLBACK(src,.proc/check_menu,user))
|
||||
if(!check_menu(user))
|
||||
return
|
||||
switch(choice)
|
||||
if("Floors & Walls")
|
||||
mode = RCD_FLOORWALL
|
||||
if("Airlock")
|
||||
mode = RCD_AIRLOCK
|
||||
if("Deconstruct")
|
||||
mode = RCD_DECONSTRUCT
|
||||
if("Grilles & Windows")
|
||||
mode = RCD_WINDOWGRILLE
|
||||
if("Change Access")
|
||||
change_airlock_access(user)
|
||||
return
|
||||
if("Change Airlock Type")
|
||||
change_airlock_setting(user)
|
||||
return
|
||||
if("Change Window Type")
|
||||
toggle_window_type(user)
|
||||
return
|
||||
else
|
||||
return
|
||||
playsound(src, 'sound/effects/pop.ogg', 50, 0)
|
||||
to_chat(user, "<span class='notice'>You change RCD's mode to '[choice]'.</span>")
|
||||
|
||||
/obj/item/construction/rcd/proc/target_check(atom/A, mob/user) // only returns true for stuff the device can actually work with
|
||||
if((isturf(A) && A.density && mode==RCD_DECONSTRUCT) || (isturf(A) && !A.density) || (istype(A, /obj/machinery/door/airlock) && mode==RCD_DECONSTRUCT) || istype(A, /obj/structure/grille) || (istype(A, /obj/structure/window) && mode==RCD_DECONSTRUCT) || istype(A, /obj/structure/girder))
|
||||
|
||||
+123
-12
@@ -14,13 +14,14 @@
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
var/max_amount = 90
|
||||
var/active = FALSE
|
||||
actions_types = list(/datum/action/item_action/rcl)
|
||||
actions_types = list(/datum/action/item_action/rcl_col,/datum/action/item_action/rcl_gui)
|
||||
var/list/colors = list("red", "yellow", "green", "blue", "pink", "orange", "cyan", "white")
|
||||
var/current_color_index = 1
|
||||
var/ghetto = FALSE
|
||||
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
|
||||
var/datum/component/mobhook
|
||||
var/datum/radial_menu/persistent/wiring_gui_menu
|
||||
|
||||
/obj/item/twohanded/rcl/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/stack/cable_coil))
|
||||
@@ -85,7 +86,8 @@
|
||||
/obj/item/twohanded/rcl/Destroy()
|
||||
QDEL_NULL(loaded)
|
||||
last = null
|
||||
setActive(FALSE, null) // setactive(FALSE) removes mobhook
|
||||
QDEL_NULL(mobhook)
|
||||
QDEL_NULL(wiring_gui_menu)
|
||||
return ..()
|
||||
|
||||
/obj/item/twohanded/rcl/update_icon()
|
||||
@@ -115,20 +117,28 @@
|
||||
if(loaded)
|
||||
QDEL_NULL(loaded)
|
||||
loaded = null
|
||||
QDEL_NULL(wiring_gui_menu)
|
||||
unwield(user)
|
||||
setActive(wielded, user)
|
||||
active = wielded
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/twohanded/rcl/pickup(mob/user)
|
||||
..()
|
||||
getMobhook(user)
|
||||
|
||||
|
||||
|
||||
/obj/item/twohanded/rcl/dropped(mob/wearer)
|
||||
..()
|
||||
if(mobhook)
|
||||
setActive(FALSE, mobhook.parent)
|
||||
active = FALSE
|
||||
QDEL_NULL(mobhook)
|
||||
last = null
|
||||
|
||||
/obj/item/twohanded/rcl/attack_self(mob/user)
|
||||
..()
|
||||
setActive(wielded, user)
|
||||
active = wielded
|
||||
if(!active)
|
||||
last = null
|
||||
else if(!last)
|
||||
@@ -137,17 +147,24 @@
|
||||
last = C
|
||||
break
|
||||
|
||||
/obj/item/twohanded/rcl/proc/setActive(toggle, mob/user)
|
||||
active = toggle
|
||||
if (active && user)
|
||||
if (mobhook && mobhook.parent != user)
|
||||
obj/item/twohanded/rcl/proc/getMobhook(mob/to_hook)
|
||||
if(to_hook)
|
||||
if(mobhook && mobhook.parent != to_hook)
|
||||
QDEL_NULL(mobhook)
|
||||
if (!mobhook)
|
||||
mobhook = user.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED = CALLBACK(src, .proc/trigger)))
|
||||
mobhook = to_hook.AddComponent(/datum/component/redirect, list(COMSIG_MOVABLE_MOVED = CALLBACK(src, .proc/trigger)))
|
||||
else
|
||||
QDEL_NULL(mobhook)
|
||||
|
||||
/obj/item/twohanded/rcl/proc/trigger(mob/user)
|
||||
if(active)
|
||||
layCable(user)
|
||||
if(wiring_gui_menu) //update the wire options as you move
|
||||
wiringGuiUpdate(user)
|
||||
|
||||
|
||||
//previous contents of trigger(), lays cable each time the player moves
|
||||
/obj/item/twohanded/rcl/proc/layCable(mob/user)
|
||||
if(!isturf(user.loc))
|
||||
return
|
||||
if(is_empty(user, 0))
|
||||
@@ -156,7 +173,7 @@
|
||||
|
||||
if(prob(2) && ghetto) //Give ghetto RCLs a 2% chance to jam, requiring it to be reactviated manually.
|
||||
to_chat(user, "<span class='warning'>[src]'s wires jam!</span>")
|
||||
setActive(FALSE, user)
|
||||
active = FALSE
|
||||
return
|
||||
else
|
||||
if(last)
|
||||
@@ -179,6 +196,91 @@
|
||||
is_empty(user) //If we've run out, display message
|
||||
update_icon()
|
||||
|
||||
//searches the current tile for a stub cable of the same colour
|
||||
/obj/item/twohanded/rcl/proc/findLinkingCable(mob/user)
|
||||
var/turf/T
|
||||
if(!isturf(user.loc))
|
||||
return
|
||||
|
||||
T = get_turf(user)
|
||||
if(T.intact || !T.can_have_cabling())
|
||||
return
|
||||
|
||||
for(var/obj/structure/cable/C in T)
|
||||
if(!C)
|
||||
continue
|
||||
if(C.cable_color != GLOB.cable_colors[colors[current_color_index]])
|
||||
continue
|
||||
if(C.d1 == 0)
|
||||
return C
|
||||
break
|
||||
return
|
||||
|
||||
|
||||
/obj/item/twohanded/rcl/proc/wiringGuiGenerateChoices(mob/user)
|
||||
var/fromdir = 0
|
||||
var/obj/structure/cable/linkingCable = findLinkingCable(user)
|
||||
if(linkingCable)
|
||||
fromdir = linkingCable.d2
|
||||
|
||||
var/list/wiredirs = list("1","5","4","6","2","10","8","9")
|
||||
for(var/icondir in wiredirs)
|
||||
var/dirnum = text2num(icondir)
|
||||
var/cablesuffix = "[min(fromdir,dirnum)]-[max(fromdir,dirnum)]"
|
||||
if(fromdir == dirnum) //cables can't loop back on themselves
|
||||
cablesuffix = "invalid"
|
||||
var/image/img = image(icon = 'icons/mob/radial.dmi', icon_state = "cable_[cablesuffix]")
|
||||
img.color = GLOB.cable_colors[colors[current_color_index]]
|
||||
wiredirs[icondir] = img
|
||||
return wiredirs
|
||||
|
||||
/obj/item/twohanded/rcl/proc/showWiringGui(mob/user)
|
||||
var/list/choices = wiringGuiGenerateChoices(user)
|
||||
|
||||
wiring_gui_menu = show_radial_menu_persistent(user, src , choices, select_proc = CALLBACK(src, .proc/wiringGuiReact, user), radius = 42)
|
||||
|
||||
/obj/item/twohanded/rcl/proc/wiringGuiUpdate(mob/user)
|
||||
if(!wiring_gui_menu)
|
||||
return
|
||||
|
||||
wiring_gui_menu.entry_animation = FALSE //stop the open anim from playing each time we update
|
||||
var/list/choices = wiringGuiGenerateChoices(user)
|
||||
|
||||
wiring_gui_menu.change_choices(choices,FALSE)
|
||||
|
||||
|
||||
//Callback used to respond to interactions with the wiring menu
|
||||
/obj/item/twohanded/rcl/proc/wiringGuiReact(mob/living/user,choice)
|
||||
if(!choice) //close on a null choice (the center button)
|
||||
QDEL_NULL(wiring_gui_menu)
|
||||
return
|
||||
|
||||
choice = text2num(choice)
|
||||
|
||||
if(!isturf(user.loc))
|
||||
return
|
||||
if(is_empty(user, 0))
|
||||
to_chat(user, "<span class='warning'>\The [src] is empty!</span>")
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(user)
|
||||
if(T.intact || !T.can_have_cabling())
|
||||
return
|
||||
|
||||
loaded.item_color = colors[current_color_index]
|
||||
|
||||
var/obj/structure/cable/linkingCable = findLinkingCable(user)
|
||||
if(linkingCable)
|
||||
if(choice != linkingCable.d2)
|
||||
loaded.cable_join(linkingCable, user, FALSE, choice)
|
||||
last = null
|
||||
else
|
||||
last = loaded.place_turf(get_turf(src), user, choice)
|
||||
|
||||
is_empty(user) //If we've run out, display message
|
||||
|
||||
wiringGuiUpdate(user)
|
||||
|
||||
|
||||
/obj/item/twohanded/rcl/pre_loaded/Initialize() //Comes preloaded with cable, for testing stuff
|
||||
. = ..()
|
||||
@@ -192,12 +294,21 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/twohanded/rcl/ui_action_click(mob/user, action)
|
||||
if(istype(action, /datum/action/item_action/rcl))
|
||||
if(istype(action, /datum/action/item_action/rcl_col))
|
||||
current_color_index++;
|
||||
if (current_color_index > colors.len)
|
||||
current_color_index = 1
|
||||
var/cwname = colors[current_color_index]
|
||||
to_chat(user, "Color changed to [cwname]!")
|
||||
if(loaded)
|
||||
loaded.item_color= colors[current_color_index]
|
||||
if(wiring_gui_menu)
|
||||
wiringGuiUpdate(user)
|
||||
else if(istype(action, /datum/action/item_action/rcl_gui))
|
||||
if(wiring_gui_menu) //The menu is already open, close it
|
||||
QDEL_NULL(wiring_gui_menu)
|
||||
else //open the menu
|
||||
showWiringGui(user)
|
||||
|
||||
/obj/item/twohanded/rcl/ghetto
|
||||
actions_types = list()
|
||||
|
||||
@@ -112,6 +112,8 @@
|
||||
LC.handlecable(C, user)
|
||||
return
|
||||
C.loaded.place_turf(src, user)
|
||||
if(C.wiring_gui_menu)
|
||||
C.wiringGuiUpdate(user)
|
||||
C.is_empty(user)
|
||||
|
||||
/turf/attackby(obj/item/C, mob/user, params)
|
||||
|
||||
@@ -639,7 +639,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai
|
||||
|
||||
// called when cable_coil is click on an installed obj/cable
|
||||
// or click on a turf that already contains a "node" cable
|
||||
/obj/item/stack/cable_coil/proc/cable_join(obj/structure/cable/C, mob/user, var/showerror = TRUE)
|
||||
/obj/item/stack/cable_coil/proc/cable_join(obj/structure/cable/C, mob/user, showerror = TRUE, forceddir)
|
||||
var/turf/U = user.loc
|
||||
if(!isturf(U))
|
||||
return
|
||||
@@ -654,14 +654,14 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai
|
||||
return
|
||||
|
||||
|
||||
if(U == T) //if clicked on the turf we're standing on, try to put a cable in the direction we're facing
|
||||
if(U == T && !forceddir) //if clicked on the turf we're standing on and a direction wasn't supplied, try to put a cable in the direction we're facing
|
||||
place_turf(T,user)
|
||||
return
|
||||
|
||||
var/dirn = get_dir(C, user)
|
||||
|
||||
// one end of the clicked cable is pointing towards us
|
||||
if(C.d1 == dirn || C.d2 == dirn)
|
||||
// one end of the clicked cable is pointing towards us and no direction was supplied
|
||||
if((C.d1 == dirn || C.d2 == dirn) && !forceddir)
|
||||
if(!U.can_have_cabling()) //checking if it's a plating or catwalk
|
||||
if (showerror)
|
||||
to_chat(user, "<span class='warning'>You can only lay cables on catwalks and plating!</span>")
|
||||
@@ -706,7 +706,7 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai
|
||||
|
||||
return
|
||||
|
||||
// exisiting cable doesn't point at our position, so see if it's a stub
|
||||
// exisiting cable doesn't point at our position or we have a supplied direction, so see if it's a stub
|
||||
else if(C.d1 == 0)
|
||||
// if so, make it a full cable pointing from it's old direction to our dirn
|
||||
var/nd1 = C.d2 // these will be the new directions
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 15 KiB |
@@ -199,6 +199,7 @@
|
||||
#include "code\_onclick\hud\picture_in_picture.dm"
|
||||
#include "code\_onclick\hud\plane_master.dm"
|
||||
#include "code\_onclick\hud\radial.dm"
|
||||
#include "code\_onclick\hud\radial_persistent.dm"
|
||||
#include "code\_onclick\hud\revenanthud.dm"
|
||||
#include "code\_onclick\hud\robot.dm"
|
||||
#include "code\_onclick\hud\screen_objects.dm"
|
||||
|
||||
Reference in New Issue
Block a user