-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathsmartfridge.dm
779 lines (676 loc) · 27.6 KB
/
smartfridge.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
// -------------------------
// Smartfridges
// -------------------------
/obj/machinery/smartfridge
name = "smartfridge"
desc = "Keeps cold things cold and hot things cold."
icon = 'icons/obj/smartfridge.dmi'
icon_state = "smartfridge"
layer = BELOW_OBJ_LAYER
density = TRUE
verb_say = "beeps"
verb_ask = "beeps"
verb_exclaim = "beeps"
max_integrity = 300
integrity_failure = 100
armor = list(MELEE = 20, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70)
use_power = IDLE_POWER_USE
idle_power_usage = 5
active_power_usage = 100
circuit = /obj/item/circuitboard/machine/smartfridge
/// Maximum number of items that can be loaded into the machine
var/max_n_of_items = 1000
var/allow_ai_retrieve = FALSE
/// List of items that the machine starts with upon spawn
var/list/initial_contents
/// Is this smartfridge going to have a glowing screen? (Drying Racks are not)
var/has_emissive = TRUE
/// the icon state for the "oh no, we're full" indicator light
var/full_indicator_state = "smartfridge-indicator"
/// the icon state for the dispensing animation
var/retrieval_state = "smartfridge-retrieve"
/// the length (in ticks) of the retrieval_state
var/retrieval_time = 19
/// whether or not the smartfridge supports a full inventory indicator icon state
var/supports_full_indicator_state = TRUE
/// whether or not the smartfridge supports a retrieval_state dispensing animation
var/supports_retrieval_state = TRUE
/// whether or not the smartfridge supports 5 levels of inventory quantity indication icon states
var/supports_capacity_indication = TRUE
/// whether or not it should use "sales pitches" similar to a vendor machine
var/pitches = FALSE
// When did we last pitch?
var/last_pitch = 0
/// How long until we can pitch again?
var/pitch_delay = 2000
/// String of slogans separated by semicolons, optional
var/product_slogans = ""
/// Shock users like an airlock.
var/seconds_electrified = MACHINE_NOT_ELECTRIFIED
/// whether or not the dispenser is active (wires can disable this)
var/dispenser_arm = TRUE
var/power_wire_cut = FALSE
var/list/slogan_list = list()
/obj/machinery/smartfridge/Initialize(mapload)
. = ..()
create_reagents(100, NO_REACT)
wires = new /datum/wires/smartfridge(src)
if(islist(initial_contents))
for(var/typekey in initial_contents)
var/amount = initial_contents[typekey]
if(isnull(amount))
amount = 1
for(var/i in 1 to amount)
load(new typekey(src))
//Slogan pitches work almost identically to the vendor code:
slogan_list = splittext(product_slogans, ";")
last_pitch = world.time + rand(0, pitch_delay)
power_change()
/obj/machinery/smartfridge/Destroy()
QDEL_NULL(wires)
return ..()
/obj/machinery/smartfridge/RefreshParts()
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
max_n_of_items = initial(max_n_of_items) * B.rating
/obj/machinery/smartfridge/examine(mob/user)
. = ..()
if(in_range(user, src) || isobserver(user))
if(!stat)//machine must be operable
if (contents.len >= max_n_of_items)
. += span_notice("The status display reads: <b>Inventory full!</b> Please remove items or upgrade the parts of this storage unit.")
else
. += span_notice("The status display reads: Inventory quantity is currently <b>[contents.len] out of [max_n_of_items]</b> items.")
else
if(!(stat & BROKEN))
. += span_notice("The status display is off.")
/obj/machinery/smartfridge/power_change()
..()
if(!(stat & BROKEN))
if(powered() && !power_wire_cut)
stat &= ~NOPOWER
START_PROCESSING(SSmachines, src)
else
stat |= NOPOWER
/obj/machinery/smartfridge/process()
if(stat & (BROKEN|NOPOWER))
return PROCESS_KILL
if(seconds_electrified > MACHINE_NOT_ELECTRIFIED)
seconds_electrified--
//Slogans and pitches.
if(pitches && prob(5) && last_pitch + pitch_delay <= world.time && (contents.len > 0 || slogan_list.len > 0))
if(contents.len > 0) //if we have contents to advertise, advertise them
if(prob(25) && slogan_list.len > 0)
//Even if we have contents to advertise, 25% of the time it will use a slogan (if available)
speak_slogan()
else
speak_advert()
else if(slogan_list.len > 0) //no contents to advertise, display a slogan instead
speak_slogan()
last_pitch = world.time
/obj/machinery/smartfridge/proc/speak_slogan()
//speak a generic slogan from our slogan list (if possible)
if(slogan_list.len > 0)
speak(pick(slogan_list))
/obj/machinery/smartfridge/proc/speak_advert()
//advertise our contents (if possible)
if(contents.len > 0)
var/selected_item1 = pick(contents)
var/selected_item2 = pick(contents)
if(contents.len > 1 && selected_item1 == selected_item2)
//make an attempt to choose another item for the advertisement.
selected_item2 = pick(contents)
speak("This unit contains [contents.len] items, such as [(selected_item1 != selected_item2) ? "\"[selected_item1]\" and \"[selected_item2]\"!" : "\"[selected_item1]\"!"]")
/obj/machinery/smartfridge/proc/speak(message)
if(stat & (BROKEN|NOPOWER)) // unpowered, no speak
return
if(!message)
return
say(message)
//Shock functionality is identical to the vending machines.
/obj/machinery/smartfridge/proc/shock(mob/user, prb)
if(stat & (BROKEN|NOPOWER)) // unpowered, no shock
return FALSE
if(!prob(prb))
return FALSE
do_sparks(5, TRUE, src)
var/check_range = TRUE
if(electrocute_mob(user, get_area(src), src, 0.7, check_range))
return TRUE
else
return FALSE
/obj/machinery/smartfridge/_try_interact(mob/user)
if(seconds_electrified && !(stat & NOPOWER))
if(shock(user, 100))
return
return ..()
/obj/machinery/smartfridge/atom_break(damage_flag)
if(!(stat & BROKEN))
stat |= BROKEN
update_appearance()
..(damage_flag)
/obj/machinery/smartfridge/update_appearance(updates=ALL)
. = ..()
set_light((!(stat & BROKEN) && powered()) ? MINIMUM_USEFUL_LIGHT_RANGE : 0)
/obj/machinery/smartfridge/update_icon_state()
. = ..()
var/startstate = initial(icon_state)
if(stat & BROKEN)
icon_state = "[startstate]-broken"
else if(powered() && !power_wire_cut)
icon_state = startstate
//Capacity indication:
if(supports_capacity_indication && contents.len > 0 && max_n_of_items > 0)
var/current_capacity_percent = (contents.len/max_n_of_items)*100
if(current_capacity_percent <= 2)
icon_state = startstate
else if(current_capacity_percent < 25)
icon_state = "[startstate]-1"
else if (current_capacity_percent < 45)
icon_state = "[startstate]-2"
else if (current_capacity_percent < 65)
icon_state = "[startstate]-3"
else if (current_capacity_percent < 85)
icon_state = "[startstate]-4"
else if (current_capacity_percent <= 100)
icon_state = "[startstate]-5"
else
icon_state = "[startstate]-off"
/obj/machinery/smartfridge/update_overlays()
. = ..()
// var/shown_contents_length = visible_items()
// if(visible_contents && shown_contents_length)
// var/content_level = "[initial(icon_state)]-[contents_icon_state]"
// switch(shown_contents_length)
// if(1 to 25)
// content_level += "-1"
// if(26 to 50)
// content_level += "-2"
// if(31 to INFINITY)
// content_level += "-3"
// . += mutable_appearance(icon, content_level)
// . += mutable_appearance(icon, "[initial(icon_state)]-glass[(machine_stat & BROKEN) ? "-broken" : ""]")
if(!stat && has_emissive)
. += emissive_appearance(icon, "[initial(icon_state)]-light-mask", src, alpha = src.alpha)
/obj/machinery/smartfridge/proc/animate_dispenser()
//visually animate the smartfridge dispensing an item
if (supports_retrieval_state && !(stat & (NOPOWER|BROKEN)))
//hacky way to flick an animated overlay in the same DMI
var/current_icon_state = icon_state
src.underlays += current_icon_state
flick(retrieval_state, src)
src.underlays -= current_icon_state
/obj/machinery/smartfridge/proc/indicate_full()
//turn on the blinking red full to capacity indicator
if (supports_full_indicator_state && !(stat & (NOPOWER|BROKEN)))
add_overlay(full_indicator_state)
src.visible_message(span_warning("\The [src]'s \"Full Inventory\" indicator light blinks on."), span_warning("Your \"Full Inventory\" indicator light blinks on, you are now at capacity."), span_notice("You hear a clunk, then a quiet beep."))
/*******************
* Item Adding
********************/
/obj/machinery/smartfridge/attackby(obj/item/O, mob/living/user, params)
if(panel_open && is_wire_tool(O))
wires.interact(user)
return
if(default_deconstruction_screwdriver(user, icon_state, icon_state, O))
if(panel_open)
add_overlay("[initial(icon_state)]-panel")
else
cut_overlay("[initial(icon_state)]-panel")
updateUsrDialog()
return
if(default_pry_open(O))
return
if(!(flags_1 & NODECONSTRUCT_1) && O.tool_behaviour == TOOL_WRENCH)
if(panel_open || !anchored)
if(default_unfasten_wrench(user, O))
power_change()
return
else
to_chat(user, span_warning("[src] needs to have it's maintenance panel open before you can reach the anchoring bolts!"))
if(default_deconstruction_crowbar(O))
updateUsrDialog()
return
if(!stat)
//Unable to add an item, it's already full.
if(contents.len >= max_n_of_items)
to_chat(user, span_warning("\The [src] is full!"))
return FALSE
//Adding a single item
if(accept_check(O))
load(O)
user.visible_message("[user] has added \the [O] to \the [src].", span_notice("You add \the [O] to \the [src]."))
update_appearance()
updateUsrDialog()
if(contents.len >= max_n_of_items)
indicate_full()
return TRUE
//Adding items from a bag
if(istype(O, /obj/item/storage/bag))
var/loaded = 0
for(var/obj/G in O.contents)
if(contents.len >= max_n_of_items)
break
if(accept_check(G))
load(G)
loaded++
update_appearance()
updateUsrDialog()
if(loaded)
if(contents.len >= max_n_of_items)
indicate_full()
user.visible_message("[user] loads \the [src] with \the [O].", \
span_notice("You fill \the [src] with \the [O]."))
else
user.visible_message("[user] loads \the [src] with \the [O].", \
span_notice("You load \the [src] with \the [O]."))
if(O.contents.len > 0)
to_chat(user, span_warning("Some items are refused."))
return TRUE
else
to_chat(user, span_warning("There is nothing in [O] to put in [src]!"))
return FALSE
//Adding items from a borg's organ storage
if(istype(O, /obj/item/organ_storage))
var/obj/item/organ_storage/OS = O
var/obj/organ = O.contents[1]
if(accept_check(organ))
load(organ)
OS.clear_organ()
user.visible_message("[user] has added \the [organ] to \the [src].", span_notice("You add \the [organ] to \the [src]."))
update_appearance()
updateUsrDialog()
if(contents.len >= max_n_of_items)
indicate_full()
return TRUE
if(!user.combat_mode)
to_chat(user, span_warning("\The [src] smartly refuses [O]."))
updateUsrDialog()
return FALSE
else
return ..()
else
return ..()
/obj/machinery/smartfridge/welder_act(mob/living/user, obj/item/I)
. = ..()
if(stat & BROKEN)
if(!I.tool_start_check(user, amount=0))
return
user.visible_message(span_notice("[user] is repairing [src]."), span_notice("You begin repairing [src]..."), span_hear("You hear welding."))
if(I.use_tool(src, user, 4 SECONDS))
if(!(stat & BROKEN))
return
to_chat(user, span_notice("You repair [src]."))
update_integrity(max_integrity)
stat &= ~BROKEN
update_icon()
return TRUE
/obj/machinery/smartfridge/proc/accept_check(obj/item/O)
if(istype(O, /obj/item/reagent_containers/food/snacks/grown/) || istype(O, /obj/item/seeds/) || istype(O, /obj/item/grown/))
return TRUE
return FALSE
/obj/machinery/smartfridge/proc/load(obj/item/O)
if(ismob(O.loc))
var/mob/M = O.loc
if(!M.transferItemToLoc(O, src))
to_chat(usr, span_warning("\The [O] is stuck to your hand, you cannot put it in \the [src]!"))
return FALSE
else
return TRUE
else
if(SEND_SIGNAL(O.loc, COMSIG_CONTAINS_STORAGE))
return SEND_SIGNAL(O.loc, COMSIG_TRY_STORAGE_TAKE, O, src)
else
O.forceMove(src)
return TRUE
///Really simple proc, just moves the object "O" into the hands of mob "M" if able, done so I could modify the proc a little for the organ fridge
/obj/machinery/smartfridge/proc/dispense(obj/item/O, mob/M)
if(!M.put_in_hands(O))
O.forceMove(drop_location())
adjust_item_drop_location(O)
/obj/machinery/smartfridge/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "SmartVend", name)
ui.set_autoupdate(FALSE)
ui.open()
/obj/machinery/smartfridge/ui_data(mob/user)
. = list()
var/listofitems = list()
for (var/I in src)
var/atom/movable/O = I
if (!QDELETED(O))
var/md5name = md5(O.name) // This needs to happen because of a bug in a TGUI component, https://github.com/ractivejs/ractive/issues/744
if (listofitems[md5name]) // which is fixed in a version we cannot use due to ie8 incompatibility
listofitems[md5name]["amount"]++ // The good news is, #30519 made smartfridge UIs non-auto-updating
else
listofitems[md5name] = list("name" = O.name, "type" = O.type, "amount" = 1)
sortList(listofitems)
.["contents"] = listofitems
.["name"] = name
.["isdryer"] = FALSE
/obj/machinery/smartfridge/handle_atom_del(atom/A) // Update the UIs in case something inside gets deleted
SStgui.update_uis(src)
/obj/machinery/smartfridge/ui_act(action, params)
. = ..()
if(.)
return
switch(action)
if("Release")
var/desired = 0
if(!allow_ai_retrieve && isAI(usr))
to_chat(usr, span_warning("[src] does not seem to be configured to respect your authority!"))
return
if(!dispenser_arm)
audible_message(span_warning("\The [src] makes a loud clunk and the dispenser arm twitches slightly."), span_warning("The dispenser arm on the [src] twitches slightly."))
return
if (params["amount"])
desired = text2num(params["amount"])
else
desired = input("How many items?", "How many items would you like to take out?", 1) as null|num
if(desired <= 0)
return FALSE
if(QDELETED(src) || QDELETED(usr) || !usr.Adjacent(src)) // Sanity checkin' in case stupid stuff happens while we wait for input()
return FALSE
//Retrieving a single item into your hand
if(desired == 1 && Adjacent(usr) && !issilicon(usr))
for(var/obj/item/O in src)
if(O.name == params["name"])
dispense(O, usr)
break
update_appearance()
cut_overlay(full_indicator_state)
animate_dispenser()
return TRUE
//Retrieving many items
for(var/obj/item/O in src)
if(desired <= 0)
break
if(O.name == params["name"])
dispense(O, usr)
desired--
update_appearance()
cut_overlay(full_indicator_state)
animate_dispenser()
return TRUE
return FALSE
// ----------------------------
// Drying Rack 'smartfridge'
// ----------------------------
/obj/machinery/smartfridge/drying_rack
name = "drying rack"
desc = "A wooden contraption, used to dry plant products, food and leather."
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "drying_rack"
use_power = IDLE_POWER_USE
idle_power_usage = 5
has_emissive = FALSE
active_power_usage = 200
supports_full_indicator_state = FALSE //whether or not the smartfridge supports a full inventory indicator icon state
supports_retrieval_state = FALSE //whether or not the smartfridge supports a retrieval_state dispensing animation
supports_capacity_indication = FALSE //whether or not the smartfridge supports 5 levels of inventory quantity indication icon states
product_slogans = "Smokin'!;Blaze it.;Roll 'em up!;This machine is made out of 85% organic hemp product.;Warning: Do not insert limbs into machine.;Enjoy your dried \"plant products\".;This machine was last inspected on April 20th, 2550.;Wait, I forgot what I was going to do... Oh yeah, dry things.;Tell the Cook to bring some food over here, I'm starving."
pitches = FALSE
var/drying = FALSE
/obj/machinery/smartfridge/drying_rack/Initialize(mapload)
. = ..()
if(component_parts && component_parts.len)
component_parts.Cut()
component_parts = null
/obj/machinery/smartfridge/drying_rack/on_deconstruction()
new /obj/item/stack/sheet/mineral/wood(drop_location(), 10)
..()
/obj/machinery/smartfridge/drying_rack/RefreshParts()
return NONE
/obj/machinery/smartfridge/drying_rack/exchange_parts()
return NONE
/obj/machinery/smartfridge/drying_rack/spawn_frame()
return NONE
/obj/machinery/smartfridge/drying_rack/default_deconstruction_crowbar(obj/item/crowbar/C, ignore_panel = 1)
..()
//Whoever made this hacky drying_rack smartfridge thing didn't use the standard construction method
//so we have to override the wiring/deconstruction of the default smartfridge here
/obj/machinery/smartfridge/drying_rack/attackby(obj/item/O, mob/user, params)
if(!(flags_1 & NODECONSTRUCT_1) && O.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, span_warning("[src] has nothing to unscrew! You think you can probably pry out the shelves, though."))
return
else if(!(flags_1 & NODECONSTRUCT_1) && O.tool_behaviour == TOOL_WRENCH)
to_chat(user, span_warning("[src] has no bolts to wrench! You think you can probably pry out the shelves, though."))
return
else
return ..()
/obj/machinery/smartfridge/drying_rack/ui_data(mob/user)
. = ..()
.["isdryer"] = TRUE
.["verb"] = "Take"
.["drying"] = drying
/obj/machinery/smartfridge/drying_rack/ui_act(action, params)
. = ..()
if(.)
update_appearance() // This is to handle a case where the last item is taken out manually instead of through drying pop-out
return
switch(action)
if("Dry")
toggle_drying(FALSE)
return TRUE
return FALSE
/obj/machinery/smartfridge/drying_rack/powered()
if(!anchored)
return FALSE
return ..()
/obj/machinery/smartfridge/drying_rack/power_change()
. = ..()
if(!powered())
toggle_drying(TRUE)
/obj/machinery/smartfridge/drying_rack/load() //For updating the filled overlay
..()
update_appearance()
/obj/machinery/smartfridge/drying_rack/update_overlays()
. = ..()
if(drying)
. += "drying_rack_drying"
if(contents.len)
. += "drying_rack_filled"
/obj/machinery/smartfridge/drying_rack/process()
..()
if(drying)
if(rack_dry())//no need to update unless something got dried
SStgui.update_uis(src)
update_appearance()
/obj/machinery/smartfridge/drying_rack/accept_check(obj/item/O)
if(istype(O, /obj/item/reagent_containers/food/snacks/))
var/obj/item/reagent_containers/food/snacks/S = O
if(S.dried_type)
return TRUE
if(istype(O, /obj/item/stack/sheet/wetleather/))
return TRUE
return FALSE
/obj/machinery/smartfridge/drying_rack/proc/toggle_drying(forceoff)
if(drying || forceoff)
drying = FALSE
use_power = IDLE_POWER_USE
else
drying = TRUE
use_power = ACTIVE_POWER_USE
update_appearance()
/obj/machinery/smartfridge/drying_rack/proc/rack_dry()
for(var/obj/item/reagent_containers/food/snacks/S in src)
if(S.dried_type == S.type)//if the dried type is the same as the object's type, don't bother creating a whole new item...
S.add_atom_colour("#ad7257", FIXED_COLOUR_PRIORITY)
S.dry = TRUE
S.forceMove(drop_location())
else
var/dried = S.dried_type
new dried(drop_location())
qdel(S)
return TRUE
for(var/obj/item/stack/sheet/wetleather/WL in src)
new /obj/item/stack/sheet/leather(drop_location(), WL.amount)
qdel(WL)
return TRUE
return FALSE
/obj/machinery/smartfridge/drying_rack/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
return
atmos_spawn_air("TEMP=1000")
/obj/machinery/smartfridge/drying_rack/CtrlClick(mob/user)
if(!user.canUseTopic(src, !issilicon(user)))
return FALSE
toggle_drying(FALSE)
return TRUE
// ----------------------------
// Bar drink smartfridge
// ----------------------------
/obj/machinery/smartfridge/drinks
name = "drink showcase"
desc = "A refrigerated storage unit for tasty, tasty alcohol."
max_n_of_items = 100
product_slogans = "Only the finest beverages for the discerning crewmember.;All our drinks are served ice-cold.;Happy Hour begins every shift at 12:00.;Don't worry, I won't tell the Captain you drink on the shift.;This'll get ya drunk.;Bottoms up!;Delightfully refreshing!;Show me the way to go home, I'm tired and I want to go to bed...;This unit contains the bartender's latest creations."
pitches = TRUE
/obj/machinery/smartfridge/drinks/accept_check(obj/item/O)
if(!istype(O, /obj/item/reagent_containers) || (O.item_flags & ABSTRACT) || !O.reagents || !O.reagents.reagent_list.len)
return FALSE
if(istype(O, /obj/item/reagent_containers/glass) || istype(O, /obj/item/reagent_containers/food/drinks) || istype(O, /obj/item/reagent_containers/food/condiment))
return TRUE
// ----------------------------
// Food smartfridge
// ----------------------------
/obj/machinery/smartfridge/food
desc = "A refrigerated storage unit for food."
product_slogans = "Clean your refrigerator regularly!;Is your refrigerator running?;Much better than storing your food in space.;Feeling hungry? Have a snack!;Tasty and nutritious!"
max_n_of_items = 200
/obj/machinery/smartfridge/food/accept_check(obj/item/O)
if(istype(O, /obj/item/reagent_containers/food/snacks/))
return TRUE
return FALSE
// -------------------------------------
// Xenobiology Slime-Extract Smartfridge
// -------------------------------------
/obj/machinery/smartfridge/extract
name = "smart slime extract storage"
desc = "A refrigerated storage unit for slime extracts."
max_n_of_items = 200
pitches = FALSE
product_slogans = "Slime on a dime.;Don't let the Syndicate get their hands on these!;Those slimes won't know what hit 'em.;Hi slimes!;Xeno guts, on ice.;For a lavaland creature, they're pretty cute!;Hello slimes!"
/obj/machinery/smartfridge/extract/accept_check(obj/item/O)
if(istype(O, /obj/item/slime_extract))
return TRUE
if(istype(O, /obj/item/slime_scanner))
return TRUE
return FALSE
/obj/machinery/smartfridge/extract/preloaded
initial_contents = list(/obj/item/slime_scanner = 2)
// -------------------------
// Organ Surgery Smartfridge
// -------------------------
/obj/machinery/smartfridge/organ
name = "smart organ storage"
desc = "A refrigerated storage unit for organ storage. Upgraded parts will activate its advanced organ healing technology."
max_n_of_items = 20 //vastly lower to prevent processing too long
product_slogans = "Right in the spleen.;Body parts, on ice!;Low-temperature organ storage decreases patient transplant rejection rates.;Register as an organ donor today!;You can't play these organs.;THIS UNIT DOES NOT CONTAIN FOOD.;Keeps your heart colder than HoS's.;This unit is equipped with state-of-the-art organ healing technology, just upgrade it's parts to activate this feature.;Upgrade this unit's parts to increase organ healing speed.;Also check out our new product, the Organ Harvester machine! Pairs well with this unit!"
pitches = FALSE
var/repair_rate = 0
/obj/machinery/smartfridge/organ/accept_check(obj/item/O)
if(istype(O, /obj/item/organ))
return TRUE
return FALSE
/obj/machinery/smartfridge/organ/load(obj/item/O)
if(..()) //if the item loads, clear can_decompose
var/obj/item/organ/organ = O
organ.organ_flags |= ORGAN_FROZEN
/obj/machinery/smartfridge/organ/dispense(obj/item/O, mob/M)
var/obj/item/organ/organ = O
organ.organ_flags &= ~ORGAN_FROZEN
..()
/obj/machinery/smartfridge/organ/RefreshParts()
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
max_n_of_items = 20 * B.rating
repair_rate = max(0, STANDARD_ORGAN_HEALING * (B.rating - 1) * 0.5)
/obj/machinery/smartfridge/organ/Destroy()
for(var/organ in src)
var/obj/item/organ/O = organ
if(O)
O.organ_flags &= ~ORGAN_FROZEN
..()
/obj/machinery/smartfridge/organ/process(delta_time)
for(var/organ in src)
var/obj/item/organ/O = organ
if(O)
O.damage = max(0, O.damage - (O.maxHealth * (repair_rate * delta_time)))
..()
/obj/machinery/smartfridge/organ/Exited(atom/movable/AM, atom/newLoc)
. = ..()
if(isorgan(AM))
var/obj/item/organ/O = AM
O.organ_flags &= ~ORGAN_FROZEN
// -----------------------------
// Chemistry Medical Smartfridge
// -----------------------------
/obj/machinery/smartfridge/chemistry
name = "smart chemical storage"
desc = "A refrigerated storage unit for medicine storage."
max_n_of_items = 100
product_slogans = "Medicine for what ails ya.;Get your medicine here!;Disclaimer: These chemicals are not regulated by the Nanotrasen Drug Administration.;Do you have a prescription for that?;This unit can dispense chemicals, medicines, toxins, and quite possibly also narcotics.;Ask your doctor or CMO about Chloral Hydrate(tm) today!;Check out our expanded inventory of pharmaceuticals.;Chemist, did you remember to make Mannitol?"
pitches = TRUE
/obj/machinery/smartfridge/chemistry/accept_check(obj/item/O)
if(istype(O, /obj/item/storage/pill_bottle))
if(O.contents.len)
for(var/obj/item/I in O)
if(!accept_check(I))
return FALSE
return TRUE
return FALSE
if(!istype(O, /obj/item/reagent_containers) || (O.item_flags & ABSTRACT))
return FALSE
if(istype(O, /obj/item/reagent_containers/pill)) // empty pill prank ok
return TRUE
if(!O.reagents || !O.reagents.reagent_list.len) // other empty containers not accepted
return FALSE
if(istype(O, /obj/item/reagent_containers/syringe) || istype(O, /obj/item/reagent_containers/glass/bottle) || istype(O, /obj/item/reagent_containers/glass/beaker) || istype(O, /obj/item/reagent_containers/spray) || istype(O, /obj/item/reagent_containers/medspray) || istype(O, /obj/item/reagent_containers/gummy))
return TRUE
return FALSE
/obj/machinery/smartfridge/chemistry/preloaded
pitches = FALSE
initial_contents = list(
/obj/item/reagent_containers/pill/epinephrine = 12,
/obj/item/reagent_containers/pill/charcoal = 5,
/obj/item/reagent_containers/glass/bottle/epinephrine = 1,
/obj/item/reagent_containers/glass/bottle/charcoal = 1)
// ----------------------------
// Virology Medical Smartfridge
// ----------------------------
/obj/machinery/smartfridge/chemistry/virology
name = "smart virus storage"
desc = "A refrigerated storage unit for volatile sample storage."
max_n_of_items = 100
product_slogans = "Try not to spill these.;Use of level-3 biohazard equipment or higher is mandatory when operating this machine.;Whoops, I think I dropped one.;Storage solutions for any and all biohazardous material."
/obj/machinery/smartfridge/chemistry/virology/preloaded
pitches = FALSE
initial_contents = list(
/obj/item/reagent_containers/syringe/antiviral = 4,
/obj/item/reagent_containers/glass/bottle/cold = 1,
/obj/item/reagent_containers/glass/bottle/flu_virion = 1,
/obj/item/reagent_containers/glass/bottle/mutagen = 1,
/obj/item/reagent_containers/glass/bottle/plasma = 1,
/obj/item/reagent_containers/glass/bottle/synaptizine = 1,
/obj/item/reagent_containers/glass/bottle/formaldehyde = 1)
// ----------------------------
// Disk """fridge"""
// ----------------------------
/obj/machinery/smartfridge/disks
name = "disk compartmentalizer"
desc = "A machine capable of storing a variety of disks. Denoted by most as the DSU (disk storage unit)."
icon = 'icons/obj/vending.dmi'
icon_state = "disktoaster"
product_slogans = "Toasty!;Burnt to a crisp.;Puts a new meaning to the term \"burning a disk\", eh?;Store your plant data disks here. Or any kind of disk really. I don't discriminate."
pass_flags = PASSTABLE
supports_full_indicator_state = FALSE //whether or not the smartfridge supports a full inventory indicator icon state
retrieval_state = "disktoaster-retrieve" //the icon state for the dispensing animation
retrieval_time = 5 //the length (in ticks) of the retrieval_state
supports_retrieval_state = TRUE //whether or not the smartfridge supports a retrieval_state dispensing animation
supports_capacity_indication = FALSE //whether or not the smartfridge supports 5 levels of inventory quantity indication icon states
/obj/machinery/smartfridge/disks/accept_check(obj/item/O)
if(istype(O, /obj/item/disk/))
return TRUE
else
return FALSE