Skip to content

Commit

Permalink
thanks bog
Browse files Browse the repository at this point in the history
  • Loading branch information
Thera-Pissed committed Oct 31, 2023
1 parent 44ba5f8 commit 386e79d
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 7 deletions.
277 changes: 277 additions & 0 deletions code/game/machinery/outpost_electrolyzer.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
//allows production of hydrogen from ice chunks
#define MOLS_PER_ICE 50
/obj/machinery/mineral/electrolyzer_unloader
name = "ice unloading machine"
icon = 'icons/obj/machines/mining_machines.dmi'
icon_state = "unloader"
density = TRUE
input_dir = WEST
output_dir = EAST
needs_item_input = TRUE
processing_flags = START_PROCESSING_MANUALLY

/obj/machinery/mineral/electrolyzer_unloader/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
if(istype(target, /obj/structure/ore_box))
var/obj/structure/ore_box/box = target
for(var/obj/item/stack/ore/ice/O in box)
unload_mineral(O)
else if(istype(target, /obj/item/stack/ore/ice))
var/obj/item/stack/ore/O = target
unload_mineral(O)

/obj/machinery/mineral/electrolyzer
name = "ice crusher"
desc = "breaks down ice into hydrogen and oxygen."
icon = 'icons/obj/recycling.dmi'
icon_state = "grinder-o1"
input_dir = WEST
density = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 50
active_power_usage = 1000
max_integrity = 500
var/crush_damage = 1000
var/datum/weakref/attached_output

/obj/machinery/mineral/electrolyzer/Initialize()
. = ..()
update_appearance()
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, loc_connections)

/obj/machinery/mineral/electrolyzer/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!anchored)
return
if(border_dir == input_dir)
return TRUE

/obj/machinery/mineral/electrolyzer/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
set_electrolyzer_output()
INVOKE_ASYNC(src, .proc/electrolyze, AM)


/obj/machinery/mineral/electrolyzer/proc/electrolyze(atom/movable/AM0, sound=TRUE)
if(machine_stat & (BROKEN|NOPOWER))
return
if(!isturf(AM0.loc))
return
if(istype(AM0, /obj/effect))
return //effects are not touchable

var/list/to_electrolyze = AM0.GetAllContents()

var/list/electrolyze = list()

var/not_electrolyzed //used to play sounds if something that isnt ice gets chucked in

var/obj/machinery/atmospherics/components/binary/electrolyzer_out/resolved_output = attached_output?.resolve()

if(!resolved_output)
return
for(var/i in to_electrolyze)
var/atom/movable/AM = i
if(istype(AM, /obj/item/stack/ore/ice))
electrolyze += AM
else
not_electrolyzed = 1
if(isliving(AM))
crush_living(AM)
if(not_electrolyzed == 1)
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE, 1) // Dont play a ton of sounds for a ton of items
for(var/electro in electrolyze)
resolved_output.electrolyze_item(electro)

if(!ismob(AM0)) //MULCH IT IF IT AINT ICE
AM0.moveToNullspace()
qdel(AM0)


/obj/machinery/mineral/electrolyzer/proc/set_electrolyzer_output()
for(var/direction in GLOB.cardinals)
for(var/obj/machinery/atmospherics/components/binary/electrolyzer_out/found in get_step(get_turf(src), direction))
attached_output = WEAKREF(found)
update_icon_state()
return TRUE

/obj/machinery/mineral/electrolyzer/proc/crush_living(mob/living/L)

L.forceMove(loc)

if(issilicon(L))
playsound(src, 'sound/items/welder.ogg', 50, TRUE)
else
playsound(src, 'sound/effects/splat.ogg', 50, TRUE)

if(iscarbon(L))
if(L.stat == CONSCIOUS)
L.say("YOUWCH!!!!", forced="recycler grinding")

// Instantly lie down, also go unconscious from the pain, before you die.
L.Unconscious(100)
L.adjustBruteLoss(crush_damage)

/obj/machinery/atmospherics/components/binary/electrolyzer_out
name = "electrolyzing chamber"
desc = "breaks down ice into hydrogen and oxygen."
icon = 'icons/obj/shuttle.dmi'
icon_state = "heater_pipe"

use_power = IDLE_POWER_USE
idle_power_usage = 50
active_power_usage = 1000

density = TRUE
max_integrity = 400
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 30)
layer = OBJ_LAYER
showpipe = TRUE
pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
var/molstomakedebug //removewhendone

