-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathsecure.dm
182 lines (148 loc) · 5.94 KB
/
secure.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
/obj/structure/closet/crate/secure
desc = "A secure crate."
name = "secure crate"
icon_state = "securecrate"
secure = TRUE
locked = TRUE
max_integrity = 500
armor = list(MELEE = 30, BULLET = 50, LASER = 50, ENERGY = 50, BOMB = 0, BIO = 0, RAD = 0, FIRE = 80, ACID = 80, ELECTRIC = 100)
var/tamperproof = 0
/obj/structure/closet/crate/secure/run_atom_armor(damage_amount, damage_type, damage_flag = 0, attack_dir)
if(damage_flag == MELEE && damage_amount < 25)
return 0
. = ..()
/obj/structure/closet/crate/secure/update_overlays()
. = ..()
if(broken)
. += "securecrateemag"
else if(locked)
. += "securecrater"
else
. += "securecrateg"
/obj/structure/closet/crate/secure/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = TRUE, attack_dir, armour_penetration = 0)
if(prob(tamperproof) && damage_amount >= DAMAGE_PRECISION)
boom()
else
return ..()
/obj/structure/closet/crate/secure/proc/boom(mob/user)
if(user)
to_chat(user, span_danger("The crate's anti-tamper system activates!"))
log_bomber(user, "has detonated a", src)
for(var/atom/movable/AM in src)
qdel(AM)
explosion(get_turf(src), 0, 1, 5, 5)
qdel(src)
/obj/structure/closet/crate/secure/cheap
/obj/structure/closet/crate/secure/weapon
desc = "A secure weapons crate."
name = "weapons crate"
icon_state = "weaponcrate"
/obj/structure/closet/crate/secure/plasma
desc = "A secure plasma crate."
name = "plasma crate"
icon_state = "plasmacrate"
/obj/structure/closet/crate/secure/gear
desc = "A secure gear crate."
name = "gear crate"
icon_state = "secgearcrate"
/obj/structure/closet/crate/secure/gear/donut
var/donutsleft = 10
/obj/structure/closet/crate/secure/gear/donut/open(mob/living/user)
. = ..()
if(donutsleft > 0)
new /obj/item/reagent_containers/food/snacks/donut(src)
donutsleft--
/obj/structure/closet/crate/secure/hydroponics
desc = "A crate with a lock on it, painted in the scheme of the station's botanists."
name = "secure hydroponics crate"
icon_state = "hydrosecurecrate"
/obj/structure/closet/crate/secure/engineering
desc = "A crate with a lock on it, painted in the scheme of the station's engineers."
name = "secure engineering crate"
icon_state = "engi_secure_crate"
/obj/structure/closet/crate/secure/radiation
desc = "A crate with a lock and is painted with a radiation sign on it. This crate is designed to prevent radiation from leaking outside of the crate."
name = "secure radiation crate"
icon_state = "radiation_secure"
flags_1 = RAD_CONTAIN_CONTENTS // rad-insulated
/obj/structure/closet/crate/secure/science
name = "secure science crate"
desc = "A crate with a lock on it, painted in the scheme of the station's scientists."
icon_state = "scisecurecrate"
/obj/structure/closet/crate/secure/medical
name = "secure medical crate"
desc = "A crate with a lock on it, painted in the scheme of the station's doctors."
icon_state = "medsecurecrate"
/obj/structure/closet/crate/secure/owned
name = "private crate"
desc = "A crate cover designed to only open for who purchased its contents."
icon_state = "privatecrate"
///Account of the person buying the crate if private purchasing.
var/datum/bank_account/buyer_account
///Department of the person buying the crate if buying via the NIRN app.
var/datum/bank_account/department/department_account
///Is the secure crate opened or closed?
var/privacy_lock = TRUE
///Is the crate being bought by a person, or a budget card?
var/department_purchase = FALSE
/obj/structure/closet/crate/secure/owned/hydroponics
icon_state = "hydrosecurecrate"
/obj/structure/closet/crate/secure/owned/engineering
icon_state = "engi_secure_crate"
/obj/structure/closet/crate/secure/owned/science
icon_state = "scisecurecrate"
/obj/structure/closet/crate/secure/owned/medical
icon_state = "medsecurecrate"
/obj/structure/closet/crate/secure/owned/gear
icon_state = "secgearcrate"
/obj/structure/closet/crate/secure/owned/civ
icon_state = "plasmacrate"
/obj/structure/closet/crate/secure/owned/radiation
icon_state = "radiation_secure"
flags_1 = RAD_CONTAIN_CONTENTS // rad-insulated
/obj/structure/closet/crate/secure/owned/cheap
/obj/structure/closet/crate/secure/owned/cheap/hydroponics
icon_state = "hydrosecurecrate"
/obj/structure/closet/crate/secure/owned/cheap/engineering
icon_state = "engi_secure_crate"
/obj/structure/closet/crate/secure/owned/cheap/science
icon_state = "scisecurecrate"
/obj/structure/closet/crate/secure/owned/cheap/medical
icon_state = "medsecurecrate"
/obj/structure/closet/crate/secure/owned/cheap/gear
icon_state = "secgearcrate"
/obj/structure/closet/crate/secure/owned/cheap/civ
icon_state = "plasmacrate"
/obj/structure/closet/crate/secure/owned/examine(mob/user)
. = ..()
. += span_notice("It's locked with a privacy lock, and can only be unlocked by the buyer's ID.")
/obj/structure/closet/crate/secure/owned/Initialize(mapload, datum/bank_account/_buyer_account)
. = ..()
buyer_account = _buyer_account
if(istype(buyer_account, /datum/bank_account/department))
department_purchase = TRUE
department_account = buyer_account
/obj/structure/closet/crate/secure/owned/togglelock(mob/living/user, silent)
if(!secure)
return
if(broken)
to_chat(user, span_warning("\The [src] is broken!"))
return
if(!allowed(user))
if(!silent)
to_chat(user, span_notice("Access Denied"))
return
if(privacy_lock)
var/obj/item/card/id/id_card = user.get_idcard(TRUE)
if(!id_card || !id_card.registered_account)
to_chat(user, span_notice("No bank account found!"))
return
if((id_card.registered_account != buyer_account) && !(department_purchase && (id_card.registered_account?.account_job?.paycheck_department) == (department_account.department_id)))
to_chat(user, span_notice("Bank account does not match with buyer!"))
return
if(iscarbon(user))
add_fingerprint(user)
locked = !locked
user.visible_message(span_notice("[user] [locked ? null : "un"]locks [src]."),
span_notice("You [locked ? null : "un"]lock [src]."))
update_appearance(UPDATE_ICON)