Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e8f3906

Browse filesBrowse files
Removes the non-bitfield slot flags (yogstation13#19165)
* Removes the non-bitfield slot flags Replaces instances of non-bitfield slot flags with the proper bitfield instead. * Update brain_item.dm
1 parent 4a152b3 commit e8f3906
Copy full SHA for e8f3906

203 files changed

+889-885Lines changed: 889 additions & 885 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎code/__DEFINES/inventory.dm‎

Copy file name to clipboardExpand all lines: code/__DEFINES/inventory.dm
+38-89Lines changed: 38 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -20,103 +20,52 @@
2020
#define STORAGE_VIEW_DEPTH 2
2121

2222
//ITEM INVENTORY SLOT BITMASKS
23-
#define ITEM_SLOT_OCLOTHING (1<<0)
24-
#define ITEM_SLOT_ICLOTHING (1<<1)
25-
#define ITEM_SLOT_GLOVES (1<<2)
26-
#define ITEM_SLOT_EYES (1<<3)
27-
#define ITEM_SLOT_EARS (1<<4)
28-
#define ITEM_SLOT_MASK (1<<5)
29-
#define ITEM_SLOT_HEAD (1<<6)
30-
#define ITEM_SLOT_FEET (1<<7)
31-
#define ITEM_SLOT_ID (1<<8)
32-
#define ITEM_SLOT_BELT (1<<9)
33-
#define ITEM_SLOT_BACK (1<<10)
23+
/// Suit slot (armors, costumes, space suits, etc.)
24+
#define ITEM_SLOT_OCLOTHING (1<<0)
25+
/// Jumpsuit slot
26+
#define ITEM_SLOT_ICLOTHING (1<<1)
27+
/// Glove slot
28+
#define ITEM_SLOT_GLOVES (1<<2)
29+
/// Glasses slot
30+
#define ITEM_SLOT_EYES (1<<3)
31+
/// Ear slot (radios, earmuffs)
32+
#define ITEM_SLOT_EARS (1<<4)
33+
/// Mask slot
34+
#define ITEM_SLOT_MASK (1<<5)
35+
/// Head slot (helmets, hats, etc.)
36+
#define ITEM_SLOT_HEAD (1<<6)
37+
/// Shoe slot
38+
#define ITEM_SLOT_FEET (1<<7)
39+
/// ID slot
40+
#define ITEM_SLOT_ID (1<<8)
41+
/// Belt slot
42+
#define ITEM_SLOT_BELT (1<<9)
43+
/// Back slot
44+
#define ITEM_SLOT_BACK (1<<10)
3445
/// Dextrous simplemob "hands" (used for Drones and Dextrous Guardians)
35-
#define ITEM_SLOT_DEX_STORAGE (1<<11)
36-
/// this is to allow items with a w_class of WEIGHT_CLASS_NORMAL or WEIGHT_CLASS_BULKY to fit in pockets.
37-
#define ITEM_SLOT_POCKET (1<<12)
38-
/// this is to deny items with a w_class of WEIGHT_CLASS_SMALL or WEIGHT_CLASS_TINY to fit in pockets.
39-
#define ITEM_SLOT_DENYPOCKET (1<<13)
40-
#define ITEM_SLOT_NECK (1<<14)
41-
#define ITEM_SLOT_HANDS (1<<15)
42-
#define ITEM_SLOT_BACKPACK (1<<16)
43-
/// Prevents items from being stored in suit storage
44-
#define ITEM_SLOT_DENY_S_STORE (1<<17)
46+
#define ITEM_SLOT_DEX_STORAGE (1<<11)
47+
/// Neck slot (ties, bedsheets, scarves)
48+
#define ITEM_SLOT_NECK (1<<12)
49+
/// A character's hand slots
50+
#define ITEM_SLOT_HANDS (1<<13)
51+
/// Inside of a character's backpack
52+
#define ITEM_SLOT_BACKPACK (1<<14)
4553
/// Suit Storage slot
46-
#define ITEM_SLOT_SUITSTORE (1<<18)
54+
#define ITEM_SLOT_SUITSTORE (1<<15)
4755
/// Left Pocket slot
48-
#define ITEM_SLOT_LPOCKET (1<<19)
56+
#define ITEM_SLOT_LPOCKET (1<<16)
4957
/// Right Pocket slot
50-
#define ITEM_SLOT_RPOCKET (1<<20)
58+
#define ITEM_SLOT_RPOCKET (1<<17)
5159
/// Handcuff slot
52-
#define ITEM_SLOT_HANDCUFFED (1<<21)
60+
#define ITEM_SLOT_HANDCUFFED (1<<18)
5361
/// Legcuff slot (bolas, beartraps)
54-
#define ITEM_SLOT_LEGCUFFED (1<<22)
62+
#define ITEM_SLOT_LEGCUFFED (1<<19)
5563

64+
/// Total amount of slots
65+
#define SLOTS_AMT 20 // Keep this up to date!
5666

57-
//SLOTS
58-
#define SLOT_BACK 1
59-
#define SLOT_WEAR_MASK 2
60-
#define SLOT_HANDCUFFED 3
61-
/// wherever you provide a slot for hands you provide SLOT_HANDS.
62-
/// SLOT_HANDS as a slot will pick ANY available hand
63-
#define SLOT_HANDS 4
64-
#define SLOT_BELT 5
65-
#define SLOT_WEAR_ID 6
66-
#define SLOT_EARS 7
67-
#define SLOT_GLASSES 8
68-
#define SLOT_GLOVES 9
69-
#define SLOT_NECK 10
70-
#define SLOT_HEAD 11
71-
#define SLOT_SHOES 12
72-
#define SLOT_WEAR_SUIT 13
73-
#define SLOT_W_UNIFORM 14
74-
#define SLOT_L_STORE 15
75-
#define SLOT_R_STORE 16
76-
#define SLOT_SUIT_STORE 17
77-
#define SLOT_IN_BACKPACK 18
78-
#define SLOT_LEGCUFFED 19
79-
#define SLOT_GENERC_DEXTROUS_STORAGE 20
80-
81-
#define SLOTS_AMT 20 // Keep this up to date!
82-
83-
//I hate that this has to exist
84-
/proc/slotdefine2slotbit(slotdefine) //Keep this up to date with the value of SLOT BITMASKS and SLOTS (the two define sections above)
85-
. = 0
86-
switch(slotdefine)
87-
if(SLOT_BACK)
88-
. = ITEM_SLOT_BACK
89-
if(SLOT_WEAR_MASK)
90-
. = ITEM_SLOT_MASK
91-
if(SLOT_NECK)
92-
. = ITEM_SLOT_NECK
93-
if(SLOT_BELT)
94-
. = ITEM_SLOT_BELT
95-
if(SLOT_WEAR_ID)
96-
. = ITEM_SLOT_ID
97-
if(SLOT_EARS)
98-
. = ITEM_SLOT_EARS
99-
if(SLOT_GLASSES)
100-
. = ITEM_SLOT_EYES
101-
if(SLOT_GLOVES)
102-
. = ITEM_SLOT_GLOVES
103-
if(SLOT_HEAD)
104-
. = ITEM_SLOT_HEAD
105-
if(SLOT_SHOES)
106-
. = ITEM_SLOT_FEET
107-
if(SLOT_WEAR_SUIT)
108-
. = ITEM_SLOT_OCLOTHING
109-
if(SLOT_W_UNIFORM)
110-
. = ITEM_SLOT_ICLOTHING
111-
if(SLOT_L_STORE, SLOT_R_STORE)
112-
. = ITEM_SLOT_POCKET
113-
if(SLOT_HANDS)
114-
. = ITEM_SLOT_HANDS
115-
if(SLOT_IN_BACKPACK)
116-
. = ITEM_SLOT_BACKPACK
117-
if(SLOT_SUIT_STORE)
118-
. = ITEM_SLOT_SUITSTORE
119-
67+
//SLOT GROUP HELPERS
68+
#define ITEM_SLOT_POCKETS (ITEM_SLOT_LPOCKET|ITEM_SLOT_RPOCKET)
12069

12170
//Bit flags for the flags_inv variable, which determine when a piece of clothing hides another. IE a helmet hiding glasses.
12271
//Make sure to update check_obscured_slots() if you add more.
Collapse file

‎code/__DEFINES/maths.dm‎

Copy file name to clipboardExpand all lines: code/__DEFINES/maths.dm
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113

114114
#define TORADIANS(degrees) ((degrees) * 0.0174532925)
115115

116+
/// Gets shift x that would be required the bitflag (1<<x)
117+
/// We need the round because log has floating-point inaccuracy, and if we undershoot at all on list indexing we'll get the wrong index.
118+
#define TOBITSHIFT(bit) ( round(log(2, bit), 1) )
119+
116120
// Will filter out extra rotations and negative rotations
117121
// E.g: 540 becomes 180. -180 becomes 180.
118122
#define SIMPLIFY_DEGREES(degrees) (MODULUS((degrees), 360))
Collapse file

‎code/__HELPERS/pronouns.dm‎

Copy file name to clipboardExpand all lines: code/__HELPERS/pronouns.dm
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,62 +203,62 @@
203203
/mob/living/carbon/human/p_they(capitalized, temp_gender)
204204
var/list/obscured = check_obscured_slots()
205205
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
206-
if((SLOT_W_UNIFORM in obscured) && skipface)
206+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
207207
temp_gender = PLURAL
208208
return ..()
209209

210210
/mob/living/carbon/human/p_their(capitalized, temp_gender)
211211
var/list/obscured = check_obscured_slots()
212212
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
213-
if((SLOT_W_UNIFORM in obscured) && skipface)
213+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
214214
temp_gender = PLURAL
215215
return ..()
216216

217217
/mob/living/carbon/human/p_them(capitalized, temp_gender)
218218
var/list/obscured = check_obscured_slots()
219219
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
220-
if((SLOT_W_UNIFORM in obscured) && skipface)
220+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
221221
temp_gender = PLURAL
222222
return ..()
223223

224224
/mob/living/carbon/human/p_have(temp_gender)
225225
var/list/obscured = check_obscured_slots()
226226
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
227-
if((SLOT_W_UNIFORM in obscured) && skipface)
227+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
228228
temp_gender = PLURAL
229229
return ..()
230230

231231
/mob/living/carbon/human/p_are(temp_gender)
232232
var/list/obscured = check_obscured_slots()
233233
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
234-
if((SLOT_W_UNIFORM in obscured) && skipface)
234+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
235235
temp_gender = PLURAL
236236
return ..()
237237

238238
/mob/living/carbon/human/p_were(temp_gender)
239239
var/list/obscured = check_obscured_slots()
240240
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
241-
if((SLOT_W_UNIFORM in obscured) && skipface)
241+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
242242
temp_gender = PLURAL
243243
return ..()
244244

245245
/mob/living/carbon/human/p_do(temp_gender)
246246
var/list/obscured = check_obscured_slots()
247247
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
248-
if((SLOT_W_UNIFORM in obscured) && skipface)
248+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
249249
temp_gender = PLURAL
250250
return ..()
251251

252252
/mob/living/carbon/human/p_s(temp_gender)
253253
var/list/obscured = check_obscured_slots()
254254
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
255-
if((SLOT_W_UNIFORM in obscured) && skipface)
255+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
256256
temp_gender = PLURAL
257257
return ..()
258258

259259
/mob/living/carbon/human/p_es(temp_gender)
260260
var/list/obscured = check_obscured_slots()
261261
var/skipface = (wear_mask && (wear_mask.flags_inv & HIDEFACE)) || (head && (head.flags_inv & HIDEFACE))
262-
if((SLOT_W_UNIFORM in obscured) && skipface)
262+
if((ITEM_SLOT_ICLOTHING in obscured) && skipface)
263263
temp_gender = PLURAL
264264
return ..()
Collapse file

‎code/__HELPERS/type2type.dm‎

Copy file name to clipboardExpand all lines: code/__HELPERS/type2type.dm
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,25 +412,25 @@
412412

413413
/proc/slot2body_zone(slot)
414414
switch(slot)
415-
if(SLOT_BACK, SLOT_WEAR_SUIT, SLOT_W_UNIFORM, SLOT_BELT, SLOT_WEAR_ID)
415+
if(ITEM_SLOT_BACK, ITEM_SLOT_OCLOTHING, ITEM_SLOT_ICLOTHING, ITEM_SLOT_BELT, ITEM_SLOT_ID)
416416
return BODY_ZONE_CHEST
417417

418-
if(SLOT_GLOVES, SLOT_HANDS, SLOT_HANDCUFFED)
418+
if(ITEM_SLOT_GLOVES, ITEM_SLOT_HANDS, ITEM_SLOT_HANDCUFFED)
419419
return pick(BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND)
420420

421-
if(SLOT_HEAD, SLOT_NECK, SLOT_NECK, SLOT_EARS)
421+
if(ITEM_SLOT_HEAD, ITEM_SLOT_NECK, ITEM_SLOT_NECK, ITEM_SLOT_EARS)
422422
return BODY_ZONE_HEAD
423423

424-
if(SLOT_WEAR_MASK)
424+
if(ITEM_SLOT_MASK)
425425
return BODY_ZONE_PRECISE_MOUTH
426426

427-
if(SLOT_GLASSES)
427+
if(ITEM_SLOT_EYES)
428428
return BODY_ZONE_PRECISE_EYES
429429

430-
if(SLOT_SHOES)
430+
if(ITEM_SLOT_FEET)
431431
return pick(BODY_ZONE_PRECISE_R_FOOT, BODY_ZONE_PRECISE_L_FOOT)
432432

433-
if(SLOT_LEGCUFFED)
433+
if(ITEM_SLOT_LEGCUFFED)
434434
return pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
435435

436436
//adapted from http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
Collapse file

‎code/_onclick/hud/alien.dm‎

Copy file name to clipboardExpand all lines: code/_onclick/hud/alien.dm
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
107107
if(inv.slot_id)
108108
inv.hud = src
109-
inv_slots[inv.slot_id] = inv
109+
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
110110
inv.update_icon()
111111

112112
/datum/hud/alien/persistent_inventory_update()
Collapse file

‎code/_onclick/hud/drones.dm‎

Copy file name to clipboardExpand all lines: code/_onclick/hud/drones.dm
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
inv_box.icon_state = "suit_storage"
99
// inv_box.icon_full = "template"
1010
inv_box.screen_loc = ui_drone_storage
11-
inv_box.slot_id = SLOT_GENERC_DEXTROUS_STORAGE
11+
inv_box.slot_id = ITEM_SLOT_DEX_STORAGE
1212
static_inventory += inv_box
1313

1414
inv_box = new /atom/movable/screen/inventory()
@@ -17,13 +17,13 @@
1717
inv_box.icon_state = "mask"
1818
// inv_box.icon_full = "template"
1919
inv_box.screen_loc = ui_drone_head
20-
inv_box.slot_id = SLOT_HEAD
20+
inv_box.slot_id = ITEM_SLOT_HEAD
2121
static_inventory += inv_box
2222

2323
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
2424
if(inv.slot_id)
2525
inv.hud = src
26-
inv_slots[inv.slot_id] = inv
26+
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
2727
inv.update_icon()
2828

2929

Collapse file

‎code/_onclick/hud/generic_dextrous.dm‎

Copy file name to clipboardExpand all lines: code/_onclick/hud/generic_dextrous.dm
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
5454
if(inv.slot_id)
5555
inv.hud = src
56-
inv_slots[inv.slot_id] = inv
56+
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
5757
inv.update_icon()
5858

5959
/datum/hud/dextrous/persistent_inventory_update()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.