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

refactor: (?) simple replacement slot_l_hand -> SLOT_HUD_LEFT_HAND etc #4515

Merged
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
53 changes: 27 additions & 26 deletions code/__DEFINES/clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,33 @@
#define HIDEGLASSES (1<<7) //APPLIES ONLY TO HELMETS/MASKS!!
#define HIDENAME (1<<8) //APPLIES ONLY TO HELMETS/MASKS!! Dictates whether we appear as unknown.

// slots
#define slot_back 1
#define slot_wear_mask 2
#define slot_handcuffed 3
#define slot_l_hand 4
#define slot_r_hand 5
#define slot_belt 6
#define slot_wear_id 7
#define slot_l_ear 8
#define slot_glasses 9
#define slot_gloves 10
#define slot_head 11
#define slot_shoes 12
#define slot_wear_suit 13
#define slot_w_uniform 14
#define slot_l_store 15
#define slot_r_store 16
#define slot_s_store 17
#define slot_in_backpack 18
#define slot_legcuffed 19
#define slot_r_ear 20
#define slot_wear_pda 21
#define slot_tie 22
#define slot_collar 23
#define slot_neck 24
#define slots_amt 24
// Slot defines for var/list/inv_slots, some of these dont really show up on the HUD,
// but still function like it in other ways. I know thats weird.
#define SLOT_HUD_BACK 1
#define SLOT_HUD_WEAR_MASK 2
#define SLOT_HUD_HANDCUFFED 3
#define SLOT_HUD_LEFT_HAND 4 // l_hand
#define SLOT_HUD_RIGHT_HAND 5 // r_hand
#define SLOT_HUD_BELT 6
#define SLOT_HUD_WEAR_ID 7
#define SLOT_HUD_LEFT_EAR 8 // l_ear
#define SLOT_HUD_GLASSES 9
#define SLOT_HUD_GLOVES 10
#define SLOT_HUD_HEAD 11
#define SLOT_HUD_SHOES 12
#define SLOT_HUD_OUTER_SUIT 13 // wear_suit
#define SLOT_HUD_JUMPSUIT 14 // w_uniform
#define SLOT_HUD_LEFT_STORE 15 // l_store
#define SLOT_HUD_RIGHT_STORE 16 // r_store
#define SLOT_HUD_SUIT_STORE 17
#define SLOT_HUD_IN_BACKPACK 18 // this just puts stuff a backpack if you have one
#define SLOT_HUD_LEGCUFFED 19
#define SLOT_HUD_RIGHT_EAR 20 // r_ear
#define SLOT_HUD_WEAR_PDA 21
#define SLOT_HUD_TIE 22
#define SLOT_HUD_COLLAR 23
#define SLOT_HUD_NECK 24
#define SLOT_HUD_AMOUNT 24

// accessory slots
#define ACCESSORY_SLOT_DECOR 1
Expand Down
36 changes: 18 additions & 18 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define ALL_CARDINALS (NORTH|SOUTH|EAST|WEST)

//FLAGS BITMASK
#define STOPSPRESSUREDMAGE (1<<0) // This flag is used on the flags variable for SUIT and HEAD items which stop pressure damage. Note that the flag 1 was previous used as ONBACK, so it is possible for some code to use (flags & 1) when checking if something can be put on your back. Replace this code with (inv_flags & SLOT_BACK) if you see it anywhere To successfully stop you taking all pressure damage you must have both a suit and head item with this flag.
#define STOPSPRESSUREDMAGE (1<<0) // This flag is used on the flags variable for SUIT and HEAD items which stop pressure damage. Note that the flag 1 was previous used as ONBACK, so it is possible for some code to use (flags & 1) when checking if something can be put on your back. Replace this code with (inv_flags & SLOT_FLAG_BACK) if you see it anywhere To successfully stop you taking all pressure damage you must have both a suit and head item with this flag.
#define NODROP (1<<1) // This flag makes it so that an item literally cannot be removed at all, or at least that's how it should be. Only deleted.
#define NOBLUDGEON (1<<2) // when an item has this it produces no "X has been hit by Y with Z" message with the default handler
#define AIRTIGHT (1<<3) // mask allows internals
Expand Down Expand Up @@ -163,23 +163,23 @@
#define NO_RUINS 4

