Adipoelectric Generator

Added the adipoelectric generator, a machine that takes fat from the person who uses it and turns into current for the wire it's placed on. Unlocked at roundstart
Internal cleanup for the adipoelectric transformer
This commit is contained in:
Alphas00
2024-05-01 17:01:30 +02:00
parent 0f61e09deb
commit c70380f996
4 changed files with 153 additions and 5 deletions
@@ -0,0 +1,149 @@
/obj/machinery/power/adipoelectric_generator
name = "adipoelectric generator"
desc = "This device uses calorite technology to transform excess blubber into power!"
icon = 'GainStation13/icons/obj/adipoelectric_transformer.dmi'
icon_state = "state_off"
density = FALSE
anchored = FALSE
use_power = NO_POWER_USE
state_open = TRUE
circuit = /obj/item/circuitboard/machine/power/adipoelectric_generator
occupant_typecache = list(/mob/living/carbon)
var/laser_modifier
var/max_fat
var/obj/structure/cable/attached
var/conversion_rate = 10000
var/emp_timer = 0
var/active = FALSE
var/datum/looping_sound/generator/soundloop
/obj/machinery/power/adipoelectric_generator/Initialize()
. = ..()
soundloop = new(list(src), active)
if(anchored)
connect_to_network()
update_icon()
/obj/machinery/power/adipoelectric_generator/RefreshParts()
laser_modifier = 0
max_fat = 0
for(var/obj/item/stock_parts/micro_laser/C in component_parts)
laser_modifier += C.rating
for(var/obj/item/stock_parts/matter_bin/C in component_parts)
max_fat += C.rating * 2
/obj/machinery/power/adipoelectric_generator/process()
if(occupant:fatness_real > 0 && powernet && anchored && (emp_timer < world.time))
active = TRUE
add_avail(conversion_rate * laser_modifier * max_fat)
occupant:adjust_fatness(-max_fat, FATTENING_TYPE_ITEM)
soundloop.start()
else
active = FALSE
soundloop.stop()
update_icon()
/obj/machinery/power/adipoelectric_generator/relaymove(mob/user)
if(user.stat)
return
open_machine()
soundloop.stop()
/obj/machinery/power/adipoelectric_generator/emp_act(severity)
. = ..()
if(!(stat & (BROKEN|NOPOWER)))
emp_timer = world.time + 600
if(occupant)
open_machine()
/obj/machinery/power/adipoelectric_generator/attackby(obj/item/P, mob/user, params)
if(state_open)
if(default_deconstruction_screwdriver(user, "state_open", "state_off", P))
return
if(default_pry_open(P))
return
if(default_deconstruction_crowbar(P))
return
if(istype(P, /obj/item/wrench) && !active)
if(!anchored && !isinspace())
connect_to_network()
to_chat(user, "<span class='notice'>You secure the generator to the floor.</span>")
anchored = TRUE
dir = SOUTH
else if(anchored)
disconnect_from_network()
to_chat(user, "<span class='notice'>You unsecure the generator from the floor.</span>")
anchored = FALSE
playsound(src.loc, 'sound/items/deconstruct.ogg', 50, 1)
return
return ..()
/obj/machinery/power/adipoelectric_generator/interact(mob/user)
toggle_open()
return TRUE
/obj/machinery/power/adipoelectric_generator/proc/toggle_open()
if(state_open)
close_machine()
else
open_machine()
soundloop.stop()
update_icon()
/obj/machinery/power/adipoelectric_generator/open_machine()
. = ..()
/obj/machinery/power/adipoelectric_generator/close_machine()
. = ..()
if(occupant && anchored && !panel_open)
add_fingerprint(occupant)
else
open_machine()
/obj/machinery/power/adipoelectric_generator/update_icon()
cut_overlays()
if(panel_open)
icon_state = "state_open"
return
if(occupant)
var/image/occupant_overlay
occupant_overlay = image(occupant.icon, occupant.icon_state)
occupant_overlay.copy_overlays(occupant)
occupant_overlay.dir = SOUTH
occupant_overlay.pixel_y = 10
add_overlay(occupant_overlay)
if(!active)
icon_state = "state_off"
else
icon_state = "state_on"
else
icon_state = "state_off"
/obj/machinery/power/adipoelectric_generator/power_change()
..()
update_icon()
/obj/machinery/power/adipoelectric_generator/Destroy()
QDEL_NULL(soundloop)
. = ..()
/obj/item/circuitboard/machine/power/adipoelectric_generator
name = "Adipoelectric Generator (Machine Board)"
build_path = /obj/machinery/power/adipoelectric_generator
req_components = list(
/obj/item/stock_parts/micro_laser = 5,
/obj/item/stock_parts/matter_bin = 1,
/obj/item/stack/cable_coil = 2)
needs_anchored = FALSE
/datum/design/board/adipoelectric_generator
name = "Machine Design (Adipoelectric Generator Board)"
desc = "The circuit board for an Adipoelectric Generator."
id = "adipoelectric_generator"
build_path = /obj/item/circuitboard/machine/power/adipoelectric_generator
category = list("Engineering Machinery")
departmental_flags = DEPARTMENTAL_FLAG_ENGINEERING
@@ -1,14 +1,12 @@
GLOBAL_LIST_EMPTY(adipoelectric_transformer)
/obj/machinery/adipoelectric_transformer
name = "adipoelectric transformer" //change name to adipoelectric generator
name = "adipoelectric transformer"
desc = "This device uses calorite technology to store excess current in the wire it's placed on into whoever steps on!"
icon = 'GainStation13/icons/obj/adipoelectric_transformer.dmi'
icon_state = "state_off"
density = FALSE
use_power = IDLE_POWER_USE
idle_power_usage = 0
active_power_usage = 0
use_power = NO_POWER_USE
state_open = TRUE
circuit = /obj/item/circuitboard/machine/adipoelectric_transformer
occupant_typecache = list(/mob/living/carbon)
+1 -1
View File
@@ -12,7 +12,7 @@
"destructive_analyzer", "circuit_imprinter", "experimentor", "rdconsole", "design_disk", "tech_disk", "rdserver", "rdservercontrol", "mechfab",
"space_heater", "xlarge_beaker", "sec_rshot", "sec_bshot", "sec_slug", "sec_Islug", "sec_dart", "sec_38", "sec_38lethal",
"rglass","plasteel","plastitanium","plasmaglass","plasmareinforcedglass","titaniumglass","plastitaniumglass","chem_pack","medkit_cabinet",
"disposable_hypospray","plastic_knife","plastic_fork","plastic_spoon","large_beaker")
"disposable_hypospray","plastic_knife","plastic_fork","plastic_spoon","large_beaker", "adipoelectric_generator")
/datum/techweb_node/mmi
id = "mmi"
+1
View File
@@ -3085,6 +3085,7 @@
#include "GainStation13\code\game\objects\effects\spawners\choco_slime_delivery.dm"
#include "GainStation13\code\game\turfs\closed.dm"
#include "GainStation13\code\game\turfs\open.dm"
#include "GainStation13\code\machinery\adipoelectric_generator.dm"
#include "GainStation13\code\machinery\adipoelectric_transformer.dm"
#include "GainStation13\code\machinery\fattening_turret.dm"
#include "GainStation13\code\machinery\feeding_tube.dm"