-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathpreferred_map.dm
52 lines (37 loc) · 1.28 KB
/
preferred_map.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
/// During map rotation, this will help determine the chosen map.
/datum/preference/choiced/preferred_map
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "preferred_map"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/choiced/preferred_map/init_possible_values()
var/list/maps = list()
maps += ""
for (var/map in config.maplist)
var/datum/map_config/map_config = config.maplist[map]
if (!map_config.votable)
continue
maps += map
return maps
/datum/preference/choiced/preferred_map/create_default_value()
return ""
/datum/preference/choiced/preferred_map/compile_constant_data()
var/list/data = ..()
var/display_names = list()
if (config.defaultmap)
display_names[""] = "Default ([config.defaultmap.map_name])"
else
display_names[""] = "Default"
for (var/choice in get_choices())
if (choice == "")
continue
var/datum/map_config/map_config = config.maplist[choice]
var/map_name = map_config.map_name
if (map_config.voteweight <= 0)
map_name += " (disabled)"
display_names[choice] = map_name
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = display_names
return data
/datum/preference/choiced/preferred_map/is_accessible(datum/preferences/preferences)
if (!..(preferences))
return FALSE
return CONFIG_GET(flag/preference_map_voting)