forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathbase_xeno.dm
216 lines (179 loc) · 8.25 KB
/
base_xeno.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/// MODULE _XENO_REDO
/mob/living/carbon/alien/adult/banda
name = "rare bugged alien"
icon = 'modular_bandastation/xeno_rework/icons/big_xenos.dmi'
rotate_on_lying = FALSE
base_pixel_x = -16 //All of the xeno sprites are 64x64, and we want them to be level with the tile they are on, much like oversized quirk users
mob_size = MOB_SIZE_LARGE
layer = LARGE_MOB_LAYER //above most mobs, but below speechbubbles
plane = ABOVE_GAME_PLANE
maptext_height = 64
maptext_width = 64
pressure_resistance = 200
/// What icon file update_held_items will look for when making inhands for xenos
var/alt_inhands_file = 'modular_bandastation/xeno_rework/icons/big_xenos.dmi'
/// Setting this will give a xeno generic_evolve set to evolve them into this type
var/next_evolution
/// Keeps track of if a xeno has evolved recently, if so then we prevent them from evolving until that time is up
var/has_evolved_recently = FALSE
/// How long xenos should be unable to evolve after recently evolving
var/evolution_cooldown_time = 90 SECONDS
/// Determines if a xeno is unable to use abilities
var/unable_to_use_abilities = FALSE
/// Pixel X shifting of the on fire overlay
var/on_fire_pixel_x = 16
/// Pixel Y shifting of the on fire overlay
var/on_fire_pixel_y = 16
/mob/living/carbon/alien/adult/banda/Initialize(mapload)
. = ..()
AddComponent(/datum/component/seethrough_mob)
GRANT_ACTION(/datum/action/cooldown/alien/banda/sleepytime)
if(next_evolution)
GRANT_ACTION(/datum/action/cooldown/alien/banda/generic_evolve)
pixel_x = -16
ADD_TRAIT(src, TRAIT_XENO_HEAL_AURA, TRAIT_XENO_INNATE)
real_name = "alien [caste]"
/// Called when a larva or xeno evolves, adds a configurable timer on evolving again to the xeno
/mob/living/carbon/alien/adult/banda/proc/has_just_evolved()
if(has_evolved_recently)
return
has_evolved_recently = TRUE
addtimer(CALLBACK(src, PROC_REF(can_evolve_once_again)), evolution_cooldown_time)
/// Allows xenos to evolve again if they are currently unable to
/mob/living/carbon/alien/adult/banda/proc/can_evolve_once_again()
if(!has_evolved_recently)
return
has_evolved_recently = FALSE
/datum/action/cooldown/alien/banda
button_icon = 'modular_bandastation/xeno_rework/icons/xeno_actions.dmi'
/// Some xeno abilities block other abilities from being used, this allows them to get around that in cases where it is needed
var/can_be_used_always = FALSE
/datum/action/cooldown/alien/banda/IsAvailable(feedback = FALSE)
. = ..()
if(!.)
return FALSE
if(can_be_used_always)
return TRUE
var/mob/living/carbon/alien/adult/banda/owner_alien = owner
if(!istype(owner_alien) || owner_alien.unable_to_use_abilities)
return FALSE
/datum/action/cooldown/alien/banda/sleepytime //I don't think this has a mechanical advantage but they have cool resting sprites so...
name = "Rest"
desc = "Иногда даже кровожадным чужим нужно немного полежать."
button_icon_state = "sleepytime"
/datum/action/cooldown/alien/banda/sleepytime/Activate()
var/mob/living/carbon/sleepytime_mob = owner
if(!isalien(owner))
return FALSE
if(!sleepytime_mob.resting)
sleepytime_mob.set_resting(new_resting = TRUE, silent = FALSE, instant = TRUE)
return TRUE
sleepytime_mob.set_resting(new_resting = FALSE, silent = FALSE, instant = FALSE)
return TRUE
/datum/action/cooldown/alien/banda/generic_evolve
name = "Evolve"
desc = "Позволяет нам эволюционировать в высшую касту нашего типа, если такая ещё не существует."
button_icon_state = "evolution"
/// What type this ability will turn the owner into upon completion
var/type_to_evolve_into
/datum/action/cooldown/alien/banda/generic_evolve/Grant(mob/grant_to)
. = ..()
if(!isalien(owner))
return
var/mob/living/carbon/alien/target_alien = owner
plasma_cost = target_alien.get_max_plasma() //This ability should always require that a xeno be at their max plasma capacity to use
/datum/action/cooldown/alien/banda/generic_evolve/Activate()
var/mob/living/carbon/alien/adult/banda/evolver = owner
if(!istype(evolver))
to_chat(owner, span_warning("You aren't an alien, you can't evolve!"))
return FALSE
type_to_evolve_into = evolver.next_evolution
if(!type_to_evolve_into)
to_chat(evolver, span_bolddanger("Something is wrong... We can't evolve into anything? (This is broken report it on GitHub)"))
CRASH("Couldn't find an evolution for [owner] ([owner.type]).")
if(!isturf(evolver.loc))
return FALSE
if(get_alien_type(type_to_evolve_into))
evolver.balloon_alert(evolver, "Слишком много наших эволюционировавших форм уже существует.")
return FALSE
var/obj/item/organ/alien/hivenode/node = evolver.get_organ_by_type(/obj/item/organ/alien/hivenode)
if(!node)
to_chat(evolver, span_bolddanger("Мы не ощущаем связь нашего узла с ульем... Мы не можем эволюционировать!"))
return FALSE
if(node.recent_queen_death)
to_chat(evolver, span_bolddanger("Смерть нашей королевы... Мы не можем собрать достаточно ментальной энергии, чтобы эволюционировать..."))
return FALSE
if(evolver.has_evolved_recently)
evolver.balloon_alert(evolver, "сможет эволюционировать через 1.5 минуты") //Make that 1.5 variable later, but it keeps fucking up for me :(
return FALSE
var/new_beno = new type_to_evolve_into(evolver.loc)
evolver.alien_evolve(new_beno)
return TRUE
/datum/movespeed_modifier/alien_quick
multiplicative_slowdown = -0.5
/datum/movespeed_modifier/alien_slow
multiplicative_slowdown = 0.5
/datum/movespeed_modifier/alien_heavy
multiplicative_slowdown = 1
/datum/movespeed_modifier/alien_big
multiplicative_slowdown = 2
/mob/living/carbon/alien/adult/banda/update_held_items()
..()
remove_overlay(HANDS_LAYER)
var/list/hands = list()
var/obj/item/l_hand = get_item_for_held_index(1)
if(l_hand)
var/itm_state = l_hand.inhand_icon_state
if(!itm_state)
itm_state = l_hand.icon_state
var/mutable_appearance/l_hand_item = mutable_appearance(alt_inhands_file, "[itm_state][caste]_l", -HANDS_LAYER)
if(l_hand.blocks_emissive)
l_hand_item.overlays += emissive_blocker(l_hand_item.icon, l_hand_item.icon_state, alpha = l_hand_item.alpha)
hands += l_hand_item
var/obj/item/r_hand = get_item_for_held_index(2)
if(r_hand)
var/itm_state = r_hand.inhand_icon_state
if(!itm_state)
itm_state = r_hand.icon_state
var/mutable_appearance/r_hand_item = mutable_appearance(alt_inhands_file, "[itm_state][caste]_r", -HANDS_LAYER)
if(r_hand.blocks_emissive)
r_hand_item.overlays += emissive_blocker(r_hand_item.icon, r_hand_item.icon_state, alpha = r_hand_item.alpha)
hands += r_hand_item
overlays_standing[HANDS_LAYER] = hands
apply_overlay(HANDS_LAYER)
/mob/living/carbon/proc/get_max_plasma()
var/obj/item/organ/alien/plasmavessel/vessel = get_organ_by_type(/obj/item/organ/alien/plasmavessel)
if(!vessel)
return -1
return vessel.max_plasma
/mob/living/carbon/alien/adult/banda/alien_evolve(mob/living/carbon/alien/new_xeno, is_it_a_larva)
var/mob/living/carbon/alien/adult/banda/xeno_to_transfer_to = new_xeno
xeno_to_transfer_to.setDir(dir)
if(!islarva(xeno_to_transfer_to))
xeno_to_transfer_to.has_just_evolved()
if(mind)
mind.name = xeno_to_transfer_to.real_name
mind.transfer_to(xeno_to_transfer_to)
qdel(src)
/mob/living/carbon/alien/adult/banda/findQueen() //Yes we really do need to do this whole thing to let the queen finder work
if(hud_used)
hud_used.alien_queen_finder.cut_overlays()
var/mob/queen = get_alien_type(/mob/living/carbon/alien/adult/banda/queen)
if(!queen)
return
var/turf/Q = get_turf(queen)
var/turf/A = get_turf(src)
if(Q.z != A.z) //The queen is on a different Z level, we cannot sense that far.
return
var/Qdir = get_dir(src, Q)
var/Qdist = get_dist(src, Q)
var/finder_icon = "finder_center" //Overlay showed when adjacent to or on top of the queen!
switch(Qdist)
if(2 to 7)
finder_icon = "finder_near"
if(8 to 20)
finder_icon = "finder_med"
if(21 to INFINITY)
finder_icon = "finder_far"
var/image/finder_eye = image('icons/hud/screen_alien.dmi', finder_icon, dir = Qdir)
hud_used.alien_queen_finder.add_overlay(finder_eye)