mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
Merge pull request #17293 from RemieRichards/clothing_variable_modding
Allows clothing to alter variables on the wearer, Admin modifiable too!
This commit is contained in:
+44
-13
@@ -13,19 +13,7 @@
|
||||
#define SLOT_POCKET 2048 //this is to allow items with a w_class of 3 or 4 to fit in pockets.
|
||||
#define SLOT_DENYPOCKET 4096 //this is to deny items with a w_class of 2 or 1 to fit in pockets.
|
||||
|
||||
//Bit flags for the flags_inv variable, which determine when a piece of clothing hides another. IE a helmet hiding glasses.
|
||||
#define HIDEGLOVES 1
|
||||
#define HIDESUITSTORAGE 2
|
||||
#define HIDEJUMPSUIT 4 //these first four are only used in exterior suits
|
||||
#define HIDESHOES 8
|
||||
#define HIDEMASK 16 //these last six are only used in masks and headgear.
|
||||
#define HIDEEARS 32 // (ears means headsets and such)
|
||||
#define HIDEEYES 64 // Whether eyes and glasses are hidden
|
||||
#define HIDEFACE 128 // Whether we appear as unknown.
|
||||
#define HIDEHAIR 256
|
||||
#define HIDEFACIALHAIR 512
|
||||
|
||||
//slots
|
||||
//SLOTS
|
||||
#define slot_back 1
|
||||
#define slot_wear_mask 2
|
||||
#define slot_handcuffed 3
|
||||
@@ -49,6 +37,49 @@
|
||||
|
||||
#define slots_amt 20 // Keep this up to date!
|
||||
|
||||
//I hate that this has to exist
|
||||
/proc/slotdefine2slotbit(slotdefine) //Keep this up to date with the value of SLOT BITMASKS and SLOTS (the two define sections above)
|
||||
. = 0
|
||||
switch(slotdefine)
|
||||
if(slot_back)
|
||||
. = SLOT_BACK
|
||||
if(slot_wear_mask)
|
||||
. = SLOT_MASK
|
||||
if(slot_belt)
|
||||
. = SLOT_BELT
|
||||
if(slot_wear_id)
|
||||
. = SLOT_ID
|
||||
if(slot_ears)
|
||||
. = SLOT_EARS
|
||||
if(slot_glasses)
|
||||
. = SLOT_EYES
|
||||
if(slot_gloves)
|
||||
. = SLOT_GLOVES
|
||||
if(slot_head)
|
||||
. = SLOT_HEAD
|
||||
if(slot_shoes)
|
||||
. = SLOT_FEET
|
||||
if(slot_wear_suit)
|
||||
. = SLOT_OCLOTHING
|
||||
if(slot_w_uniform)
|
||||
. = SLOT_ICLOTHING
|
||||
if(slot_l_store, slot_r_store)
|
||||
. = SLOT_POCKET
|
||||
|
||||
|
||||
//Bit flags for the flags_inv variable, which determine when a piece of clothing hides another. IE a helmet hiding glasses.
|
||||
#define HIDEGLOVES 1
|
||||
#define HIDESUITSTORAGE 2
|
||||
#define HIDEJUMPSUIT 4 //these first four are only used in exterior suits
|
||||
#define HIDESHOES 8
|
||||
#define HIDEMASK 16 //these last six are only used in masks and headgear.
|
||||
#define HIDEEARS 32 // (ears means headsets and such)
|
||||
#define HIDEEYES 64 // Whether eyes and glasses are hidden
|
||||
#define HIDEFACE 128 // Whether we appear as unknown.
|
||||
#define HIDEHAIR 256
|
||||
#define HIDEFACIALHAIR 512
|
||||
|
||||
|
||||
//Cant seem to find a mob bitflags area other than the powers one
|
||||
|
||||
// bitflags for clothing parts - also used for limbs
|
||||
|
||||
@@ -19,6 +19,38 @@
|
||||
var/gang //Is this a gang outfit?
|
||||
var/scan_reagents = 0 //Can the wearer see reagents while it's equipped?
|
||||
|
||||
//Var modification - PLEASE be careful with this I know who you are and where you live
|
||||
var/list/user_vars_to_edit = list() //VARNAME = VARVALUE eg: "name" = "butts"
|
||||
var/list/user_vars_remembered = list() //Auto built by the above + dropped() + equipped()
|
||||
|
||||
|
||||
/obj/item/clothing/Destroy()
|
||||
dropped()
|
||||
user_vars_remembered = null //Oh god somebody put REFERENCES in here? not to worry, we'll clean it up
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/clothing/dropped(mob/user)
|
||||
..()
|
||||
if(user_vars_remembered && user_vars_remembered.len)
|
||||
for(var/variable in user_vars_remembered)
|
||||
if(variable in user.vars)
|
||||
if(user.vars[variable] == user_vars_to_edit[variable]) //Is it still what we set it to? (if not we best not change it)
|
||||
user.vars[variable] = user_vars_remembered[variable]
|
||||
user_vars_remembered = list()
|
||||
|
||||
|
||||
/obj/item/clothing/equipped(mob/user, slot)
|
||||
..()
|
||||
|
||||
if(slot_flags & slotdefine2slotbit(slot)) //Was equipped to a valid slot for this item?
|
||||
for(var/variable in user_vars_to_edit)
|
||||
if(variable in user.vars)
|
||||
user_vars_remembered[variable] = user.vars[variable]
|
||||
user.vars[variable] = user_vars_to_edit[variable]
|
||||
|
||||
|
||||
|
||||
//Ears: currently only used for headsets and earmuffs
|
||||
/obj/item/clothing/ears
|
||||
name = "ears"
|
||||
|
||||
@@ -490,3 +490,10 @@
|
||||
|
||||
/obj/item/clothing/head/winterhood/miner
|
||||
icon_state = "winterhood_miner"
|
||||
|
||||
/obj/item/clothing/suit/spookyghost
|
||||
name = "spooky ghost"
|
||||
desc = "this is obviously just a bedsheet, but maybe try it on?"
|
||||
icon_state = "bedsheet"
|
||||
user_vars_to_edit = list("name" = "Spooky Ghost", "real_name" = "Spooky Ghost" , "incorporeal_move" = 1, "appearance_flags" = KEEP_TOGETHER|TILE_BOUND, "alpha" = 150)
|
||||
alternate_worn_layer = ABOVE_BODY_FRONT_LAYER //so the bedsheet goes over everything but fire
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Reference in New Issue
Block a user