//ITEM INVENTORY SLOT BITMASKS
#define SLOT_OCLOTHING (1<<0)
#define SLOT_ICLOTHING (1<<1)
#define SLOT_GLOVES (1<<2)
#define SLOT_EYES (1<<3)
#define SLOT_EARS (1<<4)
#define SLOT_MASK (1<<5)
#define SLOT_HEAD (1<<6)
#define SLOT_FEET (1<<7)
#define SLOT_ID (1<<8)
#define SLOT_BELT (1<<9)
#define SLOT_BACK (1<<10)
#define SLOT_POCKET (1<<11) //this is to allow items with a w_class of 3 or 4 to fit in pockets.
#define SLOT_DENYPOCKET (1<<12) //this is to deny items with a w_class of 2 or 1 to fit in pockets.
#define SLOT_TWOEARS (1<<13)
#define SLOT_PDA (1<<14)
#define SLOT_TIE (1<<15)
#define SLOT_NECK (1<<16)
#define SLOT_FLAG_OCLOTHING (1<<0)
#define SLOT_FLAG_ICLOTHING (1<<1)
#define SLOT_FLAG_GLOVES (1<<2)
#define SLOT_FLAG_EYES (1<<3)
#define SLOT_FLAG_EARS (1<<4)
#define SLOT_FLAG_MASK (1<<5)
#define SLOT_FLAG_HEAD (1<<6)
#define SLOT_FLAG_FEET (1<<7)
#define SLOT_FLAG_ID (1<<8)
#define SLOT_FLAG_BELT (1<<9)
#define SLOT_FLAG_BACK (1<<10)
#define SLOT_FLAG_POCKET (1<<11) //this is to allow items with a w_class of 3 or 4 to fit in pockets.
#define SLOT_FLAG_DENYPOCKET (1<<12) //this is to deny items with a w_class of 2 or 1 to fit in pockets.
#define SLOT_FLAG_TWOEARS (1<<13)
#define SLOT_FLAG_PDA (1<<14)
#define SLOT_FLAG_TIE (1<<15)
#define SLOT_FLAG_NECK (1<<16)

//ORGAN TYPE FLAGS
#define AFFECT_ROBOTIC_ORGAN 1
Expand Down
26 changes: 26 additions & 0 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2043,3 +2043,29 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
else
return NORTH

/proc/slot_bitfield_to_slot(input_slot_flags) //Doesn't work with ears or pockets
switch(input_slot_flags)
if(SLOT_FLAG_OCLOTHING)
return SLOT_HUD_OUTER_SUIT
if(SLOT_FLAG_ICLOTHING)
return SLOT_HUD_JUMPSUIT
if(SLOT_FLAG_GLOVES)
return SLOT_HUD_GLOVES
if(SLOT_FLAG_EYES)
return SLOT_HUD_GLASSES
if(SLOT_FLAG_MASK)
return SLOT_HUD_WEAR_MASK
if(SLOT_FLAG_HEAD)
return SLOT_HUD_HEAD
if(SLOT_FLAG_FEET)
return SLOT_HUD_SHOES
if(SLOT_FLAG_ID)
return SLOT_HUD_WEAR_ID
if(SLOT_FLAG_BELT)
return SLOT_HUD_BELT
if(SLOT_FLAG_BACK)
return SLOT_HUD_BACK
if(SLOT_FLAG_PDA)
return SLOT_HUD_WEAR_PDA
if(SLOT_FLAG_TIE)
return SLOT_HUD_TIE
8 changes: 4 additions & 4 deletions code/_onclick/hud/alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@
inv_box.icon = 'icons/mob/screen_alien.dmi'
inv_box.icon_state = "hand_r"
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
inv_box.slot_id = SLOT_HUD_RIGHT_HAND
static_inventory += inv_box

inv_box = new /obj/screen/inventory/hand()
inv_box.name = "l_hand"
inv_box.icon = 'icons/mob/screen_alien.dmi'
inv_box.icon_state = "hand_l"
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
inv_box.slot_id = SLOT_HUD_LEFT_HAND
static_inventory += inv_box

using = new /obj/screen/swap_hand()
Expand All @@ -95,15 +95,15 @@
inv_box.icon = 'icons/mob/screen_alien.dmi'
inv_box.icon_state = "pocket"
inv_box.screen_loc = ui_alien_storage_l
inv_box.slot_id = slot_l_store
inv_box.slot_id = SLOT_HUD_LEFT_STORE
static_inventory += inv_box

