From 48370e5a35a19eab427d3e403b653e65fa391ca2 Mon Sep 17 00:00:00 2001 From: Time-Green Date: Tue, 23 Apr 2019 19:15:10 +0200 Subject: [PATCH] Adds the fat extractor (#43337) * Adds the fat extractor * adds emagged option * new icons and fixes * update light * adds a fucking comma * Update code/game/machinery/fat_sucker.dm Co-Authored-By: Time-Green * name constistency * Update code/game/machinery/fat_sucker.dm Co-Authored-By: Time-Green --- code/game/machinery/fat_sucker.dm | 212 ++++++++++++++++++ .../circuitboards/machine_circuitboards.dm | 6 + .../research/designs/machine_designs.dm | 12 +- code/modules/research/techweb/all_nodes.dm | 2 +- icons/obj/machines/fat_sucker.dmi | Bin 0 -> 1111 bytes tgstation.dme | 1 + 6 files changed, 230 insertions(+), 3 deletions(-) create mode 100644 code/game/machinery/fat_sucker.dm create mode 100644 icons/obj/machines/fat_sucker.dmi diff --git a/code/game/machinery/fat_sucker.dm b/code/game/machinery/fat_sucker.dm new file mode 100644 index 00000000000..b817fd20bec --- /dev/null +++ b/code/game/machinery/fat_sucker.dm @@ -0,0 +1,212 @@ +/obj/machinery/fat_sucker + name = "lipid extractor" + desc = "Safely and efficiently extracts excess fat from a subject." + icon = 'icons/obj/machines/fat_sucker.dmi' + icon_state = "fat" + + state_open = FALSE + density = TRUE + req_access = list(ACCESS_KITCHEN) + var/processing = FALSE + var/start_at = NUTRITION_LEVEL_WELL_FED + var/stop_at = NUTRITION_LEVEL_STARVING + var/free_exit = TRUE //set to false to prevent people from exiting before being completely stripped of fat + var/bite_size = 15 //amount of nutrients we take per process + var/nutrients //amount of nutrients we got build up + var/nutrient_to_meat = 90 //one slab of meat gives about 52 nutrition + var/datum/looping_sound/microwave/soundloop //100% stolen from microwaves + var/breakout_time = 600 + + var/next_fact = 10 //in ticks, so about 20 seconds + var/static/list/fat_facts = list(\ + "Fats are triglycerides made up of a combination of different building blocks; glycerol and fatty acids.", \ + "Adults should get a recommended 20-35% of their energy intake from fat.", \ + "Being overweight or obese puts you at an increased risk of chronic diseases, such as cardiovascular diseases, metabolic syndrome, type 2 diabetes and some types of cancers.", \ + "Not all fats are bad. A certain amount of fat is an essential part of a healthy balanced diet. " , \ + "Saturated fat should form no more than 11% of your daily calories.", \ + "Unsaturated fat, that is monounsaturated fats, polyunsaturated fats and omega-3 fatty acids, is found in plant foods and fish." \ + ) + +/obj/machinery/fat_sucker/Initialize() + . = ..() + soundloop = new(list(src), FALSE) + update_icon() + +/obj/machinery/fat_sucker/RefreshParts() + ..() + var/rating = 0 + for(var/obj/item/stock_parts/micro_laser/L in component_parts) + rating += L.rating + bite_size = initial(bite_size) + rating * 5 + nutrient_to_meat = initial(nutrient_to_meat) - rating * 5 + +/obj/machinery/fat_sucker/examine(mob/user) + . = ..() + to_chat(user, "Alt-Click to toggle the safety hatch.") + to_chat(user, "Removing [bite_size] nutritional units per operation.") + to_chat(user, "Requires [nutrient_to_meat] nutritional units per meat slab.") + +/obj/machinery/fat_sucker/close_machine(mob/user) + if(panel_open) + to_chat(user, "You need to close the maintenance hatch first!") + return + ..() + playsound(src, 'sound/machines/click.ogg', 50) + if(occupant) + if(!iscarbon(occupant)) + occupant.forceMove(drop_location()) + occupant = null + return + to_chat(occupant, "You enter [src]") + addtimer(CALLBACK(src, .proc/start_extracting), 20, TIMER_OVERRIDE|TIMER_UNIQUE) + update_icon() + +/obj/machinery/fat_sucker/open_machine(mob/user) + make_meat() + playsound(src, 'sound/machines/click.ogg', 50) + if(processing) + stop() + ..() + +/obj/machinery/fat_sucker/container_resist(mob/living/user) + if(!free_exit || state_open) + to_chat(user, "The emergency release is not responding! You start pushing against the hull!") + user.changeNext_move(CLICK_CD_BREAKOUT) + user.last_special = world.time + CLICK_CD_BREAKOUT + user.visible_message("You see [user] kicking against the door of [src]!", \ + "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ + "You hear a metallic creaking from [src].") + if(do_after(user, breakout_time, target = src)) + if(!user || user.stat != CONSCIOUS || user.loc != src || state_open) + return + free_exit = TRUE + user.visible_message("[user] successfully broke out of [src]!", \ + "You successfully break out of [src]!") + open_machine() + return + open_machine() + +/obj/machinery/fat_sucker/interact(mob/user) + if(state_open) + close_machine() + else if(!processing || free_exit) + open_machine() + else + to_chat(user, "The safety hatch has been disabled!") + +/obj/machinery/fat_sucker/AltClick(mob/living/user) + if(!user.canUseTopic(src, BE_CLOSE)) + return + if(user == occupant) + to_chat(user, "You can't reach the controls from inside!") + return + if(!(obj_flags & EMAGGED) && !allowed(user)) + to_chat(user, "You lack the required access.") + return + free_exit = !free_exit + to_chat(user, "Safety hatch [free_exit ? "unlocked" : "locked"].") + +/obj/machinery/fat_sucker/update_icon() + overlays.Cut() + if(!state_open) + if(processing) + overlays += "[icon_state]_door_on" + overlays += "[icon_state]_stack" + overlays += "[icon_state]_smoke" + overlays += "[icon_state]_green" + else + overlays += "[icon_state]_door_off" + if(occupant) + if(powered(EQUIP)) + overlays += "[icon_state]_stack" + overlays += "[icon_state]_yellow" + else + overlays += "[icon_state]_red" + else if(powered(EQUIP)) + overlays += "[icon_state]_red" + if(panel_open) + overlays += "[icon_state]_panel" + +/obj/machinery/fat_sucker/process() + if(!processing) + return + if(!powered(EQUIP) || !occupant || !iscarbon(occupant)) + open_machine() + return + + var/mob/living/carbon/C = occupant + if(C.nutrition <= stop_at) + open_machine() + playsound(src, 'sound/machines/microwave/microwave-end.ogg', 100, FALSE) + return + C.adjust_nutrition(-bite_size) + nutrients += bite_size + + if(next_fact <= 0) + next_fact = initial(next_fact) + say(pick(fat_facts)) + playsound(loc, 'sound/machines/chime.ogg', 30, FALSE) + else + next_fact-- + use_power(500) + +/obj/machinery/fat_sucker/proc/start_extracting() + if(state_open || !occupant || processing || !powered(EQUIP)) + return + if(iscarbon(occupant)) + var/mob/living/carbon/C = occupant + if(C.nutrition > start_at) + processing = TRUE + soundloop.start() + update_icon() + set_light(2, 1, "#ff0000") + else + say("Subject not fat enough.") + playsound(src, 'sound/machines/buzz-sigh.ogg', 40, FALSE) + overlays += "[icon_state]_red" //throw a red light icon over it, to show that it wont work + +/obj/machinery/fat_sucker/proc/stop() + processing = FALSE + soundloop.stop() + set_light(0, 0) + +/obj/machinery/fat_sucker/proc/make_meat() + if(occupant && iscarbon(occupant)) + var/mob/living/carbon/C = occupant + if(C.type_of_meat) + if(nutrients >= nutrient_to_meat * 2) + C.put_in_hands(new /obj/item/reagent_containers/food/snacks/cookie (), TRUE) + while(nutrients >= nutrient_to_meat) + nutrients -= nutrient_to_meat + new C.type_of_meat (drop_location()) + while(nutrients >= nutrient_to_meat / 3) + nutrients -= nutrient_to_meat / 3 + new /obj/item/reagent_containers/food/snacks/meat/rawcutlet/plain (drop_location()) + nutrients = 0 + +/obj/machinery/fat_sucker/screwdriver_act(mob/living/user, obj/item/I) + . = TRUE + if(..()) + return + if(occupant) + to_chat(user, "[src] is currently occupied!") + return + if(state_open) + to_chat(user, "[src] must be closed to [panel_open ? "close" : "open"] its maintenance hatch!") + return + if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) + update_icon() + return + return FALSE + +/obj/machinery/fat_sucker/crowbar_act(mob/living/user, obj/item/I) + if(default_deconstruction_crowbar(I)) + return TRUE + +/obj/machinery/fat_sucker/emag_act(mob/living/user) + if(obj_flags & EMAGGED) + return + start_at = 100 + stop_at = 0 + to_chat(user, "You remove the access restrictions and lower the automatic ejection threshold!") + obj_flags |= EMAGGED diff --git a/code/game/objects/items/circuitboards/machine_circuitboards.dm b/code/game/objects/items/circuitboards/machine_circuitboards.dm index 570b11e56f4..190b2124ce6 100644 --- a/code/game/objects/items/circuitboards/machine_circuitboards.dm +++ b/code/game/objects/items/circuitboards/machine_circuitboards.dm @@ -995,3 +995,9 @@ name = "Pay Stand (Machine Board)" build_path = /obj/machinery/paystand req_components = list() + +/obj/item/circuitboard/machine/fat_sucker + name = "Lipid Extractor (Machine Board)" + build_path = /obj/machinery/fat_sucker + req_components = list(/obj/item/stock_parts/micro_laser = 1, + /obj/item/kitchen/fork = 1) diff --git a/code/modules/research/designs/machine_designs.dm b/code/modules/research/designs/machine_designs.dm index eed4e801ac2..9e9ac487cf4 100644 --- a/code/modules/research/designs/machine_designs.dm +++ b/code/modules/research/designs/machine_designs.dm @@ -416,8 +416,8 @@ id = "scanner_gate" build_path = /obj/item/circuitboard/machine/scanner_gate category = list ("Misc. Machinery") - departmental_flags = DEPARTMENTAL_FLAG_ALL - + departmental_flags = DEPARTMENTAL_FLAG_ALL + /datum/design/board/holopad name = "Machine Design (AI Holopad Board)" desc = "The circuit board for a holopad." @@ -586,3 +586,11 @@ build_path = /obj/item/circuitboard/machine/paystand category = list ("Misc. Machinery") departmental_flags = DEPARTMENTAL_FLAG_ALL + +/datum/design/board/fat_sucker + name = "Machine Design (Lipid Extractor)" + desc = "The circuit board for a lipid extractor." + id = "fat_sucker" + build_path = /obj/item/circuitboard/machine/fat_sucker + category = list ("Misc. Machinery") + departmental_flags = DEPARTMENTAL_FLAG_SERVICE \ No newline at end of file diff --git a/code/modules/research/techweb/all_nodes.dm b/code/modules/research/techweb/all_nodes.dm index 3e8ad6c4b6e..8306596b028 100644 --- a/code/modules/research/techweb/all_nodes.dm +++ b/code/modules/research/techweb/all_nodes.dm @@ -74,7 +74,7 @@ display_name = "Biological Processing" description = "From slimes to kitchens." prereq_ids = list("biotech") - design_ids = list("smartfridge", "gibber", "deepfryer", "monkey_recycler", "processor", "gibber", "microwave", "reagentgrinder", "dish_drive") + design_ids = list("smartfridge", "gibber", "deepfryer", "monkey_recycler", "processor", "gibber", "microwave", "reagentgrinder", "dish_drive", "fat_sucker") research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500) export_price = 5000 diff --git a/icons/obj/machines/fat_sucker.dmi b/icons/obj/machines/fat_sucker.dmi new file mode 100644 index 0000000000000000000000000000000000000000..ad8b0d13cdc6d49fc9364e43ba33db465917ad25 GIT binary patch literal 1111 zcmV-d1gQIoP)C0001QP)t-sz`(#- zX^3!yp_Qh;z{}i=o3unwVM$hLCM!gsk+M2OX1{S>|8SlE%)V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index c2fdbefa8d2..97771db4ea1 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -590,6 +590,7 @@ #include "code\game\machinery\doppler_array.dm" #include "code\game\machinery\droneDispenser.dm" #include "code\game\machinery\exp_cloner.dm" +#include "code\game\machinery\fat_sucker.dm" #include "code\game\machinery\firealarm.dm" #include "code\game\machinery\flasher.dm" #include "code\game\machinery\gulag_item_reclaimer.dm"