-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathprisonlabor.dm
66 lines (57 loc) · 1.93 KB
/
prisonlabor.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
/obj/machinery/plate_press
name = "license plate press"
desc = "You know, we're making a lot of license plates for a station with no cars in it."
icon = 'icons/obj/machines/prison.dmi'
icon_state = "offline"
use_power = IDLE_POWER_USE
idle_power_usage = 2
active_power_usage = 50
var/obj/item/stack/license_plates/empty/current_plate
var/pressing = FALSE
/obj/machinery/plate_press/update_icon_state()
. = ..()
if(!is_operational())
icon_state = "offline"
else if(pressing)
icon_state = "loop"
else if(current_plate)
icon_state = "online_loaded"
else
icon_state = "online"
/obj/machinery/plate_press/Destroy()
QDEL_NULL(current_plate)
. = ..()
/obj/machinery/plate_press/attackby(obj/item/I, mob/living/user, params)
if(!is_operational())
to_chat(user, "<span class='warning'>[src] has to be on to do this!</span>")
return FALSE
if(pressing)
to_chat(user, "<span class='warning'>[src] already has a plate in it!</span>")
return FALSE
if(istype(I, /obj/item/stack/license_plates/empty))
var/obj/item/stack/license_plates/empty/plate = I
plate.use(1)
current_plate = new plate.type(src, 1) //Spawn a new single sheet in the machine
update_appearance(UPDATE_ICON)
else
return ..()
/obj/machinery/plate_press/attack_hand(mob/living/user)
. = ..()
if(pressing || !current_plate)
return
work_press(user)
///This proc attempts to create a plate. User cannot move during this process.
/obj/machinery/plate_press/proc/work_press(mob/living/user)
pressing = TRUE
update_appearance(UPDATE_ICON)
to_chat(user, "<span class='notice'>You start pressing a new license plate!</span>")
if(!do_after(user, 4 SECONDS, src))
pressing = FALSE
update_appearance(UPDATE_ICON)
return FALSE
use_power(100)
to_chat(user, "<span class='notice'>You finish pressing a new license plate!</span>")
pressing = FALSE
QDEL_NULL(current_plate)
update_appearance(UPDATE_ICON)
new /obj/item/stack/license_plates/filled(drop_location(), 1)