-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
pet.dm
111 lines (96 loc) · 2.85 KB
/
pet.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
/mob/living/simple_animal/pet
icon = 'icons/mob/pets.dmi'
mob_size = MOB_SIZE_SMALL
mob_biotypes = MOB_ORGANIC|MOB_BEAST
blood_volume = BLOOD_VOLUME_GENERIC
var/unique_pet = FALSE // if the mob can be renamed
var/obj/item/clothing/neck/petcollar/pcollar
var/collar_type //if the mob has collar sprites, define them.
/// wuv emote for being pet
var/wuv_happy = "looks happy!"
/// wuv emote for being slapped
var/wuv_angy = "looks upset!"
/mob/living/simple_animal/pet/handle_atom_del(atom/A)
if(A == pcollar)
pcollar = null
return ..()
/mob/living/simple_animal/pet/proc/add_collar(obj/item/clothing/neck/petcollar/P, mob/user)
if(QDELETED(P) || pcollar)
return
if(!user.transferItemToLoc(P, src))
return
if(mob_size == MOB_SIZE_TINY)
to_chat(user, span_notice("The [P] is too big for [src]'s neck."))
return
pcollar = P
regenerate_icons()
to_chat(user, span_notice("You put the [P] around [src]'s neck."))
if(P.tagname && !unique_pet)
fully_replace_character_name(null, "\proper [P.tagname]")
/mob/living/simple_animal/pet/Move(NewLoc, direct)
. = ..()
if(!pcollar)
return
if (!(mobility_flags & MOBILITY_STAND))
return
if(loc != NewLoc)
return
if(!has_gravity(loc))
return
SEND_SIGNAL(pcollar, COMSIG_NECK_STEP_ACTION)
/mob/living/simple_animal/pet/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/clothing/neck/petcollar) && !pcollar)
add_collar(O, user)
return
if(istype(O, /obj/item/newspaper))
if(!stat)
user.visible_message("[user] baps [name] on the nose with the rolled up [O].")
spawn(0)
for(var/i in list(1,2,4,8,4,2,1,2))
setDir(i)
sleep(0.1 SECONDS)
else
..()
/mob/living/simple_animal/pet/attack_hand(mob/living/carbon/human/M, modifiers)
. = ..()
wuv(M, !M.combat_mode)
/mob/living/simple_animal/pet/Initialize(mapload)
. = ..()
if(pcollar)
pcollar = new(src)
regenerate_icons()
/mob/living/simple_animal/pet/Destroy()
QDEL_NULL(pcollar)
return ..()
/mob/living/simple_animal/pet/revive(full_heal = 0, admin_revive = 0)
. = ..()
if(.)
if(collar_type)
collar_type = "[initial(collar_type)]"
regenerate_icons()
/mob/living/simple_animal/pet/death(gibbed)
..(gibbed)
if(collar_type)
collar_type = "[initial(collar_type)]_dead"
regenerate_icons()
/mob/living/simple_animal/pet/gib()
if(pcollar)
pcollar.forceMove(drop_location())
pcollar = null
..()
/mob/living/simple_animal/pet/regenerate_icons()
cut_overlays()
if(pcollar && collar_type)
add_overlay("[collar_type]collar")
add_overlay("[collar_type]tag")
/mob/living/simple_animal/pet/proc/wuv(mob/M, change = TRUE)
if(change)
if(M && stat != DEAD)
new /obj/effect/temp_visual/heart(loc)
emote("me", 1, wuv_happy, TRUE)
if(flags_1 & HOLOGRAM_1)
return
SEND_SIGNAL(M, COMSIG_ADD_MOOD_EVENT, src, /datum/mood_event/pet_animal, src)
else
if(M && stat != DEAD)
emote("me", 1, wuv_angy, TRUE)