-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathcleanable.dm
125 lines (109 loc) · 4.4 KB
/
cleanable.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
/obj/effect/decal/cleanable
gender = PLURAL
layer = ABOVE_NORMAL_TURF_LAYER
var/list/random_icon_states = null
///I'm sorry but cleanable/blood code is ass, and so is blood_DNA
var/blood_state = ""
///0-100, amount of blood in this decal, used for making footprints and affecting the alpha of bloody footprints
var/bloodiness = 0
///When two of these are on a same tile or do we need to merge them into just one?
var/mergeable_decal = TRUE
///The type of cleaning required to clean the decal. See __DEFINES/cleaning.dm for the options
var/clean_type = CLEAN_TYPE_LIGHT_DECAL
///The reagent this decal holds. Leave blank for none.
var/datum/reagent/decal_reagent
///The amount of reagent this decal holds, if decal_reagent is defined
var/reagent_amount = 0
/obj/effect/decal/cleanable/Initialize(mapload, list/datum/disease/diseases)
. = ..()
if (random_icon_states && (icon_state == initial(icon_state)) && length(random_icon_states) > 0)
icon_state = pick(random_icon_states)
create_reagents(300)
if(loc && isturf(loc))
for(var/obj/effect/decal/cleanable/C in loc)
if(C != src && C.type == type && !QDELETED(C))
if (replace_decal(C))
return INITIALIZE_HINT_QDEL
if(LAZYLEN(diseases))
var/list/datum/disease/diseases_to_add = list()
for(var/datum/disease/D in diseases)
if(D.spread_flags & DISEASE_SPREAD_CONTACT_FLUIDS)
diseases_to_add += D
if(LAZYLEN(diseases_to_add))
AddComponent(/datum/component/infective, diseases_to_add)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/decal/cleanable/proc/replace_decal(obj/effect/decal/cleanable/C) // Returns true if we should give up in favor of the pre-existing decal
if(mergeable_decal)
return TRUE
/obj/effect/decal/cleanable/attackby(obj/item/W, mob/user, params)
if((istype(W, /obj/item/reagent_containers/glass) && !istype(W, /obj/item/reagent_containers/glass/rag)) || istype(W, /obj/item/reagent_containers/food/drinks))
if(src.reagents && W.reagents)
. = 1 //so the containers don't splash their content on the src while scooping.
if(!src.reagents.total_volume)
to_chat(user, span_notice("[src] isn't thick enough to scoop up!"))
return
if(W.reagents.total_volume >= W.reagents.maximum_volume)
to_chat(user, span_notice("[W] is full!"))
return
to_chat(user, span_notice("You start scooping up [src] into [W]..."))
var/scoop_time
scoop_time = min((W.reagents.maximum_volume - W.reagents.total_volume), src.reagents.total_volume) //1 second per 10 units scooped
if(do_after(user, scoop_time))
to_chat(user, span_notice("You scoop up [src] into [W]!"))
reagents.trans_to(W, reagents.total_volume, transfered_by = user)
if(!reagents.total_volume) //scooped up all of it
qdel(src)
return
if(W.is_hot()) //todo: make heating a reagent holder proc
if(istype(W, /obj/item/clothing/mask/cigarette))
return
else
var/hotness = W.is_hot()
reagents.expose_temperature(hotness)
to_chat(user, span_notice("You heat [name] with [W]!"))
else
return ..()
/obj/effect/decal/cleanable/ex_act()
if(reagents)
for(var/datum/reagent/R in reagents.reagent_list)
R.on_ex_act()
..()
/obj/effect/decal/cleanable/fire_act(exposed_temperature, exposed_volume)
if(reagents)
reagents.expose_temperature(exposed_temperature)
..()
//Add "bloodiness" of this blood's type, to the human's shoes
//This is on /cleanable because fuck this ancient mess
/obj/effect/decal/cleanable/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
if(iscarbon(AM) && blood_state && bloodiness > 40 && !HAS_TRAIT(AM, TRAIT_LIGHT_STEP))
SEND_SIGNAL(AM, COMSIG_STEP_ON_BLOOD, src)
update_icon()
/**
* Checks if this decal is a valid decal that can be blood crawled in.
*/
/obj/effect/decal/cleanable/proc/can_bloodcrawl_in()
if((blood_state != BLOOD_STATE_OIL) && (blood_state != BLOOD_STATE_NOT_BLOODY))
return bloodiness
return FALSE
/**
* Gets the color associated with the any blood present on this decal. If there is no blood, returns null.
*/
/obj/effect/decal/cleanable/proc/get_blood_color()
switch(blood_state)
if(BLOOD_STATE_HUMAN)
return rgb(149, 10, 10)
if(BLOOD_STATE_XENO)
return rgb(43, 186, 0)
if(BLOOD_STATE_OIL)
return rgb(22, 22, 22)
return null
/obj/effect/decal/cleanable/wash(clean_types)
. = ..()
if (. || (clean_types & clean_type))
qdel(src)
return TRUE
return .