Refactors Rabbits to be a Basic Mob (#71205)

## About The Pull Request

Back in #64175, I reworked rabbits such that their base behavior was
just a cute fluffy snuggle monster, and not have the "easter" variant be
the default. Now that we're transitioning everything from simple_animal
to basic, I figured now was the time to shift that over too.

Pretty much everything should be the same as it was before, I even took
some time to add behavior to some elements to allow it to work (let me
know if I should handle it a different way) but rabbits as a
simple_animal and rabbits as a basic mob should now not be very
distinguishable (beyond the fact that they only speak via subtrees).

I also got rid of the single-letter icon_states in the DMI and
accomodated the code to fix because I finally got irritated enough to do
something about that.
## Why It's Good For The Game

Although I didn't really have any pressing urge to add more complex AI
behavior to rabbits than just pretty much re-implementing what they had
as a simple_animal, this is an excellent first-step to allowing much
more extensible behaviors to these fuzzy creatures.

Also, it takes three more mobs off "the frozen list". Whoopie!
## Changelog
🆑
fix: Dead Black Space Rabbits should now properly have a sprite.
/🆑

The UpdatePaths is useless for the maps we have on our repository
(holodecks use a spawner code-side), but I'm going to be nice to
downstreams who need it.
This commit is contained in:
san7890
2022-11-16 00:40:39 -07:00
committed by GitHub
parent cb8ca472a1
commit 1d256b5506
12 changed files with 150 additions and 100 deletions

View File

@@ -54,6 +54,28 @@
emote_hear = list("bleats.")
emote_see = list("shakes her head.", "stares into the distance.")
/datum/ai_planning_subtree/random_speech/rabbit
speech_chance = 10
speak = list("Mrrp.", "CHIRP!", "Mrrp?") // rabbits make some weird noises dude i don't know what to tell you
emote_hear = list("hops.")
emote_see = list("hops around.", "bounces up and down.")
/// For the easter subvariant of rabbits, these ones actually speak catchphrases.
/datum/ai_planning_subtree/random_speech/rabbit/easter
speak = list(
"Hop into Easter!",
"Come get your eggs!",
"Prizes for everyone!",
)
/// These ones have a space mask on, so their catchphrases are muffled.
/datum/ai_planning_subtree/random_speech/rabbit/easter/space
speak = list(
"Hmph mmph mmmph!",
"Mmphe mmphe mmphe!",
"Hmm mmm mmm!",
)
/datum/ai_planning_subtree/random_speech/cow
speech_chance = 1
speak = list("moo?","moo","MOOOOOO")

View File

@@ -19,14 +19,18 @@
if(!isbasicmob(target))
return ELEMENT_INCOMPATIBLE
if(min_body_temp)
if(isnum(min_body_temp))
src.min_body_temp = min_body_temp
if(max_body_temp)
if(isnum(max_body_temp))
src.max_body_temp = max_body_temp
if(cold_damage)
if(isnum(cold_damage))
src.cold_damage = cold_damage
if(heat_damage)
if(isnum(heat_damage))
src.heat_damage = heat_damage
RegisterSignal(target, COMSIG_LIVING_LIFE, PROC_REF(on_life))
/datum/element/basic_body_temp_sensitive/Detach(datum/source)

View File

@@ -159,7 +159,7 @@
spawnableAtoms = list(/obj/structure/flora/bush/snow/style_random = 1)
/datum/map_generator_module/snow/bunnies
spawnableAtoms = list(/mob/living/simple_animal/rabbit = 0.5)
spawnableAtoms = list(/mob/living/basic/rabbit = 0.5)
/datum/map_generator_module/snow/rand_ice_rocks
spawnableAtoms = list(/obj/structure/flora/rock/icy/style_random = 5, /obj/structure/flora/rock/pile/icy/style_random = 5)

View File

@@ -34,7 +34,7 @@
barry.say(pick("BUZZ BUZZ", "PULLING A RABBIT OUT OF A HAT IS A TIRED TROPE", "I DIDN'T ASK TO BEE HERE"), forced = "bee hat")
else
magician.visible_message(span_notice("[magician] taps [src] with [hitby_wand], then reaches in and pulls out a bunny! Cute!"), span_notice("You tap [src] with your [hitby_wand.name] and pull out a cute bunny!"))
var/mob/living/simple_animal/rabbit/bunbun = new(get_turf(magician))
var/mob/living/basic/rabbit/bunbun = new(get_turf(magician))
bunbun.mob_try_pickup(magician, instant=TRUE)
#undef RABBIT_CD_TIME

View File

@@ -30,9 +30,9 @@
if(R.name != "blobspawn")
if(prob(35))
if(isspaceturf(R.loc))
new /mob/living/simple_animal/rabbit/easter/space(R.loc)
new /mob/living/basic/rabbit/easter/space(R.loc)
else
new /mob/living/simple_animal/rabbit/easter(R.loc)
new /mob/living/basic/rabbit/easter(R.loc)
//Easter Baskets
/obj/item/storage/basket/easter

View File

@@ -85,7 +85,7 @@
/mob/living/simple_animal/butterfly,
/mob/living/simple_animal/chick/holo,
/mob/living/simple_animal/pet/fox,
/mob/living/simple_animal/rabbit,
/mob/living/basic/rabbit,
)
mobtype += pick(
/mob/living/simple_animal/pet/dog/corgi,

View File

@@ -0,0 +1,111 @@
/**
* ## Rabbit
*
* A creature that hops around with small tails and long ears.
*
* This contains the code for both your standard rabbit as well as the subtypes commonly found during Easter.
*
*/
/mob/living/basic/rabbit
name = "rabbit"
desc = "The hippiest hop around."
icon = 'icons/mob/simple/rabbit.dmi'
icon_state = "rabbit_white"
icon_living = "rabbit_white"
icon_dead = "rabbit_white_dead"
gender = PLURAL
mob_biotypes = MOB_ORGANIC | MOB_BEAST
health = 15
maxHealth = 15
density = FALSE
gold_core_spawnable = FRIENDLY_SPAWN
speak_emote = list("sniffles", "twitches")
response_help_continuous = "pets"
response_help_simple = "pet"
response_disarm_continuous = "gently pushes aside"
response_disarm_simple = "gently push aside"
attack_sound = 'sound/weapons/punch1.ogg'
attack_vis_effect = ATTACK_EFFECT_KICK
response_harm_continuous = "kicks"
response_harm_simple = "kick"
attack_verb_continuous = "kicks"
attack_verb_simple = "kick"
butcher_results = list(/obj/item/food/meat/slab = 1)
ai_controller = /datum/ai_controller/basic_controller/rabbit
/// passed to animal_varity as the prefix icon.
var/icon_prefix = "rabbit"
/mob/living/basic/rabbit/Initialize(mapload)
. = ..()
AddElement(/datum/element/pet_bonus, "hops around happily!")
AddElement(/datum/element/animal_variety, icon_prefix, pick("brown", "black", "white"), TRUE)
if(prob(20)) // bunny
name = "bunny"
/datum/ai_controller/basic_controller/rabbit
ai_traits = STOP_MOVING_WHEN_PULLED
ai_movement = /datum/ai_movement/basic_avoidance
idle_behavior = /datum/idle_behavior/idle_random_walk
planning_subtrees = list(/datum/ai_planning_subtree/random_speech/rabbit)
/// The easter subtype of rabbits, will lay eggs and say Eastery catchphrases.
/mob/living/basic/rabbit/easter
icon_state = "easter_rabbit_white"
icon_living = "easter_rabbit_white"
icon_dead = "easter_rabbit_white_dead"
icon_prefix = "easter_rabbit"
ai_controller = /datum/ai_controller/basic_controller/rabbit/easter
///passed to the egg_layer component as how many eggs it starts out as able to lay.
var/initial_egg_amount = 10
///passed to the egg_layer component as how many eggs it's allowed to hold at most.
var/max_eggs_held = 8
/mob/living/basic/rabbit/easter/Initialize(mapload)
. = ..()
//passed to the egg_layer component as how many eggs it gets when it eats something.
var/eggs_added_from_eating = rand(1, 4)
var/list/feed_messages = list("[p_they()] nibbles happily.", "[p_they()] noms happily.")
AddComponent(/datum/component/egg_layer,\
/obj/item/surprise_egg,\
list(/obj/item/food/grown/carrot),\
feed_messages,\
list("hides an egg.","scampers around suspiciously.","begins making a huge racket.","begins shuffling."),\
initial_egg_amount,\
eggs_added_from_eating,\
max_eggs_held,\
)
/datum/ai_controller/basic_controller/rabbit/easter
planning_subtrees = list(/datum/ai_planning_subtree/random_speech/rabbit/easter)
/// Same deal as the standard easter subtype, but these ones are able to brave the cold of space with their handy gas mask.
/mob/living/basic/rabbit/easter/space
icon_state = "space_rabbit_white"
icon_living = "space_rabbit_white"
icon_dead = "space_rabbit_white_dead"
icon_prefix = "space_rabbit"
ai_controller = /datum/ai_controller/basic_controller/rabbit/easter/space
// Minimum Allowable Body Temp, zero because we are meant to survive in space and we have a fucking RABBIT SPACE MASK.
var/minimum_survivable_temperature = 0
// Maximum Allowable Body Temp, 1500 because we might overheat and die in said RABBIT SPACE MASK.
var/maximum_survivable_temperature = 1500
/mob/living/basic/rabbit/easter/space/Initialize(mapload)
. = ..()
// string_assoc_list returns a cached list, which we then use as a static list to pass into the below AddElement
var/list/habitable_atmos = string_assoc_list(list(
"min_oxy" = 0,
"max_oxy" = 0,
"min_plas" = 0,
"max_plas" = 0,
"min_co2" = 0,
"max_co2" = 0,
"min_n2" = 0,
"max_n2" = 0,
))
AddElement(/datum/element/atmos_requirements, atmos_requirements = habitable_atmos, unsuitable_atmos_damage = 0)
// heat_damage is 0.5 here to account for low health on the rabbit.
AddElement(/datum/element/basic_body_temp_sensitive, min_body_temp = minimum_survivable_temperature, max_body_temp = maximum_survivable_temperature, cold_damage = 0, heat_damage = 0.5)
/datum/ai_controller/basic_controller/rabbit/easter/space
planning_subtrees = list(/datum/ai_planning_subtree/random_speech/rabbit/easter/space)

View File

@@ -1,87 +0,0 @@
/**
* ## Rabbit
*
* A creature that hops around with small tails and long ears.
*
* This contains the code for both your standard rabbit as well as the subtypes commonly found during Easter.
*
*/
/mob/living/simple_animal/rabbit
name = "\improper rabbit"
desc = "The hippiest hop around."
gender = PLURAL
mob_biotypes = MOB_ORGANIC|MOB_BEAST
health = 15
maxHealth = 15
icon = 'icons/mob/simple/rabbit.dmi'
icon_state = "rabbit_white"
icon_living = "rabbit_white"
icon_dead = "rabbit_white_dead"
speak_emote = list("sniffles","twitches")
emote_hear = list("hops.")
emote_see = list("hops around","bounces up and down")
butcher_results = list(/obj/item/food/meat/slab = 1)
can_be_held = TRUE
density = FALSE
speak_chance = 2
turns_per_move = 3
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"
attack_verb_continuous = "kicks"
attack_verb_simple = "kick"
pass_flags = PASSTABLE | PASSMOB
mob_size = MOB_SIZE_SMALL
gold_core_spawnable = FRIENDLY_SPAWN
//passed to animal_varity as the prefix icon.
var/icon_prefix = "rabbit"
/mob/living/simple_animal/rabbit/Initialize(mapload)
. = ..()
AddElement(/datum/element/pet_bonus, "hops around happily!")
AddElement(/datum/element/animal_variety, icon_prefix, pick("brown","black","white"), TRUE)
/mob/living/simple_animal/rabbit/easter
icon_state = "e_rabbit_white"
icon_living = "e_rabbit_white"
icon_dead = "e_rabbit_white_dead"
icon_prefix = "e_rabbit"
speak = list(
"Hop into Easter!",
"Come get your eggs!",
"Prizes for everyone!",
)
icon_prefix = "e_rabbit"
///passed to the egg_layer component as how many eggs it starts out as able to lay.
var/initial_egg_amount = 10
///passed to the egg_layer component as how many eggs it's allowed to hold at most.
var/max_eggs_held = 8
/mob/living/simple_animal/rabbit/easter/space
icon_state = "s_rabbit_white"
icon_living = "s_rabbit_white"
icon_dead = "s_rabbit_white_dead"
icon_prefix = "s_rabbit"
atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_plas" = 0, "max_plas" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
minbodytemp = 0
maxbodytemp = 1500
unsuitable_atmos_damage = 0
/mob/living/simple_animal/rabbit/easter/Initialize(mapload)
. = ..()
//passed to the egg_layer component as how many eggs it gets when it eats something.
var/eggs_added_from_eating = rand(1, 4)
var/list/feed_messages = list("[p_they()] nibbles happily.", "[p_they()] noms happily.")
AddElement(/datum/element/animal_variety, icon_prefix, pick("brown","black","white"), TRUE)
AddComponent(/datum/component/egg_layer,\
/obj/item/surprise_egg,\
list(/obj/item/food/grown/carrot),\
feed_messages,\
list("hides an egg.","scampers around suspiciously.","begins making a huge racket.","begins shuffling."),\
initial_egg_amount,\
eggs_added_from_eating,\
max_eggs_held,\
)

View File

@@ -379,9 +379,6 @@
/mob/living/simple_animal/pet/penguin/baby,
/mob/living/simple_animal/pet/penguin/emperor,
/mob/living/simple_animal/pet/penguin/emperor/shamebrero,
/mob/living/simple_animal/rabbit,
/mob/living/simple_animal/rabbit/easter,
/mob/living/simple_animal/rabbit/easter/space,
/mob/living/simple_animal/revenant,
/mob/living/simple_animal/robot_customer,
/mob/living/simple_animal/shade,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@@ -3531,6 +3531,7 @@
#include "code\modules\mob\living\basic\basic_defense.dm"
#include "code\modules\mob\living\basic\health_adjustment.dm"
#include "code\modules\mob\living\basic\farm_animals\pig.dm"
#include "code\modules\mob\living\basic\farm_animals\rabbit.dm"
#include "code\modules\mob\living\basic\farm_animals\sheep.dm"
#include "code\modules\mob\living\basic\farm_animals\cow\_cow.dm"
#include "code\modules\mob\living\basic\farm_animals\cow\cow_ai.dm"
@@ -3721,7 +3722,6 @@
#include "code\modules\mob\living\simple_animal\friendly\lizard.dm"
#include "code\modules\mob\living\simple_animal\friendly\penguin.dm"
#include "code\modules\mob\living\simple_animal\friendly\pet.dm"
#include "code\modules\mob\living\simple_animal\friendly\rabbit.dm"
#include "code\modules\mob\living\simple_animal\friendly\robot_customer.dm"
#include "code\modules\mob\living\simple_animal\friendly\sloth.dm"
#include "code\modules\mob\living\simple_animal\friendly\snake.dm"

View File

@@ -0,0 +1,3 @@
# transforms simple rabbit animals to the new basic animal subtype
/mob/living/simple_animal/rabbit/@SUBTYPES : /mob/living/basic/rabbit/@SUBTYPES{@OLD}