Files
Bubberstation/code/modules/mob/living/basic/pets/sloth.dm
Jacquerel 90b974071d Sign up for Cargorilla from the lobby (#79776)
## About The Pull Request

If the station rolls the "Cargo Gorilla" trait, a button will now be
visible on the lobby.
Clicking on this button before the round has started will add you to a
list of participants, one of whom will be selected to become a gorilla
when the round begins.
If nobody signs up (because they're really boring I guess) the job will
instead appear on the latejoin menu.
Once someone has become the gorilla the button will disappear.


![dreamseeker_ntP3OayAuV](https://github.com/tgstation/tgstation/assets/7483112/a26087ea-1ee7-4e9f-b37c-195cb1b1744f)

While implementing this I noticed that an inverted check means we were
never populating the "GLOB.cargo_sloth" field which means the station
trait wasn't even working.

BEHIND THE SCENES
This also adds a generic "job station trait" which can be expanded in
the future.
Future developers can extend this to add other "rare jobs" with relative
ease.
By default I have made it so all subtypes of this trait are mutually
exclusive, only one can roll at a time.

This also means that I have converted "cargo gorilla" into a job, which
applies most of the code previously located in the mob's typepath or in
the station trait.
The fact that it is a job means that **admins** can enable any number of
gorillas to be present on the latejoin menu (but not the roundstart one,
as it is not possible to add Cargo Gorilla to your occupation
preferences) if they so desire.
The random beurocratic station trait, event, and traitor item (and the
job console) are not able to add gorilla slots.

Because I changed "Cargo Gorilla" to a job it now no longer exists on
the map until a player gains the role, and there wasn't a non-hacky way
to copy the name of this round's cargo sloth. Instead I just added a
small cargo gorilla name list.

## Why It's Good For The Game

Makes the presence of a fun trait more visible to players.
Means that people who aren't observing get a chance to be a monkey.
This is a framework several other people have wanted to exist for their
own features.

## Changelog

🆑 Jacquerel and Fikou
qol: If the station rolls the "Cargo Gorilla" station trait. you will be
able to sign up for the role from the game lobby.
qol: If nobody signs up to be the Cargo Gorilla then you can select it
from the Late Join menu and arrive on the arrival shuttle.
fix: The Cargo Gorilla will actually spawn.
/🆑
2023-12-12 08:48:49 -08:00

98 lines
3.0 KiB
Plaintext

GLOBAL_DATUM(cargo_sloth, /mob/living/basic/sloth)
/mob/living/basic/sloth
name = "sloth"
desc = "An adorable, sleepy creature."
icon = 'icons/mob/simple/pets.dmi'
icon_state = "sloth"
icon_living = "sloth"
icon_dead = "sloth_dead"
speak_emote = list("yawns")
can_be_held = TRUE
held_state = "sloth"
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 = "bites"
attack_verb_simple = "bite"
attack_sound = 'sound/weapons/bite.ogg'
attack_vis_effect = ATTACK_EFFECT_BITE
mob_biotypes = MOB_ORGANIC|MOB_BEAST
gold_core_spawnable = FRIENDLY_SPAWN
melee_damage_lower = 18
melee_damage_upper = 18
health = 50
maxHealth = 50
speed = 10 // speed is fucking weird man. they aren't fast though don't worry
butcher_results = list(/obj/item/food/meat/slab = 3)
ai_controller = /datum/ai_controller/basic_controller/sloth
/mob/living/basic/sloth/Initialize(mapload)
. = ..()
AddElement(/datum/element/pet_bonus, "slowly smiles!")
AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_CLAW)
AddElement(/datum/element/ai_retaliate)
AddComponent(/datum/component/tree_climber)
if(!mapload || !isnull(GLOB.cargo_sloth) || !is_station_level(z))
return
// If someone adds non-cargo sloths to maps we'll have a problem but we're fine for now
GLOB.cargo_sloth = src
GLOB.gorilla_start += get_turf(src)
/mob/living/basic/sloth/Destroy()
if(GLOB.cargo_sloth == src)
GLOB.cargo_sloth = null
return ..()
/mob/living/basic/sloth/paperwork
name = "Paperwork"
desc = "Cargo's pet sloth. About as useful as the rest of the techs."
gender = MALE
gold_core_spawnable = NO_SPAWN
/mob/living/basic/sloth/citrus
name = "Citrus"
desc = "Cargo's pet sloth. She's dressed in a horrible sweater."
icon_state = "cool_sloth"
icon_living = "cool_sloth"
icon_dead = "cool_sloth_dead"
gender = FEMALE
butcher_results = list(/obj/item/toy/spinningtoy = 1)
gold_core_spawnable = NO_SPAWN
/// They're really passive in game, so they just wanna get away if you start smacking them. No trees in space from them to use for clawing your eyes out, but they will try if desperate.
/datum/ai_controller/basic_controller/sloth
blackboard = list(
BB_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
BB_FLEE_TARGETING_STRATEGY = /datum/targeting_strategy/basic,
)
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/target_retaliate/to_flee,
/datum/ai_planning_subtree/flee_target/from_flee_key,
/datum/ai_planning_subtree/climb_trees,
/datum/ai_planning_subtree/random_speech/sloth,
)
/datum/ai_planning_subtree/random_speech/sloth
speech_chance = 1
emote_hear = list("snores.", "yawns.")
emote_see = list("dozes off.", "looks around sleepily.")