From 4053499c837c34d080795f6df6e3198dc67f194d Mon Sep 17 00:00:00 2001 From: Jordie Date: Sat, 25 Nov 2017 15:42:06 +1100 Subject: [PATCH 1/4] A few investigate_log and message_admin fixes --- code/modules/flufftext/Hallucination.dm | 10 +--- .../mob/living/carbon/carbon_defines.dm | 7 +++ code/modules/research/circuitprinter.dm | 47 +++++++++++++++ code/modules/research/protolathe.dm | 57 +++++++++++++++++++ code/modules/research/rdconsole.dm | 39 +++++++++++++ 5 files changed, 151 insertions(+), 9 deletions(-) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 866b763fe6..d95591b6fd 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -13,13 +13,6 @@ Gunshots/explosions/opening doors/less rare audio (done) #define HAL_LINES_FILE "hallucination.json" -/mob/living/carbon - var/image/halimage - var/image/halbody - var/obj/halitem - var/hal_screwyhud = SCREWYHUD_NONE - var/next_hallucination = 0 - GLOBAL_LIST_INIT(hallucinations_minor, list( /datum/hallucination/sounds, /datum/hallucination/bolts, @@ -82,6 +75,7 @@ GLOBAL_LIST_INIT(hallucinations_major, list( /datum/hallucination/Destroy() target.investigate_log("was afflicted with a hallucination of type [type]. [feedback_details]", INVESTIGATE_HALLUCINATIONS) + target = null return ..() /obj/effect/hallucination @@ -203,7 +197,6 @@ GLOBAL_LIST_INIT(hallucinations_major, list( flood_turfs = list() if(target.client) target.client.images.Remove(flood_images) - target = null qdel(flood_images) flood_images = list() return ..() @@ -1159,4 +1152,3 @@ GLOBAL_LIST_INIT(hallucinations_major, list( H.preparePixelProjectile(target, start) H.fire() qdel(src) - diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index 45c10c6ae9..4e409391da 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -49,3 +49,10 @@ var/icon_render_key = "" var/static/list/limb_icon_cache = list() + + //halucination vars + var/image/halimage + var/image/halbody + var/obj/halitem + var/hal_screwyhud = SCREWYHUD_NONE + var/next_hallucination = 0 diff --git a/code/modules/research/circuitprinter.dm b/code/modules/research/circuitprinter.dm index ebeb869d9c..38c5465aff 100644 --- a/code/modules/research/circuitprinter.dm +++ b/code/modules/research/circuitprinter.dm @@ -94,3 +94,50 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis). use_power(max(1000, (MINERAL_MATERIAL_AMOUNT * M.last_amount_inserted / 10))) add_overlay("protolathe_[stack_name]") addtimer(CALLBACK(src, /atom/proc/cut_overlay, "protolathe_[stack_name]"), 10) +<<<<<<< HEAD +======= + +/obj/machinery/rnd/circuit_imprinter/proc/user_try_print_id(id) + if((!linked_console && requires_console) || !id) + return FALSE + var/datum/design/D = (linked_console || requires_console)? linked_console.stored_research.researched_designs[id] : get_techweb_design_by_id(id) + if(!istype(D)) + return FALSE + + var/power = 1000 + for(var/M in D.materials) + power += round(D.materials[M] / 5) + power = max(4000, power) + use_power(power) + + var/list/efficient_mats = list() + for(var/MAT in D.materials) + efficient_mats[MAT] = D.materials[MAT]/efficiency_coeff + + if(!materials.has_materials(efficient_mats)) + say("Not enough materials to complete prototype.") + return FALSE + for(var/R in D.reagents_list) + if(!reagents.has_reagent(R, D.reagents_list[R]/efficiency_coeff)) + say("Not enough reagents to complete prototype.") + return FALSE + + busy = TRUE + flick("circuit_imprinter_ani", src) + materials.use_amount(efficient_mats) + for(var/R in D.reagents_list) + reagents.remove_reagent(R, D.reagents_list[R]/efficiency_coeff) + + var/P = D.build_path + addtimer(CALLBACK(src, .proc/reset_busy), 16) + addtimer(CALLBACK(src, .proc/do_print, P, efficient_mats, D.dangerous_construction), 16) + return TRUE + +/obj/machinery/rnd/circuit_imprinter/proc/do_print(path, list/matlist, notify_admins) + if(notify_admins && usr) + investigate_log("[key_name(usr)] built [path] at a circuit imprinter.", INVESTIGATE_RESEARCH) + message_admins("[ADMIN_LOOKUPFLW(usr)] has built [path] at a circuit imprinter.") + var/obj/item/I = new path(get_turf(src)) + I.materials = matlist.Copy() + SSblackbox.record_feedback("nested_tally", "circuit_printed", 1, list("[type]", "[path]")) +>>>>>>> b09b1c3... A few investigate_log and message_admin fixes (#32993) diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index 9df4946ed2..e67982d21b 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -95,3 +95,60 @@ Note: Must be placed west/left of and R&D console to function. use_power(max(1000, (MINERAL_MATERIAL_AMOUNT * M.last_amount_inserted / 10))) add_overlay("protolathe_[stack_name]") addtimer(CALLBACK(src, /atom/proc/cut_overlay, "protolathe_[stack_name]"), 10) +<<<<<<< HEAD +======= + +/obj/machinery/rnd/protolathe/proc/user_try_print_id(id, amount) + if((!istype(linked_console) && requires_console) || !id) + return FALSE + if(istext(amount)) + amount = text2num(amount) + if(isnull(amount)) + amount = 1 + var/datum/design/D = (linked_console || requires_console)? linked_console.stored_research.researched_designs[id] : get_techweb_design_by_id(id) + if(!istype(D)) + return FALSE + if(D.make_reagents.len) + return FALSE + + var/power = 1000 + amount = Clamp(amount, 1, 10) + for(var/M in D.materials) + power += round(D.materials[M] * amount / 5) + power = max(3000, power) + use_power(power) + + var/list/efficient_mats = list() + for(var/MAT in D.materials) + efficient_mats[MAT] = D.materials[MAT]*efficiency_coeff + + if(!materials.has_materials(efficient_mats, amount)) + say("Not enough materials to complete prototype[amount > 1? "s" : ""].") + return FALSE + for(var/R in D.reagents_list) + if(!reagents.has_reagent(R, D.reagents_list[R]*efficiency_coeff)) + say("Not enough reagents to complete prototype[amount > 1? "s" : ""].") + return FALSE + + materials.use_amount(efficient_mats, amount) + for(var/R in D.reagents_list) + reagents.remove_reagent(R, D.reagents_list[R]*efficiency_coeff) + + busy = TRUE + flick("protolathe_n", src) + var/timecoeff = efficiency_coeff * D.lathe_time_factor + + addtimer(CALLBACK(src, .proc/reset_busy), (32 * timecoeff * amount) ** 0.8) + addtimer(CALLBACK(src, .proc/do_print, D.build_path, amount, efficient_mats, D.dangerous_construction), (32 * timecoeff * amount) ** 0.8) + return TRUE + +/obj/machinery/rnd/protolathe/proc/do_print(path, amount, list/matlist, notify_admins) + if(notify_admins && usr) + investigate_log("[key_name(usr)] built [amount] of [path] at a protolathe.", INVESTIGATE_RESEARCH) + message_admins("[ADMIN_LOOKUPFLW(usr)] has built [amount] of [path] at a protolathe") + for(var/i in 1 to amount) + var/obj/item/I = new path(get_turf(src)) + if(!istype(I, /obj/item/stack/sheet) && !istype(I, /obj/item/ore/bluespace_crystal)) + I.materials = matlist.Copy() + SSblackbox.record_feedback("nested_tally", "item_printed", amount, list("[type]", "[path]")) +>>>>>>> b09b1c3... A few investigate_log and message_admin fixes (#32993) diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index b98a75e6fd..6506a55a31 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -133,6 +133,45 @@ won't update every console in existence) but it's more of a hassle to do. Also, . = ..() updateUsrDialog() +<<<<<<< HEAD +======= +/obj/machinery/computer/rdconsole/proc/research_node(id, mob/user) + if(!stored_research.available_nodes[id] || stored_research.researched_nodes[id]) + say("Node unlock failed: Either already researched or not available!") + return FALSE + var/datum/techweb_node/TN = SSresearch.techweb_nodes[id] + if(!istype(TN)) + say("Node unlock failed: Unknown error.") + return FALSE + var/price = TN.get_price(stored_research) + if(stored_research.research_points >= price) + investigate_log("[key_name(user)] researched [id]([price]) on techweb id [stored_research.id].", INVESTIGATE_RESEARCH) + if(stored_research == SSresearch.science_tech) + SSblackbox.record_feedback("associative", "science_techweb_unlock", 1, list("id" = "[id]", "price" = "[price]", "time" = "[SQLtime()]")) + if(stored_research.research_node(SSresearch.techweb_nodes[id])) + say("Sucessfully researched [TN.display_name].") + var/logname = "Unknown" + if(isAI(user)) + logname = "AI: [user.name]" + if(iscarbon(user)) + var/obj/item/card/id/idcard = user.get_active_held_item() + if(istype(idcard)) + logname = "User: [idcard.registered_name]" + if(ishuman(user)) + var/mob/living/carbon/human/H = user + var/obj/item/I = H.wear_id + if(istype(I)) + var/obj/item/card/id/ID = I.GetID() + if(istype(ID)) + logname = "User: [ID.registered_name]" + stored_research.research_logs += "[logname] researched node id [id] for [price] points." + return TRUE + else + say("Failed to research node: Internal database error!") + return FALSE + say("Not enough research points...") + return FALSE +>>>>>>> b09b1c3... A few investigate_log and message_admin fixes (#32993) /obj/machinery/computer/rdconsole/on_deconstruction() if(linked_destroy) From 61521990e2782593f6a4ffff7b4dc7d02cc6e878 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Sun, 26 Nov 2017 21:39:11 -0500 Subject: [PATCH 2/4] Update circuitprinter.dm --- code/modules/research/circuitprinter.dm | 47 ------------------------- 1 file changed, 47 deletions(-) diff --git a/code/modules/research/circuitprinter.dm b/code/modules/research/circuitprinter.dm index 38c5465aff..ebeb869d9c 100644 --- a/code/modules/research/circuitprinter.dm +++ b/code/modules/research/circuitprinter.dm @@ -94,50 +94,3 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis). use_power(max(1000, (MINERAL_MATERIAL_AMOUNT * M.last_amount_inserted / 10))) add_overlay("protolathe_[stack_name]") addtimer(CALLBACK(src, /atom/proc/cut_overlay, "protolathe_[stack_name]"), 10) -<<<<<<< HEAD -======= - -/obj/machinery/rnd/circuit_imprinter/proc/user_try_print_id(id) - if((!linked_console && requires_console) || !id) - return FALSE - var/datum/design/D = (linked_console || requires_console)? linked_console.stored_research.researched_designs[id] : get_techweb_design_by_id(id) - if(!istype(D)) - return FALSE - - var/power = 1000 - for(var/M in D.materials) - power += round(D.materials[M] / 5) - power = max(4000, power) - use_power(power) - - var/list/efficient_mats = list() - for(var/MAT in D.materials) - efficient_mats[MAT] = D.materials[MAT]/efficiency_coeff - - if(!materials.has_materials(efficient_mats)) - say("Not enough materials to complete prototype.") - return FALSE - for(var/R in D.reagents_list) - if(!reagents.has_reagent(R, D.reagents_list[R]/efficiency_coeff)) - say("Not enough reagents to complete prototype.") - return FALSE - - busy = TRUE - flick("circuit_imprinter_ani", src) - materials.use_amount(efficient_mats) - for(var/R in D.reagents_list) - reagents.remove_reagent(R, D.reagents_list[R]/efficiency_coeff) - - var/P = D.build_path - addtimer(CALLBACK(src, .proc/reset_busy), 16) - addtimer(CALLBACK(src, .proc/do_print, P, efficient_mats, D.dangerous_construction), 16) - return TRUE - -/obj/machinery/rnd/circuit_imprinter/proc/do_print(path, list/matlist, notify_admins) - if(notify_admins && usr) - investigate_log("[key_name(usr)] built [path] at a circuit imprinter.", INVESTIGATE_RESEARCH) - message_admins("[ADMIN_LOOKUPFLW(usr)] has built [path] at a circuit imprinter.") - var/obj/item/I = new path(get_turf(src)) - I.materials = matlist.Copy() - SSblackbox.record_feedback("nested_tally", "circuit_printed", 1, list("[type]", "[path]")) ->>>>>>> b09b1c3... A few investigate_log and message_admin fixes (#32993) From 90691c68d0a90b772ead4cca471ab0c4bad00325 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Sun, 26 Nov 2017 21:39:40 -0500 Subject: [PATCH 3/4] Update rdconsole.dm --- code/modules/research/rdconsole.dm | 39 ------------------------------ 1 file changed, 39 deletions(-) diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index 6506a55a31..b98a75e6fd 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -133,45 +133,6 @@ won't update every console in existence) but it's more of a hassle to do. Also, . = ..() updateUsrDialog() -<<<<<<< HEAD -======= -/obj/machinery/computer/rdconsole/proc/research_node(id, mob/user) - if(!stored_research.available_nodes[id] || stored_research.researched_nodes[id]) - say("Node unlock failed: Either already researched or not available!") - return FALSE - var/datum/techweb_node/TN = SSresearch.techweb_nodes[id] - if(!istype(TN)) - say("Node unlock failed: Unknown error.") - return FALSE - var/price = TN.get_price(stored_research) - if(stored_research.research_points >= price) - investigate_log("[key_name(user)] researched [id]([price]) on techweb id [stored_research.id].", INVESTIGATE_RESEARCH) - if(stored_research == SSresearch.science_tech) - SSblackbox.record_feedback("associative", "science_techweb_unlock", 1, list("id" = "[id]", "price" = "[price]", "time" = "[SQLtime()]")) - if(stored_research.research_node(SSresearch.techweb_nodes[id])) - say("Sucessfully researched [TN.display_name].") - var/logname = "Unknown" - if(isAI(user)) - logname = "AI: [user.name]" - if(iscarbon(user)) - var/obj/item/card/id/idcard = user.get_active_held_item() - if(istype(idcard)) - logname = "User: [idcard.registered_name]" - if(ishuman(user)) - var/mob/living/carbon/human/H = user - var/obj/item/I = H.wear_id - if(istype(I)) - var/obj/item/card/id/ID = I.GetID() - if(istype(ID)) - logname = "User: [ID.registered_name]" - stored_research.research_logs += "[logname] researched node id [id] for [price] points." - return TRUE - else - say("Failed to research node: Internal database error!") - return FALSE - say("Not enough research points...") - return FALSE ->>>>>>> b09b1c3... A few investigate_log and message_admin fixes (#32993) /obj/machinery/computer/rdconsole/on_deconstruction() if(linked_destroy) From 424ba669f1fbccf54f475c5f76bb15e2dac58ed6 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Sun, 26 Nov 2017 21:40:14 -0500 Subject: [PATCH 4/4] Update protolathe.dm --- code/modules/research/protolathe.dm | 57 ----------------------------- 1 file changed, 57 deletions(-) diff --git a/code/modules/research/protolathe.dm b/code/modules/research/protolathe.dm index e67982d21b..9df4946ed2 100644 --- a/code/modules/research/protolathe.dm +++ b/code/modules/research/protolathe.dm @@ -95,60 +95,3 @@ Note: Must be placed west/left of and R&D console to function. use_power(max(1000, (MINERAL_MATERIAL_AMOUNT * M.last_amount_inserted / 10))) add_overlay("protolathe_[stack_name]") addtimer(CALLBACK(src, /atom/proc/cut_overlay, "protolathe_[stack_name]"), 10) -<<<<<<< HEAD -======= - -/obj/machinery/rnd/protolathe/proc/user_try_print_id(id, amount) - if((!istype(linked_console) && requires_console) || !id) - return FALSE - if(istext(amount)) - amount = text2num(amount) - if(isnull(amount)) - amount = 1 - var/datum/design/D = (linked_console || requires_console)? linked_console.stored_research.researched_designs[id] : get_techweb_design_by_id(id) - if(!istype(D)) - return FALSE - if(D.make_reagents.len) - return FALSE - - var/power = 1000 - amount = Clamp(amount, 1, 10) - for(var/M in D.materials) - power += round(D.materials[M] * amount / 5) - power = max(3000, power) - use_power(power) - - var/list/efficient_mats = list() - for(var/MAT in D.materials) - efficient_mats[MAT] = D.materials[MAT]*efficiency_coeff - - if(!materials.has_materials(efficient_mats, amount)) - say("Not enough materials to complete prototype[amount > 1? "s" : ""].") - return FALSE - for(var/R in D.reagents_list) - if(!reagents.has_reagent(R, D.reagents_list[R]*efficiency_coeff)) - say("Not enough reagents to complete prototype[amount > 1? "s" : ""].") - return FALSE - - materials.use_amount(efficient_mats, amount) - for(var/R in D.reagents_list) - reagents.remove_reagent(R, D.reagents_list[R]*efficiency_coeff) - - busy = TRUE - flick("protolathe_n", src) - var/timecoeff = efficiency_coeff * D.lathe_time_factor - - addtimer(CALLBACK(src, .proc/reset_busy), (32 * timecoeff * amount) ** 0.8) - addtimer(CALLBACK(src, .proc/do_print, D.build_path, amount, efficient_mats, D.dangerous_construction), (32 * timecoeff * amount) ** 0.8) - return TRUE - -/obj/machinery/rnd/protolathe/proc/do_print(path, amount, list/matlist, notify_admins) - if(notify_admins && usr) - investigate_log("[key_name(usr)] built [amount] of [path] at a protolathe.", INVESTIGATE_RESEARCH) - message_admins("[ADMIN_LOOKUPFLW(usr)] has built [amount] of [path] at a protolathe") - for(var/i in 1 to amount) - var/obj/item/I = new path(get_turf(src)) - if(!istype(I, /obj/item/stack/sheet) && !istype(I, /obj/item/ore/bluespace_crystal)) - I.materials = matlist.Copy() - SSblackbox.record_feedback("nested_tally", "item_printed", amount, list("[type]", "[path]")) ->>>>>>> b09b1c3... A few investigate_log and message_admin fixes (#32993)