Skip to content

Commit

Permalink
Compiling/refining screen object work.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Dec 6, 2023
1 parent 49670f4 commit 793f1b6
Show file tree
Hide file tree
Showing 16 changed files with 83 additions and 91 deletions.
1 change: 0 additions & 1 deletion code/__defines/mech.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#define HARDPOINT_BACK "back"
#define HARDPOINT_LEFT_HAND "left hand"
#define HARDPOINT_RIGHT_HAND "right hand"
Expand Down
33 changes: 0 additions & 33 deletions code/_onclick/hud/deity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,3 @@
action_intent = D
..()
D.sync_to_mob(mymob)

/obj/screen/intent/deity/proc/sync_to_mob(var/mob)
var/mob/living/deity/D = mob
for(var/i in 1 to D.control_types.len)
var/obj/screen/S = new()
S.SetName(null) //Don't want them to be able to actually right click it.
S.mouse_opacity = MOUSE_OPACITY_UNCLICKABLE
S.icon_state = "blank"
desc_screens[D.control_types[i]] = S
S.maptext_width = 128
S.screen_loc = screen_loc
//This sets it up right. Trust me.
S.maptext_y = 33/2*i - i*i/2 - 10
D.client.screen += S
S.maptext_x = -125

update_text()

/obj/screen/intent/deity/proc/update_text()
if(!isdeity(usr))
return
var/mob/living/deity/D = usr
for(var/i in D.control_types)
var/obj/screen/S = desc_screens[i]
var/datum/phenomena/P = D.intent_phenomenas[intent][i]
if(P)
S.maptext = "<span style='font-size:7pt;font-family:Impact'><font color='#3C3612'>[P.name]</font></span>"
else
S.maptext = null

/obj/screen/intent/deity/handle_click(mob/user, params)
..()
update_text()
4 changes: 2 additions & 2 deletions code/_onclick/hud/global_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var/global/datum/global_hud/hud

// makes custom colored overlay, can also generate scanline
/datum/global_hud/proc/setup_overlay(icon_state, color)
var/obj/screen/screen = new /obj/screen()
var/obj/screen/screen = new /obj/screen(null)
screen.screen_loc = ui_entire_screen
screen.icon = 'icons/effects/hud_full.dmi'
screen.icon_state = icon_state
Expand All @@ -39,7 +39,7 @@ var/global/datum/global_hud/hud
//Holomap screen object is invisible and work
//By setting it as n images location, without icon changes
//Make it part of global hud since it's inmutable
holomap = new /obj/screen()
holomap = new /obj/screen(null)
holomap.name = "holomap"
holomap.icon = null
holomap.layer = HUD_BASE_LAYER
Expand Down
47 changes: 12 additions & 35 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
var/show_intent_icons = FALSE
var/hotkey_ui_hidden = FALSE //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons)

var/obj/screen/lingchemdisplay
var/list/hand_hud_objects
var/list/swaphand_hud_objects
var/obj/screen/action_intent
Expand All @@ -48,7 +47,6 @@
/datum/hud/Destroy()
. = ..()
stamina_bar = null
lingchemdisplay = null
action_intent = null
move_intent = null
adding = null
Expand Down Expand Up @@ -165,10 +163,15 @@
if(existing_box.slot_id == hand_tag)
inv_box = existing_box
break

if(!inv_box)
inv_box = new /obj/screen/inventory(null, mymob)
inv_box = new /obj/screen/inventory(null, mymob, ui_style, ui_color, ui_alpha)
else
inv_box.icon = ui_style
inv_box.color = ui_color
inv_box.alpha = ui_alpha

inv_box.SetName(hand_tag)
inv_box.icon = ui_style
inv_box.icon_state = "hand_base"

inv_box.cut_overlays()
Expand All @@ -178,8 +181,6 @@
inv_box.update_icon()

inv_box.slot_id = hand_tag
inv_box.color = ui_color
inv_box.alpha = ui_alpha
inv_box.appearance_flags |= KEEP_TOGETHER

LAZYDISTINCTADD(hand_hud_objects, inv_box)
Expand Down Expand Up @@ -250,10 +251,7 @@
if(gear_slot in held_slots)
continue

inv_box = new /obj/screen/inventory(null, mymob)
inv_box.icon = ui_style
inv_box.color = ui_color
inv_box.alpha = ui_alpha
inv_box = new /obj/screen/inventory(null, mymob, ui_style, ui_color, ui_alpha)

var/datum/inventory_slot/inv_slot = inventory_slots[gear_slot]
inv_box.SetName(inv_slot.slot_name)
Expand All @@ -271,47 +269,26 @@
adding += inv_box

if(has_hidden_gear)
var/obj/screen/using = new /obj/screen/toggle()
using.icon = ui_style
using.screen_loc = ui_inventory
using.color = ui_color
using.alpha = ui_alpha
adding += using
adding += new /obj/screen/toggle(null, mymob, ui_style, ui_color, ui_alpha)