inv_box = new /obj/screen/inventory()
inv_box.name = "storage2"
inv_box.icon = 'icons/mob/screen_alien.dmi'
inv_box.icon_state = "pocket"
inv_box.screen_loc = ui_alien_storage_r
inv_box.slot_id = slot_r_store
inv_box.slot_id = SLOT_HUD_RIGHT_STORE
static_inventory += inv_box

//end of equippable shit
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/devil.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
inv_box.icon = ui_style
inv_box.icon_state = "hand_r"
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
inv_box.slot_id = SLOT_HUD_RIGHT_HAND
static_inventory += inv_box

inv_box = new /obj/screen/inventory/hand()
inv_box.name = "left hand"
inv_box.icon = ui_style
inv_box.icon_state = "hand_l"
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
inv_box.slot_id = SLOT_HUD_LEFT_HAND
static_inventory += inv_box

using = new /obj/screen/swap_hand()
Expand Down
10 changes: 5 additions & 5 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
var/list/toggleable_inventory = list() //the screen objects which can be hidden
var/list/hotkeybuttons = list() //the buttons that can be used via hotkeys
var/list/infodisplay = list() //the screen objects that display mob info (health, alien plasma, etc...)
var/list/inv_slots[slots_amt] // /obj/screen/inventory objects, ordered by their slot ID.
var/list/inv_slots[SLOT_HUD_AMOUNT] // /obj/screen/inventory objects, ordered by their slot ID.

var/obj/screen/movable/action_button/hide_toggle/hide_actions_toggle
var/action_buttons_hidden = FALSE
Expand Down Expand Up @@ -159,10 +159,10 @@
mymob.client.screen += infodisplay

//These ones are a part of 'static_inventory', 'toggleable_inventory' or 'hotkeybuttons' but we want them to stay
if(inv_slots[slot_l_hand])
mymob.client.screen += inv_slots[slot_l_hand] //we want the hands to be visible
if(inv_slots[slot_r_hand])
mymob.client.screen += inv_slots[slot_r_hand] //we want the hands to be visible
if(inv_slots[SLOT_HUD_LEFT_HAND])
mymob.client.screen += inv_slots[SLOT_HUD_LEFT_HAND] //we want the hands to be visible
if(inv_slots[SLOT_HUD_RIGHT_HAND])
mymob.client.screen += inv_slots[SLOT_HUD_RIGHT_HAND] //we want the hands to be visible
if(action_intent)
mymob.client.screen += action_intent //we want the intent switcher visible
action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is.
Expand Down
38 changes: 19 additions & 19 deletions code/_onclick/hud/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
inv_box = new /obj/screen/inventory()
inv_box.name = "i_clothing"
inv_box.icon = ui_style
inv_box.slot_id = slot_w_uniform
inv_box.slot_id = SLOT_HUD_JUMPSUIT
inv_box.icon_state = "uniform"
inv_box.screen_loc = ui_iclothing
inv_box.color = ui_color
Expand All @@ -137,7 +137,7 @@
inv_box = new /obj/screen/inventory()
inv_box.name = "o_clothing"
inv_box.icon = ui_style
inv_box.slot_id = slot_wear_suit
inv_box.slot_id = SLOT_HUD_OUTER_SUIT
inv_box.icon_state = "suit"
inv_box.screen_loc = ui_oclothing
inv_box.color = ui_color
Expand All @@ -151,7 +151,7 @@
inv_box.color = ui_color
inv_box.alpha = ui_alpha
inv_box.screen_loc = ui_rhand
inv_box.slot_id = slot_r_hand
inv_box.slot_id = SLOT_HUD_RIGHT_HAND
static_inventory += inv_box

inv_box = new /obj/screen/inventory/hand()
Expand All @@ -161,7 +161,7 @@
inv_box.color = ui_color
inv_box.alpha = ui_alpha
inv_box.screen_loc = ui_lhand
inv_box.slot_id = slot_l_hand
inv_box.slot_id = SLOT_HUD_LEFT_HAND
static_inventory += inv_box

