Merge pull request #16123 from SandPoot/more-hud-stuff

Add hud_owner to more stuff for safety
This commit is contained in:
deathride58
2025-02-17 01:47:43 -05:00
committed by GitHub
13 changed files with 83 additions and 85 deletions

View File

@@ -213,7 +213,7 @@
our_hud = null
return ..()
/atom/movable/screen/button_palette/Initialize(mapload)
/atom/movable/screen/button_palette/Initialize(mapload, datum/hud/hud_owner)
. = ..()
update_appearance()

View File

@@ -512,7 +512,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
var/angle = 0
var/mob/living/simple_animal/hostile/construct/Cviewer = null
/atom/movable/screen/alert/bloodsense/Initialize(mapload)
/atom/movable/screen/alert/bloodsense/Initialize(mapload, datum/hud/hud_owner)
. = ..()
narnar = new('icons/mob/screen_alert.dmi', "mini_nar")
START_PROCESSING(SSprocessing, src)

View File

@@ -39,7 +39,7 @@
var/client/parent
var/matrix/target
/atom/movable/screen/credit/Initialize(mapload, credited, client/P, icon/I)
/atom/movable/screen/credit/Initialize(mapload, datum/hud/hud_owner, credited, client/P, icon/I)
. = ..()
icon = I
parent = P
@@ -55,14 +55,15 @@
animate(src, alpha = 255, time = CREDIT_EASE_DURATION, flags = ANIMATION_PARALLEL)
addtimer(CALLBACK(src, PROC_REF(FadeOut)), CREDIT_ROLL_SPEED - CREDIT_EASE_DURATION)
QDEL_IN(src, CREDIT_ROLL_SPEED)
P.screen += src
if(parent)
parent.screen += src
/atom/movable/screen/credit/Destroy()
var/client/P = parent
P.screen -= src
icon = null
LAZYREMOVE(P.credits, src)
parent = null
if(parent)
parent.screen -= src
LAZYREMOVE(parent.credits, src)
parent = null
return ..()
/atom/movable/screen/credit/proc/FadeOut()

View File

@@ -9,7 +9,7 @@
/// Boolean, have the cops arrived? If so, the icon stops changing and remains the same.
var/cops_arrived = 0
/atom/movable/screen/wanted/Initialize(mapload)
/atom/movable/screen/wanted/Initialize(mapload, datum/hud/hud_owner)
. = ..()
update_icon()

View File

@@ -221,7 +221,7 @@
///Whether we are readied up for the round or not
var/ready = FALSE
/atom/movable/screen/lobby/button/ready/Initialize(mapload)
/atom/movable/screen/lobby/button/ready/Initialize(mapload, datum/hud/hud_owner)
. = ..()
switch(SSticker.current_state)
if(GAME_STATE_PREGAME, GAME_STATE_STARTUP)
@@ -268,7 +268,7 @@
base_icon_state = "join_game"
enabled = null // set in init
/atom/movable/screen/lobby/button/join/Initialize(mapload)
/atom/movable/screen/lobby/button/join/Initialize(mapload, datum/hud/hud_owner)
. = ..()
switch(SSticker.current_state)
if(GAME_STATE_PREGAME, GAME_STATE_STARTUP)
@@ -333,7 +333,7 @@
base_icon_state = "observe"
enabled = null // set in init
/atom/movable/screen/lobby/button/observe/Initialize(mapload)
/atom/movable/screen/lobby/button/observe/Initialize(mapload, datum/hud/hud_owner)
. = ..()
if(SSticker.current_state > GAME_STATE_STARTUP)
set_button_status(TRUE)

View File

@@ -14,7 +14,7 @@
var/mutable_appearance/standard_background
var/const/max_dimensions = 10
/atom/movable/screen/movable/pic_in_pic/Initialize(mapload)
/atom/movable/screen/movable/pic_in_pic/Initialize(mapload, datum/hud/hud_owner)
. = ..()
make_backgrounds()
@@ -55,7 +55,7 @@
add_overlay(move_tab)
if(!button_x)
button_x = new /atom/movable/screen/component_button(null, src)
button_x = new /atom/movable/screen/component_button(null, hud, src)
var/mutable_appearance/MA = new /mutable_appearance()
MA.name = "close"
MA.icon = 'icons/misc/pic_in_pic.dmi'
@@ -68,7 +68,7 @@
vis_contents += button_x
if(!button_expand)
button_expand = new /atom/movable/screen/component_button(null, src)
button_expand = new /atom/movable/screen/component_button(null, hud, src)
var/mutable_appearance/MA = new /mutable_appearance()
MA.name = "expand"
MA.icon = 'icons/misc/pic_in_pic.dmi'
@@ -81,7 +81,7 @@
vis_contents += button_expand
if(!button_shrink)
button_shrink = new /atom/movable/screen/component_button(null, src)
button_shrink = new /atom/movable/screen/component_button(null, hud, src)
var/mutable_appearance/MA = new /mutable_appearance()
MA.name = "shrink"
MA.icon = 'icons/misc/pic_in_pic.dmi'