/obj/machinery/atmospherics/components/binary/electrolyzer_out/proc/electrolyze_item(obj/item/I)
var/datum/gas_mixture/air1 = airs[1] //hydrogen out
var/datum/gas_mixture/air2 = airs[2] //oxygen out
var/obj/item/stack/ore/ice/S = I
var/molstomake = S.get_amount() * MOLS_PER_ICE
molstomakedebug = molstomake
air1.adjust_moles (GAS_HYDROGEN, molstomake)
air2.adjust_moles (GAS_O2, molstomake / 2)
/*
/obj/machinery/mineral/electrolyzer
name = "ice crusher"
desc = "breaks down ice into hydrogen and oxygen."
icon = 'icons/obj/recycling.dmi'
icon_state = "grinder-o0"
circuit = /obj/item/circuitboard/machine/electrolyzer
input_dir = WEST
output_dir = EAST
density = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 50
active_power_usage = 1000
max_integrity = 500
var/icon_name = "grinder-o"
var/amount_produced = 50
var/item_recycle_sound = 'sound/items/welder.ogg'
/obj/machinery/electrolyzer/Initialize()
. = ..()
/obj/machinery/electrolyzer/attackby(obj/item/I, mob/user, params)
if(default_deconstruction_screwdriver(user, "grinder-oOpen", "grinder-o0", I))
return
if(default_pry_open(I))
return
if(default_deconstruction_crowbar(I))
return
return ..()
/obj/machinery/electrolyzer/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!anchored)
return
if(border_dir == eat_dir)
return TRUE
/obj/machinery/electrolyzer/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
INVOKE_ASYNC(src, .proc/electrolyze, AM)
/obj/machinery/electrolyzer/proc/electrolyze(atom/movable/AM0, sound=TRUE)
if(machine_stat & (BROKEN|NOPOWER))
return
if(!isturf(AM0.loc))
return
if(istype(AM0, /obj/effect))
return //effects are not touchable
var/list/to_electrolyze = AM0.GetAllContents()
var/list/electrolyze = list()
for(var/i in to_electrolyze)
var/atom/movable/AM = i
if(istype(AM, /obj/item/ice_chunk))
electrolyze += AM
else if (istype(AM, /obj/item))
playsound(src, 'sound/machines/buzz-sigh.ogg', 20, FALSE)
for(var/electrolyzed in electrolyze)
electrolyze_item()
/obj/machinery/electrolyzer/proc/electrolyze(atom/movable/AM0, sound=TRUE)
if(QDELETED(target))
return
if(machine_stat & (BROKEN|NOPOWER))
return
if(!isturf(AM0.loc))
return
if(istype(AM0, /obj/effect))
return //effects are not touchable
var/list/to_electrolyze = AM0.GetAllContents()
var/list/electrolyze = list()
for(var/i in to_electrolyze)
var/atom/movable/AM = i
if(istype(AM, /obj/item))
var/obj/item/bodypart/head/as_head = AM
var/obj/item/mmi/as_mmi = AM
if(istype(AM, /obj/item/organ/brain) || (istype(as_head) && as_head.brain) || (istype(as_mmi) && as_mmi.brain) || istype(AM, /obj/item/dullahan_relay))
living_detected = TRUE
nom += AM
else if(isliving(AM))
living_detected = TRUE
crunchy_nom += AM
var/not_eaten = to_eat.len - nom.len - crunchy_nom.len
if(living_detected) // First, check if we have any living beings detected.
if(obj_flags & EMAGGED)
for(var/CRUNCH in crunchy_nom) // Eat them and keep going because we don't care about safety.
if(isliving(CRUNCH)) // MMIs and brains will get eaten like normal items
crush_living(CRUNCH)
else // Stop processing right now without eating anything.
emergency_stop()
return
for(var/nommed in nom)
recycle_item(nommed)
if(nom.len && sound)
playsound(src, item_recycle_sound, (50 + nom.len*5), TRUE, nom.len, ignore_walls = (nom.len - 10)) // As a substitute for playing 50 sounds at once.
if(not_eaten)
playsound(src, 'sound/machines/buzz-sigh.ogg', (50 + not_eaten*5), FALSE, not_eaten, ignore_walls = (not_eaten - 10)) // Ditto.
if(!ismob(AM0))
AM0.moveToNullspace()
qdel(AM0)
else // Lets not move a mob to nullspace and qdel it, yes?
for(var/i in AM0.contents)
var/atom/movable/content = i
content.moveToNullspace()
qdel(content)
/obj/machinery/atmospherics/components/binary/electrolyzer_out
name = "electrolyzing chamber"
desc = "breaks down ice into hydrogen and oxygen."
icon = 'icons/obj/shuttle.dmi'
use_power = IDLE_POWER_USE
idle_power_usage = 50
active_power_usage = 1000
density = TRUE
max_integrity = 400
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 30)
layer = OBJ_LAYER
showpipe = TRUE
/obj/machinery/atmospherics/components/binary/electrolyzer_out/electrolyze()
*/
6 changes: 5 additions & 1 deletion code/game/machinery/shuttle/shuttle_engine_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
* Engines that use oxidizer and fuel to output thrust. Theoretically works with any mix of fuels and oxiders. Wish me luck.
*/

/obj/item/paper/guides/recycler
name = "paper - 'combustion thruster instructions'"
default_raw_text = "<h2>Combustion Thruster Instructions</h2> text <b>bold</b>"

