From 9809a5fc1bf5d520a5a734fc2f027a7fe78c4d8b Mon Sep 17 00:00:00 2001 From: Crazylemon64 Date: Thu, 3 Dec 2015 23:46:10 -0800 Subject: [PATCH] Lots of cool fixes! Read below! - Radio MMIs can now talk on the radio like a regular person does - Same for MMIs in mechs - A posibrain in a mecha doesn't lose its ability to hear binary chat - Mechs now consume power when moving again - Disassembling mecha wreckage now doesn't have a bunch of annoying "hit by" messages - MMIs in someone's grasp no longer cause a rigsuit-related runtime --- code/game/mecha/mecha.dm | 5 ++- code/game/mecha/mecha_wreckage.dm | 36 ++++++++--------- code/modules/clothing/spacesuits/rig/rig.dm | 5 ++- code/modules/mob/living/carbon/brain/MMI.dm | 13 +------ code/modules/mob/living/carbon/brain/brain.dm | 28 ++++++++++++- code/modules/mob/living/carbon/brain/say.dm | 39 ++++++++++++------- 6 files changed, 75 insertions(+), 51 deletions(-) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 045e5498ca3..75a94859983 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -323,6 +323,7 @@ move_result = mechstep(direction) if(move_result) can_move = 0 + use_power(step_energy_drain) if(mecha_do_after(step_in)) can_move = 1 return 1 @@ -803,7 +804,7 @@ go_out() return - + else if(istype(W, /obj/item/stack/cable_coil)) if(state == 3 && hasInternalDamage(MECHA_INT_SHORT_CIRCUIT)) var/obj/item/stack/cable_coil/CC = W @@ -1250,7 +1251,7 @@ return 0 if(!user.unEquip(mmi_as_oc)) user << "\the [mmi_as_oc] is stuck to your hand, you cannot put it in \the [src]" - return + return 0 var/mob/brainmob = mmi_as_oc.brainmob brainmob.reset_view(src) /* diff --git a/code/game/mecha/mecha_wreckage.dm b/code/game/mecha/mecha_wreckage.dm index 7adc9592d03..8287db928f1 100644 --- a/code/game/mecha/mecha_wreckage.dm +++ b/code/game/mecha/mecha_wreckage.dm @@ -35,29 +35,28 @@ var/obj/item/weapon/weldingtool/WT = W if(salvage_num <= 0) user.visible_message("[user] begins to slice apart the now completely stripped [src].", "You begin to slice apart the [src].", "You hear the sound of a welder nearby.") - if(do_after(user,80,target=src)) + if(WT.remove_fuel(0,user) && do_after(user,80,target=src)) user.visible_message("The now-dilapidated [src] falls apart in a clatter.", "As you slice apart the final support structures, the [src] falls apart in a heap.", "You hear metal clanking to the floor.") new /obj/item/stack/sheet/metal(src.loc) var/obj/item/stack/rods/rods = new /obj/item/stack/rods(src.loc) rods.amount = 2 qdel(src) - return - if (isemptylist(welder_salvage)) - user << "What's left on the [src] cannot be removed with a welder, besides the frame itself" - else if(WT.remove_fuel(0,user)) - var/type = prob(70)?pick(welder_salvage):null - if(type) - var/N = new type(get_turf(user)) - user.visible_message("[user] cuts [N] from [src]", "You cut [N] from [src]", "You hear a sound of welder nearby") - if(istype(N, /obj/item/mecha_parts/part)) - welder_salvage -= type - salvage_num-- - else - user << "You failed to salvage anything valuable from [src]." else - user << "\blue You need more welding fuel to complete this task." - return - if(istype(W, /obj/item/weapon/wirecutters)) + if (isemptylist(welder_salvage)) + user << "What's left on the [src] cannot be removed with a welder, besides the frame itself" + else if(WT.remove_fuel(0,user)) + var/type = prob(70)?pick(welder_salvage):null + if(type) + var/N = new type(get_turf(user)) + user.visible_message("[user] cuts [N] from [src]", "You cut [N] from [src]", "You hear a sound of welder nearby") + if(istype(N, /obj/item/mecha_parts/part)) + welder_salvage -= type + salvage_num-- + else + user << "You failed to salvage anything valuable from [src]." + else + user << "\blue You need more welding fuel to complete this task." + else if(istype(W, /obj/item/weapon/wirecutters)) if(salvage_num <= 0) user << "You don't see anything that can be cut with [W]." return @@ -69,14 +68,13 @@ salvage_num-- else user << "You failed to salvage anything valuable from [src]." - if(istype(W, /obj/item/weapon/crowbar)) + else if(istype(W, /obj/item/weapon/crowbar)) if(!isemptylist(crowbar_salvage)) var/obj/S = pick(crowbar_salvage) if(S) S.loc = get_turf(user) crowbar_salvage -= S user.visible_message("[user] pries [S] from [src].", "You pry [S] from [src].") - return else user << "You don't see anything that can be pried with [W]." else diff --git a/code/modules/clothing/spacesuits/rig/rig.dm b/code/modules/clothing/spacesuits/rig/rig.dm index 3c315119555..114ad9d7b35 100644 --- a/code/modules/clothing/spacesuits/rig/rig.dm +++ b/code/modules/clothing/spacesuits/rig/rig.dm @@ -890,7 +890,10 @@ return src /mob/living/carbon/human/get_rig() - return back + if(istype(back,/obj/item/weapon/rig)) + return back + else + return null #undef ONLY_DEPLOY #undef ONLY_RETRACT diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm index 3160ff56cc3..5e6b142038c 100644 --- a/code/modules/mob/living/carbon/brain/MMI.dm +++ b/code/modules/mob/living/carbon/brain/MMI.dm @@ -55,6 +55,7 @@ if(brainmob) O.attack(brainmob, user)//Oh noooeeeee + // Brainmobs can take damage, but they can't actually die. Maybe should fix. return ..() @@ -111,18 +112,6 @@ radio.broadcasting = 1//So it's broadcasting from the start. verb//Allows the brain to toggle the radio functions. - Toggle_Broadcasting() - set name = "Toggle Broadcasting" - set desc = "Toggle broadcasting channel on or off." - set category = "MMI" - set src = usr.loc//In user location, or in MMI in this case. - set popup_menu = 0//Will not appear when right clicking. - - if(brainmob.stat)//Only the brainmob will trigger these so no further check is necessary. - brainmob << "Can't do that while incapacitated or dead." - - radio.broadcasting = radio.broadcasting==1 ? 0 : 1 - brainmob << "\blue Radio is [radio.broadcasting==1 ? "now" : "no longer"] broadcasting." Toggle_Listening() set name = "Toggle Listening" diff --git a/code/modules/mob/living/carbon/brain/brain.dm b/code/modules/mob/living/carbon/brain/brain.dm index 61879d81f52..4e9e7c4c63d 100644 --- a/code/modules/mob/living/carbon/brain/brain.dm +++ b/code/modules/mob/living/carbon/brain/brain.dm @@ -64,10 +64,34 @@ /mob/living/carbon/brain/blob_act() return - /mob/living/carbon/brain/on_forcemove(atom/newloc) if(container) container.loc = newloc else //something went very wrong. CRASH("Brainmob without container.") - loc = container \ No newline at end of file + loc = container + +/* +This will return true if the brain has a container that leaves it less helpless than a naked brain + +I'm using this for Stat to give it a more nifty interface to work with +*/ +/mob/living/carbon/brain/proc/has_synthetic_assistance() + return (container && istype(container, /obj/item/device/mmi)) || in_contents_of(/obj/mecha) + +/mob/living/carbon/brain/Stat() + ..() + if(has_synthetic_assistance()) + statpanel("Status") + stat(null, "Station Time: [worldtime2text()]") + + if(emergency_shuttle) + var/eta_status = emergency_shuttle.get_status_panel_eta() + if(eta_status) + stat(null, eta_status) + if(client.statpanel == "Status") + //Knowing how well-off your mech is doing is really important as an MMI + if(istype(src.loc, /obj/mecha)) + var/obj/mecha/M = src.loc + stat("Exosuit Charge:", "[istype(M.cell) ? "[M.cell.charge] / [M.cell.maxcharge]" : "No cell detected"]") + stat("Exosuit Integrity", "[!M.health ? "0" : "[(M.health / initial(M.health)) * 100]"]%") \ No newline at end of file diff --git a/code/modules/mob/living/carbon/brain/say.dm b/code/modules/mob/living/carbon/brain/say.dm index 083ce847a52..f2f2c1b15c3 100644 --- a/code/modules/mob/living/carbon/brain/say.dm +++ b/code/modules/mob/living/carbon/brain/say.dm @@ -12,26 +12,35 @@ else message = Gibberish(message, (emp_damage*6))//scrambles the message, gets worse when emp_damage is higher - if(istype(container, /obj/item/device/mmi/radio_enabled)) - var/radio_MMI_message = message //split off so the MMI can get a trimmed message without fucking up living/say() - if(!speaking) - speaking = parse_language(message) - if(speaking) - radio_MMI_message = copytext(message, 2 + length(speaking.key)) - else - speaking = get_default_language() - - var/obj/item/device/mmi/radio_enabled/R = container - if(R.radio) - spawn(0) R.radio.hear_talk(src, trim(sanitize(radio_MMI_message)), say_quote(radio_MMI_message), speaking) - ..(message) /mob/living/carbon/brain/can_speak(var/datum/language/speaking) - if(speaking == all_languages["Robot Talk"] && istype(loc, /obj/item/device/mmi/posibrain)) //so posibrains can speak binary; less messy than adding the language + if(speaking == all_languages["Robot Talk"] && (container && istype(container, /obj/item/device/mmi/posibrain))) //so posibrains can speak binary; less messy than adding the language return 1 else return ..() /mob/living/carbon/brain/binarycheck() - return istype(loc, /obj/item/device/mmi/posibrain) \ No newline at end of file + return (container && istype(container, /obj/item/device/mmi/posibrain)) + +/mob/living/carbon/brain/handle_message_mode(var/message_mode, var/message, var/verb, var/speaking, var/used_radios, var/alt_name) + switch(message_mode) + if("headset") + var/radio_worked = 0 // If any of the radios our brainmob could use functioned, this is set true so that we don't use any others + // I'm doing it this way so that if the mecha radio fails for some reason, a radio MMI still has the built-in fallback + if (container && istype(container,/obj/item/device/mmi)) + var/obj/item/device/mmi/c = container + if (!radio_worked && c.mecha) + var/obj/mecha/metalgear = c.mecha + if(metalgear.radio) + radio_worked = metalgear.radio.talk_into(src, message, message_mode, verb, speaking) + + else if(!radio_worked && istype(c, /obj/item/device/mmi/radio_enabled)) + var/obj/item/device/mmi/radio_enabled/R = c + if(R.radio) + radio_worked = R.radio.talk_into(src, message, message_mode, verb, speaking) + return radio_worked + if ("whisper") + whisper_say(message, speaking, alt_name) + return 1 + else return 0 \ No newline at end of file