using = new /obj/screen/swap_hand()
Expand All @@ -187,7 +187,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "id"
inv_box.screen_loc = ui_id
inv_box.slot_id = slot_wear_id
inv_box.slot_id = SLOT_HUD_WEAR_ID
inv_box.color = ui_color
inv_box.alpha = ui_alpha
static_inventory += inv_box
Expand All @@ -197,7 +197,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "pda"
inv_box.screen_loc = ui_pda
inv_box.slot_id = slot_wear_pda
inv_box.slot_id = SLOT_HUD_WEAR_PDA
inv_box.color = ui_color
inv_box.alpha = ui_alpha
static_inventory += inv_box
Expand All @@ -207,7 +207,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "mask"
inv_box.screen_loc = ui_mask
inv_box.slot_id = slot_wear_mask
inv_box.slot_id = SLOT_HUD_WEAR_MASK
inv_box.color = ui_color
inv_box.alpha = ui_alpha
toggleable_inventory += inv_box
Expand All @@ -217,7 +217,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "neck"
inv_box.screen_loc = ui_neck
inv_box.slot_id = slot_neck
inv_box.slot_id = SLOT_HUD_NECK
inv_box.color = ui_color
inv_box.alpha = ui_alpha
toggleable_inventory += inv_box
Expand All @@ -227,7 +227,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "back"
inv_box.screen_loc = ui_back
inv_box.slot_id = slot_back
inv_box.slot_id = SLOT_HUD_BACK
inv_box.color = ui_color
inv_box.alpha = ui_alpha
static_inventory += inv_box
Expand All @@ -237,7 +237,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "pocket"
inv_box.screen_loc = ui_storage1
inv_box.slot_id = slot_l_store
inv_box.slot_id = SLOT_HUD_LEFT_STORE
inv_box.color = ui_color
inv_box.alpha = ui_alpha
static_inventory += inv_box
Expand All @@ -247,7 +247,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "pocket"
inv_box.screen_loc = ui_storage2
inv_box.slot_id = slot_r_store
inv_box.slot_id = SLOT_HUD_RIGHT_STORE
inv_box.color = ui_color
inv_box.alpha = ui_alpha
static_inventory += inv_box
Expand All @@ -259,7 +259,7 @@
inv_box.color = ui_color
inv_box.alpha = ui_alpha
inv_box.screen_loc = ui_sstore1
inv_box.slot_id = slot_s_store
inv_box.slot_id = SLOT_HUD_SUIT_STORE
static_inventory += inv_box

using = new /obj/screen/resist()
Expand Down Expand Up @@ -288,7 +288,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "gloves"
inv_box.screen_loc = ui_gloves
inv_box.slot_id = slot_gloves
inv_box.slot_id = SLOT_HUD_GLOVES
inv_box.color = ui_color
inv_box.alpha = ui_alpha
toggleable_inventory += inv_box
Expand All @@ -298,7 +298,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "glasses"
inv_box.screen_loc = ui_glasses
inv_box.slot_id = slot_glasses
inv_box.slot_id = SLOT_HUD_GLASSES
inv_box.color = ui_color
inv_box.alpha = ui_alpha
toggleable_inventory += inv_box
Expand All @@ -308,7 +308,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "ears"
inv_box.screen_loc = ui_l_ear
inv_box.slot_id = slot_l_ear
inv_box.slot_id = SLOT_HUD_LEFT_EAR
inv_box.color = ui_color
inv_box.alpha = ui_alpha
toggleable_inventory += inv_box
Expand All @@ -318,7 +318,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "ears"
inv_box.screen_loc = ui_r_ear
inv_box.slot_id = slot_r_ear
inv_box.slot_id = SLOT_HUD_RIGHT_EAR
inv_box.color = ui_color
inv_box.alpha = ui_alpha
toggleable_inventory += inv_box
Expand All @@ -328,7 +328,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "head"
inv_box.screen_loc = ui_head
inv_box.slot_id = slot_head
inv_box.slot_id = SLOT_HUD_HEAD
inv_box.color = ui_color
inv_box.alpha = ui_alpha
toggleable_inventory += inv_box
Expand All @@ -338,7 +338,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "shoes"
inv_box.screen_loc = ui_shoes
inv_box.slot_id = slot_shoes
inv_box.slot_id = SLOT_HUD_SHOES
inv_box.color = ui_color
inv_box.alpha = ui_alpha
toggleable_inventory += inv_box
Expand All @@ -348,7 +348,7 @@
inv_box.icon = ui_style
inv_box.icon_state = "belt"
inv_box.screen_loc = ui_belt
inv_box.slot_id = slot_belt
inv_box.slot_id = SLOT_HUD_BELT
inv_box.color = ui_color
inv_box.alpha = ui_alpha
static_inventory += inv_box
Expand Down
Loading
Loading