-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
_job.dm
260 lines (200 loc) · 8.87 KB
/
_job.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
/datum/job
//The name of the job , used for preferences, bans and more. Make sure you know what you're doing before changing this.
var/title = "NOPE"
//Job access. The use of minimal_access or access is determined by a config setting: config.jobs_have_minimal_access
var/list/minimal_access = list() //Useful for servers which prefer to only have access given to the places a job absolutely needs (Larger server population)
var/list/access = list() //Useful for servers which either have fewer players, so each person needs to fill more than one role, or servers which like to give more access, so players can't hide forever in their super secure departments (I'm looking at you, chemistry!)
//Determines who can demote this position
var/department_head = list()
//Tells the given channels that the given mob is the new department head. See communications.dm for valid channels.
var/list/head_announce = null
//Bitflags for the job
var/flag = NONE //Deprecated
var/department_flag = NONE //Deprecated
var/auto_deadmin_role_flags = NONE
//Players will be allowed to spawn in as jobs that are set to "Station"
var/faction = "None"
//How many players can be this job
var/total_positions = 0
//How many players can spawn in as this job
var/spawn_positions = 0
//How many players have this job
var/current_positions = 0
//Supervisors, who this person answers to directly
var/supervisors = ""
//Sellection screen color
var/selection_color = "#ffffff"
//If this is set to 1, a text is printed to the player when jobs are assigned, telling him that he should let admins know that he has to disconnect.
var/req_admin_notify
//If you have the use_age_restriction_for_jobs config option enabled and the database set up, this option will add a requirement for players to be at least minimal_player_age days old. (meaning they first signed in at least that many days before.)
var/minimal_player_age = 0
var/outfit = null
var/exp_requirements = 0
var/exp_type = ""
var/exp_type_department = ""
//The amount of good boy points playing this role will earn you towards a higher chance to roll antagonist next round
//can be overridden by antag_rep.txt config
var/antag_rep = 10
var/paycheck = PAYCHECK_MINIMAL
var/paycheck_department = ACCOUNT_CIV
var/list/mind_traits // Traits added to the mind of the mob assigned this job
var/display_order = JOB_DISPLAY_ORDER_DEFAULT
///Levels unlocked at roundstart in physiology
var/list/roundstart_experience
//Only override this proc
//H is usually a human unless an /equip override transformed it
/datum/job/proc/after_spawn(mob/living/H, mob/M, latejoin = FALSE)
//do actions on H but send messages to M as the key may not have been transferred_yet
if(mind_traits)
for(var/t in mind_traits)
ADD_TRAIT(H.mind, t, JOB_TRAIT)
if(roundstart_experience && ishuman(H))
var/mob/living/carbon/human/experiencer = H
for(var/i in roundstart_experience)
experiencer.mind.adjust_experience(i, roundstart_experience[i], TRUE)
/datum/job/proc/announce(mob/living/carbon/human/H)
if(head_announce)
announce_head(H, head_announce)
/datum/job/proc/override_latejoin_spawn(mob/living/carbon/human/H) //Return TRUE to force latejoining to not automatically place the person in latejoin shuttle/whatever.
return FALSE
//Used for a special check of whether to allow a client to latejoin as this job.
/datum/job/proc/special_check_latejoin(client/C)
return TRUE
/datum/job/proc/GetAntagRep()
. = CONFIG_GET(keyed_list/antag_rep)[lowertext(title)]
if(. == null)
return antag_rep
//Don't override this unless the job transforms into a non-human (Silicons do this for example)
/datum/job/proc/equip(mob/living/carbon/human/H, visualsOnly = FALSE, announce = TRUE, latejoin = FALSE, datum/outfit/outfit_override = null, client/preference_source)
if(!H)
return FALSE
if(CONFIG_GET(flag/enforce_human_authority) && (title in GLOB.command_positions))
if(H.dna.species.id != "human")
H.set_species(/datum/species/human)
H.apply_pref_name("human", preference_source)
if(!visualsOnly)
var/datum/bank_account/bank_account = new(H.real_name, src, H.dna.species.payday_modifier)
bank_account.payday(STARTING_PAYCHECKS, TRUE)
H.account_id = bank_account.account_id
//Equip the rest of the gear
H.dna.species.before_equip_job(src, H, visualsOnly)
if(outfit_override || outfit)
H.equipOutfit(outfit_override ? outfit_override : outfit, visualsOnly)
H.dna.species.after_equip_job(src, H, visualsOnly)
if(!visualsOnly && announce)
announce(H)
/datum/job/proc/get_access()
if(!config) //Needed for robots.
return src.minimal_access.Copy()
. = list()
if(CONFIG_GET(flag/jobs_have_minimal_access))
. = src.minimal_access.Copy()
else
. = src.access.Copy()
if(CONFIG_GET(flag/everyone_has_maint_access)) //Config has global maint access set
. |= list(ACCESS_MAINT_TUNNELS)
/datum/job/proc/announce_head(mob/living/carbon/human/H, channels) //tells the given channel that the given mob is the new department head. See communications.dm for valid channels.
if(H && GLOB.announcement_systems.len)
//timer because these should come after the captain announcement
SSticker.OnRoundstart(CALLBACK(GLOBAL_PROC, .proc/addtimer, CALLBACK(pick(GLOB.announcement_systems), /obj/machinery/announcement_system/proc/announce, "NEWHEAD", H.real_name, H.job, channels), 1))
//If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1
/datum/job/proc/player_old_enough(client/C)
if(available_in_days(C) == 0)
return TRUE //Available in 0 days = available right now = player is old enough to play.
return FALSE
/datum/job/proc/available_in_days(client/C)
if(!C)
return 0
if(!CONFIG_GET(flag/use_age_restriction_for_jobs))
return 0
if(!SSdbcore.Connect())
return 0 //Without a database connection we can't get a player's age so we'll assume they're old enough for all jobs
if(!isnum(minimal_player_age))
return 0
return max(0, minimal_player_age - C.player_age)
/datum/job/proc/config_check()
return TRUE
/datum/job/proc/map_check()
return TRUE
/datum/job/proc/radio_help_message(mob/M)
to_chat(M, "<b>Prefix your message with :h to speak on your department's radio. To see other prefixes, look closely at your headset.</b>")
/datum/outfit/job
name = "Standard Gear"
var/jobtype = null
uniform = /obj/item/clothing/under/color/grey
id = /obj/item/card/id
ears = /obj/item/radio/headset
belt = /obj/item/pda
back = /obj/item/storage/backpack
shoes = /obj/item/clothing/shoes/sneakers/black
box = /obj/item/storage/box/survival
var/backpack = /obj/item/storage/backpack
var/satchel = /obj/item/storage/backpack/satchel
var/duffelbag = /obj/item/storage/backpack/duffelbag
var/pda_slot = ITEM_SLOT_BELT
/datum/outfit/job/pre_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
switch(H.backpack)
if(GBACKPACK)
back = /obj/item/storage/backpack //Grey backpack
if(GSATCHEL)
back = /obj/item/storage/backpack/satchel //Grey satchel
if(GDUFFELBAG)
back = /obj/item/storage/backpack/duffelbag //Grey Duffel bag
if(LSATCHEL)
back = /obj/item/storage/backpack/satchel/leather //Leather Satchel
if(DSATCHEL)
back = satchel //Department satchel
if(DDUFFELBAG)
back = duffelbag //Department duffel bag
else
back = backpack //Department backpack
//converts the uniform string into the path we'll wear, whether it's the skirt or regular variant
var/holder
if(H.jumpsuit_style == PREF_SKIRT)
holder = "[uniform]/skirt"
if(!text2path(holder))
holder = "[uniform]"
else
holder = "[uniform]"
uniform = text2path(holder)
/datum/outfit/job/post_equip(mob/living/carbon/human/H, visualsOnly = FALSE)
if(visualsOnly)
return
var/datum/job/J = SSjob.GetJobType(jobtype)
if(!J)
J = SSjob.GetJob(H.job)
var/obj/item/card/id/C = H.wear_id
if(istype(C))
C.access = J.get_access()
shuffle_inplace(C.access) // Shuffle access list to make NTNet passkeys less predictable
C.registered_name = H.real_name
C.assignment = J.title
if(H.age)
C.registered_age = H.age
C.update_label()
for(var/A in SSeconomy.bank_accounts)
var/datum/bank_account/B = A
if(B.account_id == H.account_id)
C.registered_account = B
B.bank_cards += C
break
H.sec_hud_set_ID()
var/obj/item/pda/PDA = H.get_item_by_slot(pda_slot)
if(istype(PDA))
PDA.owner = H.real_name
PDA.ownjob = J.title
PDA.update_label()
if(H.client?.prefs.playtime_reward_cloak)
neck = /obj/item/clothing/neck/cloak/skill_reward/playing
/datum/outfit/job/get_chameleon_disguise_info()
var/list/types = ..()
types -= /obj/item/storage/backpack //otherwise this will override the actual backpacks
types += backpack
types += satchel
types += duffelbag
return types
//Warden and regular officers add this result to their get_access()
/datum/job/proc/check_config_for_sec_maint()
if(CONFIG_GET(flag/security_has_maint_access))
return list(ACCESS_MAINT_TUNNELS)
return list()