-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathturnstile.dm
63 lines (58 loc) · 2.17 KB
/
turnstile.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
/obj/machinery/turnstile
name = "turnstile"
desc = "A mechanical door that permits one-way access to an area."
icon = 'icons/obj/objects.dmi'
icon_state = "turnstile_map"
power_channel = AREA_USAGE_ENVIRON
density = TRUE
max_integrity = 250
//Robust! It'll be tough to break...
armor = list(MELEE = 50, BULLET = 20, LASER = 0, ENERGY = 80, BOMB = 10, BIO = 100, RAD = 100, FIRE = 90, ACID = 50)
anchored = TRUE
use_power = FALSE
idle_power_usage = 2
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
layer = OPEN_DOOR_LAYER
/obj/machinery/turnstile/brig
name = "Brig turnstile"
//Seccies and brig phys may always pass, either way.
req_access = list(ACCESS_SEC_BASIC)
max_integrity = 400 /// Made of damn good steel
damage_deflection = 21 /// Same as airlocks!
/obj/machinery/turnstile/Initialize(mapload)
. = ..()
icon_state = "turnstile"
/obj/machinery/turnstile/can_atmos_pass(turf/target_turf, vertical = FALSE)
return TRUE
/obj/machinery/turnstile/Cross(atom/movable/mover)
. = ..()
if(istype(mover) && (mover.pass_flags & PASSGLASS))
return TRUE
if(istype(mover, /mob/living/simple_animal/bot))
flick("operate", src)
playsound(src,'sound/items/ratchet.ogg',50,0,3)
return TRUE
else if (!isliving(mover) && !istype(mover, /obj/vehicle/ridden/wheelchair))
flick("deny", src)
playsound(src,'sound/machines/deniedbeep.ogg',50,0,3)
return FALSE
var/allowed = allowed(mover)
//Sec can drag you out unceremoniously.
if(!allowed && mover.pulledby)
allowed = allowed(mover.pulledby)
if(istype(mover, /obj/vehicle/ridden/wheelchair))
for(var/mob/living/rider in mover.buckled_mobs)
if(allowed(rider) && !mover.pulledby) //defer to the above dragging code if we are being dragged
allowed = TRUE
var/is_handcuffed = FALSE
if(iscarbon(mover))
var/mob/living/carbon/C = mover
is_handcuffed = C.handcuffed
if((get_dir(loc, mover.loc) == dir && !is_handcuffed) || allowed) //Make sure looking at appropriate border, loc is first so the turnstyle faces the mover
flick("operate", src)
playsound(src,'sound/items/ratchet.ogg',50,0,3)
return TRUE
else
flick("deny", src)
playsound(src,'sound/machines/deniedbeep.ogg',50,0,3)
return FALSE