-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharaña.dm
207 lines (192 loc) · 6.62 KB
/
araña.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
#define SPINNING_WEB 1
#define LAYING_EGGS 2
#define MOVING_TO_TARGET 3
#define SPINNING_COCOON 4
//basic spider mob, these generally guard nests
/mob/living/simple_animal/hostile/giant_spider
name = "giant spider"
desc = "Furry and black, it makes you shudder to look at it has medium sized fangs dripping corrosive liquid, this one looks bigger and has deep red eyes."
icon_state = "guard"
icon_living = "guard"
icon_dead = "guard_dead"
speak_emote = list("chitters")
emote_hear = list("chitters")
speak_chance = 5
turns_per_move = 5
see_in_dark = 70
break_stuff_probability = 100
meat_type = /obj/item/reagent_container/food/snacks/bearmeat
response_help = "pets the"
response_disarm = "gently pushes aside the"
response_harm = "pokes the"
stop_automated_movement_when_pulled = 0
maxHealth = 250
health = 250
melee_damage_lower = 15
melee_damage_upper = 20
heat_damage_per_tick = 20
cold_damage_per_tick = 20
var/poison_per_bite = 5
var/poison_type = "toxin" "iota"
faction = "spiders"
var/busy = FALSE
move_to_delay = 6
speed = 3
//nursemaids - these create webs and eggs
/mob/living/simple_animal/hostile/giant_spider/nurse
desc = "Furry and black, it makes you shudder to look at it has small fangs dripping a sickling looking liquid, this one has brilliant green eyes."
icon_state = "nurse"
icon_living = "nurse"
icon_dead = "nurse_dead"
maxHealth = 150
health = 150
melee_damage_lower = 5
melee_damage_upper = 10
poison_per_bite = 10
var/atom/cocoon_target
poison_type = "stoxin"
var/fed = 0
//hunters have the most poison and move the fastest, so they can find prey
/mob/living/simple_animal/hostile/giant_spider/hunter
desc = "Furry and black, it makes you shudder to look at it has protuding big fangs dripping corrosive liquid, this one has sparkling purple eyes."
icon_state = "hunter"
icon_living = "hunter"
icon_dead = "hunter_dead"
maxHealth = 120
health = 120
melee_damage_lower = 10
melee_damage_upper = 20
poison_per_bite = 5
move_to_delay = 4
/mob/living/simple_animal/hostile/giant_spider/initialize_pass_flags(datum/pass_flags_container/PF)
..()
if (PF)
PF.flags_pass = PASS_FLAGS_CRAWLER
/mob/living/simple_animal/hostile/giant_spider/AttackingTarget()
..()
if(isliving(target_mob))
var/mob/living/L = target_mob
if(L.reagents)
L.reagents.add_reagent("toxin", "iota", poison_per_bite)
if(prob(poison_per_bite))
to_chat(L, SPAN_DANGER("You feel a tiny prick."))
L.reagents.add_reagent(poison_type, 10)
/mob/living/simple_animal/hostile/giant_spider/Life(delta_time)
..()
if(!stat)
if(stance == HOSTILE_STANCE_IDLE)
//1% chance to skitter madly away
if(!busy && prob(1))
/*var/list/move_targets = list()
for(var/turf/T as anything in ORANGE_TURFS(20, src))
move_targets.Add(T)*/
stop_automated_movement = 1
walk_to(src, pick(orange(20, src)), 1, move_to_delay)
spawn(50)
stop_automated_movement = 0
walk(src,0)
/mob/living/simple_animal/hostile/giant_spider/nurse/proc/GiveUp(C)
spawn(100)
if(busy == MOVING_TO_TARGET)
if(cocoon_target == C && get_dist(src,cocoon_target) > 1)
cocoon_target = null
busy = FALSE
stop_automated_movement = 0
/mob/living/simple_animal/hostile/giant_spider/nurse/Life(delta_time)
..()
if(!stat)
if(stance == HOSTILE_STANCE_IDLE)
var/list/can_see = view(src, 10)
//30% chance to stop wandering and do something
if(!busy && prob(30))
//first, check for potential food nearby to cocoon
for(var/mob/living/carbon/C in can_see)
if(C.stat)
cocoon_target = C
busy = MOVING_TO_TARGET
walk_to(src, C, 1, move_to_delay)
//give up if we can't reach them after 10 seconds
GiveUp(C)
return
//second, spin a sticky spiderweb on this tile
var/obj/effect/spider/stickyweb/W = locate() in get_turf(src)
if(!W)
busy = SPINNING_WEB
src.visible_message(SPAN_NOTICE("\the [src] begins to secrete a sticky substance."))
stop_automated_movement = 1
spawn(40)
if(busy == SPINNING_WEB)
new /obj/effect/spider/stickyweb(src.loc)
busy = FALSE
stop_automated_movement = 0
else
//third, lay an egg cluster there
var/obj/effect/spider/eggcluster/E = locate() in get_turf(src)
if(!E && fed > 0)
busy = LAYING_EGGS
src.visible_message(SPAN_NOTICE("\the [src] begins to lay a cluster of eggs."))
stop_automated_movement = 1
spawn(50)
if(busy == LAYING_EGGS)
E = locate() in get_turf(src)
if(!E)
new /obj/effect/spider/eggcluster(src.loc)
fed--
busy = FALSE
stop_automated_movement = 0
else
//fourthly, cocoon any nearby items so those pesky pinkskins can't use them
for(var/obj/O in can_see)
if(O.anchored)
continue
if(istype(O, /obj/item) || istype(O, /obj/structure) || istype(O, /obj/structure/machinery))
cocoon_target = O
busy = MOVING_TO_TARGET
stop_automated_movement = 1
walk_to(src, O, 1, move_to_delay)
//give up if we can't reach them after 10 seconds
GiveUp(O)
else if(busy == MOVING_TO_TARGET && cocoon_target)
if(get_dist(src, cocoon_target) <= 1)
busy = SPINNING_COCOON
src.visible_message(SPAN_NOTICE("\the [src] begins to secrete a sticky substance around \the [cocoon_target]."))
stop_automated_movement = 1
walk(src,0)
spawn(50)
if(busy == SPINNING_COCOON)
if(cocoon_target && istype(cocoon_target.loc, /turf) && get_dist(src,cocoon_target) <= 1)
var/obj/effect/spider/cocoon/C = new(cocoon_target.loc)
var/large_cocoon = 0
C.pixel_x = cocoon_target.pixel_x
C.pixel_y = cocoon_target.pixel_y
for(var/mob/living/M in C.loc)
if(istype(M, /mob/living/simple_animal/hostile/giant_spider))
continue
large_cocoon = 1
fed++
src.visible_message(SPAN_DANGER("\the [src] sticks a proboscis into \the [cocoon_target] and sucks a viscous substance out."))
M.forceMove(C)
C.pixel_x = M.pixel_x
C.pixel_y = M.pixel_y
break
for(var/obj/item/I in C.loc)
I.forceMove(C)
for(var/obj/structure/S in C.loc)
if(!S.anchored)
S.forceMove(C)
large_cocoon = 1
for(var/obj/structure/machinery/M in C.loc)
if(!M.anchored)
M.forceMove(C)
large_cocoon = 1
if(large_cocoon)
C.icon_state = pick("cocoon_large1","cocoon_large2","cocoon_large3")
busy = FALSE
stop_automated_movement = 0
else
busy = FALSE
stop_automated_movement = 0
#undef SPINNING_WEB
#undef LAYING_EGGS
#undef MOVING_TO_TARGET
#undef SPINNING_COCOON