mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 18:11:47 +00:00
* Update beefman.dm * Update beefman.dm * xsaxsfvvvvvvvv * Update shaded_bloodsucker.dm * yeah that thing * FUCK you * Update hunting_contract.dm * dd * vdvdfv * Update monsterhunter_weapons.dm * Update whiterabbit.dm * onokkn * Update monsterhunter_weapons.dm * Update monsterhunter_weapons.dm * efe * Update whiterabbit.dm * yeaywa * Update red_rabbit.dmi * oihop * Update HunterContract.js * wonderland.dm * gs * dcd * Update rabbit.dmi * ass * fvd * Update paradox_rabbit.dm * f * Update tgstation.dme * Delete heartbeatmoon.dmi * shtntb * sed * sfe * Update monsterhunter_weapons.dm * cdc * Update wonderland.dm * dgrd * wef * b * pipkk * Update hunting_contract.dm * Update paradox_rabbit.dm * wr * Update worn_mask.dmi * some documenting * Update areas.dm * eg * Update white_rabbit.dm * Update HunterContract.js * s * Update weapons.dmi * Update weapons.dmi * Jack in the bomb * some signals * ui * h * y * music * Update wonderlandmusic.ogg * f * v * cleanups * g * a * t * y * g * a * o * first commit * Adding our stuff back in * k * Before procs * proc refs * carps * Fixes * shuttles * dumb dumb names * I hate windows I hate windows * I hate windows I hate windows * h * Selenestation has issues * Update monsterhunter_weapons.dm * eretics * Update weapons.dmi * Update monsterhunter_weapons.dm * g * kpop * r * m * grgr * Update simple_animal_freeze.dm * Update wonderland_apocalypse.dm * Update wonderland_apocalypse.dm * d * Update fulp_defines.dm * ff * Update wonderland.dmm * Update tgstation.dme * Update infil_objectives.dm * Update infil_objectives.dm * Update monsterhunter_weapons.dm * Update monsterhunter_event.dm * Update monsterhunter_event.dm * Update areas.dm * Update monsterhunter_event.dm * Update monsterhunter_weapons.dm * Step 0, version 2 * step 0.5 - version 2 * step 1 - version 2 * 2.5 version 2 * fix * Mapping * okay fine * more mapping * uuuuu hhhh * fixes * help me * hurry * I'm killing the mf that did access helpers on this map * Welp, we lost. * Or did we? --------- Co-authored-by: SmoSmoSmoSmok <95004236+SmoSmoSmoSmok@users.noreply.github.com> Co-authored-by: Pepsilawn <reisenrui@gmail.com> Co-authored-by: SgtHunk <68669754+SgtHunk@users.noreply.github.com>
226 lines
7.9 KiB
Plaintext
226 lines
7.9 KiB
Plaintext
/*
|
|
Destructive Analyzer
|
|
|
|
It is used to destroy hand-held objects and advance technological research. Controls are in the linked R&D console.
|
|
|
|
Note: Must be placed within 3 tiles of the R&D Console
|
|
*/
|
|
/obj/machinery/rnd/destructive_analyzer
|
|
name = "destructive analyzer"
|
|
desc = "Learn science by destroying things!"
|
|
icon_state = "d_analyzer"
|
|
base_icon_state = "d_analyzer"
|
|
circuit = /obj/item/circuitboard/machine/destructive_analyzer
|
|
var/decon_mod = 0
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/RefreshParts()
|
|
. = ..()
|
|
var/T = 0
|
|
for(var/datum/stock_part/stock_part in component_parts)
|
|
T += stock_part.tier
|
|
decon_mod = T
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/proc/ConvertReqString2List(list/source_list)
|
|
var/list/temp_list = params2list(source_list)
|
|
for(var/O in temp_list)
|
|
temp_list[O] = text2num(temp_list[O])
|
|
return temp_list
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/Insert_Item(obj/item/O, mob/living/user)
|
|
if(!user.combat_mode)
|
|
. = 1
|
|
if(!is_insertion_ready(user))
|
|
return
|
|
if(!user.transferItemToLoc(O, src))
|
|
to_chat(user, span_warning("\The [O] is stuck to your hand, you cannot put it in the [src.name]!"))
|
|
return
|
|
busy = TRUE
|
|
loaded_item = O
|
|
to_chat(user, span_notice("You add the [O.name] to the [src.name]!"))
|
|
flick("d_analyzer_la", src)
|
|
addtimer(CALLBACK(src, PROC_REF(finish_loading)), 10)
|
|
updateUsrDialog()
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/proc/finish_loading()
|
|
update_appearance()
|
|
reset_busy()
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/update_icon_state()
|
|
icon_state = "[base_icon_state][loaded_item ? "_l" : null]"
|
|
return ..()
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/proc/destroy_item(obj/item/thing, innermode = FALSE)
|
|
if(QDELETED(thing) || QDELETED(src))
|
|
return FALSE
|
|
if(!innermode)
|
|
flick("d_analyzer_process", src)
|
|
busy = TRUE
|
|
addtimer(CALLBACK(src, PROC_REF(reset_busy)), 24)
|
|
use_power(250)
|
|
if(thing == loaded_item)
|
|
loaded_item = null
|
|
var/list/food = thing.GetDeconstructableContents()
|
|
for(var/obj/item/innerthing in food)
|
|
destroy_item(innerthing, TRUE)
|
|
for(var/mob/living/victim in thing)
|
|
if(victim.stat != DEAD)
|
|
victim.investigate_log("has been killed by a destructive analyzer.", INVESTIGATE_DEATHS)
|
|
victim.death()
|
|
|
|
qdel(thing)
|
|
loaded_item = null
|
|
if (!innermode)
|
|
update_appearance()
|
|
return TRUE
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/proc/user_try_decon_id(id, mob/user)
|
|
if(!istype(loaded_item))
|
|
return FALSE
|
|
|
|
if (id && id != RESEARCH_MATERIAL_DESTROY_ID)
|
|
var/datum/techweb_node/TN = SSresearch.techweb_node_by_id(id)
|
|
if(!istype(TN))
|
|
return FALSE
|
|
var/dpath = loaded_item.type
|
|
var/list/worths = TN.boost_item_paths[dpath]
|
|
var/list/differences = list()
|
|
var/list/already_boosted = stored_research.boosted_nodes[TN.id]
|
|
for(var/i in worths)
|
|
var/used = already_boosted? already_boosted[i] : 0
|
|
var/value = min(worths[i], TN.research_costs[i]) - used
|
|
if(value > 0)
|
|
differences[i] = value
|
|
if(length(worths) && !length(differences))
|
|
return FALSE
|
|
var/choice = tgui_alert(user, "Are you sure you want to destroy [loaded_item] to [!length(worths) ? "reveal [TN.display_name]" : "boost [TN.display_name] by [json_encode(differences)] point\s"]?", "Destructive Analyzer", list("Proceed", "Cancel"))
|
|
if(choice != "Proceed")
|
|
return FALSE
|
|
if(QDELETED(loaded_item) || QDELETED(src))
|
|
return FALSE
|
|
SSblackbox.record_feedback("nested tally", "item_deconstructed", 1, list("[TN.id]", "[loaded_item.type]"))
|
|
if(destroy_item(loaded_item))
|
|
stored_research.boost_with_item(SSresearch.techweb_node_by_id(TN.id), dpath)
|
|
|
|
else
|
|
var/list/point_value = techweb_item_point_check(loaded_item)
|
|
if(stored_research.deconstructed_items[loaded_item.type])
|
|
point_value = list()
|
|
var/user_mode_string = ""
|
|
if(length(point_value))
|
|
user_mode_string = " for [json_encode(point_value)] points"
|
|
var/choice = tgui_alert(usr, "Are you sure you want to destroy [loaded_item][user_mode_string]?",, list("Proceed", "Cancel"))
|
|
if(choice == "Cancel")
|
|
return FALSE
|
|
if(QDELETED(loaded_item) || QDELETED(src))
|
|
return FALSE
|
|
destroy_item(loaded_item)
|
|
return TRUE
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/proc/unload_item()
|
|
if(!loaded_item)
|
|
return FALSE
|
|
loaded_item.forceMove(get_turf(src))
|
|
loaded_item = null
|
|
update_appearance()
|
|
return TRUE
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/ui_interact(mob/user)
|
|
. = ..()
|
|
var/datum/browser/popup = new(user, "destructive_analyzer", name, 900, 600)
|
|
popup.set_content(ui_deconstruct())
|
|
popup.open()
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/proc/ui_deconstruct() //Legacy code
|
|
var/list/l = list()
|
|
if(!loaded_item)
|
|
l += "<div class='statusDisplay'>No item loaded. Standing-by...</div>"
|
|
else
|
|
l += "<div class='statusDisplay'>[RDSCREEN_NOBREAK]"
|
|
l += "<table><tr><td>[icon2html(loaded_item, usr)]</td><td><b>[loaded_item.name]</b> <A href='?src=[REF(src)];eject_item=1'>Eject</A></td></tr></table>[RDSCREEN_NOBREAK]"
|
|
l += "Select a node to boost by deconstructing this item. This item can boost:"
|
|
|
|
var/anything = FALSE
|
|
var/list/boostable_nodes = techweb_item_boost_check(loaded_item)
|
|
for(var/id in boostable_nodes)
|
|
anything = TRUE
|
|
var/list/worth = boostable_nodes[id]
|
|
var/datum/techweb_node/N = SSresearch.techweb_node_by_id(id)
|
|
|
|
l += "<div class='statusDisplay'>[RDSCREEN_NOBREAK]"
|
|
if (stored_research.researched_nodes[N.id]) // already researched
|
|
l += "<span class='linkOff'>[N.display_name]</span>"
|
|
l += "This node has already been researched."
|
|
else if(!length(worth)) // reveal only
|
|
if (stored_research.hidden_nodes[N.id])
|
|
l += "<A href='?src=[REF(src)];deconstruct=[N.id]'>[N.display_name]</A>"
|
|
l += "This node will be revealed."
|
|
else
|
|
l += "<span class='linkOff'>[N.display_name]</span>"
|
|
l += "This node has already been revealed."
|
|
else // boost by the difference
|
|
var/list/differences = list()
|
|
var/list/already_boosted = stored_research.boosted_nodes[N.id]
|
|
for(var/i in worth)
|
|
var/already_boosted_amount = already_boosted? stored_research.boosted_nodes[N.id][i] : 0
|
|
var/amt = min(worth[i], N.research_costs[i]) - already_boosted_amount
|
|
if(amt > 0)
|
|
differences[i] = amt
|
|
if (length(differences))
|
|
l += "<A href='?src=[REF(src)];deconstruct=[N.id]'>[N.display_name]</A>"
|
|
l += "This node will be boosted with the following:<BR>[techweb_point_display_generic(differences)]"
|
|
else
|
|
l += "<span class='linkOff'>[N.display_name]</span>"
|
|
l += "This node has already been boosted.</span>"
|
|
l += "</div>[RDSCREEN_NOBREAK]"
|
|
|
|
var/list/point_values = techweb_item_point_check(loaded_item)
|
|
if(point_values)
|
|
anything = TRUE
|
|
l += "<div class='statusDisplay'>[RDSCREEN_NOBREAK]"
|
|
if (stored_research.deconstructed_items[loaded_item.type])
|
|
l += "<span class='linkOff'>Point Deconstruction</span>"
|
|
l += "This item's points have already been claimed."
|
|
else
|
|
l += "<A href='?src=[REF(src)];deconstruct=[RESEARCH_MATERIAL_DESTROY_ID]'>Point Deconstruction</A>"
|
|
l += "This item is worth: <BR>[techweb_point_display_generic(point_values)]!"
|
|
l += "</div>[RDSCREEN_NOBREAK]"
|
|
|
|
if(!(loaded_item.resistance_flags & INDESTRUCTIBLE))
|
|
l += "<div class='statusDisplay'><A href='?src=[REF(src)];deconstruct=[RESEARCH_MATERIAL_DESTROY_ID]'>Destroy Item</A>"
|
|
l += "</div>[RDSCREEN_NOBREAK]"
|
|
anything = TRUE
|
|
|
|
if (!anything)
|
|
l += "Nothing!"
|
|
|
|
l += "</div>"
|
|
|
|
for(var/i in 1 to length(l))
|
|
if(!findtextEx(l[i], RDSCREEN_NOBREAK))
|
|
l[i] += "<br>"
|
|
. = l.Join("")
|
|
return replacetextEx(., RDSCREEN_NOBREAK, "")
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/Topic(raw, ls)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
add_fingerprint(usr)
|
|
usr.set_machine(src)
|
|
|
|
if(ls["eject_item"]) //Eject the item inside the destructive analyzer.
|
|
if(busy)
|
|
to_chat(usr, span_danger("The destructive analyzer is busy at the moment."))
|
|
return
|
|
if(loaded_item)
|
|
unload_item()
|
|
if(ls["deconstruct"])
|
|
if(!user_try_decon_id(ls["deconstruct"], usr))
|
|
say("Destructive analysis failed!")
|
|
|
|
updateUsrDialog()
|
|
|
|
/obj/machinery/rnd/destructive_analyzer/screwdriver_act(mob/living/user, obj/item/tool)
|
|
return FALSE
|