From 6bf406067cba5674c1cdf1ea002d96c1b2cee7dd Mon Sep 17 00:00:00 2001 From: AlaunusLux <89751433+AlaunusLux@users.noreply.github.com> Date: Sat, 8 Jun 2024 11:54:28 -0500 Subject: [PATCH] Various Borer fixes (#18969) I changed add_antag to add_antag_mind in borer/LateLogin because the former proc re-created the borer, causing it to drop the src/client reference. The only notable difference I observe is the antag noise doesn't play, which could be added manually if needed. Alternative methods to solve this would be welcome, though. I did have an alternative method [here](https://github.com/Aurorastation/Aurora.3/commit/5d4157588baa0998f499aba7678bf8c6551247ca), but that only "fixed" the ghost spawner, not admin possession. I also say "fixed" because that method does not give the post ghost-spawn message. Fixes #18600 - The implant check was only checking for objs, which the borer implant is not. The borer was also erroneously being removed from the implants list when releasing control back to their host. Fixes #18281 - This had a few pain points. psi was null, so it made the callback for activating powers fail. Once that was fixed, it caused many RTEs when trying to draw the HUD/screen for the powers. Refactoring a few encoding/decoding procs fixed that. Fixing these issues fixed borer monkeys not being able to speak TCB, which is strange because I thought I'd seen a borer monkey speaking TCB during a round where the psychic bug existed. Fixes #9621 - For this, I switched rejuvenate to revive. This lets them move, and also does not kill them again due to brain damage. If it proves to be too strong, it can be tweaked, but I did want to get brain devouring working for this PR. - There's also the jumpstart verb, which seems will never be used with this revive in place (or even before, with the rejuvenate). I suppose it can be used if they die again after reviving. - Should a message be added to the revive given during the devouring process? Jumpstart gives one: `visible_message(SPAN_WARNING("With a hideous, rattling moan, [src] shudders back to life!"))` Fixes #9523 Also fixes borers not being able to infest someone they are being held by. Existing Issues not addressed by this PR: - Infesting a monkey does not give you the monkey's health HUD (because it doesn't exist?). Assuming and releasing control will show it, though. - Borer antag overlay icons on Mobs seems inconsistent. potentially due to testing methods with clientless mobs - Borers cannot use psychic lance while being held - Psi aura on first receiving powers. Equip first ability and drop to fix. --------- Signed-off-by: AlaunusLux <89751433+AlaunusLux@users.noreply.github.com> --- code/_onclick/hud/ability_screen_objects.dm | 16 +++---- code/_onclick/hud/movable_screen_objects.dm | 28 +++++------ code/game/antagonist/antagonist_add.dm | 4 +- .../mob/living/simple_animal/borer/borer.dm | 13 ++---- .../simple_animal/borer/borer_powers.dm | 37 +++++++++++---- code/modules/psionics/abilities/_ability.dm | 2 +- code/modules/surgery/implant.dm | 4 +- html/changelogs/alaunuslux-borer-fixes.yml | 46 +++++++++++++++++++ 8 files changed, 108 insertions(+), 42 deletions(-) create mode 100644 html/changelogs/alaunuslux-borer-fixes.yml diff --git a/code/_onclick/hud/ability_screen_objects.dm b/code/_onclick/hud/ability_screen_objects.dm index ef1dbaf5728..9f458f0b8c2 100644 --- a/code/_onclick/hud/ability_screen_objects.dm +++ b/code/_onclick/hud/ability_screen_objects.dm @@ -44,7 +44,7 @@ toggle_open() -/obj/screen/movable/ability_master/proc/toggle_open(var/forced_state = 0) +/obj/screen/movable/ability_master/proc/toggle_open(var/forced_state = 0, var/mob/user = usr) if(showing && (forced_state != 2)) // We are closing the ability master, hide the abilities. for(var/obj/screen/ability/O in ability_objects) if(my_mob && my_mob.client) @@ -53,31 +53,31 @@ overlays.len = 0 overlays.Add(closed_state) else if(forced_state != 1) // We're opening it, show the icons. - open_ability_master() + open_ability_master(user) update_abilities(1) showing = TRUE overlays.len = 0 overlays.Add(open_state) update_icon() -/obj/screen/movable/ability_master/proc/open_ability_master() +/obj/screen/movable/ability_master/proc/open_ability_master(var/mob/user = usr) var/list/screen_loc_xy = splittext(screen_loc,",") //Create list of X offsets var/list/screen_loc_X = splittext(screen_loc_xy[1],":") - var/x_position = decode_screen_X(screen_loc_X[1]) + var/x_position = decode_screen_X(screen_loc_X[1], user) var/x_pix = screen_loc_X[2] //Create list of Y offsets var/list/screen_loc_Y = splittext(screen_loc_xy[2],":") - var/y_position = decode_screen_Y(screen_loc_Y[1]) + var/y_position = decode_screen_Y(screen_loc_Y[1], user) var/y_pix = screen_loc_Y[2] for(var/i = 1; i <= ability_objects.len; i++) var/obj/screen/ability/A = ability_objects[i] var/xpos = x_position + (x_position < 8 ? 1 : -1)*(i%7) var/ypos = y_position + (y_position < 8 ? round(i/7) : -round(i/7)) - A.screen_loc = "[encode_screen_X(xpos)]:[x_pix],[encode_screen_Y(ypos)]:[y_pix]" + A.screen_loc = "[encode_screen_X(xpos, user)]:[x_pix],[encode_screen_Y(ypos, user)]:[y_pix]" if(my_mob && my_mob.client) my_mob.client.screen += A @@ -299,7 +299,7 @@ connected_power = null return ..() -/obj/screen/movable/ability_master/proc/add_psionic_ability(var/obj/object_given, var/ability_icon_given, var/singleton/psionic_power/P) +/obj/screen/movable/ability_master/proc/add_psionic_ability(var/obj/object_given, var/ability_icon_given, var/singleton/psionic_power/P, var/mob/user) if(!object_given) message_admins("ERROR: add_psionic_ability() was not given an object in its arguments.") if(!P) @@ -314,7 +314,7 @@ A.connected_power = P ability_objects.Add(A) if(my_mob.client) - toggle_open(2) //forces the icons to refresh on screen + toggle_open(2, user) //forces the icons to refresh on screen /obj/screen/ability/obj_based/psionic/get_examine_text(mob/user) . = ..() diff --git a/code/_onclick/hud/movable_screen_objects.dm b/code/_onclick/hud/movable_screen_objects.dm index 1fd274251b4..39a937ed698 100644 --- a/code/_onclick/hud/movable_screen_objects.dm +++ b/code/_onclick/hud/movable_screen_objects.dm @@ -44,50 +44,50 @@ var/pix_Y = text2num(screen_loc_Y[2]) - 16 screen_loc = "[screen_loc_X[1]]:[pix_X],[screen_loc_Y[1]]:[pix_Y]" -/obj/screen/movable/proc/encode_screen_X(X) - if(X > usr?.client?.view+1) - . = "EAST-[usr?.client?.view*2 + 1-X]" - else if(X < usr?.client?.view+1) +/obj/screen/movable/proc/encode_screen_X(X, var/mob/user = usr) + if(X > user?.client?.view+1) + . = "EAST-[user?.client?.view*2 + 1-X]" + else if(X < user?.client?.view+1) . = "WEST+[X-1]" else . = "CENTER" -/obj/screen/movable/proc/decode_screen_X(X) +/obj/screen/movable/proc/decode_screen_X(X, var/mob/user = usr) //Find EAST/WEST implementations if(findtext(X,"EAST-")) var/num = text2num(copytext(X,6)) //Trim EAST- if(!num) num = 0 - . = usr?.client?.view*2 + 1 - num + . = user?.client?.view*2 + 1 - num else if(findtext(X,"WEST+")) var/num = text2num(copytext(X,6)) //Trim WEST+ if(!num) num = 0 . = num+1 else if(findtext(X,"CENTER")) - . = usr?.client?.view+1 + . = user?.client?.view+1 -/obj/screen/movable/proc/encode_screen_Y(Y) - if(Y > usr?.client?.view+1) - . = "NORTH-[usr?.client?.view*2 + 1-Y]" - else if(Y < usr?.client?.view+1) +/obj/screen/movable/proc/encode_screen_Y(Y, var/mob/user = usr) + if(Y > user?.client?.view+1) + . = "NORTH-[user?.client?.view*2 + 1-Y]" + else if(Y < user?.client?.view+1) . = "SOUTH+[Y-1]" else . = "CENTER" -/obj/screen/movable/proc/decode_screen_Y(Y) +/obj/screen/movable/proc/decode_screen_Y(Y, var/mob/user = usr) if(findtext(Y,"NORTH-")) var/num = text2num(copytext(Y,7)) //Trim NORTH- if(!num) num = 0 - . = usr?.client?.view*2 + 1 - num + . = user?.client?.view*2 + 1 - num else if(findtext(Y,"SOUTH+")) var/num = text2num(copytext(Y,7)) //Time SOUTH+ if(!num) num = 0 . = num+1 else if(findtext(Y,"CENTER")) - . = usr?.client?.view+1 + . = user?.client?.view+1 //Debug procs /client/proc/test_movable_UI() diff --git a/code/game/antagonist/antagonist_add.dm b/code/game/antagonist/antagonist_add.dm index a0e001813e1..d633f0c669c 100644 --- a/code/game/antagonist/antagonist_add.dm +++ b/code/game/antagonist/antagonist_add.dm @@ -37,6 +37,7 @@ if(player.current.client) add_verb(player.current.client, /client/proc/aooc) + add_verb(player.current.client, /mob/living/proc/write_ambition) to_chat(player.current, SPAN_NOTICE("Once you decide on a goal to pursue, you can optionally display it to everyone at the end of the shift with the Set Ambition verb, located in the IC tab. You can change this at any time, and it otherwise has no bearing on your round.")) add_verb(player.current.client, /mob/living/proc/write_ambition) @@ -75,9 +76,10 @@ if(player.current.client) if(!is_special_character(player) && !check_rights(R_ADMIN|R_MOD|R_CCIAA, 0, player.current)) remove_verb(player.current.client, /client/proc/aooc) + if(!is_special_character(player)) + remove_verb(player.current.client, /mob/living/proc/write_ambition) if(!is_special_character(player)) - remove_verb(player.current.client, /mob/living/proc/write_ambition) player.ambitions = "" return 1 diff --git a/code/modules/mob/living/simple_animal/borer/borer.dm b/code/modules/mob/living/simple_animal/borer/borer.dm index 17b53e3a13b..7bfacebc3b0 100644 --- a/code/modules/mob/living/simple_animal/borer/borer.dm +++ b/code/modules/mob/living/simple_animal/borer/borer.dm @@ -46,9 +46,11 @@ /mob/living/simple_animal/borer/LateLogin() ..() if(mind) - borers.add_antagonist(mind) - if(client && host) - client.screen += host.healths + borers.add_antagonist_mind(mind, 1, borers.role_text, borers.welcome_text) + if(client) + client.init_verbs() + if(host) + client.screen += host.healths /mob/living/simple_animal/borer/Initialize() . = ..() @@ -111,11 +113,6 @@ if(ability_bar) QDEL_NULL(ability_bar) - if(istype(host,/mob/living/carbon/human)) - var/mob/living/carbon/human/H = host - var/obj/item/organ/external/head = H.get_organ(BP_HEAD) - head.implants -= src - controlling = FALSE host.remove_language(LANGUAGE_BORER) diff --git a/code/modules/mob/living/simple_animal/borer/borer_powers.dm b/code/modules/mob/living/simple_animal/borer/borer_powers.dm index b9962141266..3e30bfb3736 100644 --- a/code/modules/mob/living/simple_animal/borer/borer_powers.dm +++ b/code/modules/mob/living/simple_animal/borer/borer_powers.dm @@ -38,6 +38,14 @@ detach() leave_host() +/mob/living/simple_animal/borer/proc/is_held_by(var/mob/living/carbon/M) + if (istype(usr.loc, /obj/item/holder)) + var/obj/item/holder/H = usr.loc + if (istype(H.loc, /mob/living/carbon/human)) + var/mob/living/carbon/human/held_by = H.loc + return held_by == M + + return FALSE /mob/living/simple_animal/borer/verb/infest() set category = "Abilities" @@ -56,6 +64,12 @@ if(src.Adjacent(C)) choices += C + if (istype(usr.loc, /obj/item/holder)) + var/obj/item/holder/H = usr.loc + if (istype(H.loc, /mob/living/carbon/human)) + var/mob/living/carbon/human/held_by = H.loc + choices += held_by + if(!length(choices)) to_chat(src, SPAN_NOTICE("There are no viable hosts within range.")) return @@ -73,7 +87,7 @@ return if(!M || !src) return - if(!Adjacent(M)) + if(!Adjacent(M) && !is_held_by(M)) return if(M.has_brain_worms()) to_chat(src, SPAN_WARNING("You cannot infest someone who is already infested!")) @@ -103,7 +117,7 @@ to_chat(M, SPAN_WARNING("Something slimy begins probing at the opening of your ear canal...")) to_chat(src, SPAN_WARNING("You slither up [M] and begin probing at their ear canal...")) - if(!do_after(src,30)) + if(!do_after(src,30) && !is_held_by(M)) to_chat(src, SPAN_WARNING("As [M] moves away, you are dislodged and fall to the ground.")) return if(!M || !src) @@ -112,7 +126,7 @@ to_chat(src, SPAN_NOTICE("You cannot infest a target in your current state.")) return - if(M in view(1, src)) + if((M in view(1, src)) || is_held_by(M)) to_chat(src, SPAN_NOTICE("You wiggle into [M]'s ear.")) if(!M.stat) to_chat(M, SPAN_DANGER("Something disgusting and slimy wiggles into your ear!")) @@ -121,7 +135,7 @@ src.host.status_flags |= PASSEMOTES src.forceMove(M) - if(client) + if(client && host.healths) client.screen += host.healths //Update their traitor status. @@ -187,6 +201,8 @@ if(src.mind) src.mind.special_role = "Borer Husk" src.mind.transfer_to(host) + if(host.client) + host.client.init_verbs() var/obj/item/organ/internal/borer/B = new(H) var/obj/item/organ/external/affecting = H.get_organ(BP_HEAD) @@ -207,8 +223,8 @@ H.lastKnownIP = s2h_ip // Since the host is dead, we want to kick it back into action immediately, then redo it to ensure they're good to go - H.rejuvenate() - addtimer(CALLBACK(H, PROC_REF(rejuvenate)), 30) + H.revive() + addtimer(CALLBACK(H, PROC_REF(revive)), 30) /mob/living/simple_animal/borer/verb/secrete_chemicals() set category = "Abilities" @@ -481,9 +497,14 @@ return to_chat(src, SPAN_NOTICE("You succeed in interfacing with the host's zona bovinae, this will be a painful process for them.")) - host.awaken_psi_basic("something in your head") - host.psi.psi_points = 3 /// You don't get a lot at the start. + host.psi = new(host) host.add_language(LANGUAGE_TCB) // if we don't have TCB, give them TCB | this allows monkey borers to RP + host.awaken_psi_basic("something in your head") + addtimer(CALLBACK(src, PROC_REF(set_starting_psi_points)), 4.7 SECONDS) + +/mob/living/simple_animal/borer/proc/set_starting_psi_points() + host.psi.psi_points = 3// You don't get a lot at the start. + host.psi.last_psionic_rank = host.psi.psionic_rank /mob/living/simple_animal/borer/verb/advance_psionics() set category = "Abilities" diff --git a/code/modules/psionics/abilities/_ability.dm b/code/modules/psionics/abilities/_ability.dm index f04e1ca6e57..c74776715b8 100644 --- a/code/modules/psionics/abilities/_ability.dm +++ b/code/modules/psionics/abilities/_ability.dm @@ -18,7 +18,7 @@ /singleton/psionic_power/proc/apply(var/mob/living/carbon/human/H) if(H.ability_master) var/obj/spellbutton/spell = new(H, spell_path, name, icon_state) - H.ability_master.add_psionic_ability(spell, icon_state, src) + H.ability_master.add_psionic_ability(spell, icon_state, src, H) H.psi.psionic_powers |= type return TRUE else diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm index 3005f1098ce..4e4f0787a0f 100644 --- a/code/modules/surgery/implant.dm +++ b/code/modules/surgery/implant.dm @@ -184,12 +184,12 @@ if(length(affected.implants)) var/list/implants = list() var/shrapnel_present = FALSE - for(var/obj/I in affected.implants) + for(var/I in affected.implants) implants += I if(!istype(I, /obj/item/implant)) shrapnel_present = TRUE - for(var/obj/I in implants) + for(var/I in implants) /// Prioritize shrapnel instead of stuff like loyalty implants. if(shrapnel_present && istype(I, /obj/item/implant)) continue diff --git a/html/changelogs/alaunuslux-borer-fixes.yml b/html/changelogs/alaunuslux-borer-fixes.yml new file mode 100644 index 00000000000..2d1a44bade0 --- /dev/null +++ b/html/changelogs/alaunuslux-borer-fixes.yml @@ -0,0 +1,46 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: AlaunusLux + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Cortical borers can now properly bestow psi powers upon their host." + - bugfix: "Borers can now use the host's psi powers when controlling them." + - bugfix: "Borers can now be removed in surgery, like shrapnel." + - bugfix: "Borers can now move after devouring a dead host's brain." + - bugfix: "Borers can now infest a person that is holding them in their hand." + - bugfix: "Monkey borers will be able to speak Tau Ceti Basic after using the psionic awakening ability."