mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 18:44:48 +01:00
Refactors screen objects to /atom/movable (#24068)
* introduce helper + remove unused proc * we love compatibility * Update code/_onclick/hud/action_button.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/_onclick/hud/action_button.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/_onclick/hud/alert.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/_onclick/hud/blob_overmind.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/_onclick/hud/blob_overmind.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/_onclick/hud/blob_overmind.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/modules/martial_arts/martial.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/modules/mining/lavaland/loot/tendril_loot.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/modules/mob/living/carbon/human/species/shadow.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/modules/mob/living/carbon/human/species/shadow.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/modules/mob/living/living_update_status.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/_onclick/hud/screen_objects.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/_onclick/hud/screen_objects.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/_onclick/hud/screen_objects.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/game/objects/items/weapons/storage/internal.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/game/machinery/computer/camera_advanced.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/game/machinery/computer/camera_advanced.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/game/objects/items/weapons/storage/internal.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * Update code/game/mecha/mecha.dm Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> * deconflict --------- Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
@@ -12,10 +12,10 @@
|
||||
var/switch_state = BM_SWITCHSTATE_NONE
|
||||
var/switch_width = 5
|
||||
// modeswitch UI
|
||||
var/obj/screen/buildmode/mode/modebutton
|
||||
var/atom/movable/screen/buildmode/mode/modebutton
|
||||
var/list/modeswitch_buttons = list()
|
||||
// dirswitch UI
|
||||
var/obj/screen/buildmode/bdir/dirbutton
|
||||
var/atom/movable/screen/buildmode/bdir/dirbutton
|
||||
var/list/dirswitch_buttons = list()
|
||||
|
||||
/datum/click_intercept/buildmode/New()
|
||||
@@ -32,23 +32,23 @@
|
||||
|
||||
/datum/click_intercept/buildmode/create_buttons()
|
||||
// keep a reference so we can update it upon mode switch
|
||||
modebutton = new /obj/screen/buildmode/mode(src)
|
||||
modebutton = new /atom/movable/screen/buildmode/mode(src)
|
||||
buttons += modebutton
|
||||
buttons += new /obj/screen/buildmode/help(src)
|
||||
buttons += new /atom/movable/screen/buildmode/help(src)
|
||||
// keep a reference so we can update it upon dir switch
|
||||
dirbutton = new /obj/screen/buildmode/bdir(src)
|
||||
dirbutton = new /atom/movable/screen/buildmode/bdir(src)
|
||||
buttons += dirbutton
|
||||
buttons += new /obj/screen/buildmode/quit(src)
|
||||
buttons += new /atom/movable/screen/buildmode/quit(src)
|
||||
// build the list of modeswitching buttons
|
||||
build_options_grid(subtypesof(/datum/buildmode_mode), modeswitch_buttons, /obj/screen/buildmode/modeswitch)
|
||||
build_options_grid(list(SOUTH,EAST,WEST,NORTH,NORTHWEST), dirswitch_buttons, /obj/screen/buildmode/dirswitch)
|
||||
build_options_grid(subtypesof(/datum/buildmode_mode), modeswitch_buttons, /atom/movable/screen/buildmode/modeswitch)
|
||||
build_options_grid(list(SOUTH,EAST,WEST,NORTH,NORTHWEST), dirswitch_buttons, /atom/movable/screen/buildmode/dirswitch)
|
||||
|
||||
/datum/click_intercept/buildmode/proc/build_options_grid(list/elements, list/buttonslist, buttontype)
|
||||
var/pos_idx = 0
|
||||
for(var/thing in elements)
|
||||
var/x = pos_idx % switch_width
|
||||
var/y = FLOOR(pos_idx / switch_width, 1)
|
||||
var/obj/screen/buildmode/B = new buttontype(src, thing)
|
||||
var/atom/movable/screen/buildmode/B = new buttontype(src, thing)
|
||||
// this stuff is equivalent to the commented out line for 511 compat
|
||||
// B.screen_loc = "NORTH-[(1 + 0.5 + y*1.5)],WEST+[0.5 + x*1.5]"
|
||||
B.screen_loc = "NORTH-[1 + FLOOR(0.5 + 1.5*y, 1) + ((y + 1) % 2)]:[16*((y + 1) % 2)],WEST+[FLOOR(0.5 + 1.5*x, 1)]:[16*((x + 1) % 2)]"
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/obj/screen/buildmode
|
||||
/atom/movable/screen/buildmode
|
||||
icon = 'icons/misc/buildmode.dmi'
|
||||
var/datum/click_intercept/buildmode/bd
|
||||
plane = HUD_PLANE_BUILDMODE
|
||||
|
||||
/obj/screen/buildmode/New(bld)
|
||||
/atom/movable/screen/buildmode/New(bld)
|
||||
bd = bld
|
||||
return ..()
|
||||
|
||||
/obj/screen/buildmode/Destroy()
|
||||
/atom/movable/screen/buildmode/Destroy()
|
||||
bd = null
|
||||
return ..()
|
||||
|
||||
/obj/screen/buildmode/mode
|
||||
/atom/movable/screen/buildmode/mode
|
||||
name = "Toggle Mode"
|
||||
icon_state = "buildmode_basic"
|
||||
screen_loc = "NORTH,WEST"
|
||||
|
||||
/obj/screen/buildmode/mode/Click(location, control, params)
|
||||
/atom/movable/screen/buildmode/mode/Click(location, control, params)
|
||||
var/list/pa = params2list(params)
|
||||
|
||||
if(pa.Find("left"))
|
||||
@@ -26,64 +26,64 @@
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/screen/buildmode/mode/update_icon_state()
|
||||
/atom/movable/screen/buildmode/mode/update_icon_state()
|
||||
icon_state = bd.mode.get_button_iconstate()
|
||||
|
||||
/obj/screen/buildmode/help
|
||||
/atom/movable/screen/buildmode/help
|
||||
icon_state = "buildhelp"
|
||||
screen_loc = "NORTH,WEST+1"
|
||||
name = "Buildmode Help"
|
||||
|
||||
/obj/screen/buildmode/help/Click()
|
||||
/atom/movable/screen/buildmode/help/Click()
|
||||
bd.mode.show_help(usr)
|
||||
return TRUE
|
||||
|
||||
/obj/screen/buildmode/bdir
|
||||
/atom/movable/screen/buildmode/bdir
|
||||
icon_state = "build"
|
||||
screen_loc = "NORTH,WEST+2"
|
||||
name = "Change Dir"
|
||||
|
||||
/obj/screen/buildmode/bdir/update_icon(updates=UPDATE_ICON_STATE)
|
||||
/atom/movable/screen/buildmode/bdir/update_icon(updates=UPDATE_ICON_STATE)
|
||||
dir = bd.build_dir
|
||||
..()
|
||||
|
||||
/obj/screen/buildmode/bdir/Click()
|
||||
/atom/movable/screen/buildmode/bdir/Click()
|
||||
bd.toggle_dirswitch()
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
// used to switch between modes
|
||||
/obj/screen/buildmode/modeswitch
|
||||
/atom/movable/screen/buildmode/modeswitch
|
||||
var/datum/buildmode_mode/modetype
|
||||
|
||||
/obj/screen/buildmode/modeswitch/New(bld, mt)
|
||||
/atom/movable/screen/buildmode/modeswitch/New(bld, mt)
|
||||
modetype = mt
|
||||
icon_state = "buildmode_[initial(modetype.key)]"
|
||||
name = initial(modetype.key)
|
||||
return ..(bld)
|
||||
|
||||
/obj/screen/buildmode/modeswitch/Click()
|
||||
/atom/movable/screen/buildmode/modeswitch/Click()
|
||||
bd.change_mode(modetype)
|
||||
return TRUE
|
||||
|
||||
// used to switch between dirs
|
||||
/obj/screen/buildmode/dirswitch
|
||||
/atom/movable/screen/buildmode/dirswitch
|
||||
icon_state = "build"
|
||||
|
||||
/obj/screen/buildmode/dirswitch/New(bld, newdir)
|
||||
/atom/movable/screen/buildmode/dirswitch/New(bld, newdir)
|
||||
dir = newdir
|
||||
name = dir2text(dir)
|
||||
return ..(bld)
|
||||
|
||||
/obj/screen/buildmode/dirswitch/Click()
|
||||
/atom/movable/screen/buildmode/dirswitch/Click()
|
||||
bd.change_dir(dir)
|
||||
return TRUE
|
||||
|
||||
/obj/screen/buildmode/quit
|
||||
/atom/movable/screen/buildmode/quit
|
||||
icon_state = "buildquit"
|
||||
screen_loc = "NORTH,WEST+3"
|
||||
name = "Quit Buildmode"
|
||||
|
||||
/obj/screen/buildmode/quit/Click()
|
||||
/atom/movable/screen/buildmode/quit/Click()
|
||||
bd.quit()
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user