/datum/hud/proc/BuildHandsUI()

var/ui_style = get_ui_style()
var/ui_color = get_ui_color()
var/ui_alpha = get_ui_alpha()

var/obj/screen/using

// Swap hand and quick equip screen elems.
using = new /obj/screen/equip()
using.icon = ui_style
using.color = ui_color
using.alpha = ui_alpha
var/obj/screen/using = new /obj/screen/equip(null, mymob, ui_style, ui_color, ui_alpha)
src.adding += using
LAZYADD(swaphand_hud_objects, using)

var/list/held_slots = mymob.get_held_item_slots()
if(length(held_slots) > 1)

using = new /obj/screen/inventory(null, mymob)
using.SetName("hand")
using.icon = ui_style
using.icon_state = "hand1"
using.color = ui_color
using.alpha = ui_alpha
using = new /obj/screen/inventory/swaphand(null, mymob, ui_style, ui_color, ui_alpha)
src.adding += using
LAZYADD(swaphand_hud_objects, using)

using = new /obj/screen/inventory(null, mymob)
using.SetName("hand")
using.icon = ui_style
using.icon_state = "hand2"
using.color = ui_color
using.alpha = ui_alpha
using = new /obj/screen/inventory/swaphand/right(null, mymob, ui_style, ui_color, ui_alpha)
src.adding += using
LAZYADD(swaphand_hud_objects, using)

Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/pai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var/obj/screen/pai/hud_elem = hud_type
if(TYPE_IS_ABSTRACT(hud_elem))
continue
new hud_elem(null, mymob)
adding += new hud_elem(null, mymob)

..()
hide_inventory()
8 changes: 5 additions & 3 deletions code/_onclick/hud/radial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@

var/global/list/radial_menus = list()

/obj/screen/radial/Destroy()
parent = null
return ..()

/obj/screen/radial
icon = 'icons/screen/radial.dmi'
layer = HUD_ABOVE_ITEM_LAYER
plane = HUD_PLANE
requires_owner = FALSE
var/datum/radial_menu/parent

/obj/screen/radial/Destroy()
parent = null
return ..()

/obj/screen/radial/slice
icon_state = "radial_slice"
var/choice
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/radial_persistent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var/datum/callback/select_proc_callback

/datum/radial_menu/persistent/New()
close_button = new /obj/screen/radial/persistent/center
close_button = new /obj/screen/radial/persistent/center(null)
close_button.parent = src

/datum/radial_menu/persistent/element_chosen(choice_id,mob/user)
Expand Down
15 changes: 9 additions & 6 deletions code/_onclick/hud/screen/_screen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
For more information, see the byond documentation on the screen_loc and screen vars.
*/
/obj/screen
name = ""
icon = 'icons/mob/screen1.dmi'
plane = HUD_PLANE
layer = HUD_BASE_LAYER
appearance_flags = NO_CLIENT_COLOR
name = ""
icon = 'icons/mob/screen1.dmi'
plane = HUD_PLANE
layer = HUD_BASE_LAYER
appearance_flags = NO_CLIENT_COLOR
abstract_type = /obj/screen
is_spawnable_type = FALSE

/// The mob that owns this screen object, if any.
var/weakref/owner_ref
Expand All @@ -20,7 +22,8 @@
var/user_incapacitation_flags = INCAPACITATION_DEFAULT

/obj/screen/Initialize(mapload, mob/_owner, ui_style, ui_color, ui_alpha)
owner_ref = ismob(_owner) && weakref(_owner)
if(ismob(_owner))
owner_ref = weakref(_owner)
if(requires_owner && !owner_ref)
PRINT_STACK_TRACE("ERROR: [type]'s Initialize() was not given an owner argument.")
return INITIALIZE_HINT_QDEL
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/screen/screen_exosuit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@

/obj/screen/exosuit/heat/Initialize(mapload, mob/_owner, ui_style, ui_color, ui_alpha)
. = ..()
gauge_needle = new /obj/screen/exosuit/needle(_owner)
gauge_needle = new /obj/screen/exosuit/needle(null, _owner)
add_vis_contents(src, gauge_needle)

/obj/screen/exosuit/heat/Destroy()
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/screen/screen_gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
var/toggle_flag

/obj/screen/gun/handle_click(mob/user, params)
if(toggle_flag && isliving(user))
if(isliving(user))
var/mob/living/shooter = user
if(!shooter.aiming)
shooter.aiming = new(user)
Expand Down
33 changes: 33 additions & 0 deletions code/_onclick/hud/screen/screen_intent.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,36 @@
cut_overlays()
add_overlay(image('icons/mob/screen_phenomena.dmi', icon_state = "hud", pixel_x = -138, pixel_y = -1))
compile_overlays()

