This repository has been archived by the owner on Sep 12, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
research_disk.dm
95 lines (83 loc) · 2.81 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
/obj/item/disk/tech_disk
name = "technology disk"
desc = "A disk for storing technology data for further research."
icon_state = "datadisk0"
custom_materials = list(/datum/material/iron=300, /datum/material/glass=100)
var/datum/techweb/stored_research
/obj/item/disk/tech_disk/Initialize()
. = ..()
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"
custom_materials = null
/obj/item/disk/tech_disk/debug/Initialize()
. = ..()
stored_research = new /datum/techweb/admin
/obj/item/disk/tech_disk/major
name = "Reformatted technology disk"
desc = "A disk containing a new, completed tech from the B.E.P.I.S. Upload the disk to an R&D Console to redeem the tech."
icon_state = "rndmajordisk"
custom_materials = list(/datum/material/iron=300, /datum/material/glass=100)
/obj/item/disk/tech_disk/major/Initialize()
. = ..()
stored_research = new /datum/techweb/bepis
/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
///research points it holds
var/value = 69
///origin of the research
var/origin_type = "debug"
///if it ws merged with different origins to apply a bonus
var/mixed = FALSE
/obj/item/research_notes/Initialize(mapload, _value, _origin_type)
. = ..()
if(_value)
value = _value
if(_origin_type)
origin_type = _origin_type
change_vol()
/obj/item/research_notes/examine(mob/user)
. = ..()
. += "<span class='notice'>It is worth [value] research points.</span>"
/// proc that changes name and icon depending on value
/obj/item/research_notes/proc/change_vol()
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 when you slap research notes into another one, it applies a bonus if they are of different origin (only applied once)
/obj/item/research_notes/proc/merge(obj/item/research_notes/new_paper)
var/bonus = min(value , new_paper.value)
value = value + new_paper.value
if(origin_type != new_paper.origin_type && !mixed)
value += bonus * 0.3
origin_type = "[origin_type] and [new_paper.origin_type]"
mixed = TRUE
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