From 8ea1c3b08e7a7f17e1ee612a429b99d13dafe458 Mon Sep 17 00:00:00 2001 From: CRUNCH <143041327+Fordoxia@users.noreply.github.com> Date: Thu, 28 Aug 2025 15:56:29 +0100 Subject: [PATCH] Migrates `obj/item/inflatable` and `obj/structure/inflatable` to the new attack chain. (#30253) * creation * Update inflatable.dm --- .../items/robot/items/inflatable_tool.dm | 42 ----- code/game/objects/structures/inflatable.dm | 154 ++++++++++++------ paradise.dme | 1 - 3 files changed, 107 insertions(+), 90 deletions(-) delete mode 100644 code/game/objects/items/robot/items/inflatable_tool.dm diff --git a/code/game/objects/items/robot/items/inflatable_tool.dm b/code/game/objects/items/robot/items/inflatable_tool.dm deleted file mode 100644 index 6d7b999602f..00000000000 --- a/code/game/objects/items/robot/items/inflatable_tool.dm +++ /dev/null @@ -1,42 +0,0 @@ -/obj/item/inflatable/cyborg - var/power_use = 400 - var/structure_type = /obj/structure/inflatable - /// How long it takes to inflate - var/delay = 1 SECONDS - -/obj/item/inflatable/cyborg/door - name = "inflatable door" - desc = "A folded membrane which rapidly expands into a simple door on activation." - icon_state = "folded_door" - power_use = 600 - structure_type = /obj/structure/inflatable/door - -/obj/item/inflatable/cyborg/examine(mob/user) - . = ..() - . += "As a synthetic, you can restore them at a cyborg recharger." - -/obj/item/inflatable/cyborg/attack_self__legacy__attackchain(mob/user) - if(locate(/obj/structure/inflatable) in get_turf(user)) - to_chat(user, "There's already an inflatable structure!") - return FALSE - - if(!do_after(user, delay, FALSE, user)) - return FALSE - - if(!useResource(user)) - return FALSE - - playsound(loc, 'sound/items/zip.ogg', 75, TRUE) - to_chat(user, "You inflate [src].") - var/obj/structure/inflatable/R = new structure_type(user.loc) - transfer_fingerprints_to(R) - R.add_fingerprint(user) - -/obj/item/inflatable/cyborg/proc/useResource(mob/user) - if(!isrobot(user)) - return FALSE - var/mob/living/silicon/robot/R = user - if(R.cell.charge < power_use) - to_chat(user, "Not enough power!") - return FALSE - return R.cell.use(power_use) diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm index 81d51d6b53b..6cef4067128 100644 --- a/code/game/objects/structures/inflatable.dm +++ b/code/game/objects/structures/inflatable.dm @@ -1,20 +1,47 @@ +// MARK: Wall /obj/item/inflatable name = "inflatable wall" desc = "A folded membrane which rapidly expands into a large cubical shape on activation." icon = 'icons/obj/inflatable.dmi' icon_state = "folded_wall" + var/structure_type = /obj/structure/inflatable + var/torn = FALSE + new_attack_chain = TRUE /obj/item/inflatable/examine(mob/user) . = ..() - . += "Use this item in hand to create an inflatable wall." + if(!torn) + . += "Use this item in hand to create an inflatable wall." + else + . += "[src] is torn and cannot hold air anymore. It's completely useless now." + + +/obj/item/inflatable/activate_self(mob/user) + if(..()) + return + + if(torn) + add_fingerprint(user) + to_chat(user, "[src] cannot be inflated anymore!") + return ITEM_INTERACT_COMPLETE + + if(locate(/obj/structure/inflatable) in get_turf(user)) + to_chat(user, "There's already an inflatable structure here!") + return ITEM_INTERACT_COMPLETE -/obj/item/inflatable/attack_self__legacy__attackchain(mob/user) playsound(loc, 'sound/items/zip.ogg', 75, 1) to_chat(user, "You inflate [src].") - var/obj/structure/inflatable/R = new /obj/structure/inflatable(user.loc) + var/obj/structure/inflatable/R = new structure_type(user.loc) src.transfer_fingerprints_to(R) R.add_fingerprint(user) - qdel(src) + if(!isrobot(loc)) + qdel(src) + return ITEM_INTERACT_COMPLETE + +/obj/item/inflatable/torn + name = "torn inflatable wall" + icon_state = "folded_wall_torn" + torn = TRUE /obj/structure/inflatable name = "inflatable wall" @@ -26,6 +53,7 @@ icon_state = "wall" var/torn = /obj/item/inflatable/torn var/intact = /obj/item/inflatable + new_attack_chain = TRUE /obj/structure/inflatable/examine(mob/user) . = ..() @@ -49,18 +77,21 @@ /obj/structure/inflatable/attack_hand(mob/user) add_fingerprint(user) -/obj/structure/inflatable/attackby__legacy__attackchain(obj/item/I, mob/living/user, params) - if(I.sharp || is_type_in_typecache(I, GLOB.pointed_types)) - user.do_attack_animation(src, used_item = I) - deconstruct(FALSE) - return FALSE - return ..() +/obj/structure/inflatable/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!used.sharp && !is_type_in_typecache(used, GLOB.pointed_types)) + return ..() + + user.do_attack_animation(src, used_item = used) + deconstruct(FALSE) + return ITEM_INTERACT_COMPLETE /obj/structure/inflatable/AltClick() if(usr.stat || usr.restrained()) return + if(!Adjacent(usr)) return + deconstruct(TRUE) /obj/structure/inflatable/deconstruct(disassembled = TRUE) @@ -79,19 +110,17 @@ transfer_fingerprints_to(R) qdel(src) - +// MARK: Door /obj/item/inflatable/door name = "inflatable door" - desc = "A folded membrane which rapidly expands into a simple door on activation." + desc = "A folded membrane which rapidly expands into a simple airtight door on activation." icon_state = "folded_door" + structure_type = /obj/structure/inflatable/door -/obj/item/inflatable/door/attack_self__legacy__attackchain(mob/user) - playsound(loc, 'sound/items/zip.ogg', 75, 1) - to_chat(user, "You inflate [src].") - var/obj/structure/inflatable/door/R = new /obj/structure/inflatable/door(user.loc) - src.transfer_fingerprints_to(R) - R.add_fingerprint(user) - qdel(src) +/obj/item/inflatable/door/torn + name = "torn inflatable door" + icon_state = "folded_door_torn" + torn = TRUE /// Based on mineral door code /obj/structure/inflatable/door @@ -103,12 +132,16 @@ var/state_open = FALSE var/is_operating = FALSE -/obj/structure/inflatable/door/attack_ai(mob/user as mob) //those aren't machinery, they're just big fucking slabs of a mineral - if(is_ai(user)) //so the AI can't open it +/obj/structure/inflatable/door/attack_ai(mob/user as mob) + if(is_ai(user)) // The AI can't open it. return - else if(isrobot(user)) //but cyborgs can - if(get_dist(user,src) <= 1) //not remotely though - return try_to_operate(user) + + if(isrobot(user) && Adjacent(user)) // Cyborgs can, but not remotely. + return try_to_operate(user) + +/obj/structure/inflatable/door/attack_ghost(mob/user) + if(user.can_advanced_admin_interact()) + operate() /obj/structure/inflatable/door/attack_hand(mob/user as mob) return try_to_operate(user) @@ -124,17 +157,24 @@ /obj/structure/inflatable/door/proc/try_to_operate(atom/user) if(is_operating) return + + if(ismecha(user)) + operate() + return + if(ismob(user)) var/mob/M = user - if(M.client) - if(iscarbon(M)) - var/mob/living/carbon/C = M - if(!C.handcuffed) - operate() - else - operate() - else if(ismecha(user)) - operate() + if(!M.client) + operate() + return + + if(!iscarbon(M)) + operate() + return + + var/mob/living/carbon/C = M + if(!C.handcuffed) + operate() /obj/structure/inflatable/door/proc/operate() is_operating = TRUE @@ -156,24 +196,44 @@ else icon_state = "door_closed" -/obj/item/inflatable/torn - name = "torn inflatable wall" - desc = "A folded membrane which rapidly expands into a large cubical shape on activation. It is too torn to be usable." - icon_state = "folded_wall_torn" +// MARK: Robot Module +/obj/item/inflatable/cyborg + var/power_cost = 400 + /// How long it takes to inflate. + var/delay = 1 SECONDS -/obj/item/inflatable/torn/attack_self__legacy__attackchain(mob/user) - to_chat(user, "The inflatable wall is too torn to be inflated!") - add_fingerprint(user) +/obj/item/inflatable/cyborg/door + name = "inflatable door" + desc = "A folded membrane which rapidly expands into a simple door on activation." + icon_state = "folded_door" + power_cost = 600 + structure_type = /obj/structure/inflatable/door -/obj/item/inflatable/door/torn - name = "torn inflatable door" - desc = "A folded membrane which rapidly expands into a simple door on activation. It is too torn to be usable." - icon_state = "folded_door_torn" +/obj/item/inflatable/cyborg/examine(mob/user) + . = ..() + . += "As a synthetic, you will synthesise these directly from your cell's energy reserves." -/obj/item/inflatable/door/torn/attack_self__legacy__attackchain(mob/user) - to_chat(user, "The inflatable door is too torn to be inflated!") - add_fingerprint(user) +/obj/item/inflatable/cyborg/activate_self(mob/user) + if(!do_after(user, delay, FALSE, user)) + return ITEM_INTERACT_COMPLETE + if(!useResource(user)) + return ITEM_INTERACT_COMPLETE + + return ..() + +/obj/item/inflatable/cyborg/proc/useResource(mob/user) + if(!isrobot(user)) + return FALSE + + var/mob/living/silicon/robot/R = user + if(R.cell.charge < power_cost) + to_chat(user, "Not enough power!") + return FALSE + + return R.cell.use(power_cost) + +// MARK: Briefcase /obj/item/storage/briefcase/inflatable name = "inflatable barrier box" desc = "Contains inflatable walls and doors." diff --git a/paradise.dme b/paradise.dme index 317dd1fe2a5..debe44f8831 100644 --- a/paradise.dme +++ b/paradise.dme @@ -1356,7 +1356,6 @@ #include "code\game\objects\items\robot\robot_items.dm" #include "code\game\objects\items\robot\robot_parts.dm" #include "code\game\objects\items\robot\robot_upgrades.dm" -#include "code\game\objects\items\robot\items\inflatable_tool.dm" #include "code\game\objects\items\stacks\medical_packs.dm" #include "code\game\objects\items\stacks\nanopaste.dm" #include "code\game\objects\items\stacks\rods.dm"