From cdf4616561d992dd656bd4383b92ee00d89b0ac5 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Mon, 28 Nov 2022 20:57:00 +0100 Subject: [PATCH] pAIs and lightgeists can now correctly climb ladders. (#70869) ## About The Pull Request See the title and the relative issue reports. The logic here is that, if they can move, chances are they can also use ladders (with a few exceptions such as camera mobs). This ought to include both pAIs and lightgeists, even if they cannot directly interact with about every other object in the game. I have also moved lightgeists onto a new file, from colossus.dm. ## Why It's Good For The Game This will fix #57061 and fix #69228. ## Changelog :cl: fix: pAIs and lightgeists can now correctly climb ladders. fix: fixed a small issue with the radial menu for ladders that caused the user to travel down when abruptly closed. /:cl: Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> --- code/_onclick/other_mobs.dm | 14 +++- code/game/objects/structures/ladders.dm | 15 +++- .../simple_animal/hostile/lightgeist.dm | 73 +++++++++++++++++++ .../hostile/megafauna/colossus.dm | 65 ----------------- tgstation.dme | 1 + 5 files changed, 100 insertions(+), 68 deletions(-) create mode 100644 code/modules/mob/living/simple_animal/hostile/lightgeist.dm diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 06c2d9dd467..4b92fca5c50 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -265,9 +265,21 @@ pAI */ -/mob/living/silicon/pai/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers)//Stops runtimes due to attack_animal being the default +/mob/living/silicon/pai/resolve_unarmed_attack(atom/attack_target, list/modifiers) + attack_target.attack_pai(src, modifiers) + +/mob/living/silicon/pai/resolve_right_click_attack(atom/target, list/modifiers) + return target.attack_pai_secondary(src, modifiers) + +/atom/proc/attack_pai(mob/user, list/modifiers) return +/** + * Called when a pAI right clicks an atom. + * Returns a SECONDARY_ATTACK_* value. + */ +/atom/proc/attack_pai_secondary(mob/user, list/modifiers) + return SECONDARY_ATTACK_CALL_NORMAL /* Simple animals diff --git a/code/game/objects/structures/ladders.dm b/code/game/objects/structures/ladders.dm index 15247ecc7d9..76a6cdadea0 100644 --- a/code/game/objects/structures/ladders.dm +++ b/code/game/objects/structures/ladders.dm @@ -157,7 +157,7 @@ going_up = TRUE if("Down") going_up = FALSE - if("Cancel") + else return if(is_ghost || !travel_time) @@ -251,7 +251,18 @@ /obj/structure/ladder/attack_robot_secondary(mob/living/silicon/robot/user) . = ..() if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN || !user.Adjacent(src)) - return SECONDARY_ATTACK_CONTINUE_CHAIN + return + use(user, going_up = FALSE) + return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN + +/obj/structure/ladder/attack_pai(mob/user, list/modifiers) + use(user) + return TRUE + +/obj/structure/ladder/attack_pai_secondary(mob/user, list/modifiers) + . = ..() + if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) + return use(user, going_up = FALSE) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/modules/mob/living/simple_animal/hostile/lightgeist.dm b/code/modules/mob/living/simple_animal/hostile/lightgeist.dm new file mode 100644 index 00000000000..f2acd34730b --- /dev/null +++ b/code/modules/mob/living/simple_animal/hostile/lightgeist.dm @@ -0,0 +1,73 @@ +/** + * A small critter meant to heal other living mobs and unable to interact with almost everything else. + * The procs related to its unarmed attacks can be found in _onclick/other_mobs.dm (attack_lightgeist) + */ +/mob/living/simple_animal/hostile/lightgeist + name = "lightgeist" + desc = "This small floating creature is a completely unknown form of life... being near it fills you with a sense of tranquility." + icon_state = "lightgeist" + icon_living = "lightgeist" + icon_dead = "butterfly_dead" + turns_per_move = 1 + response_help_continuous = "waves away" + response_help_simple = "wave away" + response_disarm_continuous = "brushes aside" + response_disarm_simple = "brush aside" + response_harm_continuous = "disrupts" + response_harm_simple = "disrupt" + speak_emote = list("oscillates") + maxHealth = 2 + health = 2 + harm_intent_damage = 5 + melee_damage_lower = 5 + melee_damage_upper = 5 + friendly_verb_continuous = "taps" + friendly_verb_simple = "tap" + density = FALSE + pass_flags = PASSTABLE | PASSGRILLE | PASSMOB + mob_size = MOB_SIZE_TINY + gold_core_spawnable = HOSTILE_SPAWN + verb_say = "warps" + verb_ask = "floats inquisitively" + verb_exclaim = "zaps" + verb_yell = "bangs" + initial_language_holder = /datum/language_holder/lightbringer + damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) + light_range = 4 + faction = list("neutral") + del_on_death = TRUE + unsuitable_atmos_damage = 0 + minbodytemp = 0 + maxbodytemp = 1500 + obj_damage = 0 + environment_smash = ENVIRONMENT_SMASH_NONE + AIStatus = AI_OFF + stop_automated_movement = TRUE + +/mob/living/simple_animal/hostile/lightgeist/Initialize(mapload) + . = ..() + AddElement(/datum/element/simple_flying) + remove_verb(src, /mob/living/verb/pulled) + remove_verb(src, /mob/verb/me_verb) + var/datum/atom_hud/medsensor = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] + medsensor.show_to(src) + + ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) + +/mob/living/simple_animal/hostile/lightgeist/ghost() + . = ..() + if(.) + death() + +/mob/living/simple_animal/hostile/lightgeist/AttackingTarget() + if(istype(target, /obj/structure/ladder)) //special case where lightgeists can use ladders properly. + var/obj/structure/ladder/laddy = target + laddy.use(src) + return + if(!isliving(target) || target == src) + return + var/mob/living/living_target = target + if(living_target.stat != DEAD) + living_target.heal_overall_damage(melee_damage_upper, melee_damage_upper) + new /obj/effect/temp_visual/heal(get_turf(target), "#80F5FF") + visible_message(span_notice("[src] mends the wounds of [target]."),span_notice("You mend the wounds of [target].")) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm index 9041188a44b..7660a491ee3 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/colossus.dm @@ -478,71 +478,6 @@ if(istype(ghost)) attack_ghost(ghost) -/mob/living/simple_animal/hostile/lightgeist - name = "lightgeist" - desc = "This small floating creature is a completely unknown form of life... being near it fills you with a sense of tranquility." - icon_state = "lightgeist" - icon_living = "lightgeist" - icon_dead = "butterfly_dead" - turns_per_move = 1 - response_help_continuous = "waves away" - response_help_simple = "wave away" - response_disarm_continuous = "brushes aside" - response_disarm_simple = "brush aside" - response_harm_continuous = "disrupts" - response_harm_simple = "disrupt" - speak_emote = list("oscillates") - maxHealth = 2 - health = 2 - harm_intent_damage = 5 - melee_damage_lower = 5 - melee_damage_upper = 5 - friendly_verb_continuous = "taps" - friendly_verb_simple = "tap" - density = FALSE - pass_flags = PASSTABLE | PASSGRILLE | PASSMOB - mob_size = MOB_SIZE_TINY - gold_core_spawnable = HOSTILE_SPAWN - verb_say = "warps" - verb_ask = "floats inquisitively" - verb_exclaim = "zaps" - verb_yell = "bangs" - initial_language_holder = /datum/language_holder/lightbringer - damage_coeff = list(BRUTE = 1, BURN = 1, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0) - light_range = 4 - faction = list("neutral") - del_on_death = TRUE - unsuitable_atmos_damage = 0 - minbodytemp = 0 - maxbodytemp = 1500 - obj_damage = 0 - environment_smash = ENVIRONMENT_SMASH_NONE - AIStatus = AI_OFF - stop_automated_movement = TRUE - -/mob/living/simple_animal/hostile/lightgeist/Initialize(mapload) - . = ..() - AddElement(/datum/element/simple_flying) - remove_verb(src, /mob/living/verb/pulled) - remove_verb(src, /mob/verb/me_verb) - var/datum/atom_hud/medsensor = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED] - medsensor.show_to(src) - - ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) - -/mob/living/simple_animal/hostile/lightgeist/AttackingTarget() - if(isliving(target) && target != src) - var/mob/living/L = target - if(L.stat != DEAD) - L.heal_overall_damage(melee_damage_upper, melee_damage_upper) - new /obj/effect/temp_visual/heal(get_turf(target), "#80F5FF") - visible_message(span_notice("[src] mends the wounds of [target]."),span_notice("You mend the wounds of [target].")) - -/mob/living/simple_animal/hostile/lightgeist/ghost() - . = ..() - if(.) - death() - /obj/machinery/anomalous_crystal/possessor //Allows you to bodyjack small animals, then exit them at your leisure, but you can only do this once per activation. Because they blow up. Also, if the bodyjacked animal dies, SO DO YOU. observer_desc = "When activated, this crystal allows you to take over small animals, and then exit them at the possessors leisure. Exiting the animal kills it, and if you die while possessing the animal, you die as well." activation_method = ACTIVATE_TOUCH diff --git a/tgstation.dme b/tgstation.dme index c04f8c7bd79..5046710be45 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3794,6 +3794,7 @@ #include "code\modules\mob\living\simple_animal\hostile\hostile.dm" #include "code\modules\mob\living\simple_animal\hostile\illusion.dm" #include "code\modules\mob\living\simple_animal\hostile\killertomato.dm" +#include "code\modules\mob\living\simple_animal\hostile\lightgeist.dm" #include "code\modules\mob\living\simple_animal\hostile\mecha_pilot.dm" #include "code\modules\mob\living\simple_animal\hostile\mimic.dm" #include "code\modules\mob\living\simple_animal\hostile\mushroom.dm"