/
goose.dm
264 lines (237 loc) · 8.97 KB
/
goose.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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#define GOOSE_SATIATED 50
/mob/living/simple_animal/hostile/retaliate/goose
name = "goose"
desc = "It's loose"
icon_state = "goose" // sprites by cogwerks from goonstation, used with permission
icon_living = "goose"
icon_dead = "goose_dead"
mob_biotypes = MOB_ORGANIC|MOB_BEAST
speak_chance = 0
turns_per_move = 5
butcher_results = list(/obj/item/food/meat/slab = 2)
response_help_continuous = "pets"
response_help_simple = "pet"
response_disarm_continuous = "gently pushes aside"
response_disarm_simple = "gently push aside"
response_harm_continuous = "kicks"
response_harm_simple = "kick"
emote_taunt = list("hisses")
taunt_chance = 30
speed = 0
maxHealth = 25
health = 25
harm_intent_damage = 5
melee_damage_lower = 5
melee_damage_upper = 5
attack_verb_continuous = "pecks"
attack_verb_simple = "peck"
attack_sound = "goose"
speak_emote = list("honks")
faction = list("neutral")
attack_same = TRUE
gold_core_spawnable = HOSTILE_SPAWN
var/random_retaliate = TRUE
var/icon_vomit_start = "vomit_start"
var/icon_vomit = "vomit"
var/icon_vomit_end = "vomit_end"
var/message_cooldown = 0
var/list/nummies = list()
var/choking = FALSE
/mob/living/simple_animal/hostile/retaliate/goose/Initialize()
. = ..()
RegisterSignal(src, COMSIG_MOVABLE_MOVED, .proc/goosement)
/mob/living/simple_animal/hostile/retaliate/goose/proc/goosement(atom/movable/AM, OldLoc, Dir, Forced)
if(stat == DEAD)
return
nummies.Cut()
nummies += loc.contents
if(prob(5) && random_retaliate)
Retaliate()
/mob/living/simple_animal/hostile/retaliate/goose/handle_automated_action()
if(length(nummies))
var/obj/item/E = locate() in nummies
if(E && E.loc == loc)
feed(E)
nummies -= E
/mob/living/simple_animal/hostile/retaliate/goose/vomit/handle_automated_action()
if(length(nummies))
var/obj/item/E = pick(nummies)
if(!E.has_material_type(/datum/material/plastic))
nummies -= E // remove non-plastic item from queue
E = locate(/obj/item/reagent_containers/food) in nummies // find food
if(E && E.loc == loc)
feed(E)
nummies -= E
/mob/living/simple_animal/hostile/retaliate/goose/proc/feed(obj/item/suffocator)
if(stat == DEAD || choking) // plapatin I swear to god
return FALSE
if(suffocator.has_material_type(/datum/material/plastic)) // dumb goose'll swallow food or drink with plastic in it
visible_message("<span class='danger'>[src] hungrily gobbles up \the [suffocator]! </span>")
visible_message("<span class='boldwarning'>[src] is choking on \the [suffocator]! </span>")
suffocator.forceMove(src)
choke(suffocator)
choking = TRUE
return TRUE
/mob/living/simple_animal/hostile/retaliate/goose/vomit
name = "Birdboat"
real_name = "Birdboat"
desc = "It's a sick-looking goose, probably ate too much maintenance trash. Best not to move it around too much."
gender = MALE
response_help_continuous = "pets"
response_help_simple = "pet"
response_disarm_continuous = "gently pushes aside"
response_disarm_simple = "gently push aside"
response_harm_continuous = "kicks"
response_harm_simple = "kick"
gold_core_spawnable = NO_SPAWN
random_retaliate = FALSE
var/vomiting = FALSE
var/vomitCoefficient = 1
var/vomitTimeBonus = 0
var/datum/action/cooldown/vomit/goosevomit
/mob/living/simple_animal/hostile/retaliate/goose/vomit/Initialize()
. = ..()
goosevomit = new
goosevomit.Grant(src)
// 5% chance every round to have anarchy mode deadchat control on birdboat.
if(prob(5))
desc = "[initial(desc)] It's waddling more than usual. It seems to be possessed."
deadchat_plays()
/mob/living/simple_animal/hostile/retaliate/goose/vomit/Destroy()
UnregisterSignal(src, COMSIG_MOVABLE_MOVED)
QDEL_NULL(goosevomit)
return ..()
/mob/living/simple_animal/hostile/retaliate/goose/vomit/examine(user)
. = ..()
. += "<span class='notice'>Somehow, it still looks hungry.</span>"
/mob/living/simple_animal/hostile/retaliate/goose/attackby(obj/item/O, mob/user)
. = ..()
if(feed(O))
return TRUE
/mob/living/simple_animal/hostile/retaliate/goose/vomit/feed(obj/item/reagent_containers/food/tasty)
. = ..()
if(. || !istype(tasty))
return FALSE
if (contents.len > GOOSE_SATIATED)
if(message_cooldown < world.time)
visible_message("<span class='notice'>[src] looks too full to eat \the [tasty]!</span>")
message_cooldown = world.time + 5 SECONDS
return FALSE
if (tasty.foodtype & GROSS)
visible_message("<span class='notice'>[src] hungrily gobbles up \the [tasty]!</span>")
tasty.forceMove(src)
playsound(src,'sound/items/eatfood.ogg', 70, TRUE)
vomitCoefficient += 3
vomitTimeBonus += 2
return TRUE
else
if(message_cooldown < world.time)
visible_message("<span class='notice'>[src] refuses to eat \the [tasty].</span>")
message_cooldown = world.time + 5 SECONDS
return FALSE
/mob/living/simple_animal/hostile/retaliate/goose/proc/choke(obj/item/reagent_containers/food/plastic)
if(stat == DEAD || choking)
return
addtimer(CALLBACK(src, .proc/suffocate), 300)
/mob/living/simple_animal/hostile/retaliate/goose/vomit/choke(obj/item/reagent_containers/food/plastic)
if(stat == DEAD || choking)
return
if(prob(25))
visible_message("<span class='warning'>[src] is gagging on \the [plastic]!</span>")
manual_emote("gags!")
addtimer(CALLBACK(src, .proc/vomit), 300)
else
addtimer(CALLBACK(src, .proc/suffocate), 300)
/mob/living/simple_animal/hostile/retaliate/goose/Life(delta_time = SSMOBS_DT, times_fired)
. = ..()
if(choking && !stat)
do_jitter_animation(50)
if(DT_PROB(10, delta_time))
emote("gasp")
/mob/living/simple_animal/hostile/retaliate/goose/proc/suffocate()
if(!choking)
return
deathmessage = "lets out one final oxygen-deprived honk before [p_they()] go[p_es()] limp and lifeless.."
death()
/mob/living/simple_animal/hostile/retaliate/goose/vomit/proc/vomit()
if (stat == DEAD)
return
var/turf/T = get_turf(src)
var/obj/item/reagent_containers/food/consumed = locate() in contents //Barf out a single food item from our guts
choking = FALSE // assume birdboat is vomiting out whatever he was choking on
if (prob(50) && consumed)
barf_food(consumed)
else
playsound(T, 'sound/effects/splat.ogg', 50, TRUE)
T.add_vomit_floor(src)
/mob/living/simple_animal/hostile/retaliate/goose/vomit/proc/barf_food(atom/A, hard = FALSE)
if (stat == DEAD)
return
if(!istype(A, /obj/item/reagent_containers/food))
return
var/turf/currentTurf = get_turf(src)
var/obj/item/reagent_containers/food/consumed = A
consumed.forceMove(currentTurf)
var/destination = get_edge_target_turf(currentTurf, pick(GLOB.alldirs)) //Pick a random direction to toss them in
var/throwRange = hard ? rand(2,8) : 1
consumed.safe_throw_at(destination, throwRange, 2) //Thow the food at a random tile 1 spot away
sleep(2)
if (QDELETED(src) || QDELETED(consumed))
return
currentTurf = get_turf(consumed)
currentTurf.add_vomit_floor(src)
playsound(currentTurf, 'sound/effects/splat.ogg', 50, TRUE)
/mob/living/simple_animal/hostile/retaliate/goose/vomit/proc/vomit_prestart(duration)
flick("vomit_start",src)
addtimer(CALLBACK(src, .proc/vomit_start, duration), 13) //13 is the length of the vomit_start animation in gooseloose.dmi
/mob/living/simple_animal/hostile/retaliate/goose/vomit/proc/vomit_start(duration)
vomiting = TRUE
icon_state = "vomit"
vomit()
addtimer(CALLBACK(src, .proc/vomit_preend), duration)
/mob/living/simple_animal/hostile/retaliate/goose/vomit/proc/vomit_preend()
for (var/obj/item/consumed in contents) //Get rid of any food left in the poor thing
barf_food(consumed, TRUE)
sleep(1)
if (QDELETED(src))
return
vomit_end()
/mob/living/simple_animal/hostile/retaliate/goose/vomit/proc/vomit_end()
flick("vomit_end",src)
vomiting = FALSE
icon_state = initial(icon_state)
/mob/living/simple_animal/hostile/retaliate/goose/vomit/goosement(atom/movable/AM, OldLoc, Dir, Forced)
. = ..()
if(vomiting)
vomit() // its supposed to keep vomiting if you move
return
if(prob(vomitCoefficient * 0.2))
vomit_prestart(vomitTimeBonus + 25)
vomitCoefficient = 1
vomitTimeBonus = 0
/// A proc to make it easier for admins to make the goose playable by deadchat.
/mob/living/simple_animal/hostile/retaliate/goose/vomit/deadchat_plays(mode = ANARCHY_MODE, cooldown = 12 SECONDS)
. = AddComponent(/datum/component/deadchat_control/cardinal_movement, mode, list(
"vomit" = CALLBACK(src, .proc/vomit_prestart, 25),
"honk" = CALLBACK(src, /atom/movable.proc/say, "HONK!!!"),
"spin" = CALLBACK(src, /mob.proc/emote, "spin")), cooldown, CALLBACK(src, .proc/stop_deadchat_plays))
if(. == COMPONENT_INCOMPATIBLE)
return
stop_automated_movement = TRUE
/datum/action/cooldown/vomit
name = "Vomit"
check_flags = AB_CHECK_CONSCIOUS
button_icon_state = "vomit"
icon_icon = 'icons/mob/animal.dmi'
cooldown_time = 250
/datum/action/cooldown/vomit/Trigger()
if(!..())
return FALSE
if(!istype(owner, /mob/living/simple_animal/hostile/retaliate/goose/vomit))
return FALSE
var/mob/living/simple_animal/hostile/retaliate/goose/vomit/vomit = owner
if(!vomit.vomiting)
vomit.vomit_prestart(vomit.vomitTimeBonus + 25)
vomit.vomitCoefficient = 1
vomit.vomitTimeBonus = 0
return TRUE