Skip to content

Commit

Permalink
some inventory backend changes & fixes (#6891)
Browse files Browse the repository at this point in the history
  • Loading branch information
silicons authored Nov 29, 2024
1 parent 03581ba commit c472903
Show file tree
Hide file tree
Showing 68 changed files with 935 additions and 671 deletions.
10 changes: 9 additions & 1 deletion citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,6 @@
#include "code\game\machinery\CableLayer.dm"
#include "code\game\machinery\cell_charger.dm"
#include "code\game\machinery\cloning.dm"
#include "code\game\machinery\colormate.dm"
#include "code\game\machinery\cryo.dm"
#include "code\game\machinery\cryopod.dm"
#include "code\game\machinery\deployable.dm"
Expand All @@ -1350,6 +1349,7 @@
#include "code\game\machinery\floor_light.dm"
#include "code\game\machinery\floorlayer.dm"
#include "code\game\machinery\fossilrevive.dm"
#include "code\game\machinery\gear_painter.dm"
#include "code\game\machinery\holopad.dm"
#include "code\game\machinery\holoposter.dm"
#include "code\game\machinery\holosign.dm"
Expand Down Expand Up @@ -1515,6 +1515,7 @@
#include "code\game\objects\items-defense.dm"
#include "code\game\objects\items-interaction.dm"
#include "code\game\objects\items-inventory-hooks.dm"
#include "code\game\objects\items-inventory-old.dm"
#include "code\game\objects\items-inventory-rendering.dm"
#include "code\game\objects\items-inventory.dm"
#include "code\game\objects\items.dm"
Expand Down Expand Up @@ -2014,6 +2015,7 @@
#include "code\game\objects\systems\_system.dm"
#include "code\game\objects\systems\cell_slot.dm"
#include "code\game\objects\systems\storage\storage-screen_object.dm"
#include "code\game\objects\systems\storage\storage-ui.dm"
#include "code\game\objects\systems\storage\storage.dm"
#include "code\game\objects\systems\storage\subtypes\stack.dm"
#include "code\game\objects\systems\storage\subtypes\stock_parts.dm"
Expand Down Expand Up @@ -2543,6 +2545,7 @@
#include "code\modules\client\verbs\system.dm"
#include "code\modules\client\verbs\view.dm"
#include "code\modules\clothing\chameleon.dm"
#include "code\modules\clothing\clothing-inventory.dm"
#include "code\modules\clothing\clothing.dm"
#include "code\modules\clothing\clothing_accessories.dm"
#include "code\modules\clothing\clothing_icons.dm"
Expand Down Expand Up @@ -2577,6 +2580,7 @@
#include "code\modules\clothing\head\oricon.dm"
#include "code\modules\clothing\head\pilot_helmet.dm"
#include "code\modules\clothing\head\soft_caps.dm"
#include "code\modules\clothing\head\misc\cakehat.dm"
#include "code\modules\clothing\head\xeno\tajara.dm"
#include "code\modules\clothing\masks\_mask.dm"
#include "code\modules\clothing\masks\boxing.dm"
Expand Down Expand Up @@ -3641,14 +3645,18 @@
#include "code\modules\mob\freelook\mask\cultnet.dm"
#include "code\modules\mob\freelook\mask\eye.dm"
#include "code\modules\mob\freelook\mask\update_triggers.dm"
#include "code\modules\mob\inventory\inventory-get.dm"
#include "code\modules\mob\inventory\inventory-hands-check.dm"
#include "code\modules\mob\inventory\inventory-hands-drop.dm"
#include "code\modules\mob\inventory\inventory-hands-get.dm"
#include "code\modules\mob\inventory\inventory-hands-legacy.dm"
#include "code\modules\mob\inventory\inventory-hands-put.dm"
#include "code\modules\mob\inventory\inventory-hands.dm"
#include "code\modules\mob\inventory\inventory-hooks.dm"
#include "code\modules\mob\inventory\inventory-query.dm"
#include "code\modules\mob\inventory\inventory-rendering.dm"
#include "code\modules\mob\inventory\inventory-slot-equip.dm"
#include "code\modules\mob\inventory\inventory-slot-get.dm"
#include "code\modules\mob\inventory\inventory.dm"
#include "code\modules\mob\inventory\inventory_slot.dm"
#include "code\modules\mob\living\autohiss.dm"
Expand Down
10 changes: 9 additions & 1 deletion code/__DEFINES/_flags/item_flags.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Flags for the item_flags var on /obj/item
/// is this item equipped into an inventory slot or hand of a mob? used for tooltips
/// todo: is this still needed? `inv_slot_or_index` on `/obj/item` is a good check already
#define ITEM_IN_INVENTORY (1<<0)
/// When dropped, it calls qdel on itself
#define ITEM_DROPDEL (1<<1)
Expand Down Expand Up @@ -128,7 +129,14 @@ DEFINE_BITFIELD(inv_hide_flags, list(
BITFIELD(BLOCKHAIR),
))

//!# bitflags for /obj/item/var/body_cover_flags
//* Body Cover Flags / Body Part Flags *//
//* *//
//* These are used in many places, despite only being used commonly on *//
//* /item's and /item/organ/external's. *//
//* *//
//* These should be used any time you need to store coverage or parts *//
//* of a standard humanoid body. *//

#define HEAD (1<<0)
#define FACE (1<<1)
#define EYES (1<<2)
Expand Down
8 changes: 4 additions & 4 deletions code/__DEFINES/dcs/signals/datums/signals_inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

/// raised with (obj/item/item, datum/inventory_slot/slot_or_index)
///
/// * raised after COMSIG_INVENTORY_ITEM_EXITED_SLOT during swaps
#define COMSIG_INVENTORY_ITEM_ENTERED_SLOT "inventory-item-entered-slot"
/// * raised after COMSIG_INVENTORY_ITEM_EXITED during swaps
#define COMSIG_INVENTORY_ITEM_ENTERED "inventory-item-entered-slot"
/// raised with (obj/item/item, datum/inventory_slot/slot_or_index)
///
/// * raised before COMSIG_INVENTORY_ITEM_ENTERED_SLOT during swaps
#define COMSIG_INVENTORY_ITEM_EXITED_SLOT "inventory-item-exited-slot"
/// * raised before COMSIG_INVENTORY_ITEM_ENTERED during swaps
#define COMSIG_INVENTORY_ITEM_EXITED "inventory-item-exited-slot"
/// raised with ()
///
/// * raised on any inventory slot mutation
Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/inventory/procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

// todo: INV_OP_RECURSE for nested / worn-over pieces

//* Inventory Return Flags *//
//* Inventory Returns *//

/// Failed
///
Expand Down
23 changes: 22 additions & 1 deletion code/__DEFINES/inventory/slots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ DEFINE_BITFIELD(slot_equip_checks, list(
BITFIELD(SLOT_EQUIP_CHECK_USE_PROC),
))

//! slot meta inventory_slot_flags flags
//* /datum/inventory_slot inventory_slot_flags *//

/// render on mob
#define INV_SLOT_IS_RENDERED (1<<0)
/// considered worn equipment
Expand Down Expand Up @@ -66,6 +67,26 @@ DEFINE_BITFIELD(inventory_slot_flags, list(
BITFIELD(INV_SLOT_STRIP_ONLY_REMOVES),
))

//* /datum/inventory_slot inventory_filter_flags *//

#define INV_FILTER_UNKNOWN (1<<1)
#define INV_FILTER_EQUIPMENT (1<<2)
#define INV_FILTER_RESTRAINTS (1<<3)

/// specially handled value
#define INV_FILTER_HANDS (1<<23)

DEFINE_BITFIELD_NEW(inv_slot_filter, list(
/datum/inventory_slot = list(
NAMEOF_STATIC(/datum/inventory_slot, inventory_filter_flags),
),
), list(
BITFIELD_NEW("Unknown", INV_FILTER_UNKNOWN),
BITFIELD_NEW("Equipment", INV_FILTER_EQUIPMENT),
BITFIELD_NEW("Restraints", INV_FILTER_RESTRAINTS),
BITFIELD_NEW("Hands", INV_FILTER_HANDS),
))

//! slot flags
// Item inventory slot bitmasks.
#define SLOT_OCLOTHING (1<<0)
Expand Down
6 changes: 3 additions & 3 deletions code/__DEFINES/matrices.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
#define COLOR_MATRIX_IDENTITY list(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1, 0,0,0,0)
/// Color inversion
#define COLOR_MATRIX_INVERT list(-1,0,0,0, 0,-1,0,0, 0,0,-1,0, 0,0,0,1, 1,1,1,0)
///Sepiatone
/// Sepiatone
#define COLOR_MATRIX_SEPIATONE list(0.393,0.349,0.272,0, 0.769,0.686,0.534,0, 0.189,0.168,0.131,0, 0,0,0,1, 0,0,0,0)
///Grayscale
/// Grayscale
#define COLOR_MATRIX_GRAYSCALE list(0.33,0.33,0.33,0, 0.59,0.59,0.59,0, 0.11,0.11,0.11,0, 0,0,0,1, 0,0,0,0)
///Polaroid colors
/// Polaroid colors
#define COLOR_MATRIX_POLAROID list(1.438,-0.062,-0.062,0, -0.122,1.378,-0.122,0, -0.016,-0.016,1.483,0, 0,0,0,1, 0,0,0,0)
/// Converts reds to blue, green to red and blue to green.
#define COLOR_MATRIX_BRG list(0,0,1,0, 0,1,0,0, 1,0,0,0, 0,0,0,1, 0,0,0,0)
Expand Down
4 changes: 0 additions & 4 deletions code/controllers/subsystem/materials.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ SUBSYSTEM_DEF(materials)
/// material recipes
var/list/datum/stack_recipe/material/material_stack_recipes

// todo: Recover() should keep procedural materials
// however, i can't be assed to write Recover() until we do procedural materials
// thus, dealing with it later :^)

/// ticked atoms
var/list/ticking = list()
/// currentrun
Expand Down
4 changes: 2 additions & 2 deletions code/datums/outfits/costumes/halloween.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
r_hand = /obj/item/gun/ballistic/revolver/capgun

/datum/outfit/costume/horrorcop/post_equip(var/mob/living/carbon/human/H)
var/obj/item/clothing/under/U = H.w_uniform
var/obj/item/clothing/under/U = H.inventory.get_slot_single(/datum/inventory_slot/inventory/uniform)
if(LAZYLEN(U.accessories))
for(var/obj/item/clothing/accessory/A in U.accessories)
if(istype(A, /obj/item/clothing/accessory/holster))
Expand All @@ -58,7 +58,7 @@
r_hand = /obj/item/gun/ballistic/revolver/capgun

/datum/outfit/costume/cowboy/post_equip(var/mob/living/carbon/human/H)
var/obj/item/clothing/under/U = H.w_uniform
var/obj/item/clothing/under/U = H.inventory.get_slot_single(/datum/inventory_slot/inventory/uniform)
if(LAZYLEN(U.accessories))
for(var/obj/item/clothing/accessory/A in U.accessories)
if(istype(A, /obj/item/clothing/accessory/holster))
Expand Down
1 change: 1 addition & 0 deletions code/game/click/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,4 @@
constructed.hand_index = active_hand
if(!unarmed)
constructed.using = get_active_held_item()
return constructed
File renamed without changes.
2 changes: 1 addition & 1 deletion code/game/objects/items-carry_weight.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* Carry Weight *//
//* The carry weight system is a modular system used to discourage *//
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items-interaction.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//* This file is explicitly licensed under the MIT license. *//
//* Copyright (c) 2024 silicons *//
//* Copyright (c) 2024 Citadel Station Developers *//

//* ----- Click Triggers ----- */

Expand Down Expand Up @@ -89,7 +89,7 @@
if(isnull(actually_picked_up))
to_chat(user, SPAN_WARNING("[src] somehow slips through your grasp. What just happened?"))
return
if(!user.put_in_hands(actually_picked_up, user.active_hand))
if(!user.put_in_hands(actually_picked_up, INV_OP_NO_MERGE_STACKS, user.active_hand))
if(has_to_drop_to_ground_on_fail)
actually_picked_up.forceMove(user.drop_location())
return
Expand Down
Loading

0 comments on commit c472903

Please sign in to comment.