This repository has been archived by the owner on Apr 16, 2021. It is now read-only.
/
hydro_controls.dm
95 lines (84 loc) · 3.77 KB
/
hydro_controls.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
var/datum/hydroponics_controller/hydro_controls
/datum/hydroponics_controller/
// global variable name is currently "hydro_controls"
var/max_harvest_cap = 10 // How many items can be harvested at once.
var/delay_between_harvests = 300 // How long between harvests, in spawn() ticks.
var/list/plant_species = list()
var/list/mutations = list()
var/list/strains = list()
var/image/pot_death_display = null
var/image/pot_health_display = null
var/image/pot_harvest_display = null
proc/set_up()
pot_death_display = image('icons/obj/hydroponics/hydroponics.dmi', "led-dead")
pot_health_display = image('icons/obj/hydroponics/hydroponics.dmi', "led-health")
pot_harvest_display = image('icons/obj/hydroponics/hydroponics.dmi', "led-harv")
for (var/B in typesof(/datum/plantmutation))
if (B == /datum/plantmutation)
continue
src.mutations += new B(src)
for (var/C in typesof(/datum/plant_gene_strain))
if (C == /datum/plant_gene_strain)
continue
src.strains += new C(src)
// You need to do plants after the others or they won't set up properly due to mutations and strains
// not having been set up yet
for (var/A in typesof(/datum/plant))
if (A == /datum/plant)
continue
src.plant_species += new A(src)
spawn(0)
for (var/datum/plant/P in src.plant_species)
for (var/X in P.mutations)
if (ispath(X))
P.mutations += HY_get_mutation_from_path(X)
P.mutations -= X
for (var/X in P.commuts)
if (ispath(X))
P.commuts += HY_get_strain_from_path(X)
P.commuts -= X
/proc/HY_get_species_from_path(var/species_path)
if (!hydro_controls)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Attempt to find species before controller setup")
return null
if (!species_path)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Attempt to find species with null path in controller")
return null
if (!hydro_controls.plant_species.len)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Cant find species due to empty species list in controller")
return null
for (var/datum/plant/P in hydro_controls.plant_species)
if (species_path == P.type)
return P
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Species \"[species_path]\" not found")
return null
/proc/HY_get_mutation_from_path(var/mutation_path)
if (!hydro_controls)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Attempt to find mutation before controller setup")
return null
if (!mutation_path)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Attempt to find mutation with null path in controller")
return null
if (!hydro_controls.mutations.len)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Cant find mutation due to empty mutation list in controller")
return null
for (var/datum/plantmutation/M in hydro_controls.mutations)
if (mutation_path == M.type)
return M
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Mutation \"[mutation_path]\" not found")
return null
/proc/HY_get_strain_from_path(var/strain_path)
if (!hydro_controls)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Attempt to find strain before controller setup")
return null
if (!strain_path)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Attempt to find strain with null path in controller")
return null
if (!hydro_controls.strains.len)
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Cant find strain due to empty strain list in controller")
return null
for (var/datum/plant_gene_strain/S in hydro_controls.strains)
if (strain_path == S.type)
return S
logTheThing("debug", null, null, "<b>Hydro Controller:</b> Strain \"[strain_path]\" not found")
return null