View File

@@ -24,7 +24,7 @@
blend_mode = BLEND_MULTIPLY
alpha = 255
/atom/movable/screen/plane_master/openspace/Initialize(mapload)
/atom/movable/screen/plane_master/openspace/Initialize(mapload, datum/hud/hud_owner)
. = ..()
filters += filter(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE)
@@ -61,7 +61,7 @@
plane = ABOVE_WALL_PLANE
appearance_flags = PLANE_MASTER
/atom/movable/screen/plane_master/above_wall/Initialize(mapload)
/atom/movable/screen/plane_master/above_wall/Initialize(mapload, datum/hud/hud_owner)
. = ..()
add_filter("vision_cone", 100, list(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE))
@@ -78,7 +78,7 @@
appearance_flags = PLANE_MASTER //should use client color
blend_mode = BLEND_OVERLAY
/atom/movable/screen/plane_master/game_world/Initialize(mapload)
/atom/movable/screen/plane_master/game_world/Initialize(mapload, datum/hud/hud_owner)
. = ..()
add_filter("vision_cone", 100, list(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE))
@@ -95,7 +95,7 @@
render_target = FIELD_OF_VISION_RENDER_TARGET
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
/atom/movable/screen/plane_master/field_of_vision/Initialize(mapload)
/atom/movable/screen/plane_master/field_of_vision/Initialize(mapload, datum/hud/hud_owner)
. = ..()
filters += filter(type="alpha", render_source=FIELD_OF_VISION_BLOCKER_RENDER_TARGET, flags=MASK_INVERSE)
@@ -112,7 +112,7 @@
plane = FIELD_OF_VISION_VISUAL_PLANE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
/atom/movable/screen/plane_master/field_of_vision_visual/Initialize(mapload)
/atom/movable/screen/plane_master/field_of_vision_visual/Initialize(mapload, datum/hud/hud_owner)
. = ..()
filters += filter(type="alpha", render_source=FIELD_OF_VISION_BLOCKER_RENDER_TARGET, flags=MASK_INVERSE)
@@ -138,7 +138,7 @@
* This is then used to alpha mask the lighting plane.
*/
/atom/movable/screen/plane_master/lighting/Initialize(mapload)
/atom/movable/screen/plane_master/lighting/Initialize(mapload, datum/hud/hud_owner)
. = ..()
add_filter("emissives", 1, alpha_mask_filter(render_source = EMISSIVE_RENDER_TARGET, flags = MASK_INVERSE))
add_filter("object_lighting", 2, alpha_mask_filter(render_source = O_LIGHTING_VISUAL_RENDER_TARGET, flags = MASK_INVERSE))
@@ -152,7 +152,7 @@
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
render_target = EMISSIVE_RENDER_TARGET
/atom/movable/screen/plane_master/emissive/Initialize(mapload)
/atom/movable/screen/plane_master/emissive/Initialize(mapload, datum/hud/hud_owner)
. = ..()
add_filter("em_block_masking", 1, color_matrix_filter(GLOB.em_mask_matrix))

View File

@@ -279,7 +279,7 @@
// plane = ABOVE_HUD_PLANE
// icon_state = "backpack_close"
// /atom/movable/screen/close/Initialize(mapload, new_master)
// /atom/movable/screen/close/Initialize(mapload, datum/hud/hud_owner, new_master)
// . = ..()
// master = new_master
@@ -341,7 +341,7 @@
icon_state = "running"
mouse_over_pointer = MOUSE_HAND_POINTER
/atom/movable/screen/mov_intent/Initialize(mapload)
/atom/movable/screen/mov_intent/Initialize(mapload, datum/hud/hud_owner)
. = ..()
update_icon()
@@ -701,7 +701,7 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/splash)
mouse_over_pointer = MOUSE_HAND_POINTER
var/atom/movable/screen/parent
/atom/movable/screen/component_button/Initialize(mapload, atom/movable/screen/parent)
/atom/movable/screen/component_button/Initialize(mapload, datum/hud/hud_owner, atom/movable/screen/parent)
. = ..()
src.parent = parent

View File

@@ -25,7 +25,7 @@
icon_state = "prog_bar_100"
layer = 20 // under hand buttons
/atom/movable/screen/action_bar/clickdelay/Initialize(mapload)
/atom/movable/screen/action_bar/clickdelay/Initialize(mapload, datum/hud/hud_owner)
. = ..()
var/matrix/M = new
M.Scale(2, 1)

View File

