/
legion_tumour.dm
159 lines (138 loc) · 6.09 KB
/
legion_tumour.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/// Left behind when a legion infects you, for medical enrichment
/obj/item/organ/internal/legion_tumour
name = "legion tumour"
desc = "A mass of pulsing flesh and dark tendrils, containing the power to regenerate flesh at a terrible cost."
failing_desc = "pulses and writhes with horrible life, reaching towards you with its tendrils!"
icon = 'icons/obj/medical/organs/mining_organs.dmi'
icon_state = "legion_remains"
zone = BODY_ZONE_CHEST
slot = ORGAN_SLOT_PARASITE_EGG
decay_factor = STANDARD_ORGAN_DECAY * 3 // About 5 minutes outside of a host
/// What stage of growth the corruption has reached.
var/stage = 0
/// We apply this status effect periodically or when used on someone
var/applied_status = /datum/status_effect/regenerative_core
/// How long have we been in this stage?
var/elapsed_time = 0 SECONDS
/// How long does it take to advance one stage?
var/growth_time = 80 SECONDS // Long enough that if you go back to lavaland without realising it you're not totally fucked
/// What kind of mob will we transform into?
var/spawn_type = /mob/living/basic/mining/legion
/// Spooky sounds to play as you start to turn
var/static/list/spooky_sounds = list(
'sound/voice/lowHiss1.ogg',
'sound/voice/lowHiss2.ogg',
'sound/voice/lowHiss3.ogg',
'sound/voice/lowHiss4.ogg',
)
/obj/item/organ/internal/legion_tumour/Initialize(mapload)
. = ..()
animate_pulse()
/obj/item/organ/internal/legion_tumour/apply_organ_damage(damage_amount, maximum, required_organ_flag)
var/was_failing = organ_flags & ORGAN_FAILING
. = ..()
if (was_failing != (organ_flags & ORGAN_FAILING))
animate_pulse()
/obj/item/organ/internal/legion_tumour/set_organ_damage(damage_amount, required_organ_flag)
. = ..()
animate_pulse()
/// Do a heartbeat animation depending on if we're failing or not
/obj/item/organ/internal/legion_tumour/proc/animate_pulse()
animate(src, transform = matrix()) // Stop any current animation
var/speed_divider = organ_flags & ORGAN_FAILING ? 2 : 1
animate(src, transform = matrix().Scale(1.1), time = 0.5 SECONDS / speed_divider, easing = SINE_EASING | EASE_OUT, loop = -1, flags = ANIMATION_PARALLEL)
animate(transform = matrix(), time = 0.5 SECONDS / speed_divider, easing = SINE_EASING | EASE_IN)
animate(transform = matrix(), time = 2 SECONDS / speed_divider)
/obj/item/organ/internal/legion_tumour/Remove(mob/living/carbon/egg_owner, special, movement_flags)
. = ..()
stage = 0
elapsed_time = 0
/obj/item/organ/internal/legion_tumour/attack(mob/living/target, mob/living/user, params)
if (try_apply(target, user))
qdel(src)
return
return ..()
/// Smear it on someone like a regen core, why not. Make sure they're alive though.
/obj/item/organ/internal/legion_tumour/proc/try_apply(mob/living/target, mob/user)
if(!user.Adjacent(target) || !isliving(target))
return FALSE
if (target.stat <= SOFT_CRIT && !(organ_flags & ORGAN_FAILING))
target.add_mood_event(MOOD_CATEGORY_LEGION_CORE, /datum/mood_event/healsbadman)
target.apply_status_effect(applied_status)
if (target != user)
target.visible_message(span_notice("[user] splatters [target] with [src]... Disgusting tendrils pull [target.p_their()] wounds shut!"))
else
to_chat(user, span_notice("You smear [src] on yourself. Disgusting tendrils pull your wounds closed."))
return TRUE
if (!ishuman(target))
return FALSE
target.visible_message(span_boldwarning("[user] splatters [target] with [src]... and it springs into horrible life!"))
var/mob/living/basic/legion_brood/skull = new(target.loc)
skull.melee_attack(target)
return TRUE
/obj/item/organ/internal/legion_tumour/on_life(seconds_per_tick, times_fired)
. = ..()
if (QDELETED(src) || QDELETED(owner))
return
if (stage >= 2)
if(SPT_PROB(stage / 5, seconds_per_tick))
to_chat(owner, span_notice("You feel a bit better."))
owner.apply_status_effect(applied_status) // It's not all bad!
if(SPT_PROB(1, seconds_per_tick))
owner.emote("twitch")
switch(stage)
if(2, 3)
if(SPT_PROB(1, seconds_per_tick))
to_chat(owner, span_danger("Your chest spasms!"))
if(SPT_PROB(1, seconds_per_tick))
to_chat(owner, span_danger("You feel weak."))
if(SPT_PROB(1, seconds_per_tick))
SEND_SOUND(owner, sound(pick(spooky_sounds)))
if(SPT_PROB(2, seconds_per_tick))
owner.vomit()
if(4, 5)
if(SPT_PROB(2, seconds_per_tick))
to_chat(owner, span_danger("Something flexes under your skin."))
if(SPT_PROB(2, seconds_per_tick))
if (prob(40))
SEND_SOUND(owner, sound('sound/voice/ghost_whisper.ogg'))
else
SEND_SOUND(owner, sound(pick(spooky_sounds)))
if(SPT_PROB(3, seconds_per_tick))
owner.vomit(vomit_type = /obj/effect/decal/cleanable/vomit/old/black_bile)
if (prob(50))
var/turf/check_turf = get_step(owner.loc, owner.dir)
var/atom/land_turf = (check_turf.is_blocked_turf()) ? owner.loc : check_turf
var/mob/living/basic/legion_brood/child = new(land_turf)
child.assign_creator(owner, copy_full_faction = FALSE)
if(SPT_PROB(3, seconds_per_tick))
to_chat(owner, span_danger("Your muscles ache."))
owner.take_bodypart_damage(3)
if (stage == 5)
if (SPT_PROB(10, seconds_per_tick))
infest()
return
elapsed_time += seconds_per_tick SECONDS * ((organ_flags & ORGAN_FAILING) ? 3 : 1) // Let's call it "matured" rather than failed
if (elapsed_time < growth_time)
return
stage++
elapsed_time = 0
if (stage == 5)
to_chat(owner, span_bolddanger("Something is moving under your skin!"))
/// Consume our host
/obj/item/organ/internal/legion_tumour/proc/infest()
if (QDELETED(src) || QDELETED(owner))
return
owner.visible_message(span_boldwarning("Black tendrils burst from [owner]'s flesh, covering them in amorphous flesh!"))
var/mob/living/basic/mining/legion/new_legion = new spawn_type(owner.loc)
new_legion.consume(owner)
qdel(src)
/obj/item/organ/internal/legion_tumour/on_find(mob/living/finder)
. = ..()
to_chat(finder, span_warning("There's an enormous tumour in [owner]'s [zone]!"))
if(stage < 4)
to_chat(finder, span_notice("Its tendrils seem to twitch towards the light."))
return
to_chat(finder, span_notice("Its pulsing tendrils reach all throughout the body."))
if(prob(stage * 2))
infest()