Skip to content

Commit

Permalink
tgui strip panel + strippable element (#57889)
Browse files Browse the repository at this point in the history
Completely removes show_inv and replaces it with /datum/element/strippable. It takes a list of instantiated /datum/strippable_item which communicate which slots are available and how to interact with them. This element has been added to humans, alien humanoids, parrots, and corgis.

Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
  • Loading branch information
Mothblocks and stylemistake committed Mar 26, 2021
1 parent 247c62f commit f71b3a0
Show file tree
Hide file tree
Showing 45 changed files with 1,684 additions and 536 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@
#define APPRENTICE_AGE_MIN 29 //youngest an apprentice can be
#define SHOES_SLOWDOWN 0 //How much shoes slow you down by default. Negative values speed you up
#define SHOES_SPEED_SLIGHT SHOES_SLOWDOWN - 1 // slightest speed boost to movement
#define POCKET_STRIP_DELAY 40 //time taken (in deciseconds) to search somebody's pockets
#define POCKET_STRIP_DELAY (4 SECONDS) //time taken to search somebody's pockets
#define DOOR_CRUSH_DAMAGE 15 //the amount of damage that airlocks deal when they crush you

#define HUNGER_FACTOR 0.05 //factor at which mob nutrition decreases
Expand Down
31 changes: 31 additions & 0 deletions code/__DEFINES/strippable.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// All of these must be matched in StripMenu.js.
#define STRIPPABLE_ITEM_HEAD "head"
#define STRIPPABLE_ITEM_BACK "back"
#define STRIPPABLE_ITEM_MASK "mask"
#define STRIPPABLE_ITEM_NECK "neck"
#define STRIPPABLE_ITEM_EYES "eyes"
#define STRIPPABLE_ITEM_EARS "ears"
#define STRIPPABLE_ITEM_JUMPSUIT "jumpsuit"
#define STRIPPABLE_ITEM_SUIT "suit"
#define STRIPPABLE_ITEM_GLOVES "gloves"
#define STRIPPABLE_ITEM_FEET "shoes"
#define STRIPPABLE_ITEM_SUIT_STORAGE "suit_storage"
#define STRIPPABLE_ITEM_ID "id"
#define STRIPPABLE_ITEM_BELT "belt"
#define STRIPPABLE_ITEM_LPOCKET "left_pocket"
#define STRIPPABLE_ITEM_RPOCKET "right_pocket"
#define STRIPPABLE_ITEM_LHAND "left_hand"
#define STRIPPABLE_ITEM_RHAND "right_hand"
#define STRIPPABLE_ITEM_HANDCUFFS "handcuffs"
#define STRIPPABLE_ITEM_LEGCUFFS "legcuffs"
#define STRIPPABLE_ITEM_CORGI_COLLAR "corgi_collar"
#define STRIPPABLE_ITEM_PARROT_HEADSET "parrot_headset"

/// This slot is not obscured.
#define STRIPPABLE_OBSCURING_NONE 0

/// This slot is completely obscured, and cannot be accessed.
#define STRIPPABLE_OBSCURING_COMPLETELY 1

/// This slot can't be seen, but can be accessed.
#define STRIPPABLE_OBSCURING_HIDDEN 2
8 changes: 7 additions & 1 deletion code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Misc
*/

#define LAZYINITLIST(L) if (!L) L = list()
#define LAZYINITLIST(L) if (!L) { L = list(); }
#define UNSETEMPTY(L) if (L && !length(L)) L = null
///Like LAZYCOPY - copies an input list if the list has entries, If it doesn't the assigned list is nulled
#define LAZYLISTDUPLICATE(L) (L ? L.Copy() : null )
Expand All @@ -34,6 +34,12 @@
#define SANITIZE_LIST(L) ( islist(L) ? L : list() )
#define reverseList(L) reverseRange(L.Copy())

/// Performs an insertion on the given lazy list with the given key and value. If the value already exists, a new one will not be made.
#define LAZYORASSOCLIST(lazy_list, key, value) \
LAZYINITLIST(lazy_list); \
LAZYINITLIST(lazy_list[key]); \
lazy_list[key] |= value;

/// Passed into BINARY_INSERT to compare keys
#define COMPARE_KEY __BIN_LIST[__BIN_MID]
/// Passed into BINARY_INSERT to compare values
Expand Down

0 comments on commit f71b3a0

Please sign in to comment.