From 64773394471fdbb07ce59ca512b6e116dccea891 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Mon, 17 Jul 2023 18:41:58 +0100 Subject: [PATCH] pAI clothing (god is dead and i killed him) (#5719) ## About The Pull Request title you can select clothing from a list using the verb, swaps your shell for it second verb undoes this currently the prebuilt list is just a grey skirt and a maid outfit as i couldn't really think of anything specific to add using clothing on the pAI mob itself "uploads" the clothing the pAI can imitate the last clothing uploaded to them, this imitation just copies the sprite and has no real defense values or abilities you cannot change your shell while being held, this saves a couple of potential headaches using the clothing in-hand will open the pAI card menu (by passing attack_self to the stored pAI card) changing your shell shares the same 2 second cooldown that folding and unfolding does as a "special action" **locally tested but i'd rather this be testmerged once the prior pr #5700 is merged in-case anyone manages to break something i did not foresee** ## Why It's Good For The Game ~~it's not~~ pretty harmless addition that makes carrying around your pAI more fun ## Changelog :cl: add: pAIs can now change their shell into clothing items /:cl: --- .../modules/mob/living/silicon/pai/defense.dm | 23 +++++++++++ .../mob/living/silicon/pai/mobility.dm | 25 +++++++++-- code/modules/mob/living/silicon/pai/pai.dm | 40 ++++++++++++++---- code/modules/mob/living/silicon/pai/verbs.dm | 41 +++++++++++++++++++ 4 files changed, 119 insertions(+), 10 deletions(-) diff --git a/code/modules/mob/living/silicon/pai/defense.dm b/code/modules/mob/living/silicon/pai/defense.dm index cb29a48f0c3..cc1cf21f2a4 100644 --- a/code/modules/mob/living/silicon/pai/defense.dm +++ b/code/modules/mob/living/silicon/pai/defense.dm @@ -16,6 +16,29 @@ else if(istype(W, /obj/item/card/id) && idaccessible == 0) to_chat(user, "[src] is not accepting access modifcations at this time.") return + else if(istype(W, /obj/item/clothing)) + var/obj/item/clothing/C = W + if(C.slot_flags & SLOT_HEAD) + base_uploaded_path = /obj/item/clothing/head + if(C.slot_flags & SLOT_ICLOTHING) + base_uploaded_path = /obj/item/clothing/under + if(C.slot_flags & SLOT_EYES) + base_uploaded_path = /obj/item/clothing/glasses + if(C.slot_flags & SLOT_GLOVES) + base_uploaded_path = /obj/item/clothing/gloves + if(C.slot_flags & SLOT_MASK) + base_uploaded_path = /obj/item/clothing/mask + if(C.slot_flags & SLOT_FEET) + base_uploaded_path = /obj/item/clothing/shoes + if(C.slot_flags & SLOT_OCLOTHING) + base_uploaded_path = /obj/item/clothing/suit + last_uploaded_path = W.type + + var/obj/item/clothing/under/U = C + if(istype(U)) + uploaded_snowflake_worn_state = U.snowflake_worn_state + + return else . = ..() diff --git a/code/modules/mob/living/silicon/pai/mobility.dm b/code/modules/mob/living/silicon/pai/mobility.dm index dde5aae51cf..e2c1a31b5ed 100644 --- a/code/modules/mob/living/silicon/pai/mobility.dm +++ b/code/modules/mob/living/silicon/pai/mobility.dm @@ -4,12 +4,19 @@ ..() /mob/living/silicon/pai/proc/close_up() - last_special = world.time + 20 - // we can't close up if already inside our shell if(src.loc == shell) return + // we check mobility here to stop people folding up if they currently cannot move + if(!CHECK_MOBILITY(src, MOBILITY_CAN_MOVE)) + return + + if(!can_action()) + return + + last_special = world.time + 20 + release_vore_contents() stop_pulling() @@ -101,9 +108,21 @@ // space movement (we get one ion burst every 3 seconds) /mob/living/silicon/pai/Process_Spacemove(movement_dir = NONE) . = ..() - if(!.) + if(!. && src.loc != shell) if(world.time >= last_space_movement + 30) last_space_movement = world.time // place an effect for the movement new /obj/effect/temp_visual/pai_ion_burst(get_turf(src)) return TRUE + +/mob/living/silicon/pai/proc/can_change_shell() + if(istype(src.loc, /mob)) + to_chat(src, "You're not able to change your shell while being held.") + return FALSE + if(stat != CONSCIOUS) + return FALSE + if(!can_action()) + return FALSE + if(!CHECK_MOBILITY(src, MOBILITY_CAN_MOVE)) + return FALSE + return TRUE diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 4a31dd96039..e55e796609f 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -75,6 +75,16 @@ "Canine" = list("yaps","barks","woofs"), ) + // shell transformation + var/global/list/possible_clothing_options = list( + "Maid Costume" = /obj/item/clothing/under/dress/maid/sexy, + "Grey Pleated Skirt" = /obj/item/clothing/under/color/grey_skirt, + "Last Uploaded Clothing" = null, + ) + var/obj/item/clothing/last_uploaded_path + var/obj/item/clothing/base_uploaded_path + var/uploaded_snowflake_worn_state + /// The cable we produce and use when door or camera jacking. var/obj/item/pai_cable/cable @@ -207,13 +217,7 @@ people_eaten = min(1, new_people_eaten) // changing the shell -/mob/living/silicon/pai/proc/switch_shell(var/obj/item/new_shell) - // we're on cooldown or we are dead - if(!can_action()) - return FALSE - - last_special = world.time + 20 - +/mob/living/silicon/pai/proc/switch_shell(obj/item/new_shell) // setup transform text if(istype(new_shell, /obj/item/paicard)) transform_component.to_object_text = "neatly folds inwards, compacting down to a rectangular card" @@ -235,3 +239,25 @@ set_resting(FALSE) update_mobility() remove_verb(src, /mob/living/silicon/pai/proc/pai_nom) + + // pass attack self on to the card regardless of our shell + if(!istype(new_shell, /obj/item/paicard)) + RegisterSignal(shell, COMSIG_ITEM_ATTACK_SELF, .proc/pass_attack_self_to_card) + +// changing the shell into clothing +/mob/living/silicon/pai/proc/change_shell_by_path(object_path) + if(!can_change_shell()) + return FALSE + + last_special = world.time + 20 + + var/obj/item/new_object = new object_path + new_object.name = src.name + new_object.desc = src.desc + new_object.forceMove(src.loc) + switch_shell(new_object) + return TRUE + +/mob/living/silicon/pai/proc/pass_attack_self_to_card() + if(istype(shell.loc, /mob/living/carbon)) + card.attack_self(shell.loc) diff --git a/code/modules/mob/living/silicon/pai/verbs.dm b/code/modules/mob/living/silicon/pai/verbs.dm index 39036de4e80..1ed4938ef14 100644 --- a/code/modules/mob/living/silicon/pai/verbs.dm +++ b/code/modules/mob/living/silicon/pai/verbs.dm @@ -115,3 +115,44 @@ if (stat != CONSCIOUS) return return feed_grabbed_to_self(src,T) + +/mob/living/silicon/pai/verb/change_shell_clothing() + set name = "pAI Clothing" + set category = "pAI Commands" + set desc = "Allows you to transform your shell into clothing." + + if(!can_change_shell()) + return + + var/clothing_entry = input(usr, "What clothing would you like to change your shell to?") as null|anything in possible_clothing_options + if(clothing_entry) + if(clothing_entry != "Last Uploaded Clothing") + change_shell_by_path(possible_clothing_options[clothing_entry]) + else + if(last_uploaded_path && can_change_shell()) + last_special = world.time + 20 + var/state = initial(last_uploaded_path.icon_state) + var/icon = initial(last_uploaded_path.icon) + var/obj/item/clothing/new_clothing = new base_uploaded_path + new_clothing.forceMove(src.loc) + new_clothing.name = src.name + new_clothing.desc = src.desc + new_clothing.icon = icon + new_clothing.icon_state = state + + var/obj/item/clothing/under/U = new_clothing + if(istype(U)) + U.snowflake_worn_state = uploaded_snowflake_worn_state + + switch_shell(new_clothing) + +/mob/living/silicon/pai/verb/revert_shell_to_card() + set name = "Reset Shell" + set category = "pAI Commands" + set desc = "Reverts your shell back to card form." + + if(!can_change_shell()) + return + if(!card || card.loc != src || card == shell) + return + switch_shell(card)