-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathother_mobs.dm
276 lines (227 loc) · 7.61 KB
/
other_mobs.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
265
266
267
268
269
270
271
272
273
274
275
276
/*
Humans:
Adds an exception for gloves, to allow special glove types like the ninja ones.
Otherwise pretty standard.
*/
/mob/living/carbon/human/UnarmedAttack(atom/A, proximity, modifiers)
if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED))
if(src == A)
check_self_for_injuries()
return
if(HAS_TRAIT(A, TRAIT_NOINTERACT))
to_chat(A, span_notice("You can't touch things!"))
return
if(!has_active_hand()) //can't attack without a hand.
var/obj/item/bodypart/check_arm = get_active_hand()
if(check_arm?.bodypart_disabled)
to_chat(src, span_warning("Your [check_arm.name] is in no condition to be used."))
return
to_chat(src, span_notice("You look at your arm and sigh."))
return
// Special glove functions:
// If the gloves do anything, have them return 1 to stop
// normal attack_hand() here.
var/obj/item/clothing/gloves/G = gloves // not typecast specifically enough in defines
if(proximity && istype(G) && G.Touch(A, 1, modifiers))
return
if(SEND_SIGNAL(src, COMSIG_HUMAN_EARLY_UNARMED_ATTACK, A, proximity, modifiers) & COMPONENT_NO_ATTACK_HAND)
return
var/override = 0
for(var/datum/mutation/human/HM in dna.mutations)
override = HM.on_attack_hand(A, proximity)
if(override)
return
SEND_SIGNAL(src, COMSIG_HUMAN_MELEE_UNARMED_ATTACK, A, proximity, modifiers)
if(modifiers[RIGHT_CLICK])
var/secondary_result = A.attack_hand_secondary(src, modifiers)
if(secondary_result == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN || secondary_result == SECONDARY_ATTACK_CONTINUE_CHAIN)
return
else if(secondary_result != SECONDARY_ATTACK_CALL_NORMAL)
CRASH("attack_hand_secondary did not return a SECONDARY_ATTACK_* define.")
A.attack_hand(src, modifiers)
//Return TRUE to cancel other attack hand effects that respect it.
/atom/proc/attack_hand(mob/user, modifiers)
. = FALSE
if(!(interaction_flags_atom & INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND))
add_fingerprint(user)
if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_HAND, user, modifiers) & COMPONENT_NO_ATTACK_HAND)
. = TRUE
if(interaction_flags_atom & INTERACT_ATOM_ATTACK_HAND)
. = _try_interact(user, modifiers)
/// When the user uses their hand on an item while holding right-click
/// Returns a SECONDARY_ATTACK_* value.
/atom/proc/attack_hand_secondary(mob/user, modifiers)
if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_HAND_SECONDARY, user, modifiers) & COMPONENT_CANCEL_ATTACK_CHAIN)
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
return SECONDARY_ATTACK_CALL_NORMAL
//Return a non FALSE value to cancel whatever called this from propagating, if it respects it.
/atom/proc/_try_interact(mob/user, modifiers)
if(IsAdminGhost(user)) //admin abuse
return interact(user)
if(can_interact(user))
return interact(user)
return FALSE
/atom/proc/can_interact(mob/user)
if(!user.can_interact_with(src))
return FALSE
if((interaction_flags_atom & INTERACT_ATOM_REQUIRES_DEXTERITY) && !user.IsAdvancedToolUser())
to_chat(user, span_warning("You don't have the dexterity to do this!"))
return FALSE
if(!(interaction_flags_atom & INTERACT_ATOM_IGNORE_INCAPACITATED) && user.incapacitated((interaction_flags_atom & INTERACT_ATOM_IGNORE_RESTRAINED), !(interaction_flags_atom & INTERACT_ATOM_CHECK_GRAB)))
return FALSE
if(HAS_TRAIT(user, TRAIT_NOINTERACT))
to_chat(user, span_notice("You can't touch things!"))
return FALSE
return TRUE
/atom/ui_status(mob/user)
. = ..()
if(!can_interact(user))
. = min(., UI_UPDATE)
/atom/movable/can_interact(mob/user)
. = ..()
if(!.)
return
if(!anchored && (interaction_flags_atom & INTERACT_ATOM_REQUIRES_ANCHORED))
return FALSE
/atom/proc/interact(mob/user)
if(interaction_flags_atom & INTERACT_ATOM_NO_FINGERPRINT_INTERACT)
add_hiddenprint(user)
add_scent(user)
else
add_fingerprint(user)
if(interaction_flags_atom & INTERACT_ATOM_UI_INTERACT)
return ui_interact(user)
return FALSE
/mob/living/carbon/human/RangedAttack(atom/A, mouseparams)
. = ..()
if(gloves)
var/obj/item/clothing/gloves/G = gloves
var/list/modifiers = params2list(mouseparams)
if(istype(G) && G.Touch(A, 0, modifiers)) // for magic gloves
return
for(var/datum/mutation/human/HM in dna.mutations)
HM.on_ranged_attack(A, mouseparams)
if(isturf(A) && get_dist(src,A) <= 1)
Move_Pulled(A)
return
/*
Animals & All Unspecified
*/
/mob/living/UnarmedAttack(atom/A, proximity, modifiers)
A.attack_animal(src, modifiers)
/atom/proc/attack_animal(mob/user, modifiers)
return
/mob/living/RestrainedClickOn(atom/A)
return
/*
Monkeys
*/
/mob/living/carbon/monkey/UnarmedAttack(atom/A, proximity, modifiers)
A.attack_paw(src, modifiers)
/atom/proc/attack_paw(mob/user, modifiers)
if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_PAW, user) & COMPONENT_NO_ATTACK_HAND)
return TRUE
return FALSE
/*
Monkey RestrainedClickOn() was apparently the
one and only use of all of the restrained click code
(except to stop you from doing things while handcuffed);
moving it here instead of various hand_p's has simplified
things considerably
*/
/mob/living/carbon/monkey/RestrainedClickOn(atom/A)
if(..())
return
if(!combat_mode || !ismob(A))
return
if(is_muzzled())
return
var/mob/living/carbon/ML = A
if(istype(ML))
var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
var/obj/item/bodypart/affecting = null
if(ishuman(ML))
var/mob/living/carbon/human/H = ML
affecting = H.get_bodypart(ran_zone(dam_zone))
var/armor = ML.run_armor_check(affecting, MELEE)
if(prob(75))
ML.apply_damage(rand(1,3), BRUTE, affecting, armor)
ML.visible_message(span_danger("[name] bites [ML]!"), \
span_userdanger("[name] bites [ML]!"))
if(armor >= 2)
return
for(var/thing in diseases)
var/datum/disease/D = thing
ML.ForceContractDisease(D)
else
ML.visible_message(span_danger("[src] has attempted to bite [ML]!"))
/*
Aliens
Defaults to same as monkey in most places
*/
/mob/living/carbon/alien/UnarmedAttack(atom/A, proximity, modifiers)
A.attack_alien(src, modifiers)
/atom/proc/attack_alien(mob/living/carbon/alien/user, modifiers)
attack_paw(user, modifiers)
return
// Babby aliens
/mob/living/carbon/alien/larva/UnarmedAttack(atom/A, proximity, modifiers)
A.attack_larva(src, modifiers)
/atom/proc/attack_larva(mob/user, modifiers)
return
/*
Slimes
Nothing happening here
*/
/mob/living/simple_animal/slime/UnarmedAttack(atom/A, proximity, modifiers)
if(isturf(A))
return ..()
A.attack_slime(src, proximity, modifiers)
/atom/proc/attack_slime(mob/user, proximity, modifiers)
return
/*
Drones
*/
/mob/living/simple_animal/drone/UnarmedAttack(atom/A, proximity, modifiers)
A.attack_drone(src, modifiers)
/atom/proc/attack_drone(mob/living/simple_animal/drone/user, proximity, modifiers)
attack_hand(user, modifiers) //defaults to attack_hand. Override it when you don't want drones to do same stuff as humans.
/*
True Devil
*/
/mob/living/carbon/true_devil/UnarmedAttack(atom/A, proximity, modifiers)
A.attack_hand(src, modifiers)
/*
Brain
*/
/mob/living/brain/UnarmedAttack(atom/A, proximity, modifiers)//Stops runtimes due to attack_animal being the default
return
/*
pAI
*/
/mob/living/silicon/pai/UnarmedAttack(atom/A, proximity, modifiers)//Stops runtimes due to attack_animal being the default
return
/*
Simple animals
*/
/mob/living/simple_animal/UnarmedAttack(atom/A, proximity, modifiers)
if(!dextrous)
return ..()
if(!ismob(A))
A.attack_hand(src, modifiers)
update_inv_hands()
/*
Hostile animals
*/
/mob/living/simple_animal/hostile/UnarmedAttack(atom/A, proximity, modifiers)
target = A
if(dextrous && !ismob(A))
return ..()
else
AttackingTarget()
/*
New Players:
Have no reason to click on anything at all.
*/
/mob/dead/new_player/ClickOn()
return