@@ -2,7 +2,7 @@
name = "storage"
var/insertion_click = FALSE
/atom/movable/screen/storage/Initialize(mapload, datum/hud/hud, new_master)
/atom/movable/screen/storage/Initialize(mapload, datum/hud/hud_owner, new_master)
. = ..()
master = new_master
@@ -55,7 +55,7 @@
plane = VOLUMETRIC_STORAGE_BOX_PLANE
var/obj/item/our_item
/atom/movable/screen/storage/volumetric_box/Initialize(mapload, datum/hud/hud, new_master, obj/item/our_item)
/atom/movable/screen/storage/volumetric_box/Initialize(mapload, datum/hud/hud_owner, new_master, obj/item/our_item)
src.our_item = our_item
RegisterSignal(our_item, COMSIG_ITEM_MOUSE_ENTER, PROC_REF(on_item_mouse_enter))
RegisterSignal(our_item, COMSIG_ITEM_MOUSE_EXIT, PROC_REF(on_item_mouse_exit))
@@ -97,9 +97,9 @@
var/atom/movable/screen/storage/item_holder/holder
var/pixel_size
/atom/movable/screen/storage/volumetric_box/center/Initialize(mapload, datum/hud/hud, new_master, our_item)
left = new(null, hud, src, our_item)
right = new(null, hud, src, our_item)
/atom/movable/screen/storage/volumetric_box/center/Initialize(mapload, datum/hud/hud_owner, new_master, our_item)
left = new(null, hud_owner, src, our_item)
right = new(null, hud_owner, src, our_item)
return ..()
/atom/movable/screen/storage/volumetric_box/center/Destroy()
@@ -155,7 +155,7 @@
layer = VOLUMETRIC_STORAGE_BOX_LAYER
plane = VOLUMETRIC_STORAGE_BOX_PLANE
/atom/movable/screen/storage/volumetric_edge/Initialize(mapload, datum/hud/hud, master, our_item)
/atom/movable/screen/storage/volumetric_edge/Initialize(mapload, datum/hud/hud_owner, master, our_item)
src.master = master
return ..()
@@ -183,7 +183,7 @@
var/obj/item/our_item
vis_flags = NONE
/atom/movable/screen/storage/item_holder/Initialize(mapload, datum/hud/hud, new_master, obj/item/I)
/atom/movable/screen/storage/item_holder/Initialize(mapload, datum/hud/hud_owner, new_master, obj/item/I)
. = ..()
our_item = I
vis_contents += I

View File

@@ -8,9 +8,8 @@
maptext = ""
layer = SCREENTIP_LAYER
/atom/movable/screen/screentip/Initialize(mapload, _hud)
/atom/movable/screen/screentip/Initialize(mapload, datum/hud/hud_owner)
. = ..()
hud = _hud
update_view()
/atom/movable/screen/screentip/proc/update_view(datum/source)

View File

