Pet Commands QOL . makes pet commands easier to use (#88495)

## About The Pull Request
this PR improves the UX of pet commands a bit. i decided to expand on
their radial menu. You can now hold shift and hover over your pet to
display a menu of commands which you can choose from. alternatively, you
can still type out commands in chat


https://github.com/user-attachments/assets/9da7f7ea-58a3-4fd6-b040-45cc05cda51d



## Why It's Good For The Game
makes pet commands easier to give out when you're managing more than 1
pet. also fixes the fishing command not working.

## Changelog
🆑
qol: holding shift and hovering over your pet will display a list of
commands you can click from
fix: fixes the fishing pet command not working
/🆑
This commit is contained in:
Ben10Omintrix
2024-12-22 03:05:30 +01:00
committed by GitHub
parent d39dd980b8
commit efe62c5a72
50 changed files with 426 additions and 220 deletions
@@ -36,7 +36,7 @@
/datum/pet_command/free,
/datum/pet_command/grub_spit,
/datum/pet_command/follow,
/datum/pet_command/point_targeting/fetch,
/datum/pet_command/fetch,
)
/mob/living/basic/mining/goldgrub/Initialize(mapload)
@@ -211,6 +211,8 @@
/datum/pet_command/grub_spit
command_name = "Spit"
radial_icon = 'icons/obj/ore.dmi'
radial_icon_state = "uranium"
command_desc = "Ask your grub pet to spit out its ores."
speech_commands = list("spit", "ores")
@@ -222,4 +224,7 @@
controller.clear_blackboard_key(BB_ACTIVE_PET_COMMAND)
return SUBTREE_RETURN_FINISH_PLANNING
/datum/pet_command/grub_spit/retrieve_command_text(atom/living_pet, atom/target)
return "signals [living_pet] to spit its ores!"
#undef BURROW_RANGE
@@ -61,7 +61,7 @@
if(isnull(ore_food))
balloon_alert(src, "no food!")
else
melee_attack(ore_food)
UnarmedAttack(ore_food, TRUE, modifiers)
return FALSE
/mob/living/basic/mining/gutlunch/proc/after_birth(mob/living/basic/mining/gutlunch/grub/baby, mob/living/partner)
@@ -111,11 +111,12 @@
//pet commands when we tame the gutluncher
var/static/list/pet_commands = list(
/datum/pet_command/idle,
/datum/pet_command/move,
/datum/pet_command/free,
/datum/pet_command/point_targeting/attack,
/datum/pet_command/point_targeting/breed/gutlunch,
/datum/pet_command/attack,
/datum/pet_command/breed/gutlunch,
/datum/pet_command/follow,
/datum/pet_command/point_targeting/fetch,
/datum/pet_command/fetch,
/datum/pet_command/mine_walls,
)
@@ -102,10 +102,11 @@
/datum/pet_command/mine_walls
command_name = "Mine"
radial_icon_state = "mine"
command_desc = "Command your pet to mine down walls."
speech_commands = list("mine", "smash")
/datum/pet_command/mine_walls/try_activate_command(mob/living/commander)
/datum/pet_command/mine_walls/try_activate_command(mob/living/commander, radial_command)
var/mob/living/parent = weak_parent.resolve()
if(isnull(parent))
return
@@ -121,10 +122,13 @@
return SUBTREE_RETURN_FINISH_PLANNING
controller.queue_behavior(/datum/ai_behavior/find_mineral_wall, BB_CURRENT_PET_TARGET)
//pet commands
/datum/pet_command/point_targeting/breed/gutlunch
/datum/pet_command/mine_walls/retrieve_command_text(atom/living_pet, atom/target)
return "signals [living_pet] to start mining!"
/datum/pet_command/point_targeting/breed/gutlunch/set_command_target(mob/living/parent, atom/target)
//pet commands
/datum/pet_command/breed/gutlunch
/datum/pet_command/breed/gutlunch/set_command_target(mob/living/parent, atom/target)
if(GLOB.gutlunch_count >= MAXIMUM_GUTLUNCH_POP)
parent.balloon_alert_to_viewers("can't reproduce anymore!")
return
@@ -32,7 +32,7 @@
/// The type of charging ability we give this mob
var/charge_type = /datum/action/cooldown/mob_cooldown/charge/basic_charge/lobster
/// The pet command for the charging ability we give this mob
var/charge_command = /datum/pet_command/point_targeting/use_ability/lob_charge
var/charge_command = /datum/pet_command/use_ability/lob_charge
/// At which speed do we amputate limbs
var/snip_speed = 5 SECONDS
///Lobstrosities are natural anglers. This rapresent their proficiency at fishing when not mindless
@@ -72,10 +72,11 @@
var/list/pet_commands = list(
/datum/pet_command/idle,
/datum/pet_command/free,
/datum/pet_command/point_targeting/attack,
/datum/pet_command/move,
/datum/pet_command/attack,
charge_command,
/datum/pet_command/follow,
/datum/pet_command/point_targeting/fish,
/datum/pet_command/fish,
)
AddComponent(/datum/component/happiness)
AddComponent(/datum/component/obeys_commands, pet_commands)
@@ -153,7 +154,7 @@
ai_controller = /datum/ai_controller/basic_controller/lobstrosity/juvenile
snip_speed = 6.5 SECONDS
charge_type = /datum/action/cooldown/mob_cooldown/charge/basic_charge/lobster/shrimp
charge_command = /datum/pet_command/point_targeting/use_ability/lob_charge/shrimp
charge_command = /datum/pet_command/use_ability/lob_charge/shrimp
base_fishing_level = SKILL_LEVEL_NOVICE
/// What do we become when we grow up?
var/mob/living/basic/mining/lobstrosity/grow_type = /mob/living/basic/mining/lobstrosity
@@ -254,7 +255,7 @@
charger.apply_status_effect(/datum/status_effect/tired_post_charge/lesser)
///Command the lobster to charge at someone.
/datum/pet_command/point_targeting/use_ability/lob_charge
/datum/pet_command/use_ability/lob_charge
command_name = "Charge"
command_desc = "Command your lobstrosity to charge against someone."
radial_icon = 'icons/mob/actions/actions_items.dmi'
@@ -265,7 +266,7 @@
pet_ability_key = BB_TARGETED_ACTION
ability_behavior = /datum/ai_behavior/pet_use_ability/then_attack/long_ranged
/datum/pet_command/point_targeting/use_ability/lob_charge/set_command_target(mob/living/parent, atom/target)
/datum/pet_command/use_ability/lob_charge/set_command_target(mob/living/parent, atom/target)
if (!target)
return
var/datum/targeting_strategy/targeter = GET_TARGETING_STRATEGY(parent.ai_controller.blackboard[targeting_strategy_key])
@@ -274,5 +275,5 @@
return FALSE
return ..()
/datum/pet_command/point_targeting/use_ability/lob_charge/shrimp
/datum/pet_command/use_ability/lob_charge/shrimp
ability_behavior = /datum/ai_behavior/pet_use_ability/then_attack/short_ranged
@@ -41,8 +41,8 @@
var/list/pet_commands = list(
/datum/pet_command/idle,
/datum/pet_command/free,
/datum/pet_command/point_targeting/attack,
/datum/pet_command/point_targeting/fetch,
/datum/pet_command/attack,
/datum/pet_command/fetch,
)
/mob/living/basic/mining/mook/Initialize(mapload)
@@ -1,7 +1,7 @@
///commands the chief can pick from
GLOBAL_LIST_INIT(mook_commands, list(
new /datum/pet_command/point_targeting/attack,
new /datum/pet_command/point_targeting/fetch,
new /datum/pet_command/attack,
new /datum/pet_command/fetch,
))
/datum/ai_controller/basic_controller/mook
@@ -346,7 +346,7 @@ GLOBAL_LIST_INIT(mook_commands, list(
if(!locate(/mob/living/basic/mining/mook) in oview(command_distance, controller.pawn))
return
if(controller.blackboard_key_exists(BB_BASIC_MOB_CURRENT_TARGET))
controller.queue_behavior(/datum/ai_behavior/issue_commands, BB_BASIC_MOB_CURRENT_TARGET, /datum/pet_command/point_targeting/attack)
controller.queue_behavior(/datum/ai_behavior/issue_commands, BB_BASIC_MOB_CURRENT_TARGET, /datum/pet_command/attack)
return
var/atom/ore_target = controller.blackboard[BB_ORE_TARGET]
@@ -356,7 +356,7 @@ GLOBAL_LIST_INIT(mook_commands, list(
if(get_dist(ore_target, living_pawn) <= 1)
return
controller.queue_behavior(/datum/ai_behavior/issue_commands, BB_ORE_TARGET, /datum/pet_command/point_targeting/fetch)
controller.queue_behavior(/datum/ai_behavior/issue_commands, BB_ORE_TARGET, /datum/pet_command/fetch)
/datum/ai_behavior/issue_commands
action_cooldown = 5 SECONDS
@@ -47,11 +47,13 @@ GLOBAL_LIST_EMPTY(raptor_population)
var/ridable_component = /datum/component/riding/creature/raptor
//pet commands when we tame the raptor
var/static/list/pet_commands = list(
/datum/pet_command/breed,
/datum/pet_command/idle,
/datum/pet_command/move,
/datum/pet_command/free,
/datum/pet_command/point_targeting/attack,
/datum/pet_command/attack,
/datum/pet_command/follow,
/datum/pet_command/point_targeting/fetch,
/datum/pet_command/fetch,
)
///things we inherited from our parent
var/datum/raptor_inheritance/inherited_stats
@@ -158,7 +160,7 @@ GLOBAL_LIST_EMPTY(raptor_population)
if(isnull(ore_food))
balloon_alert(src, "no food!")
else
melee_attack(ore_food)
UnarmedAttack(ore_food, TRUE, modifiers)
return FALSE
/mob/living/basic/raptor/melee_attack(mob/living/target, list/modifiers, ignore_cooldown)