From e8b45184d26d098296b90719195f4aebd550a5a7 Mon Sep 17 00:00:00 2001 From: Casey Date: Wed, 29 Jun 2022 02:21:47 -0400 Subject: [PATCH] A pAI death tweak I forgot! --- code/game/machinery/recharger.dm | 22 + code/game/objects/items/devices/paicard_vr.dm | 385 ++++++++++++++++++ 2 files changed, 407 insertions(+) create mode 100644 code/game/objects/items/devices/paicard_vr.dm diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index f52c14da46..62042f093c 100644 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -134,6 +134,28 @@ if(!charging) update_use_power(USE_POWER_IDLE) icon_state = icon_state_idle +<<<<<<< HEAD +======= + //VOREStation Edit Start - pAI revival! + else if(istype(charging, /obj/item/device/paicard)) + var/obj/item/device/paicard/pcard = charging + if(pcard.is_damage_critical()) + pcard.forceMove(get_turf(src)) + charging = null + pcard.damage_random_component() + update_icon() + else if(pcard.pai.bruteloss) + pcard.pai.adjustBruteLoss(-5) + else if(pcard.pai.fireloss) + pcard.pai.adjustFireLoss(-5) + else + charging = null + update_icon() + src.visible_message("\The [src] ejects the [pcard]!") + pcard.forceMove(get_turf(src)) + pcard.pai.full_restore() + //VOREStation Edit End +>>>>>>> 44c1b2cda9... Merge pull request #13199 from Very-Soft/paideath else var/obj/item/weapon/cell/C = charging.get_cell() if(istype(C)) diff --git a/code/game/objects/items/devices/paicard_vr.dm b/code/game/objects/items/devices/paicard_vr.dm new file mode 100644 index 0000000000..7283966d47 --- /dev/null +++ b/code/game/objects/items/devices/paicard_vr.dm @@ -0,0 +1,385 @@ +#define PP_FUNCTIONAL 0 +#define PP_BROKEN 1 +#define PP_MISSING 2 + +var/global/list/paikeys = list() + +/obj/item/device/paicard + var/panel_open = FALSE + var/cell = PP_FUNCTIONAL //critical- power + var/processor = PP_FUNCTIONAL //critical- the thinky part + var/board = PP_FUNCTIONAL //critical- makes everything work + var/capacitor = PP_FUNCTIONAL //critical- power processing + var/projector = PP_FUNCTIONAL //non-critical- affects unfolding + var/emitter = PP_FUNCTIONAL //non-critical- affects unfolding + var/speech_synthesizer = PP_FUNCTIONAL //non-critical- affects speech + +/obj/item/device/paicard/attackby(var/obj/item/I as obj, mob/user as mob) + if(istype(I,/obj/item/weapon/tool/screwdriver)) + if(panel_open) + panel_open = FALSE + user.visible_message("\The [user] secured \the [src]'s maintenance panel.") + playsound(src, 'sound/items/Screwdriver.ogg', 50, 1) + else if(pai) + if(do_after(user, 3 SECONDS)) + panel_open = TRUE + user.visible_message("\The [user] opened \the [src]'s maintenance panel.") + playsound(src, 'sound/items/Screwdriver.ogg', 50, 1) + if(istype(I,/obj/item/device/robotanalyzer)) + if(!panel_open) + to_chat(user, "The panel isn't open. You will need to unscrew it to open it.") + else + if(cell == PP_FUNCTIONAL) + to_chat(user,"Power cell: functional") + else if(cell == PP_BROKEN) + to_chat(user,"Power cell: damaged - CRITICAL") + else + to_chat(user,"Power cell: missing - CRITICAL") + + if(processor == PP_FUNCTIONAL) + to_chat(user,"Processor: functional") + else if(processor == PP_BROKEN) + to_chat(user,"Processor: damaged - CRITICAL") + else + to_chat(user,"Processor: missing - CRITICAL") + + if(board == PP_FUNCTIONAL) + to_chat(user,"Board: functional") + else if(board == PP_BROKEN) + to_chat(user,"Board: damaged - CRITICAL") + else + to_chat(user,"Board: missing - CRITICAL") + + if(capacitor == PP_FUNCTIONAL) + to_chat(user,"Capacitors: functional") + else if(capacitor == PP_BROKEN) + to_chat(user,"Capacitors: damaged - CRITICAL") + else + to_chat(user,"Capacitors: missing - CRITICAL") + + if(projector == PP_FUNCTIONAL) + to_chat(user,"Projectors: functional") + else if(projector == PP_BROKEN) + to_chat(user,"Projectors: damaged") + else + to_chat(user,"Projectors: missing") + + if(emitter == PP_FUNCTIONAL) + to_chat(user,"Emitters: functional") + else if(emitter == PP_BROKEN) + to_chat(user,"Emitters: damaged") + else + to_chat(user,"Emitters: missing") + + if(speech_synthesizer == PP_FUNCTIONAL) + to_chat(user,"Speech Synthesizer: functional") + else if(speech_synthesizer == PP_BROKEN) + to_chat(user,"Speech Synthesizer: damaged") + else + to_chat(user,"Speech Synthesizer: missing") + + if(istype(I,/obj/item/device/multitool)) + if(!panel_open) + to_chat(user, "You can't do that in this state.") + else + var/list/parts = list() + if(cell != PP_MISSING) + parts |= "cell" + if(processor != PP_MISSING) + parts |= "processor" + if(board != PP_MISSING) + parts |= "board" + if(capacitor != PP_MISSING) + parts |= "capacitor" + if(projector != PP_MISSING) + parts |= "projector" + if(emitter != PP_MISSING) + parts |= "emitter" + if(speech_synthesizer != PP_MISSING) + parts |= "speech synthesizer" + + var/choice = tgui_input_list(user, "Which part would you like to check?", "Check part", parts) + switch(choice) + if("cell") + if(cell == PP_FUNCTIONAL) + to_chat(user,"Power cell: functional") + else if(speech_synthesizer == PP_BROKEN) + to_chat(user,"Power cell: damaged") + else + to_chat(user,"Power cell: missing") + + if("processor") + if(processor == PP_FUNCTIONAL) + to_chat(user,"Processor: functional") + else if(speech_synthesizer == PP_BROKEN) + to_chat(user,"Processor: damaged") + else + to_chat(user,"Processor: missing") + + if("board") + if(board == PP_FUNCTIONAL) + to_chat(user,"Board: functional") + else if(speech_synthesizer == PP_BROKEN) + to_chat(user,"Board: damaged") + else + to_chat(user,"Board: missing") + + if("capacitor") + if(capacitor == PP_FUNCTIONAL) + to_chat(user,"Capacitors: functional") + else if(speech_synthesizer == PP_BROKEN) + to_chat(user,"Capacitors: damaged") + else + to_chat(user,"Capacitors: missing") + + if("projector") + if(projector == PP_FUNCTIONAL) + to_chat(user,"Projectors: functional") + else if(speech_synthesizer == PP_BROKEN) + to_chat(user,"Projectors: damaged") + else + to_chat(user,"Projectors: missing") + + if("emitter") + if(emitter == PP_FUNCTIONAL) + to_chat(user,"Emitters: functional") + else if(speech_synthesizer == PP_BROKEN) + to_chat(user,"Emitters: damaged") + else + to_chat(user,"Emitters: missing") + + if("speech synthesizer") + if(speech_synthesizer == PP_FUNCTIONAL) + to_chat(user,"Speech Synthesizer: functional") + else if(speech_synthesizer == PP_BROKEN) + to_chat(user,"Speech Synthesizer: damaged") + else + to_chat(user,"Speech Synthesizer: missing") + + if(istype(I,/obj/item/paiparts/cell)) + if(cell == PP_MISSING) + if(do_after(user, 3 SECONDS)) + user.visible_message("\The [user] installs \the [I] into \the [src].","You install \the [I] into \the [src].") + cell = PP_FUNCTIONAL + user.drop_from_inventory(I) + qdel(I) + else + to_chat(user, "You would need to remove the installed [I] first!") + if(istype(I,/obj/item/paiparts/processor)) + if(processor == PP_MISSING) + if(do_after(user, 3 SECONDS)) + user.visible_message("\The [user] installs \the [I] into \the [src].","You install \the [I] into \the [src].") + processor = PP_FUNCTIONAL + user.drop_from_inventory(I) + qdel(I) + else + to_chat(user, "You would need to remove the installed [I] first!") + if(istype(I,/obj/item/paiparts/board)) + if(board == PP_MISSING) + if(do_after(user, 3 SECONDS)) + user.visible_message("\The [user] installs \the [I] into \the [src].","You install \the [I] into \the [src].") + board = PP_FUNCTIONAL + user.drop_from_inventory(I) + qdel(I) + else + to_chat(user, "You would need to remove the installed [I] first!") + if(istype(I,/obj/item/paiparts/capacitor)) + if(capacitor == PP_MISSING) + if(do_after(user, 3 SECONDS)) + user.visible_message("\The [user] installs \the [I] into \the [src].","You install \the [I] into \the [src].") + capacitor = PP_FUNCTIONAL + user.drop_from_inventory(I) + qdel(I) + else + to_chat(user, "You would need to remove the installed [I] first!") + if(istype(I,/obj/item/paiparts/projector)) + if(projector == PP_MISSING) + if(do_after(user, 3 SECONDS)) + user.visible_message("\The [user] installs \the [I] into \the [src].","You install \the [I] into \the [src].") + projector = PP_FUNCTIONAL + user.drop_from_inventory(I) + qdel(I) + else + to_chat(user, "You would need to remove the installed [I] first!") + if(istype(I,/obj/item/paiparts/emitter)) + if(emitter == PP_MISSING) + if(do_after(user, 3 SECONDS)) + user.visible_message("\The [user] installs \the [I] into \the [src].","You install \the [I] into \the [src].") + emitter = PP_FUNCTIONAL + user.drop_from_inventory(I) + qdel(I) + else + to_chat(user, "You would need to remove the installed [I] first!") + if(istype(I,/obj/item/paiparts/speech_synthesizer)) + if(speech_synthesizer == PP_MISSING) + if(do_after(user, 3 SECONDS)) + user.visible_message("\The [user] installs \the [I] into \the [src].","You install \the [I] into \the [src].") + speech_synthesizer = PP_FUNCTIONAL + user.drop_from_inventory(I) + qdel(I) + else + to_chat(user, "You would need to remove the installed [I] first!") + +/obj/item/device/paicard/attack_self(mob/user) + if(!panel_open) + access_screen(user) + return + var/list/parts = list() + if(cell != PP_MISSING) + parts |= "cell" + if(processor != PP_MISSING) + parts |= "processor" + if(board != PP_MISSING) + parts |= "board" + if(capacitor != PP_MISSING) + parts |= "capacitor" + if(projector != PP_MISSING) + parts |= "projector" + if(emitter != PP_MISSING) + parts |= "emitter" + if(speech_synthesizer != PP_MISSING) + parts |= "speech synthesizer" + + var/choice = tgui_input_list(user, "Which part would you like to remove?", "Remove part", parts) + if(choice) + playsound(src, 'sound/items/pickup/component.ogg', vary = TRUE) + else + return + if(!do_after(user, 3 SECONDS)) + return + switch(choice) + if("cell") + if(cell == PP_FUNCTIONAL) + new /obj/item/paiparts/capacitor(get_turf(user)) + else + new /obj/item/paiparts(get_turf(user)) + user.visible_message("\The [user] removes \the [choice] from \the [src].","You remove \the [choice] from \the [src].") + cell = PP_MISSING + if("processor") + if(processor == PP_FUNCTIONAL) + new /obj/item/paiparts/capacitor(get_turf(user)) + else + new /obj/item/paiparts(get_turf(user)) + user.visible_message("\The [user] removes \the [choice] from \the [src].","You remove \the [choice] from \the [src].") + processor = PP_MISSING + if("board") + board = PP_MISSING + if(board == PP_FUNCTIONAL) + new /obj/item/paiparts/capacitor(get_turf(user)) + else + new /obj/item/paiparts(get_turf(user)) + user.visible_message("\The [user] removes \the [choice] from \the [src].","You remove \the [choice] from \the [src].") + + if("capacitor") + if(capacitor == PP_FUNCTIONAL) + new /obj/item/paiparts/capacitor(get_turf(user)) + else + new /obj/item/paiparts(get_turf(user)) + user.visible_message("\The [user] removes \the [choice] from \the [src].","You remove \the [choice] from \the [src].") + capacitor = PP_MISSING + if("projector") + if(projector == PP_FUNCTIONAL) + new /obj/item/paiparts/capacitor(get_turf(user)) + else + new /obj/item/paiparts(get_turf(user)) + user.visible_message("\The [user] removes \the [choice] from \the [src].","You remove \the [choice] from \the [src].") + projector = PP_MISSING + if("emitter") + if(emitter == PP_FUNCTIONAL) + new /obj/item/paiparts/capacitor(get_turf(user)) + else + new /obj/item/paiparts(get_turf(user)) + user.visible_message("\The [user] removes \the [choice] from \the [src].","You remove \the [choice] from \the [src].") + emitter = PP_MISSING + if("speech synthesizer") + if(speech_synthesizer == PP_FUNCTIONAL) + new /obj/item/paiparts/capacitor(get_turf(user)) + else + new /obj/item/paiparts(get_turf(user)) + user.visible_message("\The [user] removes \the [choice] from \the [src].","You remove \the [choice] from \the [src].") + speech_synthesizer = PP_MISSING + +/obj/item/device/paicard/proc/death_damage() + + var/number = rand(1,4) + while(number) + number -- + switch(rand(1,4)) + if(1) + cell = PP_BROKEN + if(2) + processor = PP_BROKEN + if(3) + board = PP_BROKEN + if(4) + capacitor = PP_BROKEN + + +/obj/item/device/paicard/proc/damage_random_component(nonfatal = FALSE) + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(2, 1, src) + s.start() + if(prob(80) || nonfatal) //Way more likely to be non-fatal part damage + switch(rand(1,3)) + if(1) + projector = PP_BROKEN + if(2) + emitter = PP_BROKEN + if(3) + speech_synthesizer = PP_BROKEN + else + switch(rand(1,4)) + if(1) + cell = PP_BROKEN + if(2) + processor = PP_BROKEN + if(3) + board = PP_BROKEN + if(4) + capacitor = PP_BROKEN + +/obj/item/device/paicard/proc/is_damage_critical() + if(cell != PP_FUNCTIONAL || processor != PP_FUNCTIONAL || board != PP_FUNCTIONAL || capacitor != PP_FUNCTIONAL) + return TRUE + return FALSE + +/obj/item/paiparts + name = "broken pAI component" + desc = "It's broken scrap from a pAI card!" + icon = 'icons/obj/paicard.dmi' + icon_state = "broken" + pickup_sound = 'sound/items/pickup/card.ogg' + drop_sound = 'sound/items/drop/card.ogg' +/obj/item/paiparts/Initialize() + . = ..() + pixel_x = rand(-10,10) + pixel_y = rand(-10,10) + +/obj/item/paiparts/cell + name = "pAI power cell" + desc = "It's very small and efficient! It powers the pAI!" + icon_state = "cell" +/obj/item/paiparts/processor + name = "pAI processor" + desc = "It's the brain of your computer friend!" + icon_state = "processor" +/obj/item/paiparts/board + name = "pAI board" + desc = "It's the thing all the other parts get attatched to!" + icon_state = "board" +/obj/item/paiparts/capacitor + name = "pAI capacitor" + desc = "It helps regulate power flow!" + icon_state = "capacitor" +/obj/item/paiparts/projector + name = "pAI projector" + desc = "It projects the pAI's form!" + icon_state = "projector" +/obj/item/paiparts/emitter + name = "pAI emitter" + desc = "It emits the fields to help the pAI get around!" + icon_state = "emitter" +/obj/item/paiparts/speech_synthesizer + name = "pAI speech synthesizer" + desc = "It's a little voice box!" + icon_state = "speech_synthesizer"