@@ -11,7 +11,7 @@
/obj/item/clothing/head/helmet/space/chronos/dropped(mob/user)
if(suit)
suit.deactivate(1, 1)
..()
return ..()
/obj/item/clothing/suit/space/chronos
name = "Chronosuit"
@@ -23,23 +23,22 @@
resistance_flags = FIRE_PROOF | ACID_PROOF
mutantrace_variation = STYLE_DIGITIGRADE
var/list/chronosafe_items = list(/obj/item/chrono_eraser, /obj/item/gun/energy/chrono_gun)
var/obj/item/clothing/head/helmet/space/chronos/helmet = null
var/obj/effect/chronos_cam/camera = null
var/datum/action/innate/chrono_teleport/teleport_now = new
var/obj/item/clothing/head/helmet/space/chronos/helmet
var/obj/effect/chronos_cam/camera
var/datum/action/innate/chrono_teleport/teleport_now
var/activating = 0
var/activated = 0
var/cooldowntime = 50 //deciseconds
var/cooldowntime = 5 SECONDS
var/teleporting = 0
var/phase_timer_id
/obj/item/clothing/suit/space/chronos/New()
..()
/obj/item/clothing/suit/space/chronos/Initialize(mapload)
. = ..()
teleport_now = new(src)
teleport_now.chronosuit = src
teleport_now.target = src
/obj/item/clothing/suit/space/chronos/proc/new_camera(mob/user)
if(camera)
qdel(camera)
QDEL_NULL(camera)
camera = new /obj/effect/chronos_cam(user)
camera.holder = user
camera.chronosuit = src
@@ -55,7 +54,7 @@
/obj/item/clothing/suit/space/chronos/dropped(mob/user)
if(activated)
deactivate()
..()
return ..()
/obj/item/clothing/suit/space/chronos/emp_act(severity)
. = ..()
@@ -64,8 +63,8 @@
var/mob/living/carbon/human/user = src.loc
if(severity >= 70)
if(activated && user && ishuman(user) && (user.wear_suit == src))
to_chat(user, "<span class='danger'>E:FATAL:RAM_READ_FAIL\nE:FATAL:STACK_EMPTY\nE:FATAL:READ_NULL_POINT\nE:FATAL:PWR_BUS_OVERLOAD</span>")
to_chat(user, "<span class='userdanger'>An electromagnetic pulse disrupts your [name] and violently tears you out of time-bluespace!</span>")
to_chat(user, span_danger("E:FATAL:RAM_READ_FAIL\nE:FATAL:STACK_EMPTY\nE:FATAL:READ_NULL_POINT\nE:FATAL:PWR_BUS_OVERLOAD"))
to_chat(user, span_userdanger("An electromagnetic pulse disrupts your [name] and violently tears you out of time-bluespace!"))
user.emote("scream")
deactivate(1, 1)
@@ -75,23 +74,24 @@
if(phase_timer_id)
deltimer(phase_timer_id)
phase_timer_id = 0
if(istype(user))
if(to_turf)
user.forceMove(to_turf)
user.SetStun(0)
user.SetNextAction(0, considered_action = FALSE, immediate = FALSE)
user.alpha = 255
user.update_atom_colour()
user.animate_movement = FORWARD_STEPS
user.mob_transforming = 0
user.anchored = FALSE
teleporting = 0
for(var/obj/item/I in user.held_items)
REMOVE_TRAIT(I, TRAIT_NODROP, CHRONOSUIT_TRAIT)
if(camera)
camera.remove_target_ui()
camera.forceMove(user)
teleport_now.UpdateButtons()
if(!istype(user))
return
if(to_turf)
user.forceMove(to_turf)
user.SetStun(0)
user.SetNextAction(0, considered_action = FALSE, immediate = FALSE)
user.alpha = 255
user.update_atom_colour()
user.animate_movement = FORWARD_STEPS
user.mob_transforming = 0
user.anchored = FALSE
teleporting = 0
for(var/obj/item/I in user.held_items)
REMOVE_TRAIT(I, TRAIT_NODROP, CHRONOSUIT_TRAIT)
if(camera)
camera.remove_target_ui()
camera.forceMove(user)
teleport_now.UpdateButtons()
/obj/item/clothing/suit/space/chronos/proc/chronowalk(atom/location)
var/mob/living/carbon/human/user = src.loc
@@ -238,7 +238,7 @@
var/mob/holder = null
var/phase_time = 0
var/phase_time_length = 3
var/atom/movable/screen/chronos_target/target_ui = null
var/atom/movable/screen/chronos_target/target_ui
var/obj/item/clothing/suit/space/chronos/chronosuit
/obj/effect/chronos_cam/singularity_act()
@@ -249,17 +249,14 @@
/obj/effect/chronos_cam/proc/create_target_ui()
if(holder && holder.client && chronosuit)
if(target_ui)
remove_target_ui()
target_ui = new(null, holder)
remove_target_ui()
target_ui = new(null, holder.hud_used, holder)
holder.client.screen += target_ui
/obj/effect/chronos_cam/proc/remove_target_ui()
if(target_ui)
qdel(target_ui)
target_ui = null
QDEL_NULL(target_ui)
/obj/effect/chronos_cam/relaymove(var/mob/user, direction)
/obj/effect/chronos_cam/relaymove(mob/user, direction)
if(!holder)
qdel(src)
return
@@ -305,13 +302,13 @@
color = "#ff3311"
blend_mode = BLEND_SUBTRACT
/atom/movable/screen/chronos_target/New(loc, var/mob/living/carbon/human/user)
if(user)
var/icon/user_icon = getFlatIcon(user)
icon = user_icon
transform = user.transform
else
qdel(src)
/atom/movable/screen/chronos_target/Initialize(mapload, datum/hud/hud_owner, mob/living/carbon/human/user)
. = ..()
if(!user)
return INITIALIZE_HINT_QDEL
var/icon/user_icon = getFlatIcon(user)
icon = user_icon
transform = user.transform
/datum/action/innate/chrono_teleport
name = "Teleport Now"
@@ -324,6 +321,7 @@
return (chronosuit && chronosuit.activated && chronosuit.camera && !chronosuit.teleporting)
/datum/action/innate/chrono_teleport/Activate()
if(IsAvailable())
if(chronosuit.camera)
chronosuit.chronowalk(chronosuit.camera)
if(!IsAvailable())
return
if(chronosuit.camera)
chronosuit.chronowalk(chronosuit.camera)

View File

@@ -6,7 +6,7 @@
var/highlighted = FALSE
var/mob/camera/aiEye/pic_in_pic/aiEye
/atom/movable/screen/movable/pic_in_pic/ai/Initialize(mapload)
/atom/movable/screen/movable/pic_in_pic/ai/Initialize(mapload, datum/hud/hud_owner)
. = ..()
aiEye = new /mob/camera/aiEye/pic_in_pic()
aiEye.screen = src