From 82904b766c44bc9331b534635816b9124a3faa17 Mon Sep 17 00:00:00 2001 From: san7890 Date: Fri, 6 Oct 2023 20:41:00 -0700 Subject: [PATCH] Refactors Sloths into Basic Mobs (#78752) ## About The Pull Request Hey there, This just refactors sloths to the basic mob framework. Nothing new should be added beyond them seeming a bit more sluggish and being a bit smarter about the fights they pick/running away. ## Why It's Good For The Game Three more subtypes off the list, we are now sub-200 simple animals left to refactor. If people want to play catch with their sloth it should be much easier to fit that in now. ## Changelog :cl: refactor: Sloths are now basic mobs, however their overall sluggish behavior shouldn't have changed much- let us know if anything is broken. /:cl: --- _maps/map_files/Birdshot/birdshot.dmm | 2 +- .../map_files/Deltastation/DeltaStation2.dmm | 2 +- .../map_files/IceBoxStation/IceBoxStation.dmm | 2 +- _maps/map_files/MetaStation/MetaStation.dmm | 2 +- _maps/map_files/NorthStar/north_star.dmm | 2 +- _maps/map_files/tramstation/tramstation.dmm | 2 +- .../basic_mobs/basic_subtrees/climb_tree.dm | 1 + code/datums/components/tree_climber.dm | 2 + code/datums/station_traits/neutral_traits.dm | 4 +- .../traitor/objectives/kill_pet.dm | 4 +- code/modules/events/ghost_role/sentience.dm | 2 +- code/modules/events/wizard/petsplosion.dm | 2 +- code/modules/mob/living/basic/pets/sloth.dm | 97 +++++++++++++++++++ .../living/simple_animal/friendly/sloth.dm | 68 ------------- .../unit_tests/simple_animal_freeze.dm | 3 - tgstation.dme | 2 +- .../Scripts/78752_simple_to_basic_sloths.txt | 1 + 17 files changed, 114 insertions(+), 84 deletions(-) create mode 100644 code/modules/mob/living/basic/pets/sloth.dm delete mode 100644 code/modules/mob/living/simple_animal/friendly/sloth.dm create mode 100644 tools/UpdatePaths/Scripts/78752_simple_to_basic_sloths.txt diff --git a/_maps/map_files/Birdshot/birdshot.dmm b/_maps/map_files/Birdshot/birdshot.dmm index 8e46be856e3..052aee9740c 100644 --- a/_maps/map_files/Birdshot/birdshot.dmm +++ b/_maps/map_files/Birdshot/birdshot.dmm @@ -26928,7 +26928,7 @@ }, /obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4, /obj/machinery/holopad, -/mob/living/simple_animal/sloth/citrus, +/mob/living/basic/sloth/citrus, /turf/open/floor/iron, /area/station/cargo/storage) "jHE" = ( diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm index 1524ca5adf9..ff106565a42 100644 --- a/_maps/map_files/Deltastation/DeltaStation2.dmm +++ b/_maps/map_files/Deltastation/DeltaStation2.dmm @@ -95382,7 +95382,7 @@ /obj/structure/disposalpipe/segment{ dir = 10 }, -/mob/living/simple_animal/sloth/citrus, +/mob/living/basic/sloth/citrus, /obj/effect/turf_decal/tile/neutral/fourcorners, /turf/open/floor/iron, /area/station/command/heads_quarters/qm) diff --git a/_maps/map_files/IceBoxStation/IceBoxStation.dmm b/_maps/map_files/IceBoxStation/IceBoxStation.dmm index c082f4c3442..6aa6f438643 100644 --- a/_maps/map_files/IceBoxStation/IceBoxStation.dmm +++ b/_maps/map_files/IceBoxStation/IceBoxStation.dmm @@ -18137,7 +18137,7 @@ /area/station/maintenance/starboard/aft) "fya" = ( /obj/structure/cable, -/mob/living/simple_animal/sloth/paperwork, +/mob/living/basic/sloth/paperwork, /turf/open/floor/iron, /area/station/cargo/storage) "fyc" = ( diff --git a/_maps/map_files/MetaStation/MetaStation.dmm b/_maps/map_files/MetaStation/MetaStation.dmm index f2a999d3f38..df3e1b7490a 100644 --- a/_maps/map_files/MetaStation/MetaStation.dmm +++ b/_maps/map_files/MetaStation/MetaStation.dmm @@ -25335,7 +25335,7 @@ dir = 4 }, /obj/structure/disposalpipe/segment, -/mob/living/simple_animal/sloth/citrus, +/mob/living/basic/sloth/citrus, /turf/open/floor/iron, /area/station/cargo/storage) "jhD" = ( diff --git a/_maps/map_files/NorthStar/north_star.dmm b/_maps/map_files/NorthStar/north_star.dmm index a9e18d02c3b..535f37974ba 100644 --- a/_maps/map_files/NorthStar/north_star.dmm +++ b/_maps/map_files/NorthStar/north_star.dmm @@ -30711,7 +30711,7 @@ /turf/open/floor/plating, /area/station/maintenance/floor3/starboard/fore) "idf" = ( -/mob/living/simple_animal/sloth/paperwork, +/mob/living/basic/sloth/paperwork, /obj/effect/turf_decal/tile/yellow, /obj/effect/turf_decal/tile/brown{ dir = 4 diff --git a/_maps/map_files/tramstation/tramstation.dmm b/_maps/map_files/tramstation/tramstation.dmm index 639dc110d02..638f7512d67 100644 --- a/_maps/map_files/tramstation/tramstation.dmm +++ b/_maps/map_files/tramstation/tramstation.dmm @@ -53577,7 +53577,7 @@ /turf/open/floor/iron/white, /area/station/science/lower) "sha" = ( -/mob/living/simple_animal/sloth/paperwork, +/mob/living/basic/sloth/paperwork, /turf/open/floor/glass, /area/station/cargo/storage) "shw" = ( diff --git a/code/datums/ai/basic_mobs/basic_subtrees/climb_tree.dm b/code/datums/ai/basic_mobs/basic_subtrees/climb_tree.dm index 1beab6ec907..bad349030f1 100644 --- a/code/datums/ai/basic_mobs/basic_subtrees/climb_tree.dm +++ b/code/datums/ai/basic_mobs/basic_subtrees/climb_tree.dm @@ -1,4 +1,5 @@ /datum/ai_planning_subtree/climb_trees + operational_datums = list(/datum/component/tree_climber) ///chance to climb a tree var/climb_chance = 35 diff --git a/code/datums/components/tree_climber.dm b/code/datums/components/tree_climber.dm index b3c70153c71..9f506ae516f 100644 --- a/code/datums/components/tree_climber.dm +++ b/code/datums/components/tree_climber.dm @@ -12,6 +12,8 @@ return COMPONENT_INCOMPATIBLE src.climbing_distance = climbing_distance + ADD_TRAIT(parent, TRAIT_SUBTREE_REQUIRED_OPERATIONAL_DATUM, type) + /datum/component/tree_climber/RegisterWithParent() RegisterSignals(parent, list(COMSIG_HOSTILE_PRE_ATTACKINGTARGET, COMSIG_LIVING_CLIMB_TREE), PROC_REF(climb_tree)) RegisterSignal(parent, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine)) diff --git a/code/datums/station_traits/neutral_traits.dm b/code/datums/station_traits/neutral_traits.dm index f57f6c2e9dd..26bbc689afa 100644 --- a/code/datums/station_traits/neutral_traits.dm +++ b/code/datums/station_traits/neutral_traits.dm @@ -158,8 +158,8 @@ /datum/station_trait/cargorilla/proc/replace_cargo(datum/source) SIGNAL_HANDLER - var/mob/living/simple_animal/sloth/cargo_sloth = GLOB.cargo_sloth - if(!cargo_sloth) + var/mob/living/basic/sloth/cargo_sloth = GLOB.cargo_sloth + if(isnull(cargo_sloth)) return cargorilla = new(cargo_sloth.loc) diff --git a/code/modules/antagonists/traitor/objectives/kill_pet.dm b/code/modules/antagonists/traitor/objectives/kill_pet.dm index 51a54d99e30..f90599e6c35 100644 --- a/code/modules/antagonists/traitor/objectives/kill_pet.dm +++ b/code/modules/antagonists/traitor/objectives/kill_pet.dm @@ -26,8 +26,8 @@ JOB_CHIEF_MEDICAL_OFFICER = /mob/living/simple_animal/pet/cat/runtime, JOB_CHIEF_ENGINEER = /mob/living/simple_animal/parrot/poly, JOB_QUARTERMASTER = list( - /mob/living/simple_animal/sloth/citrus, - /mob/living/simple_animal/sloth/paperwork, + /mob/living/basic/sloth/citrus, + /mob/living/basic/sloth/paperwork, /mob/living/simple_animal/hostile/gorilla/cargo_domestic, ) ) diff --git a/code/modules/events/ghost_role/sentience.dm b/code/modules/events/ghost_role/sentience.dm index 6cdc66472c1..abc57d33a07 100644 --- a/code/modules/events/ghost_role/sentience.dm +++ b/code/modules/events/ghost_role/sentience.dm @@ -11,13 +11,13 @@ GLOBAL_LIST_INIT(high_priority_sentience, typecacheof(list( /mob/living/basic/pig, /mob/living/basic/rabbit, /mob/living/basic/sheep, + /mob/living/basic/sloth, /mob/living/basic/snake, /mob/living/basic/spider/giant/sgt_araneus, /mob/living/simple_animal/bot/secbot/beepsky, /mob/living/simple_animal/hostile/retaliate/goose/vomit, /mob/living/simple_animal/parrot, /mob/living/simple_animal/pet, - /mob/living/simple_animal/sloth, ))) /datum/round_event_control/sentience diff --git a/code/modules/events/wizard/petsplosion.dm b/code/modules/events/wizard/petsplosion.dm index 70248bf0ebb..e670fa910a1 100644 --- a/code/modules/events/wizard/petsplosion.dm +++ b/code/modules/events/wizard/petsplosion.dm @@ -13,12 +13,12 @@ GLOBAL_LIST_INIT(petsplosion_candidates, typecacheof(list( /mob/living/basic/pig, /mob/living/basic/rabbit, /mob/living/basic/sheep, + /mob/living/basic/sloth, /mob/living/basic/snake, /mob/living/basic/spider/giant/sgt_araneus, /mob/living/simple_animal/hostile/retaliate/goose/vomit, /mob/living/simple_animal/parrot, /mob/living/simple_animal/pet, - /mob/living/simple_animal/sloth, ))) /datum/round_event_control/wizard/petsplosion //the horror diff --git a/code/modules/mob/living/basic/pets/sloth.dm b/code/modules/mob/living/basic/pets/sloth.dm new file mode 100644 index 00000000000..5058e7d5334 --- /dev/null +++ b/code/modules/mob/living/basic/pets/sloth.dm @@ -0,0 +1,97 @@ +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 + +/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_TARGETTING_DATUM = new /datum/targetting_datum/basic/ignore_faction, + BB_BASIC_MOB_FLEEING = TRUE, + BB_FLEE_TARGETTING_DATUM = new /datum/targetting_datum/basic/ignore_faction, + ) + + 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.") diff --git a/code/modules/mob/living/simple_animal/friendly/sloth.dm b/code/modules/mob/living/simple_animal/friendly/sloth.dm deleted file mode 100644 index 8e308c58d12..00000000000 --- a/code/modules/mob/living/simple_animal/friendly/sloth.dm +++ /dev/null @@ -1,68 +0,0 @@ -GLOBAL_DATUM(cargo_sloth, /mob/living/simple_animal/sloth) - -/mob/living/simple_animal/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") - emote_hear = list("snores.","yawns.") - emote_see = list("dozes off.", "looks around sleepily.") - speak_chance = 1 - turns_per_move = 5 - can_be_held = TRUE - butcher_results = list(/obj/item/food/meat/slab = 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" - 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 - held_state = "sloth" - ///In the case 'melee_damage_upper' is somehow raised above 0 - attack_verb_continuous = "bites" - attack_verb_simple = "bite" - attack_sound = 'sound/weapons/bite.ogg' - attack_vis_effect = ATTACK_EFFECT_BITE - - footstep_type = FOOTSTEP_MOB_CLAW - -/mob/living/simple_animal/sloth/Initialize(mapload) - . = ..() - AddElement(/datum/element/pet_bonus, "slowly smiles!") - // If someone adds non-cargo sloths to maps we'll have a problem but we're fine for now - if(!GLOB.cargo_sloth && mapload && is_station_level(z)) - GLOB.cargo_sloth = src - -/mob/living/simple_animal/sloth/Destroy() - if(GLOB.cargo_sloth == src) - GLOB.cargo_sloth = null - - return ..() - -//Cargo Sloth -/mob/living/simple_animal/sloth/paperwork - name = "Paperwork" - desc = "Cargo's pet sloth. About as useful as the rest of the techs." - gold_core_spawnable = NO_SPAWN - -//Cargo Sloth 2 - -/mob/living/simple_animal/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 diff --git a/code/modules/unit_tests/simple_animal_freeze.dm b/code/modules/unit_tests/simple_animal_freeze.dm index eec2ab9adcf..a0a4c91be2d 100644 --- a/code/modules/unit_tests/simple_animal_freeze.dm +++ b/code/modules/unit_tests/simple_animal_freeze.dm @@ -198,9 +198,6 @@ /mob/living/simple_animal/slime/pet, /mob/living/simple_animal/slime/random, /mob/living/simple_animal/slime/transformed_slime, - /mob/living/simple_animal/sloth, - /mob/living/simple_animal/sloth/citrus, - /mob/living/simple_animal/sloth/paperwork, /mob/living/simple_animal/soulscythe, // DO NOT ADD NEW ENTRIES TO THIS LIST // READ THE COMMENT ABOVE diff --git a/tgstation.dme b/tgstation.dme index 20ec483fb5c..35caa85b9f9 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -4431,6 +4431,7 @@ #include "code\modules\mob\living\basic\pets\fox.dm" #include "code\modules\mob\living\basic\pets\penguin.dm" #include "code\modules\mob\living\basic\pets\pet.dm" +#include "code\modules\mob\living\basic\pets\sloth.dm" #include "code\modules\mob\living\basic\pets\dog\_dog.dm" #include "code\modules\mob\living\basic\pets\dog\corgi.dm" #include "code\modules\mob\living\basic\pets\dog\dog_subtypes.dm" @@ -4681,7 +4682,6 @@ #include "code\modules\mob\living\simple_animal\friendly\cat.dm" #include "code\modules\mob\living\simple_animal\friendly\gondola.dm" #include "code\modules\mob\living\simple_animal\friendly\pet.dm" -#include "code\modules\mob\living\simple_animal\friendly\sloth.dm" #include "code\modules\mob\living\simple_animal\friendly\drone\_drone.dm" #include "code\modules\mob\living\simple_animal\friendly\drone\drone_say.dm" #include "code\modules\mob\living\simple_animal\friendly\drone\drone_tools.dm" diff --git a/tools/UpdatePaths/Scripts/78752_simple_to_basic_sloths.txt b/tools/UpdatePaths/Scripts/78752_simple_to_basic_sloths.txt new file mode 100644 index 00000000000..0312b163295 --- /dev/null +++ b/tools/UpdatePaths/Scripts/78752_simple_to_basic_sloths.txt @@ -0,0 +1 @@ +/mob/living/simple_animal/sloth/@SUBTYPES : /mob/living/basic/sloth/@SUBTYPES{@OLD}