Files
Bubberstation/code/datums/outfit.dm
T
coiax d27c64c3a8 Christmas code changes (#41763)
* Christmas code changes

🆑 coiax
add: Santa can now examine presents to see what's inside.
del: Santa no longer has a mass summon presents spell, because of his
new regenerating bag!
add: Santa's bag regenerates presents as long as Santa is holding it.
balance: You can only find one gift under a christmas tree per round, no
matter how many trees you search.
balance: Santa's teleport does not announce where he's going.
fix: Fixed Santa not having a full head and beard of white hair.
fix: Fixed Santa not being genetically white-haired.
fix: Fixed Concentrated Barber's Aid not growing extreme amounts of
hair.
/🆑

The `box` var has been moved down from `/datum/outfit/job` to
`/datum/outfit`.

Added unlimited christmas tree with presents, for testing.

Santa's restriction against opening presents is now done by
TRAIT_CANNOT_OPEN_PRESENTS. Santa's ability to see inside presents is
done by the TRAIT_PRESENT_VISION, which also determines if Santa's Bag
will regenerate presents every 30 to 60 seconds.

Santa no longer starts with a breath mask and O2 tank, but instead has
an internals box. Santa no longer has a no-access gold ID, he can
teleport from room to room!

Gifts determine what type is inside them on initialization, rather than
when unwrapped.

- Reasoning -

Unlike last year, there are various possible methods of accessing
christmas trees spawners, allowing for an unlimited number of anything
presents. Cutting down the presents to one per round regardless of tree
count will avoid this.

Santa should be able to see what he's giving, because then he can reward
the naughty and nice children with different gifts.

* Missed a merge

* Adds present investigate logs, and visible messages

* Use the body+mind checking of mob.has_trait

* Less globals, more static vars on types; also event renaming
2018-12-16 12:44:53 +13:00

167 lines
4.7 KiB
Plaintext
Executable File

/datum/outfit
var/name = "Naked"
var/uniform = null
var/suit = null
var/toggle_helmet = TRUE
var/back = null
var/belt = null
var/gloves = null
var/shoes = null
var/head = null
var/mask = null
var/neck = null
var/ears = null
var/glasses = null
var/id = null
var/l_pocket = null
var/r_pocket = null
var/suit_store = null
var/r_hand = null
var/l_hand = null
var/internals_slot = null //ID of slot containing a gas tank
var/list/backpack_contents = null // In the list(path=count,otherpath=count) format
var/box // Internals box. Will be inserted at the start of backpack_contents
var/list/implants = null
var/accessory = null
var/can_be_admin_equipped = TRUE // Set to FALSE if your outfit requires runtime parameters
var/list/chameleon_extras //extra types for chameleon outfit changes, mostly guns
/datum/outfit/proc/pre_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
//to be overridden for customization depending on client prefs,species etc
return
/datum/outfit/proc/post_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
//to be overridden for toggling internals, id binding, access etc
return
/datum/outfit/proc/equip(mob/living/carbon/human/H, visualsOnly = FALSE)
pre_equip(H, visualsOnly)
//Start with uniform,suit,backpack for additional slots
if(uniform)
H.equip_to_slot_or_del(new uniform(H),SLOT_W_UNIFORM)
if(suit)
H.equip_to_slot_or_del(new suit(H),SLOT_WEAR_SUIT)
if(back)
H.equip_to_slot_or_del(new back(H),SLOT_BACK)
if(belt)
H.equip_to_slot_or_del(new belt(H),SLOT_BELT)
if(gloves)
H.equip_to_slot_or_del(new gloves(H),SLOT_GLOVES)
if(shoes)
H.equip_to_slot_or_del(new shoes(H),SLOT_SHOES)
if(head)
H.equip_to_slot_or_del(new head(H),SLOT_HEAD)
if(mask)
H.equip_to_slot_or_del(new mask(H),SLOT_WEAR_MASK)
if(neck)
H.equip_to_slot_or_del(new neck(H),SLOT_NECK)
if(ears)
H.equip_to_slot_or_del(new ears(H),SLOT_EARS)
if(glasses)
H.equip_to_slot_or_del(new glasses(H),SLOT_GLASSES)
if(id)
H.equip_to_slot_or_del(new id(H),SLOT_WEAR_ID)
if(suit_store)
H.equip_to_slot_or_del(new suit_store(H),SLOT_S_STORE)
if(accessory)
var/obj/item/clothing/under/U = H.w_uniform
if(U)
U.attach_accessory(new accessory(H))
else
WARNING("Unable to equip accessory [accessory] in outfit [name]. No uniform present!")
if(l_hand)
H.put_in_l_hand(new l_hand(H))
if(r_hand)
H.put_in_r_hand(new r_hand(H))
if(!visualsOnly) // Items in pockets or backpack don't show up on mob's icon.
if(l_pocket)
H.equip_to_slot_or_del(new l_pocket(H),SLOT_L_STORE)
if(r_pocket)
H.equip_to_slot_or_del(new r_pocket(H),SLOT_R_STORE)
if(box)
if(!backpack_contents)
backpack_contents = list()
backpack_contents.Insert(1, box)
backpack_contents[box] = 1
if(backpack_contents)
for(var/path in backpack_contents)
var/number = backpack_contents[path]
if(!isnum(number))//Default to 1
number = 1
for(var/i in 1 to number)
H.equip_to_slot_or_del(new path(H),SLOT_IN_BACKPACK)
if(!H.head && toggle_helmet && istype(H.wear_suit, /obj/item/clothing/suit/space/hardsuit))
var/obj/item/clothing/suit/space/hardsuit/HS = H.wear_suit
HS.ToggleHelmet()
post_equip(H, visualsOnly)
if(!visualsOnly)
apply_fingerprints(H)
if(internals_slot)
H.internal = H.get_item_by_slot(internals_slot)
H.update_action_buttons_icon()
if(implants)
for(var/implant_type in implants)
var/obj/item/implant/I = new implant_type(H)
I.implant(H, null, TRUE)
H.update_body()
return TRUE
/datum/outfit/proc/apply_fingerprints(mob/living/carbon/human/H)
if(!istype(H))
return
if(H.back)
H.back.add_fingerprint(H,1) //The 1 sets a flag to ignore gloves
for(var/obj/item/I in H.back.contents)
I.add_fingerprint(H,1)
if(H.wear_id)
H.wear_id.add_fingerprint(H,1)
if(H.w_uniform)
H.w_uniform.add_fingerprint(H,1)
if(H.wear_suit)
H.wear_suit.add_fingerprint(H,1)
if(H.wear_mask)
H.wear_mask.add_fingerprint(H,1)
if(H.wear_neck)
H.wear_neck.add_fingerprint(H,1)
if(H.head)
H.head.add_fingerprint(H,1)
if(H.shoes)
H.shoes.add_fingerprint(H,1)
if(H.gloves)
H.gloves.add_fingerprint(H,1)
if(H.ears)
H.ears.add_fingerprint(H,1)
if(H.glasses)
H.glasses.add_fingerprint(H,1)
if(H.belt)
H.belt.add_fingerprint(H,1)
for(var/obj/item/I in H.belt.contents)
I.add_fingerprint(H,1)
if(H.s_store)
H.s_store.add_fingerprint(H,1)
if(H.l_store)
H.l_store.add_fingerprint(H,1)
if(H.r_store)
H.r_store.add_fingerprint(H,1)
for(var/obj/item/I in H.held_items)
I.add_fingerprint(H,1)
return 1
/datum/outfit/proc/get_chameleon_disguise_info()
var/list/types = list(uniform, suit, back, belt, gloves, shoes, head, mask, neck, ears, glasses, id, l_pocket, r_pocket, suit_store, r_hand, l_hand)
types += chameleon_extras
listclearnulls(types)
return types