/obj/machinery/power/shuttle/engine/fire
name = "combustion thruster"
desc = "A thruster that burns fuel with oxider that is stored in an adjacent heater."
Expand All @@ -117,7 +121,7 @@
///what portion of the mols in the attached heater to "burn"
var/fuel_consumption = 0.0125
//multiplier for thrust
thrust = 2
thrust = 3
//used by stockparts, efficiency_multiplier
var/consumption_multiplier = 1
//If this engine should create heat when burned.
Expand Down
10 changes: 5 additions & 5 deletions code/game/machinery/shuttle/shuttle_heater.dm
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
assume_air_ratio(air_contents, 0.01) //leaks a bit of its tank
if(damage_state >= DAMAGE_HIGH)
var/epicenter = loc
explosion(epicenter, 1, 2, 3, 3, TRUE, TRUE) //boom
explosion(epicenter, 2, 2, 3, 3, TRUE, TRUE) //boom
update_parents()

/obj/machinery/atmospherics/components/unary/shuttle/fire_heater/default_change_direction_wrench(mob/user, obj/item/I)
Expand Down Expand Up @@ -380,7 +380,7 @@
to_chat(user, "<span class='warning'>You need at least 2 metal sheets to repair [src].</span>")
return
to_chat(user,"<span class='notice'>You start adding new plating.</span>")
if(do_after(user, 20, TRUE, src))
if(do_after(user, 40, TRUE, src))
if(!I.use(2))
return
to_chat(user, "<span class='notice'>You add new plating.</span>")
Expand All @@ -393,7 +393,7 @@

if(damage_state == DAMAGE_MED && I.tool_behaviour == TOOL_WRENCH && metal_repair == TRUE)
to_chat(user, "<span class='notice'>You start wrenching down the new plating.</span>")
if(I.use_tool(src, user, 40, volume=75))
if(I.use_tool(src, user, 60, volume=75))
metal_repair = FALSE
damage_state = DAMAGE_LOW
pressure_damage = 0
Expand All @@ -403,7 +403,7 @@

if(damage_state == DAMAGE_LOW && I.tool_behaviour == TOOL_CROWBAR) //fix low damage with screwdriver
to_chat(user, "<span class='notice'>You start prying in the insulation layer.</span>")
if(I.use_tool(src, user, 40, volume=75))
if(I.use_tool(src, user, 60, volume=75))
damage_state = DAMAGE_NONE
pressure_damage = 0
to_chat(user, "<span class='notice'>You secure the insulation layer.</span>")
Expand All @@ -412,7 +412,7 @@

if(damage_state == DAMAGE_NONE && I.tool_behaviour == TOOL_SCREWDRIVER && pressure_damage >= PRESSURE_DAMAGE_MAX / 2) //lets you fix pressure damage before it increases damage state
to_chat(user, "<span class='notice'>You start tightening loose screws.</span>")
if(I.use_tool(src, user, 40, volume=75))
if(I.use_tool(src, user, 60, volume=75))
pressure_damage = 0
to_chat(user, "<span class='notice'>You tighten the screws.</span>")
return
Expand Down
11 changes: 11 additions & 0 deletions code/modules/mining/ores_coins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,17 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
item_state = "slag"
singular_name = "slag chunk"

/obj/item/stack/ore/ice
name = "ice crystals"
desc = "used in an electrolyzer for hydrogen production"
icon_state = "Diamond ore"
item_state = "Diamond ore"
singular_name = "ice chunk"
scan_state = "rock_Bananium"
mine_experience = 2
grind_results = list(/datum/reagent/consumable/ice = 10)
spreadChance = 10

/obj/item/gibtonite
name = "gibtonite ore"
desc = "Extremely explosive if struck with mining equipment, Gibtonite is often used by miners to speed up their work by using it as a mining charge. This material is illegal to possess by unauthorized personnel under space law."
Expand Down
3 changes: 2 additions & 1 deletion shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@
#include "code\game\machinery\medipen_refiller.dm"
#include "code\game\machinery\navbeacon.dm"
#include "code\game\machinery\newscaster.dm"
#include "code\game\machinery\outpost_electrolyzer.dm"
#include "code\game\machinery\PDApainter.dm"
#include "code\game\machinery\prisonlabor.dm"
#include "code\game\machinery\quantum_pad.dm"
Expand Down Expand Up @@ -1443,6 +1444,7 @@
#include "code\game\turfs\open\floor\catwalk_plating.dm"
#include "code\game\turfs\open\floor\conc_floor.dm"
#include "code\game\turfs\open\floor\fancy_floor.dm"
#include "code\game\turfs\open\floor\hangar.dm"
#include "code\game\turfs\open\floor\hull.dm"
#include "code\game\turfs\open\floor\light_floor.dm"
#include "code\game\turfs\open\floor\mineral_floor.dm"
Expand All @@ -1459,7 +1461,6 @@
#include "code\game\turfs\open\floor\plating\rockplanet.dm"
#include "code\game\turfs\open\floor\plating\wasteplanet.dm"
#include "code\game\turfs\open\floor\plating\whitesands.dm"
#include "code\game\turfs\open\floor\hangar.dm"
#include "code\game\turfs\open\space\space.dm"
#include "code\game\turfs\open\space\transit.dm"
#include "code\modules\admin\admin.dm"
Expand Down

0 comments on commit 386e79d

Please sign in to comment.