Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage bugfixes #6878

Merged
merged 4 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions code/__DEFINES/_planes+layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,13 @@
#define HUD_LAYER_INVENTORY 3
/// storage objects sit here
#define HUD_LAYER_STORAGE 4
/// storage object item borders sit here
#define HUD_LAYER_STORAGE_ITEM_BOUNDING 5

// todo: deprecate
#define HUD_LAYER_ITEM 3 /// Things sitting on HUD items (largely irrelevant because INVENTORY_PLANE).
#define HUD_LAYER_ITEM 7 /// Things sitting on HUD items (largely irrelevant because INVENTORY_PLANE).
// todo: deprecate
#define HUD_LAYER_ABOVE 4 /// Things that reside above items (highlights).
#define HUD_LAYER_ABOVE 8 /// Things that reside above items (highlights).

/**
*! -- Player HUD Plane - Items
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/systems/storage/storage-screen_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
overlays.len = 0
var/center_thickness = (width - (VOLUMETRIC_STORAGE_BOX_BORDER_SIZE * 2))
var/shift_from_center = -((WORLD_ICON_SIZE * 0.5) - VOLUMETRIC_STORAGE_BOX_BORDER_SIZE) + (center_thickness * 0.5)
var/image/left = image(icon, "stored_left", HUD_LAYER_STORAGE, null, -shift_from_center)
var/image/left = image(icon, "stored_left", HUD_LAYER_STORAGE_ITEM_BOUNDING, null, -shift_from_center)
left.plane = HUD_PLANE
var/image/right = image(icon, "stored_right", HUD_LAYER_STORAGE, null, shift_from_center)
var/image/right = image(icon, "stored_right", HUD_LAYER_STORAGE_ITEM_BOUNDING, null, shift_from_center)
right.plane = HUD_PLANE
var/image/middle = image(icon, "stored_middle", HUD_LAYER_STORAGE)
var/image/middle = image(icon, "stored_middle", HUD_LAYER_STORAGE_ITEM_BOUNDING)
middle.plane = HUD_PLANE
middle.transform = matrix(center_thickness / VOLUMETRIC_STORAGE_BOX_ICON_SIZE, 0, 0, 0, 1, 0)
underlays = list(left, middle, right)
overlays = list(left, middle, right)

/atom/movable/screen/storage/panel/volumetric

Expand Down
21 changes: 17 additions & 4 deletions code/game/rendering/actor_huds/huds/inventory-screen_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
return ..()

/atom/movable/screen/actor_hud/inventory/plate/update_icon(updates)
cut_overlays()
. = ..()
var/image/self_render = new
self_render.icon = self_icon
Expand All @@ -59,7 +60,7 @@
self_render.color = self_color
self_render.plane = HUD_PLANE
self_render.layer = HUD_LAYER_INVENTORY
underlays = list(self_render)
add_overlay(self_render)

/atom/movable/screen/actor_hud/inventory/plate/sync_style(datum/hud_style/style, style_alpha, style_color)
self_alpha = style_alpha
Expand Down Expand Up @@ -124,11 +125,14 @@
var/hand_index
/// should we have handcuffed overlay?
var/handcuffed = FALSE
/// should we have the active overlay?
var/active = FALSE

/atom/movable/screen/actor_hud/inventory/plate/hand/Initialize(mapload, datum/inventory/host, hand_index)
. = ..()
src.hand_index = hand_index
sync_index(hand_index)
update_icon()

/atom/movable/screen/actor_hud/inventory/plate/hand/sync_style(datum/hud_style/style, style_alpha, style_color)
self_icon = style.inventory_icons
Expand All @@ -140,18 +144,27 @@
/atom/movable/screen/actor_hud/inventory/plate/hand/proc/sync_index(index = hand_index)
screen_loc = SCREEN_LOC_MOB_HUD_INVENTORY_HAND(index)
name = "[index % 2? "left" : "right"] hand[index > 2? " #[index]" : ""]"
icon_state = "hand-[index % 2? "left" : "right"]"
self_icon_state = "hand-[index % 2? "left" : "right"]"

/atom/movable/screen/actor_hud/inventory/plate/hand/proc/set_handcuffed(state)
if(state == handcuffed)
return
handcuffed = state
update_icon()

/atom/movable/screen/actor_hud/inventory/plate/hand/update_overlays()
/atom/movable/screen/actor_hud/inventory/plate/hand/update_icon(updates)
. = ..()
if(handcuffed)
. += image('icons/mob/screen_gen.dmi', "[hand_index % 2 ? "r_hand" : "l_hand"]_hud_handcuffs")
add_overlay(image('icons/mob/screen_gen.dmi', "[hand_index % 2 ? "r_hand" : "l_hand"]_hud_handcuffs"))
if(active)
var/image/active_image = new
active_image.icon = self_icon
active_image.icon_state = "[self_icon_state]-active"
active_image.plane = HUD_PLANE
active_image.layer = HUD_LAYER_INVENTORY
active_image.alpha = self_alpha
active_image.color = self_color
add_overlay(active_image)

/**
* Button: 'swap hand'
Expand Down
6 changes: 4 additions & 2 deletions code/game/rendering/actor_huds/huds/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@
return
if(applied_active_hand)
var/atom/movable/screen/actor_hud/inventory/plate/hand/old_hand = hands[applied_active_hand]
old_hand.cut_overlay("[old_hand.icon_state]-active")
old_hand.active = FALSE
old_hand.update_icon()
applied_active_hand = null
if(!to_index)
return
Expand All @@ -334,7 +335,8 @@
CRASH("attempted to set hand active out of bounds")
applied_active_hand = to_index
var/atom/movable/screen/actor_hud/inventory/plate/hand/new_hand = hands[to_index]
new_hand.add_overlay("[new_hand.icon_state]-active")
new_hand.active = TRUE
new_hand.update_icon()

//* Hooks *//

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/inventory/inventory-hands-get.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
RETURN_TYPE(/list)
. = list()
for(var/obj/item/I in held_items)
return I
. += I

/**
* @return list of held items
Expand Down
4 changes: 3 additions & 1 deletion code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
return ..()

/mob/living/carbon/init_inventory()
. = ..()
if(inventory)
return
inventory = new(src)
inventory.set_hand_count(2)
if(species) // todo: sigh we need to talk about init order; this shouldn't be needed
inventory.set_inventory_slots(species.inventory_slots)
Expand Down
7 changes: 0 additions & 7 deletions code/modules/mob/living/living-inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@
SLOT_ID_MASK
)

//* Init *//

/mob/living/init_inventory()
if(inventory)
return
inventory = new(src)

//* Carry Weight *//

// don't call this you shouldn't need to
Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
wires = new(src)

robot_modules_background = new()
robot_modules_background.icon = 'icons/screen/hud/common/storage.dmi'
robot_modules_background.icon_state = "block"
ident = rand(1, 999)
module_sprites["Basic"] = "robot"
Expand Down
Binary file modified icons/mob/screen/orange.dmi
Binary file not shown.
Binary file modified icons/mob/screen/white.dmi
Binary file not shown.
Binary file modified icons/screen/hud/orange/inventory-slot.dmi
Binary file not shown.
Binary file modified icons/screen/hud/white/inventory-slot.dmi
Binary file not shown.
Loading