-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathresearch_disk.dm
99 lines (88 loc) · 2.91 KB
/
research_disk.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
/obj/item/disk/tech_disk
name = "technology disk"
desc = "A disk for storing technology data for further research."
icon_state = "datadisk0"
materials = list(/datum/material/iron=300, /datum/material/glass=100)
var/datum/techweb/stored_research
/obj/item/disk/tech_disk/Initialize(mapload)
. = ..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
stored_research = new /datum/techweb
/obj/item/disk/tech_disk/debug
name = "\improper CentCom technology disk"
desc = "A debug item for research"
materials = list()
/obj/item/disk/tech_disk/debug/Initialize(mapload)
. = ..()
stored_research = new /datum/techweb/admin
/obj/item/research_notes
name = "research notes"
desc = "Valuable scientific data. Use it in a research console to scan it."
icon = 'icons/obj/bureaucracy.dmi'
icon_state = "paper"
item_state = "paper"
w_class = WEIGHT_CLASS_SMALL
/// What research points it holds
var/list/points = 0
/// What type of research points it holds, only used for mapping
var/list/point_type = TECHWEB_POINT_TYPE_GENERIC
///origin of the research
var/origin_type = "shit code"
///if it ws merged with different origins to apply a bonus
var/mixed = FALSE
/obj/item/research_notes/Initialize(mapload, _points, _point_type, _origin_type)
. = ..()
if(_points)
points = _points
if(_point_type)
point_type = _point_type
if(points && !islist(points))
points = list("[point_type]" = points)
if(_origin_type)
origin_type = _origin_type
change_vol()
/obj/item/research_notes/examine(mob/user)
. = ..()
. += span_notice("It is worth [get_value()] research points.")
/// proc that changes name and icon depending on value
/obj/item/research_notes/proc/change_vol()
var/value = get_value()
if(value >= 10000)
name = "revolutionary discovery in the field of [origin_type]"
icon_state = "docs_verified"
return
else if(value >= 2500)
name = "essay about [origin_type]"
icon_state = "paper_words"
return
else if(value >= 100)
name = "notes of [origin_type]"
icon_state = "paperslip_words"
return
else
name = "fragmentary data of [origin_type]"
icon_state = "scrap"
return
/// proc that returns the total amount of points
/obj/item/research_notes/proc/get_value()
var/value
for(var/point_type in points)
value += points[point_type]
return value
/// proc when you slap research notes into another one
/obj/item/research_notes/proc/merge(obj/item/research_notes/new_paper)
for(var/point_type in TECHWEB_POINT_TYPE_LIST_ASSOCIATIVE_NAMES) // Closest thing I can find to a list of all point types
var/new_value = points[point_type] + new_paper.points[point_type]
if(new_value)
points[point_type] = new_value
if(origin_type != new_paper.origin_type)
origin_type = "[origin_type] and [new_paper.origin_type]"
change_vol()
qdel(new_paper)
/obj/item/research_notes/attackby(obj/item/I, mob/user, params)
. = ..()
if(istype(I, /obj/item/research_notes))
var/obj/item/research_notes/R = I
merge(R)
return TRUE