mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Animal Renaming (#11082)
Allows renaming most animals, both simple animals as well as monkeys and their alien equivalents. Since animal pathing is wild with regards to things like goats and guard dogs being under the hostile path, had to add a var for hostile animals to allow renaming without repeating a bunch of code.
This commit is contained in:
@@ -471,6 +471,9 @@
|
||||
light_range = 2
|
||||
hunger_enabled = FALSE
|
||||
|
||||
/mob/living/simple_animal/penguin/holodeck/can_name(var/mob/living/M)
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/penguin/holodeck/baby
|
||||
icon_state = "penguin_baby"
|
||||
icon_living = "penguin_baby"
|
||||
|
||||
@@ -21,6 +21,7 @@ var/list/holder_mob_icon_cache = list()
|
||||
|
||||
var/last_loc_general //This stores a general location of the object. Ie, a container or a mob
|
||||
var/last_loc_specific //This stores specific extra information about the location, pocket, hand, worn on head, etc. Only relevant to mobs
|
||||
var/no_name = FALSE //If true, removes the change animal name verb for holders that don't allow name changes
|
||||
|
||||
/obj/item/holder/proc/setup_unsafe_list()
|
||||
unsafe_containers = typecacheof(list(
|
||||
@@ -39,6 +40,8 @@ var/list/holder_mob_icon_cache = list()
|
||||
item_state = icon_state
|
||||
|
||||
flags_inv |= ALWAYSDRAW
|
||||
if(no_name)
|
||||
verbs -= /obj/item/holder/verb/change_animal_name
|
||||
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
|
||||
@@ -334,6 +337,21 @@ var/list/holder_mob_icon_cache = list()
|
||||
|
||||
..()
|
||||
|
||||
/obj/item/holder/verb/change_animal_name()
|
||||
set name = "Name Animal"
|
||||
set category = "IC"
|
||||
set src in usr
|
||||
|
||||
if(isanimal(contained))
|
||||
var/mob/living/simple_animal/SA = contained
|
||||
SA.change_name(usr)
|
||||
sync(contained)
|
||||
if(ishuman(contained))
|
||||
var/mob/living/carbon/human/H = contained
|
||||
if(H.isMonkey())
|
||||
H.change_animal_name(usr)
|
||||
sync(contained)
|
||||
|
||||
//#TODO-MERGE
|
||||
//Port the reduced-duplication holder method from baystation upstream:
|
||||
//https://github.com/Baystation12/Baystation12/blob/master/code/modules/mob/holder.dm
|
||||
@@ -350,6 +368,7 @@ var/list/holder_mob_icon_cache = list()
|
||||
origin_tech = list(TECH_MAGNET = 3, TECH_BIO = 5)
|
||||
slot_flags = SLOT_HEAD | SLOT_EARS | SLOT_HOLSTER
|
||||
w_class = ITEMSIZE_SMALL
|
||||
no_name = TRUE
|
||||
|
||||
/obj/item/holder/drone
|
||||
name = "maintenance drone"
|
||||
@@ -359,6 +378,7 @@ var/list/holder_mob_icon_cache = list()
|
||||
origin_tech = list(TECH_MAGNET = 3, TECH_ENGINEERING = 5)
|
||||
slot_flags = SLOT_HEAD
|
||||
w_class = ITEMSIZE_LARGE
|
||||
no_name = TRUE
|
||||
|
||||
/obj/item/holder/drone/heavy
|
||||
name = "construction drone"
|
||||
@@ -433,6 +453,7 @@ var/list/holder_mob_icon_cache = list()
|
||||
icon_state = "brainslug"
|
||||
origin_tech = list(TECH_BIO = 6)
|
||||
w_class = ITEMSIZE_TINY
|
||||
no_name = TRUE
|
||||
|
||||
/obj/item/holder/monkey
|
||||
name = "monkey"
|
||||
@@ -570,6 +591,7 @@ var/list/holder_mob_icon_cache = list()
|
||||
icon = 'icons/mob/npc/pai.dmi'
|
||||
dir = EAST
|
||||
slot_flags = SLOT_HEAD
|
||||
no_name = TRUE
|
||||
|
||||
/obj/item/holder/pai/drone
|
||||
icon_state = "repairbot_rest"
|
||||
|
||||
@@ -1208,4 +1208,35 @@ mob/living/carbon/human/proc/change_monitor()
|
||||
return
|
||||
|
||||
primary_martial_art = selected_martial_art
|
||||
to_chat(src, SPAN_NOTICE("You will now use [primary_martial_art.name] when fighting barehanded."))
|
||||
to_chat(src, SPAN_NOTICE("You will now use [primary_martial_art.name] when fighting barehanded."))
|
||||
|
||||
//Used to rename monkey mobs since they are humans with a monkey species applied
|
||||
/mob/living/carbon/human/proc/change_animal_name()
|
||||
set name = "Name Animal"
|
||||
set desc = "Name a monkeylike animal."
|
||||
set category = "IC"
|
||||
set src in view(1)
|
||||
|
||||
var/mob/living/M = usr
|
||||
if(!M || usr == src)
|
||||
return
|
||||
|
||||
if(can_name(M))
|
||||
var/input = sanitizeSafe(input("What do you want to name \the [src]?","Choose a name") as text|null, MAX_NAME_LEN)
|
||||
if(!input)
|
||||
return
|
||||
if(stat != DEAD && in_range(M,src))
|
||||
to_chat(M, SPAN_NOTICE("You rename \the [src] to [input]."))
|
||||
name = "\proper [input]"
|
||||
real_name = input
|
||||
named = TRUE
|
||||
|
||||
//Used only to check for renaming of monkey mobs
|
||||
/mob/living/carbon/human/can_name(var/mob/living/M)
|
||||
if(named)
|
||||
to_chat(M, SPAN_NOTICE("\The [src] already has a name!"))
|
||||
return FALSE
|
||||
if(stat == DEAD)
|
||||
to_chat(M, SPAN_WARNING("You can't name a corpse."))
|
||||
return FALSE
|
||||
return TRUE
|
||||
@@ -12,6 +12,7 @@
|
||||
/mob/living/carbon/human/monkey/punpun/LateInitialize()
|
||||
name = "Pun Pun"
|
||||
real_name = name
|
||||
named = TRUE
|
||||
w_uniform = new /obj/item/clothing/under/punpun(src)
|
||||
|
||||
/obj/item/clothing/under/nupnup
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
tail = "chimptail"
|
||||
|
||||
unarmed_types = list(/datum/unarmed_attack/bite, /datum/unarmed_attack/claws)
|
||||
inherent_verbs = list(/mob/living/proc/ventcrawl)
|
||||
inherent_verbs = list(/mob/living/proc/ventcrawl, /mob/living/carbon/human/proc/change_animal_name)
|
||||
hud_type = /datum/hud_data/monkey
|
||||
meat_type = /obj/item/reagent_containers/food/snacks/meat/monkey
|
||||
|
||||
@@ -143,7 +143,8 @@
|
||||
deform = 'icons/mob/human_races/monkeys/r_vkrexi.dmi'
|
||||
|
||||
inherent_verbs = list(
|
||||
/mob/living/carbon/human/proc/bugbite
|
||||
/mob/living/carbon/human/proc/bugbite,
|
||||
/mob/living/carbon/human/proc/change_animal_name
|
||||
)
|
||||
|
||||
tail = "vkrexitail"
|
||||
|
||||
@@ -1014,4 +1014,7 @@ default behaviour is:
|
||||
hallucination += amount
|
||||
|
||||
/mob/living/set_respawn_time()
|
||||
set_death_time(CREW, world.time)
|
||||
set_death_time(CREW, world.time)
|
||||
//Used by simple animals and monkey species for renaming. M is the one doing the renaming
|
||||
/mob/living/proc/can_name(var/mob/living/M)
|
||||
return FALSE
|
||||
@@ -71,4 +71,6 @@
|
||||
var/brute_mod = 1
|
||||
|
||||
var/limb_breaking = FALSE // used to limit people from queuing up limb-breaks
|
||||
var/list/obj/aura/auras //Basically a catch-all aura/force-field thing.
|
||||
var/list/obj/aura/auras //Basically a catch-all aura/force-field thing.
|
||||
|
||||
var/named = FALSE //Affects renaming animals and monkey species. Set to TRUE for animals with unique names, such as station pets. Doesn't affect any other mob.
|
||||
@@ -35,6 +35,8 @@
|
||||
target_mob = null
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/bee/can_name(var/mob/living/M)
|
||||
return FALSE
|
||||
|
||||
//Special death behaviour. When bees accumulate enough damage to 'die', they don't outright die. Thus no call to parent
|
||||
//Instead the swarm strength (ie, size, or quantity of bees) drops and their health is refilled
|
||||
|
||||
@@ -60,6 +60,9 @@
|
||||
SSghostroles.remove_spawn_atom("borer", src)
|
||||
return ..(gibbed,deathmessage)
|
||||
|
||||
/mob/living/simple_animal/borer/can_name(var/mob/living/M)
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/borer/Life()
|
||||
..()
|
||||
if(host)
|
||||
|
||||
@@ -66,6 +66,11 @@
|
||||
ghostize()
|
||||
qdel(src)
|
||||
|
||||
/mob/living/simple_animal/construct/can_name(var/mob/living/M)
|
||||
if(iscultist(M))
|
||||
return ..()
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/construct/get_bullet_impact_effect_type(var/def_zone)
|
||||
return BULLET_IMPACT_METAL
|
||||
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
/mob/living/simple_animal/familiar/do_animate_chat(var/message, var/datum/language/language, var/small, var/list/show_to, var/duration, var/list/message_override)
|
||||
INVOKE_ASYNC(src, /atom/movable/proc/animate_chat, message, language, small, show_to, duration)
|
||||
|
||||
/mob/living/simple_animal/familiar/can_name(var/mob/living/M)
|
||||
if(M.is_wizard(TRUE))
|
||||
return ..()
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/familiar/carcinus
|
||||
name = "crab"
|
||||
desc = "A small crab said to be made of stone and starlight."
|
||||
|
||||
@@ -101,6 +101,8 @@
|
||||
attacktext = "bitten"
|
||||
attack_sound = 'sound/weapons/bite.ogg'
|
||||
|
||||
hostile_nameable = TRUE
|
||||
|
||||
butchering_products = list(/obj/item/stack/material/animalhide = 5)
|
||||
meat_amount = 8
|
||||
|
||||
|
||||
@@ -283,6 +283,7 @@
|
||||
/mob/living/simple_animal/cat/fluff/Runtime
|
||||
name = "Runtime"
|
||||
desc = "Her fur has the look and feel of velvet, and her tail quivers occasionally."
|
||||
named = TRUE
|
||||
gender = FEMALE
|
||||
icon_state = "cat"
|
||||
item_state = "cat"
|
||||
@@ -317,6 +318,7 @@
|
||||
/mob/living/simple_animal/cat/fluff/bones
|
||||
name = "Bones"
|
||||
desc = "He's a laid back, black cat. Meow."
|
||||
named = TRUE
|
||||
gender = MALE
|
||||
icon_state = "cat3"
|
||||
item_state = "cat3"
|
||||
@@ -334,6 +336,7 @@
|
||||
/mob/living/simple_animal/cat/penny
|
||||
name = "Penny"
|
||||
desc = "An important cat, straight from Central Command."
|
||||
named = TRUE
|
||||
icon_state = "penny"
|
||||
item_state = "penny"
|
||||
icon_living = "penny"
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
real_name = "Ian" //Intended to hold the name without altering it.
|
||||
gender = MALE
|
||||
desc = "It's a corgi."
|
||||
named = TRUE
|
||||
//var/obj/movement_target
|
||||
response_help = "pets"
|
||||
response_disarm = "bops"
|
||||
@@ -127,6 +128,7 @@
|
||||
real_name = "Lisa"
|
||||
gender = FEMALE
|
||||
desc = "It's a corgi with a cute pink bow."
|
||||
named = TRUE
|
||||
icon_state = "lisa"
|
||||
icon_living = "lisa"
|
||||
icon_dead = "lisa_dead"
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
name = "Coffee"
|
||||
real_name = "Coffee"
|
||||
desc = "It's Coffee, the other pet!"
|
||||
named = TRUE
|
||||
response_help = "pets"
|
||||
response_disarm = "gently pushes aside"
|
||||
response_harm = "stomps"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
canbrush = TRUE
|
||||
emote_sounds = list('sound/effects/creatures/goat.ogg')
|
||||
has_udder = TRUE
|
||||
hostile_nameable = TRUE
|
||||
|
||||
butchering_products = list(/obj/item/stack/material/animalhide = 3)
|
||||
|
||||
|
||||
@@ -31,3 +31,4 @@
|
||||
name = "Chauncey"
|
||||
real_name = "Chauncey"
|
||||
desc = "Chauncey, the Captain's trustworthy fox. I wonder what it says?"
|
||||
named = TRUE
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/rat/king/can_name(var/mob/living/M)
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/rat/king/Move()
|
||||
..()
|
||||
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
verbs |= /mob/living/simple_animal/spiderbot/proc/control_integrated_radio
|
||||
voice_name = name
|
||||
|
||||
/mob/living/simple_animal/spiderbot/can_name(var/mob/living/M)
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/spiderbot/attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
|
||||
if(istype(O, /obj/item/device/mmi))
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
tameable = FALSE
|
||||
|
||||
hostile_nameable = TRUE
|
||||
|
||||
meat_type = /obj/item/reagent_containers/food/snacks/bearmeat
|
||||
butchering_products = list(/obj/item/clothing/head/bearpelt = 1)
|
||||
meat_amount = 5
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
melee_damage_upper = 0
|
||||
density = FALSE
|
||||
belongs_to_station = TRUE
|
||||
hostile_nameable = TRUE
|
||||
var/short_name = null
|
||||
var/list/command_buffer = list()
|
||||
var/list/known_commands = list("stay", "stop", "attack", "follow")
|
||||
@@ -30,6 +31,18 @@
|
||||
command_buffer.Add(lowertext(html_decode(message)))
|
||||
return 0
|
||||
|
||||
/mob/living/simple_animal/hostile/commanded/can_name(var/mob/living/M)
|
||||
if(master && (M != master))
|
||||
to_chat(M, SPAN_WARNING("You can't name \the [src] because you aren't their master!"))
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/hostile/commanded/do_nickname(var/mob/living/M)
|
||||
var/input = sanitizeSafe(input("What nickname do you want to give \the [src]?","Choose a name") as null|text, MAX_NAME_LEN)
|
||||
if(!input)
|
||||
return
|
||||
short_name = input
|
||||
|
||||
/mob/living/simple_animal/hostile/commanded/think()
|
||||
while(command_buffer.len > 0)
|
||||
var/mob/speaker = command_buffer[1]
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
|
||||
known_commands = list("stay", "stop", "attack", "follow")
|
||||
|
||||
var/name_changed = 0
|
||||
|
||||
destroy_surroundings = FALSE
|
||||
attack_emote = "growls at"
|
||||
|
||||
@@ -71,31 +69,6 @@
|
||||
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/hostile/commanded/dog/verb/change_name()
|
||||
set name = "Name Dog"
|
||||
set category = "IC"
|
||||
set src in view(1)
|
||||
|
||||
var/mob/M = usr
|
||||
if(!M.mind) return 0
|
||||
|
||||
if(!name_changed)
|
||||
|
||||
var/input = sanitizeSafe(input("What do you want to name the dog?", ,""), MAX_NAME_LEN)
|
||||
var/short_input = sanitizeSafe(input("What nickname do you want to give the dog ?", , ""), MAX_NAME_LEN)
|
||||
|
||||
if(src && input && !M.stat && in_range(M,src))
|
||||
name = input
|
||||
real_name = input
|
||||
if(short_input != "")
|
||||
short_name = short_input
|
||||
name_changed = 1
|
||||
return 1
|
||||
|
||||
else
|
||||
to_chat(usr, "<span class='notice'>[src] already has a name!</span>")
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/hostile/commanded/dog/amaskan
|
||||
desc = "A dog trained to listen and obey its owner commands, this one is a Tamaskan."
|
||||
|
||||
@@ -107,12 +80,11 @@
|
||||
name = "Lt. Columbo"
|
||||
short_name = "Columbo"
|
||||
desc = "A dog trained to listen and obey its owner commands. This one looks about three days from retirement."
|
||||
named = TRUE
|
||||
|
||||
melee_damage_lower = 5
|
||||
melee_damage_upper = 10
|
||||
|
||||
name_changed = 1
|
||||
|
||||
icon_state = "columbo"
|
||||
icon_living = "columbo"
|
||||
icon_dead = "columbo_dead"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/mob/living/simple_animal/hostile/commanded/baby_harvester
|
||||
name = "Ives"
|
||||
desc = "A mysterious docile hivebot, this type seems to be of a kind rarely seen in the Orion Spur. Look at its little tail!"
|
||||
named = TRUE
|
||||
|
||||
icon = 'icons/mob/npc/pets.dmi'
|
||||
icon_state = "ives"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
var/smart_melee = TRUE // This makes melee mobs try to stay two tiles away from their target in combat, lunging in to attack only
|
||||
var/smart_ranged = FALSE // This makes ranged mob check for friendly fire and obstacles
|
||||
var/hostile_nameable = FALSE //If we can rename this hostile mob. Mostly to prevent repeat checks with guard dogs and hostile/retaliate farm animals
|
||||
|
||||
/mob/living/simple_animal/hostile/Initialize()
|
||||
. = ..()
|
||||
@@ -42,6 +43,14 @@
|
||||
targets = null
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/hostile/can_name(var/mob/living/M)
|
||||
if(hostile_nameable)
|
||||
return ..()
|
||||
if(faction && faction == M.faction) //In case the mob had a dociler used on it
|
||||
return ..()
|
||||
return FALSE
|
||||
|
||||
|
||||
/mob/living/simple_animal/hostile/proc/FindTarget()
|
||||
if(!faction) //No faction, no reason to attack anybody.
|
||||
return null
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
new residue(loc)
|
||||
qdel(src)
|
||||
|
||||
/mob/living/simple_animal/shade/can_name(var/mob/living/M)
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/shade/do_animate_chat(var/message, var/datum/language/language, var/small, var/list/show_to, var/duration, var/list/message_override)
|
||||
INVOKE_ASYNC(src, /atom/movable/proc/animate_chat, message, language, small, show_to, duration)
|
||||
|
||||
|
||||
@@ -181,6 +181,14 @@
|
||||
else if (health < maxHealth)
|
||||
to_chat(user, "<span class='warning'>It looks wounded.</span>")
|
||||
|
||||
/mob/living/simple_animal/can_name(var/mob/living/M)
|
||||
if(named)
|
||||
to_chat(M, SPAN_NOTICE("\The [src] already has a name!"))
|
||||
return FALSE
|
||||
if(stat == DEAD)
|
||||
to_chat(M, SPAN_WARNING("You can't name a corpse."))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/mob/living/simple_animal/Life()
|
||||
..()
|
||||
@@ -650,6 +658,33 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
|
||||
sound_time = FALSE
|
||||
addtimer(CALLBACK(src, .proc/reset_sound_time), 2 SECONDS)
|
||||
|
||||
/mob/living/simple_animal/verb/change_name()
|
||||
set name = "Name Animal"
|
||||
set desc = "Rename an animal."
|
||||
set category = "IC"
|
||||
set src in view(1)
|
||||
|
||||
var/mob/living/M = usr
|
||||
if(!M)
|
||||
return
|
||||
|
||||
if(can_name(M))
|
||||
var/input = sanitizeSafe(input("What do you want to name \the [src]?","Choose a name") as null|text, MAX_NAME_LEN)
|
||||
if(!input)
|
||||
return
|
||||
|
||||
//check for adjacent and dead in case something happened while naming.
|
||||
if(in_range(M,src) && (stat != DEAD))
|
||||
to_chat(M, SPAN_NOTICE("You rename \the [src] to [input]."))
|
||||
name = "\proper [input]"
|
||||
real_name = input
|
||||
named = TRUE
|
||||
do_nickname(M) //This is for commanded mobs who can have a short name, like guard dogs
|
||||
|
||||
//This is for commanded mobs who can have a short name, like guard dogs. Does nothing for other mobs for now
|
||||
/mob/living/simple_animal/proc/do_nickname(var/mob/living/M)
|
||||
|
||||
|
||||
/mob/living/simple_animal/proc/reset_sound_time()
|
||||
sound_time = TRUE
|
||||
|
||||
|
||||
@@ -198,3 +198,6 @@
|
||||
loc.contents += stomachContent
|
||||
|
||||
return
|
||||
|
||||
/mob/living/simple_animal/space_worm/can_name(var/mob/living/M)
|
||||
return FALSE
|
||||
|
||||
Reference in New Issue
Block a user