forked from goonstation/goonstation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
barber_shop.dm
488 lines (430 loc) · 15.3 KB
/
barber_shop.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
#define HAIRCUT 1
#define SHAVE 2
// hairea options
#define BOTTOM_DETAIL 1
#define MIDDLE_DETAIL 2
#define TOP_DETAIL 3
#define ALL_HAIR 4
#define EYES 5
#define HAIR_1_FUCKED 1
#define HAIR_2_FUCKED 2
#define HAIR_3_FUCKED 4
#define EYES_FUCKED 8
/obj/item/clothing/head/wig
name = "toupée"
desc = "You can't tell the difference, Honest!"
icon_state= "wig"
wear_layer = MOB_HAIR_LAYER2 //it IS hair afterall
hat_offset_y = -15 // offsets for hattable component
hat_offset_x = 0
///Takes a list of style ids to colors and generates a wig from it
proc/setup_wig(var/style_list)
if (!style_list)
return
var/actuallyHasHair = FALSE
for (var/style_id in style_list)
if (style_id == "none")
continue
var/image/h_image = image('icons/mob/human_hair.dmi', style_id) // aloe TODO make these work with unlockable hair
h_image.color = style_list[style_id]
src.overlays += h_image
src.wear_image.overlays += h_image
actuallyHasHair = TRUE
if (!actuallyHasHair)
src.icon_state = "short"
///A type to allow you to spawn custom wigs from the map editor
/obj/item/clothing/head/wig/spawnable
icon = 'icons/mob/human_hair.dmi'
icon_state = "bald"
var/first_id = "none"
var/first_color = "#101010"
var/second_id = "none"
var/second_color = "#101010"
var/third_id = "none"
var/third_color = "#101010"
New()
..()
var/hair_list = list()
hair_list[first_id] = first_color
hair_list[second_id] = second_color
hair_list[third_id] = third_color
src.setup_wig(hair_list)
///Randomized wig for the cargo crate
/obj/item/clothing/head/wig/spawnable/random
New()
src.name = "wig"
var/list/possible_hairstyles
if (prob(50))
possible_hairstyles = pick(get_available_custom_style_types(filter_gender=FEMININE))
else
possible_hairstyles = pick(get_available_custom_style_types(filter_gender=MASCULINE))
var/datum/customization_style/hair_type
var/picked_color = rgb(rand(0,255),rand(0,255),rand(0,255))
hair_type = pick(possible_hairstyles)
first_id = initial(hair_type.id)
first_color = picked_color
if (prob(33))
hair_type = pick(possible_hairstyles)
second_id = initial(hair_type.id)
second_color = picked_color
..()
/obj/item/clothing/head/bald_cap
name = "bald cap"
desc = "You can't tell the difference, Honest!"
icon_state = "baldcap"
item_state = "baldcap"
seal_hair = 1
/obj/item/scissors
name = "scissors"
desc = "Used to cut hair. Make sure you aim at the head, where the hair is."
icon = 'icons/obj/barber_shop.dmi'
icon_state = "scissors"
flags = FPRINT | TABLEPASS | CONDUCT
object_flags = NO_GHOSTCRITTER
tool_flags = TOOL_SNIPPING
force = 8
health = 6
w_class = W_CLASS_TINY
hit_type = DAMAGE_STAB
hitsound = 'sound/impact_sounds/Flesh_Stab_1.ogg'
throwforce = 5
throw_speed = 3
throw_range = 5
m_amt = 10000
g_amt = 5000
New()
..()
src.setItemSpecial(/datum/item_special/double) // should be doable even in barbermode
AddComponent(/datum/component/barber/haircut)
AddComponent(/datum/component/toggle_tool_use)
BLOCK_SETUP(BLOCK_KNIFE)
attack(mob/target, mob/user, def_zone, is_special = FALSE, params = null)
if (src.remove_bandage(target, user))
return 1
if (snip_surgery(target, user))
return 1
..()
custom_suicide = 1
suicide(var/mob/user as mob)
if (!src.user_can_suicide(user))
return 0
user.visible_message(SPAN_ALERT("<b>[user] slashes [his_or_her(user)] own throat with [src]!</b>"))
blood_slash(user, 25)
user.TakeDamage("head", 150, 0)
SPAWN(50 SECONDS)
if (user && !isdead(user))
user.suiciding = 0
return 1
/obj/item/razor_blade
name = "razor blade"
desc = "Used to cut facial hair"
icon = 'icons/obj/barber_shop.dmi'
icon_state = "razorblade"
flags = FPRINT | TABLEPASS | CONDUCT
c_flags = ONBELT
object_flags = NO_GHOSTCRITTER
tool_flags = TOOL_CUTTING
force = 7
health = 6
w_class = W_CLASS_TINY
hit_type = DAMAGE_CUT
hitsound = 'sound/impact_sounds/Flesh_Cut_1.ogg'
throwforce = 5
throw_speed = 3
throw_range = 5
m_amt = 10000
g_amt = 5000
New()
..()
src.setItemSpecial(/datum/item_special/double) // should be doable even in barbermode
AddComponent(/datum/component/barber/shave)
AddComponent(/datum/component/toggle_tool_use)
BLOCK_SETUP(BLOCK_KNIFE)
attack(mob/target, mob/user, def_zone, is_special = FALSE, params = null)
if (scalpel_surgery(target, user))
return 1
..()
custom_suicide = 1
suicide(var/mob/user as mob)
if (!src.user_can_suicide(user))
return 0
user.visible_message(SPAN_ALERT("<b>[user] slashes [his_or_her(user)] own throat with [src]!</b>"))
blood_slash(user, 25)
user.TakeDamage("head", 150, 0)
SPAWN(50 SECONDS)
if (user && !isdead(user))
user.suiciding = 0
return 1
/obj/item/dye_bottle
name = "hair dye bottle"
desc = "Used to dye hair a different color. Seems to be made of tough, unshatterable plastic."
icon = 'icons/obj/barber_shop.dmi'
icon_state = "dye"
flags = FPRINT | TABLEPASS
//Default Colors
var/customization_first_color = "#FFFFFF"
var/uses_left
var/hair_group = ALL_HAIR
var/image/dye_image
New()
dye_image = image(src.icon, "dye_color", -1)
..()
attack(mob/target, mob/user, def_zone, is_special = FALSE, params = null)
if(dye_hair(target, user, src))
return
else // I dunno, hit them with it?
..()
attack_self(mob/user)
. = ..()
src.hair_group = hair_group >= 5 ? 1 : hair_group + 1
var/which_part
switch (hair_group)
if (BOTTOM_DETAIL)
which_part = "bottom group of hair"
if (MIDDLE_DETAIL)
which_part = "middle group of hair"
if (TOP_DETAIL)
which_part = "top group of hair"
if (ALL_HAIR)
which_part = "entire coiffure"
if (EYES)
which_part = "eyes"
boutput(user, SPAN_HINT("You change your grip on the [src] to one that'll aim for the recipient's [which_part]."))
/obj/item/reagent_containers/food/drinks/hairgrowth
name = "\improper EZ-Hairgrowth"
desc = "The #1 hair growth product on the market! WARNING: Some side effects may occur."
icon = 'icons/obj/barber_shop.dmi'
icon_state = "tonic1"
initial_volume = 50
New()
..()
reagents.add_reagent("hairgrownium", 40)
on_reagent_change()
..()
src.icon_state = "tonic[src.reagents.total_volume ? "1" : "0"]"
/obj/stool/barber_chair //there shouldn't be any of these, here in case there's a secret map that has one, replace with /obj/stool/chair/comfy/barber_chair if you see one
name = "You shouldn't see me!"
desc = "You shouldn't be looking at this thing!"
/obj/stool/chair/comfy/barber_chair
name = "barber chair"
desc = "A special chair designed for haircutting. You don't feel like any other chair would be good enough, it HAS to be one like this. You don't know why."
icon_state = "barberchair"
anchored = ANCHORED
arm_icon_state = "arm-barber"
parts_type = /obj/item/furniture_parts/barber_chair
/obj/barber_pole
name = "barber pole"
icon = 'icons/obj/barber_shop.dmi'
icon_state = "pole"
density = 1
anchored = ANCHORED
desc = "Barber poles historically were signage used to convey that the barber would perform services such as blood letting and other medical procedures, with the red representing blood, and the white representing the bandaging. In America, long after the time when blood-letting was offered, a third colour was added to bring it in line with the colours of their national flag. This one is in space."
/obj/item/dye_bottle/proc/dye_hair(mob/living/carbon/human/M as mob, mob/user as mob, obj/item/dye_bottle/bottle as obj)
if(!ishuman(M) || !user.mind) return 0
if(!istype(src, /obj/item/dye_bottle))
boutput(user, "Hi! The thing you're using is trying to dye someone's hair, despite it not being a thing that's supposed to do that!")
boutput(user, "Please call 1-800-CODER and tell us what's going on!")
return 0
if(src.uses_left <= 0)
boutput(user, SPAN_ALERT("\The [src] is empty!"))
return 0
if(!M?.organHolder?.head)
boutput(user, SPAN_ALERT("[M] has no head, and you're all out of stump dye!"))
return 0
else //if(istype(M.buckled, /obj/stool/chair/comfy/barber_chair))
var/mob/living/carbon/human/H = M
if(ishuman(M) && ((H.head && H.head.c_flags & COVERSEYES) || (H.wear_mask && H.wear_mask.c_flags & COVERSEYES)))
// you can't stab someone in the eyes wearing a mask! - please do not stab people in the eyes with a dye bottle tia
boutput(user, SPAN_HINT("You're going to need to remove that mask/helmet first."))
return 0
var/result_msg1 = "[user] dyes [M]'s hair."
var/result_msg2 = SPAN_NOTICE("You dye [M]'s hair.")
var/result_msg3 = SPAN_NOTICE("[user] dyes your hair.")
var/is_barber = user.mind.assigned_role == "Barber"
var/passed_dye_roll = 1
if(user.bioHolder.HasEffect("clumsy") && prob(40))
var/recolor_these_hair_layers_instead = 0
var/mob/living/carbon/human/famtofuckup = null
passed_dye_roll = 0
if(prob(33))
recolor_these_hair_layers_instead |= HAIR_1_FUCKED
if(prob(33))
recolor_these_hair_layers_instead |= HAIR_2_FUCKED
if(prob(33))
recolor_these_hair_layers_instead |= HAIR_3_FUCKED
if(prob(33))
recolor_these_hair_layers_instead |= EYES_FUCKED
if (ishuman(user) && prob(50)) // dye your own hair, idiot
user.visible_message("[user] slips and dumps the [src] onto [his_or_her(user)] own head!")
famtofuckup = user
else // dye their hair, idiot
user.visible_message("[user] slips and dumps the [src] all over [M]'s head!")
famtofuckup = M
if (recolor_these_hair_layers_instead & HAIR_1_FUCKED)
famtofuckup.bioHolder.mobAppearance.customization_first_color = bottle.customization_first_color
if (recolor_these_hair_layers_instead & HAIR_2_FUCKED)
famtofuckup.bioHolder.mobAppearance.customization_second_color = bottle.customization_first_color
if (recolor_these_hair_layers_instead & HAIR_3_FUCKED)
famtofuckup.bioHolder.mobAppearance.customization_third_color = bottle.customization_first_color
if (recolor_these_hair_layers_instead & EYES_FUCKED)
famtofuckup.bioHolder.mobAppearance.e_color = bottle.customization_first_color
famtofuckup.emote("scream")
boutput(user, "And now you're out of dye. Well done.")
src.uses_left = 0
src.ClearSpecificOverlays("dye_color")
if(passed_dye_roll)
switch(bottle.hair_group)
if(BOTTOM_DETAIL, MIDDLE_DETAIL, TOP_DETAIL)
if(!is_barber && prob(25))
boutput(M, "[SPAN_ALERT("Oh no, you dyed the wrong thing!")] Maybe they won't notice?")
bottle.hair_group = pick(list(BOTTOM_DETAIL, MIDDLE_DETAIL, TOP_DETAIL) - bottle.hair_group)
switch(bottle.hair_group)
if(BOTTOM_DETAIL)
M.bioHolder.mobAppearance.customization_first_color = bottle.customization_first_color
if(MIDDLE_DETAIL)
M.bioHolder.mobAppearance.customization_second_color = bottle.customization_first_color
if(TOP_DETAIL)
M.bioHolder.mobAppearance.customization_third_color = bottle.customization_first_color
if(ALL_HAIR)
if(src.uses_left < 3)
boutput(M, SPAN_NOTICE("This dyejob's going to need a full bottle!"))
return
else
M.bioHolder.mobAppearance.customization_first_color = bottle.customization_first_color
M.bioHolder.mobAppearance.customization_second_color = bottle.customization_first_color
M.bioHolder.mobAppearance.customization_third_color = bottle.customization_first_color
if(EYES)
M.bioHolder.mobAppearance.e_color = bottle.customization_first_color
result_msg1 ="[user] dumps the [src] into [M]'s eyes!"
result_msg2 =SPAN_NOTICE("You dump the [src] in [M]'s eyes.")
result_msg3 =SPAN_ALERT("[user] dumps the [src] into your eyes!")
if(user.mind.assigned_role == "Barber")
SPAWN(2 SECONDS)
boutput(M, "Huh, that actually didn't hurt that much. What a great [pick("barber", "stylist", "bangmangler")]!")
else
M.emote("scream", 0)
boutput(M, "[SPAN_ALERT("IT BURNS!")] But the pain fades quickly. Huh.")
user.tri_message(M, result_msg1,\
result_msg2,\
result_msg3)
if (bottle.hair_group == ALL_HAIR)
boutput(user, "That was a big dyejob! It used the whole bottle!")
src.uses_left = 0
src.ClearSpecificOverlays("dye_color")
else if(src.uses_left > 1 && is_barber && bottle.hair_group != ALL_HAIR)
src.uses_left --
boutput(user, "Hey, there's still some dye left in the bottle! Looks about [get_english_num(src.uses_left)] third\s full!")
else
boutput(user, "You used the whole bottle!")
src.uses_left = 0
src.ClearSpecificOverlays("dye_color")
M.update_colorful_parts()
return 1
//////////////////////////////
/////Dye Bottle Dispenser/////
//////////////////////////////
TYPEINFO(/obj/machinery/hair_dye_dispenser)
mats = 15
/obj/machinery/hair_dye_dispenser
name = "Hair Dye Mixer 3000"
desc = "Mixes hair dye for whatever color you want"
icon = 'icons/obj/barber_shop.dmi'
icon_state = "dyedispenser"
density = 1
anchored = ANCHORED
deconstruct_flags = DECON_SCREWDRIVER | DECON_WRENCH | DECON_CROWBAR | DECON_WELDER | DECON_MULTITOOL
var/obj/item/dye_bottle/bottle = null
New()
..()
UnsubscribeProcess()
ex_act(severity)
switch(severity)
if(1)
qdel(src)
return
if(2)
if (prob(50))
qdel(src)
return
blob_act(var/power)
if (prob(power * 1.25))
qdel(src)
meteorhit()
qdel(src)
return
process()
return
attack_ai(mob/user as mob)
return src.Attackhand(user)
ui_interact(mob/user, datum/tgui/ui)
ui = tgui_process.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "DyeDispenser", name)
ui.open()
ui_data(mob/user)
. = list()
.["bottle"] = !!src.bottle
.["uses_left"] = src.bottle?.uses_left
.["bottle_color"] = src.bottle?.customization_first_color
attack_hand(mob/user)
if(status & BROKEN)
return
ui_interact(user)
attackby(obj/item/I, mob/user as mob)
if(istype(I, /obj/item/dye_bottle))
insert_bottle(I, user)
tgui_process.update_uis(src)
return
..()
proc/insert_bottle(obj/item/dye_bottle/bottle, mob/user)
if(src.bottle)
boutput(user, SPAN_NOTICE("The dispenser already has a dye bottle in it."))
else
boutput(user, SPAN_NOTICE("You insert the dye bottle into the dispenser."))
if(bottle)
user.drop_item(bottle)
bottle.set_loc(src)
src.bottle = bottle
ui_act(action, params)
if(status & BROKEN)
return
if(usr.stat || usr.restrained())
return
if (isAI(usr))
boutput(usr, SPAN_ALERT("You are unable to dispense anything, since the controls are physical levers which don't go through any other kind of input."))
return
if ((usr.contents.Find(src) || ((BOUNDS_DIST(src, usr) == 0) && istype(src.loc, /turf))))
switch(action)
if ("eject")
if(src.bottle)
src.bottle.set_loc(src.loc)
usr.put_in_hand_or_eject(src.bottle) // try to eject it into the users hand, if we can
src.bottle = null
if("fillb")
if(src.bottle)
bottle.customization_first_color = params["selectedColor"]
bottle.uses_left = 3
bottle.dye_image.color = bottle.customization_first_color
bottle.UpdateOverlays(bottle.dye_image, "dye_color")
if("emptyb")
if(src.bottle)
bottle.uses_left = 0
bottle.customization_first_color = initial(bottle.customization_first_color)
bottle.ClearSpecificOverlays("dye_color")
if("insertb")
var/obj/item/I = usr.equipped()
if(istype(I, /obj/item/dye_bottle))
insert_bottle(I, usr)
. = TRUE
// Barber stuff
#undef BOTTOM_DETAIL
#undef MIDDLE_DETAIL
#undef TOP_DETAIL
#undef ALL_HAIR
#undef EYES
#undef HAIR_1_FUCKED
#undef HAIR_2_FUCKED
#undef HAIR_3_FUCKED
#undef EYES_FUCKED
#undef HAIRCUT
#undef SHAVE