forked from ParadiseSS13/Paradise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inventory.dm
868 lines (826 loc) · 32.4 KB
/
inventory.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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
/mob/living/carbon/human/verb/quick_equip()
set name = "quick-equip"
set hidden = 1
if(ishuman(src))
var/mob/living/carbon/human/H = src
var/obj/item/I = H.get_active_hand()
var/obj/item/weapon/storage/S = H.get_inactive_hand()
if(!I)
H << "<span class='notice'>You are not holding anything to equip.</span>"
return
if(istype(I, /obj/item/clothing/head/helmet/space/rig)) // If the item to be equipped is a rigid suit helmet
src << "\red You must fasten the helmet to a hardsuit first. (Target the head and use on a hardsuit)" // Stop eva helms equipping.
return 0
if(H.equip_to_appropriate_slot(I))
if(hand)
update_inv_l_hand(0)
else
update_inv_r_hand(0)
else if(s_active && s_active.can_be_inserted(I,1)) //if storage active insert there
s_active.handle_item_insertion(I)
else if(istype(S, /obj/item/weapon/storage) && S.can_be_inserted(I,1)) //see if we have box in other hand
S.handle_item_insertion(I)
else
S = H.get_item_by_slot(slot_belt)
if(istype(S, /obj/item/weapon/storage) && S.can_be_inserted(I,1)) //else we put in belt
S.handle_item_insertion(I)
else
S = H.get_item_by_slot(slot_back) //else we put in backpack
if(istype(S, /obj/item/weapon/storage) && S.can_be_inserted(I,1))
S.handle_item_insertion(I)
else
H << "\red You are unable to equip that."
/mob/living/carbon/human/proc/equip_in_one_of_slots(obj/item/W, list/slots, del_on_fail = 1)
for (var/slot in slots)
if (equip_to_slot_if_possible(W, slots[slot], del_on_fail = 0))
return slot
if (del_on_fail)
del(W)
return null
/mob/living/carbon/human/proc/is_in_hands(var/typepath)
if(istype(l_hand,typepath))
return l_hand
if(istype(r_hand,typepath))
return r_hand
return 0
/mob/living/carbon/human/proc/has_organ(name)
var/datum/organ/external/O = organs_by_name[name]
return (O && !(O.status & ORGAN_DESTROYED) )
/mob/living/carbon/human/proc/has_organ_for_slot(slot)
switch(slot)
if(slot_back)
return has_organ("chest")
if(slot_wear_mask)
return has_organ("head")
if(slot_handcuffed)
return has_organ("l_hand") && has_organ("r_hand")
if(slot_legcuffed)
return has_organ("l_leg") && has_organ("r_leg")
if(slot_l_hand)
return has_organ("l_hand")
if(slot_r_hand)
return has_organ("r_hand")
if(slot_belt)
return has_organ("chest")
if(slot_wear_id)
// the only relevant check for this is the uniform check
return 1
if(slot_wear_pda)
return 1
if(slot_l_ear)
return has_organ("head")
if(slot_r_ear)
return has_organ("head")
if(slot_glasses)
return has_organ("head")
if(slot_gloves)
return has_organ("l_hand") && has_organ("r_hand")
if(slot_head)
return has_organ("head")
if(slot_shoes)
return has_organ("r_foot") && has_organ("l_foot")
if(slot_wear_suit)
return has_organ("chest")
if(slot_w_uniform)
return has_organ("chest")
if(slot_l_store)
return has_organ("chest")
if(slot_r_store)
return has_organ("chest")
if(slot_s_store)
return has_organ("chest")
if(slot_in_backpack)
return 1
if(slot_tie)
return 1
/mob/living/carbon/human/unEquip(obj/item/I)
. = ..() //See mob.dm for an explanation on this and some rage about people copypasting instead of calling ..() like they should.
if(!. || !I)
return
if(I == wear_suit)
if(s_store)
unEquip(s_store, 1) //It makes no sense for your suit storage to stay on you if you drop your suit.
wear_suit = null
if(I.flags_inv & HIDEJUMPSUIT)
update_inv_w_uniform()
update_inv_wear_suit(0)
else if(I == w_uniform)
if(r_store)
unEquip(r_store, 1) //Again, makes sense for pockets to drop.
if(l_store)
unEquip(l_store, 1)
if(wear_id)
unEquip(wear_id)
if(belt)
unEquip(belt)
w_uniform = null
update_inv_w_uniform(0)
else if(I == gloves)
gloves = null
update_inv_gloves(0)
else if(I == glasses)
glasses = null
update_inv_glasses(0)
else if(I == head)
head = null
if(I.flags & BLOCKHAIR)
update_hair(0) //rebuild hair
update_inv_head(0)
else if(I == r_ear)
r_ear = null
update_inv_ears(0)
else if (I == l_ear)
l_ear = null
update_inv_ears(0)
else if(I == shoes)
shoes = null
update_inv_shoes(0)
else if(I == belt)
belt = null
update_inv_belt(0)
else if(I == wear_mask)
wear_mask = null
if(I.flags & BLOCKHAIR)
update_hair(0) //rebuild hair
if(internal)
if(internals)
internals.icon_state = "internal0"
internal = null
update_inv_wear_mask(0)
else if(I == wear_id)
wear_id = null
update_inv_wear_id(0)
else if(I == r_store)
r_store = null
update_inv_pockets(0)
else if(I == l_store)
l_store = null
update_inv_pockets(0)
else if(I == s_store)
s_store = null
update_inv_s_store(0)
update_action_buttons()
//This is an UNSAFE proc. Use mob_can_equip() before calling this one! Or rather use equip_to_slot_if_possible() or advanced_equip_to_slot_if_possible()
//set redraw_mob to 0 if you don't wish the hud to be updated - if you're doing it manually in your own proc.
/mob/living/carbon/human/equip_to_slot(obj/item/W as obj, slot, redraw_mob = 1)
if(!slot) return
if(!istype(W)) return
if(!has_organ_for_slot(slot)) return
if(W == src.l_hand)
src.l_hand = null
update_inv_l_hand() //So items actually disappear from hands.
else if(W == src.r_hand)
src.r_hand = null
update_inv_r_hand()
W.loc = src
switch(slot)
if(slot_back)
src.back = W
W.equipped(src, slot)
update_inv_back(redraw_mob)
if(slot_wear_mask)
src.wear_mask = W
if((wear_mask.flags & BLOCKHAIR) || (wear_mask.flags & BLOCKHEADHAIR))
update_hair(redraw_mob) //rebuild hair
W.equipped(src, slot)
update_inv_wear_mask(redraw_mob)
if(slot_handcuffed)
src.handcuffed = W
update_inv_handcuffed(redraw_mob)
if(slot_legcuffed)
src.legcuffed = W
W.equipped(src, slot)
update_inv_legcuffed(redraw_mob)
if(slot_l_hand)
src.l_hand = W
W.equipped(src, slot)
update_inv_l_hand(redraw_mob)
if(slot_r_hand)
src.r_hand = W
W.equipped(src, slot)
update_inv_r_hand(redraw_mob)
if(slot_belt)
src.belt = W
W.equipped(src, slot)
update_inv_belt(redraw_mob)
if(slot_wear_id)
src.wear_id = W
W.equipped(src, slot)
update_inv_wear_id(redraw_mob)
if(slot_wear_pda)
src.wear_pda = W
W.equipped(src, slot)
update_inv_wear_pda(redraw_mob)
if(slot_l_ear)
src.l_ear = W
if(l_ear.slot_flags & SLOT_TWOEARS)
var/obj/item/clothing/ears/offear/O = new(W)
O.loc = src
src.r_ear = O
O.layer = 20
W.equipped(src, slot)
update_inv_ears(redraw_mob)
if(slot_r_ear)
src.r_ear = W
if(r_ear.slot_flags & SLOT_TWOEARS)
var/obj/item/clothing/ears/offear/O = new(W)
O.loc = src
src.l_ear = O
O.layer = 20
W.equipped(src, slot)
update_inv_ears(redraw_mob)
if(slot_glasses)
src.glasses = W
W.equipped(src, slot)
update_inv_glasses(redraw_mob)
if(slot_gloves)
src.gloves = W
W.equipped(src, slot)
update_inv_gloves(redraw_mob)
if(slot_head)
src.head = W
if((head.flags & BLOCKHAIR) || (head.flags & BLOCKHEADHAIR))
update_hair(redraw_mob) //rebuild hair
if(istype(W,/obj/item/clothing/head/kitty))
W.update_icon(src)
W.equipped(src, slot)
update_inv_head(redraw_mob)
if(slot_shoes)
src.shoes = W
W.equipped(src, slot)
update_inv_shoes(redraw_mob)
if(slot_wear_suit)
src.wear_suit = W
W.equipped(src, slot)
update_inv_wear_suit(redraw_mob)
if(slot_w_uniform)
src.w_uniform = W
W.equipped(src, slot)
update_inv_w_uniform(redraw_mob)
if(slot_l_store)
src.l_store = W
W.equipped(src, slot)
update_inv_pockets(redraw_mob)
if(slot_r_store)
src.r_store = W
W.equipped(src, slot)
update_inv_pockets(redraw_mob)
if(slot_s_store)
src.s_store = W
W.equipped(src, slot)
update_inv_s_store(redraw_mob)
if(slot_in_backpack)
if(src.get_active_hand() == W)
src.unEquip(W)
W.loc = src.back
if(slot_tie)
var/obj/item/clothing/under/uniform = src.w_uniform
uniform.attackby(W,src)
else
src << "<span class='warning'>You are trying to equip this item to an unsupported inventory slot. Report this to a coder!</span>"
return
W.layer = 20
return
/mob/living/carbon/human/put_in_hands(obj/item/W)
if(!W) return 0
if(put_in_active_hand(W)) return 1
else if(put_in_inactive_hand(W)) return 1
else
..()
/obj/effect/equip_e
name = "equip e"
var/mob/source = null
var/s_loc = null //source location
var/t_loc = null //target location
var/obj/item/item = null
var/place = null
var/pickpocket = null
/obj/effect/equip_e/human
name = "human"
var/mob/living/carbon/human/target = null
/obj/effect/equip_e/monkey
name = "monkey"
var/mob/living/carbon/monkey/target = null
/obj/effect/equip_e/process()
return
/obj/effect/equip_e/proc/done()
return
/obj/effect/equip_e/New()
if (!ticker)
del(src)
spawn(100)
del(src)
..()
return
/obj/effect/equip_e/human/process()
if (item)
item.add_fingerprint(source)
else
switch(place)
if("mask")
if (!( target.wear_mask ))
del(src)
if("l_hand")
if (!( target.l_hand ))
del(src)
if("r_hand")
if (!( target.r_hand ))
del(src)
if("suit")
if (!( target.wear_suit ))
del(src)
if("uniform")
if (!( target.w_uniform ))
del(src)
if("back")
if (!( target.back ))
del(src)
if("syringe")
return
if("pill")
return
if("fuel")
return
if("drink")
return
if("dnainjector")
return
if("handcuff")
if (!( target.handcuffed ))
del(src)
if("id")
if ((!( target.wear_id ) || !( target.w_uniform )))
del(src)
if("splints")
var/count = 0
for(var/organ in list("l_leg","r_leg","l_arm","r_arm"))
var/datum/organ/external/o = target.organs_by_name[organ]
if(o.status & ORGAN_SPLINTED)
count = 1
break
if(count == 0)
del(src)
return
if("internal")
if ((!( (istype(target.wear_mask, /obj/item/clothing/mask) && (istype(target.back, /obj/item/weapon/tank) || istype(target.belt, /obj/item/weapon/tank) || istype(target.s_store, /obj/item/weapon/tank)) && !( target.internal )) ) && !( target.internal )))
del(src)
var/message=null
if(target.frozen)
source << "\red Do not attempt to strip frozen people."
return
switch(place)
if("syringe")
message = "\red <B>[source] is trying to inject [target]!</B>"
if("pill")
message = "\red <B>[source] is trying to force [target] to swallow [item]!</B>"
if("drink")
message = "\red <B>[source] is trying to force [target] to swallow a gulp of [item]!</B>"
if("dnainjector")
message = "\red <B>[source] is trying to inject [target] with the [item]!</B>"
if("mask")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Had their mask removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) mask</font>")
if(target.wear_mask && (target.wear_mask.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.wear_mask] from [target]'s head!</B>"
return
else if(target.wear_mask)
message = "\red <B>[source] is trying to take off \a [target.wear_mask] from [target]'s head!</B>"
if("l_hand")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their left hand item ([target.l_hand]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) left hand item ([target.l_hand])</font>")
message = "\red <B>[source] is trying to take off \a [target.l_hand] from [target]'s left hand!</B>"
if("r_hand")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their right hand item ([target.r_hand]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) right hand item ([target.r_hand])</font>")
message = "\red <B>[source] is trying to take off \a [target.r_hand] from [target]'s right hand!</B>"
if("gloves")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their gloves ([target.gloves]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) gloves ([target.gloves])</font>")
if(target.gloves && (target.gloves.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.gloves] from [target]'s hands!</B>"
return
else if(target.gloves)
message = "\red <B>[source] is trying to take off the [target.gloves] from [target]'s hands!</B>"
if("eyes")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their eyewear ([target.glasses]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) eyewear ([target.glasses])</font>")
if(target.glasses && (target.glasses.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.glasses] from [target]'s eyes!</B>"
return
else if(target.glasses)
message = "\red <B>[source] is trying to take off the [target.glasses] from [target]'s eyes!</B>"
if("l_ear")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their left ear item ([target.l_ear]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) left ear item ([target.l_ear])</font>")
if(target.l_ear && (target.l_ear.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.l_ear] from [target]'s left ear!</B>"
return
else if(target.l_ear)
message = "\red <B>[source] is trying to take off the [target.l_ear] from [target]'s left ear!</B>"
if("r_ear")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their right ear item ([target.r_ear]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) right ear item ([target.r_ear])</font>")
if(target.r_ear && (target.r_ear.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.r_ear] from [target]'s right ear!</B>"
return
else if(target.r_ear)
message = "\red <B>[source] is trying to take off the [target.r_ear] from [target]'s right ear!</B>"
if("head")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their hat ([target.head]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) hat ([target.head])</font>")
if(target.head && (target.head.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.head] from [target]'s head!</B>"
return
else if(target.head)
message = "\red <B>[source] is trying to take off the [target.head] from [target]'s head!</B>"
if("shoes")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their shoes ([target.shoes]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) shoes ([target.shoes])</font>")
if(target.shoes && (target.shoes.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.shoes] from [target]'s feet!</B>"
return
else if(target.shoes)
message = "\red <B>[source] is trying to take off [target.shoes] from [target]'s feet!</B>"
if("belt")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their belt item ([target.belt]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) belt item ([target.belt])</font>")
if(!pickpocket && target.belt)
message = "\red <B>[source] is trying to take off \a [target.belt] from [target]'s belt!</B>"
if("suit")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their suit ([target.wear_suit]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) suit ([target.wear_suit])</font>")
if(target.wear_suit && (target.wear_suit.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.wear_suit] from [target]'s body!</B>"
return
else if(target.wear_suit)
message = "\red <B>[source] is trying to take off \a [target.wear_suit] from [target]'s body!</B>"
if("back")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their back item ([target.back]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) back item ([target.back])</font>")
message = "\red <B>[source] is trying to take off \a [target.back] from [target]'s back!</B>"
if("handcuff")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Was unhandcuffed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to unhandcuff [target.name]'s ([target.ckey])</font>")
if(target.handcuffed)
message = "\red <B>[source] is trying to unhandcuff [target]!</B>"
if("legcuff")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Was unlegcuffed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to unlegcuff [target.name]'s ([target.ckey])</font>")
if(target.legcuffed)
message = "\red <B>[source] is trying to unlegcuff [target]!</B>"
else
message = "\red <B>[source] is trying to legcuff [target]!</B>"
if("uniform")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their uniform ([target.w_uniform]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) uniform ([target.w_uniform])</font>")
for(var/obj/item/I in list(target.l_store, target.r_store))
if(I.on_found(source))
return
if(target.w_uniform && (target.w_uniform.flags & NODROP))
message = "\red <B>[source] fails to take off \a [target.w_uniform] from [target]'s body!</B>"
return
else
message = "\red <B>[source] is trying to take off \a [target.w_uniform] from [target]'s body!</B>"
if("tie")
var/obj/item/clothing/under/suit = target.w_uniform
if(suit.accessories.len)
var/obj/item/clothing/accessory/A = suit.accessories[1]
target.attack_log += "\[[time_stamp()]\] <font color='orange'>Has had their accessory ([A]) removed by [source.name] ([source.ckey])</font>"
source.attack_log += "\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) accessory ([A])</font>"
if(istype(A, /obj/item/clothing/accessory/holobadge) || istype(A, /obj/item/clothing/accessory/medal))
for(var/mob/M in viewers(target, null))
M.show_message("\red <B>[source] tears off \the [A] from [target]'s [suit]!</B>" , 1)
done()
return
else
message = "\red <B>[source] is trying to take off \a [A] from [target]'s [suit]!</B>"
if("s_store")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their suit storage item ([target.s_store]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) suit storage item ([target.s_store])</font>")
message = "\red <B>[source] is trying to take off \a [target.s_store] from [target]'s suit!</B>"
if("pockets")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their pockets emptied by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to empty [target.name]'s ([target.ckey]) pockets</font>")
for(var/obj/item/I in list(target.l_store, target.r_store))
if(I.on_found(source))
return
message = "\red <B>[source] is trying to empty [target]'s pockets!</B>"
if("CPR")
if (!target.cpr_time)
del(src)
target.cpr_time = 0
message = "\red <B>[source] is trying perform CPR on [target]!</B>"
if("id")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their ID ([target.wear_id]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) ID ([target.wear_id])</font>")
if(!pickpocket)
message = "\red <B>[source] is trying to take off [target.wear_id] from [target]'s uniform!</B>"
else
source << "\blue You try to take off [target.wear_id] from [target]'s uniform!"
if("pda")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their PDA ([target.wear_pda]) removed by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to remove [target.name]'s ([target.ckey]) PDA ([target.wear_pda])</font>")
message = "\red <B>[source] is trying to take off [target.wear_pda] from [target]'s uniform!</B>"
if("internal")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their internals toggled by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to toggle [target.name]'s ([target.ckey]) internals</font>")
if (target.internal)
message = "\red <B>[source] is trying to remove [target]'s internals!</B>"
else
message = "\red <B>[source] is trying to set on [target]'s internals.</B>"
if("splints")
message = "\red <B>[source] is trying to remove [target]'s splints!</B>"
if("sensor")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had their sensors toggled by [source.name] ([source.ckey])</font>")
source.attack_log += text("\[[time_stamp()]\] <font color='red'>Attempted to toggle [target.name]'s ([target.ckey]) sensors</font>")
var/obj/item/clothing/under/suit = target.w_uniform
if (suit.has_sensor >= 2)
source << "The controls are locked."
return
message = "\red <B>[source] is trying to set [target]'s suit sensors!</B>"
for(var/mob/M in viewers(target, null))
if(findtext(message, "is trying to take off from", 1, 0) > 0 || message == null)
message = "\red <B>[source] is trying to put \a [item] on [target]!</B>"
if(findtext(message, "is trying to put on", 1, 0) > 0)
return
else
M.show_message(message, 1)
else
M.show_message(message, 1)
spawn( HUMAN_STRIP_DELAY )
done()
return
return
/*
This proc equips stuff (or does something else) when removing stuff manually from the character window when you click and drag.
It works in conjuction with the process() above.
This proc works for humans only. Aliens stripping humans and the like will all use this proc. Stripping monkeys or somesuch will use their version of this proc.
The first if statement for "mask" and such refers to items that are already equipped and un-equipping them.
The else statement is for equipping stuff to empty slots.
The NODROP flag refers to variable of /obj/item/clothing which either allows or disallows that item to be removed.
It can still be worn/put on as normal.
*/
/obj/effect/equip_e/human/done() //TODO: And rewrite this :< ~Carn
target.cpr_time = 1
if(isanimal(source)) return //animals cannot strip people
if(!source || !target) return //Target or source no longer exist
if(source.loc != s_loc) return //source has moved
if(target.loc != t_loc) return //target has moved
if (LinkBlockedUnclimbable(t_loc, s_loc)) return
if(item && source.get_active_hand() != item) return //Swapped hands / removed item from the active one
if ((source.restrained() || source.stat)) return //Source restrained or unconscious / dead
if(target.frozen)
source << "\red Do not attempt to strip frozen people."
return
var/slot_to_process
var/strip_item //this will tell us which item we will be stripping - if any.
switch(place) //here we go again...
if("mask")
slot_to_process = slot_wear_mask
if (target.wear_mask && !(target.wear_mask.flags & NODROP))
strip_item = target.wear_mask
if("gloves")
slot_to_process = slot_gloves
if (target.gloves && !(target.gloves.flags & NODROP))
strip_item = target.gloves
if("eyes")
slot_to_process = slot_glasses
if (target.glasses)
strip_item = target.glasses
if("belt")
slot_to_process = slot_belt
if (target.belt)
strip_item = target.belt
if("s_store")
slot_to_process = slot_s_store
if (target.s_store)
strip_item = target.s_store
if("head")
slot_to_process = slot_head
if (target.head && !(target.head.flags & NODROP))
strip_item = target.head
if("l_ear")
slot_to_process = slot_l_ear
if (target.l_ear)
strip_item = target.l_ear
if("r_ear")
slot_to_process = slot_r_ear
if (target.r_ear)
strip_item = target.r_ear
if("shoes")
slot_to_process = slot_shoes
if (target.shoes && !(target.shoes.flags & NODROP))
strip_item = target.shoes
if("l_hand")
if (istype(target, /obj/item/clothing/suit/straight_jacket))
del(src)
slot_to_process = slot_l_hand
if (target.l_hand)
strip_item = target.l_hand
if("r_hand")
if (istype(target, /obj/item/clothing/suit/straight_jacket))
del(src)
slot_to_process = slot_r_hand
if (target.r_hand)
strip_item = target.r_hand
if("uniform")
slot_to_process = slot_w_uniform
if(target.w_uniform && !(target.w_uniform.flags & NODROP))
strip_item = target.w_uniform
if("suit")
slot_to_process = slot_wear_suit
if (target.wear_suit && !(target.wear_suit.flags & NODROP))
strip_item = target.wear_suit
if("tie")
var/obj/item/clothing/under/suit = target.w_uniform
//var/obj/item/clothing/accessory/tie = suit.hastie
/*if(tie)
if (istype(tie,/obj/item/clothing/accessory/storage))
var/obj/item/clothing/accessory/storage/W = tie
if (W.hold)
W.hold.close(usr)
usr.put_in_hands(tie)
suit.hastie = null*/
if(suit && suit.accessories.len)
var/obj/item/clothing/accessory/A = suit.accessories[1]
A.on_removed(usr)
suit.accessories -= A
target.update_inv_w_uniform()
if("id")
slot_to_process = slot_wear_id
if (target.wear_id)
strip_item = target.wear_id
if("pda")
slot_to_process = slot_wear_pda
if (target.wear_pda)
strip_item = target.wear_pda
if("back")
slot_to_process = slot_back
if (target.back)
strip_item = target.back
if("handcuff")
slot_to_process = slot_handcuffed
if (target.handcuffed)
strip_item = target.handcuffed
if("legcuff")
slot_to_process = slot_legcuffed
if (target.legcuffed)
strip_item = target.legcuffed
if("splints")
for(var/organ in list("l_leg","r_leg","l_arm","r_arm"))
var/datum/organ/external/o = target.get_organ(organ)
if (o && o.status & ORGAN_SPLINTED)
var/obj/item/W = new /obj/item/stack/medical/splint/single()
o.status &= ~ORGAN_SPLINTED
if (W)
W.loc = target.loc
W.layer = initial(W.layer)
W.add_fingerprint(source)
if("CPR")
if ((target.health > config.health_threshold_dead && target.health < config.health_threshold_crit))
var/suff = min(target.getOxyLoss(), 7)
target.adjustOxyLoss(-suff)
target.updatehealth()
for(var/mob/O in viewers(source, null))
O.show_message("\red [source] performs CPR on [target]!", 1)
target << "\blue <b>You feel a breath of fresh air enter your lungs. It feels good.</b>"
source << "\red Repeat at least every 7 seconds."
if("dnainjector")
var/obj/item/weapon/dnainjector/S = item
if(S)
S.add_fingerprint(source)
if (!( istype(S, /obj/item/weapon/dnainjector) ))
S.inuse = 0
del(src)
S.inject(target, source)
if (S.s_time >= world.time + 30)
S.inuse = 0
del(src)
S.s_time = world.time
for(var/mob/O in viewers(source, null))
O.show_message("\red [source] injects [target] with the DNA Injector!", 1)
S.inuse = 0
if("pockets")
slot_to_process = slot_l_store
strip_item = target.l_store //We'll do both
if("sensor")
var/obj/item/clothing/under/suit = target.w_uniform
if (suit)
if(suit.has_sensor >= 2)
source << "The controls are locked."
else
suit.set_sensors(source)
if("internal")
if (target.internal)
target.internal.add_fingerprint(source)
target.internal = null
if (target.internals)
target.internals.icon_state = "internal0"
else
if (!( istype(target.wear_mask, /obj/item/clothing/mask) ))
return
else
if (istype(target.back, /obj/item/weapon/tank))
target.internal = target.back
else if (istype(target.s_store, /obj/item/weapon/tank))
target.internal = target.s_store
else if (istype(target.belt, /obj/item/weapon/tank))
target.internal = target.belt
if (target.internal)
for(var/mob/M in viewers(target, 1))
M.show_message("[target] is now running on internals.", 1)
target.internal.add_fingerprint(source)
if (target.internals)
target.internals.icon_state = "internal1"
if(slot_to_process)
if(strip_item) //Stripping an item from the mob
var/obj/item/W = strip_item
if((W.flags & NODROP) || (W.flags & ABSTRACT)) //Just to be sure
return
target.unEquip(W)
if (target.client)
target.client.screen -= W
if (W)
W.loc = target.loc
W.layer = initial(W.layer)
W.dropped(target)
W.add_fingerprint(source)
if(slot_to_process == slot_l_store) //pockets! Needs to process the other one too. Snowflake code, wooo! It's not like anyone will rewrite this anytime soon. If I'm wrong then... CONGRATULATIONS! ;)
if(target.r_store)
target.unEquip(target.r_store) //At this stage l_store is already processed by the code above, we only need to process r_store.
else
if(item && target.has_organ_for_slot(slot_to_process)) //Placing an item on the mob
if(item.mob_can_equip(target, slot_to_process, 0))
source.unEquip(item)
target.equip_to_slot_if_possible(item, slot_to_process, 0, 1, 1)
item.dropped(source)
source.update_icons()
target.update_icons()
if(source && target)
if(source.machine == target)
target.show_inv(source)
del(src)
/mob/proc/get_item_by_slot(slot_id)
switch(slot_id)
if(slot_l_hand)
return l_hand
if(slot_r_hand)
return r_hand
return null
/mob/living/carbon/get_item_by_slot(slot_id)
switch(slot_id)
if(slot_back)
return back
if(slot_wear_mask)
return wear_mask
if(slot_handcuffed)
return handcuffed
if(slot_legcuffed)
return legcuffed
if(slot_l_hand)
return l_hand
if(slot_r_hand)
return r_hand
return null
// Return the item currently in the slot ID
/mob/living/carbon/human/get_item_by_slot(slot_id)
switch(slot_id)
if(slot_back)
return back
if(slot_wear_mask)
return wear_mask
if(slot_handcuffed)
return handcuffed
if(slot_legcuffed)
return legcuffed
if(slot_l_hand)
return l_hand
if(slot_r_hand)
return r_hand
if(slot_belt)
return belt
if(slot_wear_id)
return wear_id
if(slot_l_ear)
return l_ear
if(slot_r_ear)
return r_ear
if(slot_glasses)
return glasses
if(slot_gloves)
return gloves
if(slot_head)
return head
if(slot_shoes)
return shoes
if(slot_wear_suit)
return wear_suit
if(slot_w_uniform)
return w_uniform
if(slot_l_store)
return l_store
if(slot_r_store)
return r_store
if(slot_s_store)
return s_store
return null