/obj/screen/intent/deity/proc/sync_to_mob(var/mob)
var/mob/living/deity/D = mob
for(var/i in 1 to D.control_types.len)
var/obj/screen/S = new()
S.SetName(null) //Don't want them to be able to actually right click it.
S.mouse_opacity = MOUSE_OPACITY_UNCLICKABLE
S.icon_state = "blank"
desc_screens[D.control_types[i]] = S
S.maptext_width = 128
S.screen_loc = screen_loc
//This sets it up right. Trust me.
S.maptext_y = 33/2*i - i*i/2 - 10
D.client.screen += S
S.maptext_x = -125

update_text()

/obj/screen/intent/deity/proc/update_text()
if(!isdeity(usr))
return
var/mob/living/deity/D = usr
for(var/i in D.control_types)
var/obj/screen/S = desc_screens[i]
var/datum/phenomena/P = D.intent_phenomenas[intent][i]
if(P)
S.maptext = "<span style='font-size:7pt;font-family:Impact'><font color='#3C3612'>[P.name]</font></span>"
else
S.maptext = null

/obj/screen/intent/deity/handle_click(mob/user, params)
..()
update_text()
9 changes: 9 additions & 0 deletions code/_onclick/hud/screen/screen_swaphands.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/obj/screen/inventory/swaphand
name = "hand"
icon_state = "hand1"

/obj/screen/inventory/swaphand/handle_click(mob/user, params)
user.swap_hand()

/obj/screen/inventory/swaphand/right
icon_state = "hand2"
1 change: 1 addition & 0 deletions code/_onclick/hud/screen/screen_toggle.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/obj/screen/toggle
name = "toggle"
icon_state = "other"
screen_loc = ui_inventory

/obj/screen/toggle/handle_click(mob/user, params)
if(user.hud_used.inventory_shown)
Expand Down
12 changes: 6 additions & 6 deletions code/modules/mechs/interface/_interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
client.screen |= hud_elements

/mob/living/exosuit/InitializeHud()
zone_sel = new
zone_sel = new(null, src)
if(!LAZYLEN(hud_elements))
var/i = 1
for(var/hardpoint in hardpoints)
var/obj/screen/exosuit/hardpoint/H = new(src, hardpoint)
var/obj/screen/exosuit/hardpoint/H = new(null, src, null, null, null, hardpoint)
H.screen_loc = "LEFT:6,TOP-[i]:-16"
hud_elements |= H
hardpoint_hud_elements[hardpoint] = H
Expand All @@ -36,21 +36,21 @@
i = 0
var/pos = 7
for(var/additional_hud in additional_hud_elements)
var/obj/screen/exosuit/M = new additional_hud(src)
var/obj/screen/exosuit/M = new additional_hud(null, src)
M.screen_loc = "LEFT:6,BOTTOM+[pos]:[i]"
hud_elements |= M
i -= M.height

hud_health = new /obj/screen/exosuit/health(src)
hud_health = new /obj/screen/exosuit/health(null, src)
hud_health.screen_loc = "RIGHT-1:28,CENTER-3:11"
hud_elements |= hud_health
hud_open = locate(/obj/screen/exosuit/toggle/hatch_open) in hud_elements
hud_power = new /obj/screen/exosuit/power(src)
hud_power = new /obj/screen/exosuit/power(null, src)
hud_power.screen_loc = "RIGHT-1:28,CENTER-4:25"
hud_elements |= hud_power
hud_power_control = locate(/obj/screen/exosuit/toggle/power_control) in hud_elements
hud_camera = locate(/obj/screen/exosuit/toggle/camera) in hud_elements
hud_heat = new /obj/screen/exosuit/heat(src)
hud_heat = new /obj/screen/exosuit/heat(null, src)
hud_heat.screen_loc = "RIGHT-1:28,CENTER-4"
hud_elements |= hud_heat

Expand Down
2 changes: 1 addition & 1 deletion mods/species/ascent/mobs/nymph/nymph_ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@

/obj/screen/ascent_nymph_health
name = "health"
name = screen_loc = ANYMPH_SCREEN_LOC_HEALTH
screen_loc = ANYMPH_SCREEN_LOC_HEALTH
1 change: 1 addition & 0 deletions nebula.dme
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
#include "code\_onclick\hud\screen\screen_setup.dm"
#include "code\_onclick\hud\screen\screen_stamina.dm"
#include "code\_onclick\hud\screen\screen_storage.dm"
#include "code\_onclick\hud\screen\screen_swaphands.dm"
#include "code\_onclick\hud\screen\screen_throw.dm"
#include "code\_onclick\hud\screen\screen_toggle.dm"
#include "code\_onclick\hud\screen\screen_up_hint.dm"
Expand Down

0 comments on commit 793f1b6

Please sign in to comment.