From 299fe8c5cba1c453ec8a5cbe6d1bf061490696a5 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 7 Aug 2022 23:57:55 +0200 Subject: [PATCH] [MIRROR] Greatly increases Pun Pun's abilities and strengths (using desk bells, cross stun immunity) [MDB IGNORE] (#15411) * Greatly increases Pun Pun's abilities and strengths (using desk bells, cross stun immunity) * Update emote.dm Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> --- code/datums/ai/generic/generic_behaviors.dm | 2 +- code/datums/ai/idle_behaviors/idle_monkey.dm | 30 +++++++++++++++++-- code/datums/ai/monkey/monkey_controller.dm | 26 +++++++++++++--- code/datums/ai/monkey/punpun_subtrees.dm | 20 +++++++++++++ code/modules/mob/living/carbon/human/emote.dm | 9 ++++-- .../mob/living/carbon/human/monkey/monkey.dm | 3 +- code/modules/mob/living/emote.dm | 5 ++++ code/modules/paperwork/desk_bell.dm | 3 ++ tgstation.dme | 1 + 9 files changed, 88 insertions(+), 11 deletions(-) create mode 100644 code/datums/ai/monkey/punpun_subtrees.dm diff --git a/code/datums/ai/generic/generic_behaviors.dm b/code/datums/ai/generic/generic_behaviors.dm index d482041e7ed..23d2ec36b3c 100644 --- a/code/datums/ai/generic/generic_behaviors.dm +++ b/code/datums/ai/generic/generic_behaviors.dm @@ -213,7 +213,7 @@ var/mob/living/living_pawn = controller.pawn if(!living_pawn.get_num_held_items()) return //we want to fail the search if we don't have something held - . = ..() + return ..() /** * Variant of find and set that also requires the item to be edible. checks hands too diff --git a/code/datums/ai/idle_behaviors/idle_monkey.dm b/code/datums/ai/idle_behaviors/idle_monkey.dm index 3b12e1f275e..f7ca52d1a03 100644 --- a/code/datums/ai/idle_behaviors/idle_monkey.dm +++ b/code/datums/ai/idle_behaviors/idle_monkey.dm @@ -1,3 +1,17 @@ +/datum/idle_behavior/idle_monkey + ///Emotes that will be played commonly during idle behavior. + var/list/common_emotes = list( + "screech", + "roar", + ) + ///Emotes that will be played rarely during idle behavior. + var/list/rare_emotes = list( + "scratch", + "jump", + "roll", + "tail", + ) + /datum/idle_behavior/idle_monkey/perform_idle_behavior(delta_time, datum/ai_controller/controller) var/mob/living/living_pawn = controller.pawn @@ -5,6 +19,18 @@ var/move_dir = pick(GLOB.alldirs) living_pawn.Move(get_step(living_pawn, move_dir), move_dir) else if(DT_PROB(5, delta_time)) - INVOKE_ASYNC(living_pawn, /mob.proc/emote, pick("screech")) + INVOKE_ASYNC(living_pawn, /mob.proc/emote, pick(common_emotes)) else if(DT_PROB(1, delta_time)) - INVOKE_ASYNC(living_pawn, /mob.proc/emote, pick("scratch","jump","roll","tail")) + INVOKE_ASYNC(living_pawn, /mob.proc/emote, pick(rare_emotes)) + +/datum/idle_behavior/idle_monkey/pun_pun + common_emotes = list( + "tunesing", + "dance", + "bow", + ) + rare_emotes = list( + "clear", + "sign", + "tail", + ) diff --git a/code/datums/ai/monkey/monkey_controller.dm b/code/datums/ai/monkey/monkey_controller.dm index 31759d6e577..de28f96492a 100644 --- a/code/datums/ai/monkey/monkey_controller.dm +++ b/code/datums/ai/monkey/monkey_controller.dm @@ -29,6 +29,21 @@ have ways of interacting with a specific mob and control it. ) idle_behavior = /datum/idle_behavior/idle_monkey + ///Whether this AI is immune to being stunned by being crossed into. + var/crossed_immune = FALSE + +/datum/ai_controller/monkey/pun_pun + movement_delay = 0.7 SECONDS //pun pun moves slower so the bartender can keep track of them + planning_subtrees = list( + /datum/ai_planning_subtree/generic_resist, + /datum/ai_planning_subtree/monkey_combat, + /datum/ai_planning_subtree/generic_hunger, + /datum/ai_planning_subtree/generic_play_instrument, + /datum/ai_planning_subtree/punpun_shenanigans, + ) + idle_behavior = /datum/idle_behavior/idle_monkey/pun_pun + crossed_immune = TRUE + /datum/ai_controller/monkey/angry /datum/ai_controller/monkey/angry/TryPossessPawn(atom/new_pawn) @@ -42,7 +57,8 @@ have ways of interacting with a specific mob and control it. return AI_CONTROLLER_INCOMPATIBLE var/mob/living/living_pawn = new_pawn - RegisterSignal(new_pawn, COMSIG_MOVABLE_CROSS, .proc/on_crossed) + if(!crossed_immune) + RegisterSignal(new_pawn, COMSIG_MOVABLE_CROSS, .proc/on_crossed) RegisterSignal(new_pawn, COMSIG_PARENT_ATTACKBY, .proc/on_attackby) RegisterSignal(new_pawn, COMSIG_ATOM_ATTACK_HAND, .proc/on_attack_hand) RegisterSignal(new_pawn, COMSIG_ATOM_ATTACK_PAW, .proc/on_attack_paw) @@ -60,8 +76,10 @@ have ways of interacting with a specific mob and control it. return ..() //Run parent at end /datum/ai_controller/monkey/UnpossessPawn(destroy) + if(!crossed_immune) + UnregisterSignal(pawn, COMSIG_MOVABLE_CROSS) + UnregisterSignal(pawn, list( - COMSIG_MOVABLE_CROSS, COMSIG_PARENT_ATTACKBY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_ATTACK_PAW, @@ -88,11 +106,11 @@ have ways of interacting with a specific mob and control it. RegisterSignal(pawn, COMSIG_MOVABLE_CROSS, .proc/on_crossed) /datum/ai_controller/monkey/able_to_run() - . = ..() var/mob/living/living_pawn = pawn if(IS_DEAD_OR_INCAP(living_pawn)) return FALSE + return ..() ///re-used behavior pattern by monkeys for finding a weapon /datum/ai_controller/monkey/proc/TryFindWeapon() @@ -164,7 +182,7 @@ have ways of interacting with a specific mob and control it. /datum/ai_controller/monkey/proc/on_bullet_act(datum/source, obj/projectile/Proj) SIGNAL_HANDLER var/mob/living/living_pawn = pawn - if(istype(Proj , /obj/projectile/beam)||istype(Proj, /obj/projectile/bullet)) + if(istype(Proj, /obj/projectile/beam) || istype(Proj, /obj/projectile/bullet)) if((Proj.damage_type == BURN) || (Proj.damage_type == BRUTE)) if(!Proj.nodamage && Proj.damage < living_pawn.health && isliving(Proj.firer)) retaliate(Proj.firer) diff --git a/code/datums/ai/monkey/punpun_subtrees.dm b/code/datums/ai/monkey/punpun_subtrees.dm new file mode 100644 index 00000000000..18252801024 --- /dev/null +++ b/code/datums/ai/monkey/punpun_subtrees.dm @@ -0,0 +1,20 @@ +/datum/ai_planning_subtree/punpun_shenanigans/SelectBehaviors(datum/ai_controller/monkey/controller, delta_time) + + if(prob(5)) + controller.queue_behavior(/datum/ai_behavior/use_in_hand) + + if(!DT_PROB(MONKEY_SHENANIGAN_PROB, delta_time)) + return + + if(!controller.blackboard[BB_MONKEY_CURRENT_PRESS_TARGET]) + controller.queue_behavior(/datum/ai_behavior/find_and_set, BB_MONKEY_CURRENT_PRESS_TARGET, /obj/structure/desk_bell, 2) + else if(prob(50)) + controller.queue_behavior(/datum/ai_behavior/use_on_object, BB_MONKEY_CURRENT_PRESS_TARGET) + return SUBTREE_RETURN_FINISH_PLANNING + + if(!controller.blackboard[BB_MONKEY_CURRENT_GIVE_TARGET]) + controller.queue_behavior(/datum/ai_behavior/find_and_set/pawn_must_hold_item, BB_MONKEY_CURRENT_GIVE_TARGET, /mob/living, 2) + else if(prob(30)) + controller.queue_behavior(/datum/ai_behavior/give, BB_MONKEY_CURRENT_GIVE_TARGET) + return SUBTREE_RETURN_FINISH_PLANNING + diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index ad792774074..e33ccbdb9d5 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -126,6 +126,7 @@ if(tail?.wag_flags & WAG_ABLE) return ..() return FALSE + /datum/emote/living/carbon/human/wing key = "wing" key_third_person = "wings" @@ -156,8 +157,10 @@ if(H.dna && H.dna.species && (H.dna.features["wings"] != "None")) return TRUE -//Ayy lmao - +/datum/emote/living/carbon/human/clear_throat + key = "clear" + key_third_person = "clears throat" + message = "clears their throat." ///Snowflake emotes only for le epic chimp /datum/emote/living/carbon/human/monkey @@ -194,7 +197,7 @@ key = "tail" message = "waves their tail." -/datum/emote/living/carbon/human/monkeysign +/datum/emote/living/carbon/human/monkey/sign key = "sign" key_third_person = "signs" message_param = "signs the number %t." diff --git a/code/modules/mob/living/carbon/human/monkey/monkey.dm b/code/modules/mob/living/carbon/human/monkey/monkey.dm index 50443d02a23..792732e2596 100644 --- a/code/modules/mob/living/carbon/human/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/human/monkey/monkey.dm @@ -34,10 +34,11 @@ GLOBAL_DATUM(the_one_and_only_punpun, /mob/living/carbon/human/species/monkey/punpun) -/mob/living/carbon/human/species/monkey/punpun //except for a few special persistence features, pun pun is just a normal monkey +/mob/living/carbon/human/species/monkey/punpun name = "Pun Pun" //C A N O N unique_name = FALSE use_random_name = FALSE + ai_controller = /datum/ai_controller/monkey/pun_pun /// If we had one of the rare names in a past life var/ancestor_name /// The number of times Pun Pun has died since he was last gibbed diff --git a/code/modules/mob/living/emote.dm b/code/modules/mob/living/emote.dm index b2d032bc503..cec35a07739 100644 --- a/code/modules/mob/living/emote.dm +++ b/code/modules/mob/living/emote.dm @@ -34,6 +34,11 @@ #undef BLUSH_DURATION +/datum/emote/living/sing_tune + key = "tunesing" + key_third_person = "sings a tune" + message = "sings a tune." + /datum/emote/living/bow key = "bow" key_third_person = "bows" diff --git a/code/modules/paperwork/desk_bell.dm b/code/modules/paperwork/desk_bell.dm index 46725315ac1..2516b268b68 100644 --- a/code/modules/paperwork/desk_bell.dm +++ b/code/modules/paperwork/desk_bell.dm @@ -51,6 +51,9 @@ COOLDOWN_START(src, ring_cooldown, ring_cooldown_length) return TRUE +/obj/structure/desk_bell/attack_paw(mob/user, list/modifiers) + return attack_hand(user, modifiers) + /obj/structure/desk_bell/attackby(obj/item/weapon, mob/living/user, params) . = ..() times_rang += weapon.force diff --git a/tgstation.dme b/tgstation.dme index 0dc1a8fddb3..b9f201809ba 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -762,6 +762,7 @@ #include "code\datums\ai\monkey\monkey_behaviors.dm" #include "code\datums\ai\monkey\monkey_controller.dm" #include "code\datums\ai\monkey\monkey_subtrees.dm" +#include "code\datums\ai\monkey\punpun_subtrees.dm" #include "code\datums\ai\movement\_ai_movement.dm" #include "code\datums\ai\movement\ai_movement_basic_avoidance.dm" #include "code\datums\ai\movement\ai_movement_dumb.dm"