Skip to content

Commit

Permalink
Expands the rapid construction fabricator's appliances to be more tha…
Browse files Browse the repository at this point in the history
…n four (4) things! (#1429)

* its almost the last of the frontier stuff, wowee!!

* lets go #2

* it aint skyrat anymore stupid dog

* that should be that then

* oh wait fix the design datumf irst

* changes how the categories are sorted

* Update modular_nova/modules/colony_fabricator/code/appliances/recycler.dm



* Update modular_nova/modules/colony_fabricator/code/appliances/co2_cracker.dm



* Update modular_nova/modules/colony_fabricator/code/appliances/recycler.dm



* Update modular_nova/modules/colony_fabricator/code/appliances/co2_cracker.dm



* Update modular_nova/modules/colony_fabricator/code/appliances/co2_cracker.dm



* Update modular_nova/modules/colony_fabricator/code/appliances/recycler.dm



* lets the recycler be wrenched down

* fixes the design section

* shakes fist angrily at the nodeconstruct flag

---------

Co-authored-by: Paxilmaniac <[email protected]>
Co-authored-by: Bloop <[email protected]>
  • Loading branch information
3 people authored Jan 4, 2024
1 parent 61e91c5 commit f77dfbe
Show file tree
Hide file tree
Showing 20 changed files with 823 additions and 10 deletions.
9 changes: 9 additions & 0 deletions code/__DEFINES/~skyrat_defines/colony_fabricator_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
#define RND_CATEGORY_AKHTER_MEDICAL "Emergency Medical"
/// Category for resources made by the organics printer
#define RND_CATEGORY_AKHTER_RESOURCES "Resources"

/// Category for ingredients in the ration printer
#define RND_CATEGORY_AKHTER_FOODRICATOR_INGREDIENTS "Ingredients"
/// Category for bags and containers of reagents in the ration printer
#define RND_CATEGORY_AKHTER_FOODRICATOR_BAGS "Containers"
/// Category for snacks in the ration printer
#define RND_CATEGORY_AKHTER_FOODRICATOR_SNACKS "Luxuries"
/// Category for utensils and whatnot in the ration printer
#define RND_CATEGORY_AKHTER_FOODRICATOR_UTENSILS "Utensils"
/// Category for the seeds the organics printer can make
#define RND_CATEGORY_AKHTER_SEEDS "Synthesized Seeds"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,105 @@
w_class = WEIGHT_CLASS_NORMAL
type_to_deploy = /obj/machinery/plumbing/synthesizer/water_synth
deploy_time = 2 SECONDS

// Machine that makes botany nutrients for hydroponics farming

/obj/machinery/plumbing/synthesizer/colony_hydroponics
name = "hydroponics chemical synthesizer"
desc = "An infinitely useful device for those finding themselves in a frontier without a stable source of nutrients for crops. \
Using a simplified version of the chemistry dispenser's synthesizer process, it can create hydroponics nutrients out of nothing \
but good old electricity."
icon = 'modular_nova/modules/colony_fabricator/icons/chemistry_machines.dmi'
icon_state = "hydro_synth"
anchored = FALSE
/// Reagents that this can dispense, overrides the default list on init
var/static/list/synthesizable_reagents = list(
/datum/reagent/plantnutriment/eznutriment,
/datum/reagent/plantnutriment/left4zednutriment,
/datum/reagent/plantnutriment/robustharvestnutriment,
/datum/reagent/plantnutriment/endurogrow,
/datum/reagent/plantnutriment/liquidearthquake,
/datum/reagent/toxin/plantbgone/weedkiller,
/datum/reagent/toxin/pestkiller,
)

/obj/machinery/plumbing/synthesizer/colony_hydroponics/Initialize(mapload, bolt, layer)
. = ..()
dispensable_reagents = synthesizable_reagents
AddElement(/datum/element/manufacturer_examine, COMPANY_FRONTIER)

// Deployable item for cargo for the hydro synth

/obj/item/flatpacked_machine/hydro_synth
name = "hydroponics chemical synthesizer parts kit"
icon = 'modular_nova/modules/colony_fabricator/icons/chemistry_machines.dmi'
icon_state = "hydro_synth_parts"
w_class = WEIGHT_CLASS_NORMAL
type_to_deploy = /obj/machinery/plumbing/synthesizer/colony_hydroponics
deploy_time = 2 SECONDS

// Chem dispenser with a limited range of thematic reagents to dispense

/obj/machinery/chem_dispenser/frontier_appliance
name = "sustenance dispenser"
desc = "Creates and dispenses a small pre-defined set of chemicals and other liquids for the convenience of those typically on the frontier. \
While the machine is loved by many, it also has a reputation for making some of the worst coffees this side of the galaxy. Use at your own risk."
icon = 'modular_nova/modules/colony_fabricator/icons/chemistry_machines.dmi'
icon_state = "dispenser"
base_icon_state = "dispenser"
pass_flags = PASSTABLE
anchored_tabletop_offset = 4
anchored = FALSE
circuit = null
powerefficiency = 0.5
recharge_amount = 50
show_ph = FALSE
base_reagent_purity = 0.5
// God's strongest coffee machine
dispensable_reagents = list(
/datum/reagent/water,
/datum/reagent/consumable/powdered_milk,
/datum/reagent/consumable/sugar,
/datum/reagent/consumable/powdered_lemonade,
/datum/reagent/consumable/powdered_coco,
/datum/reagent/consumable/powdered_coffee,
/datum/reagent/consumable/powdered_tea,
/datum/reagent/consumable/vanilla,
/datum/reagent/consumable/caramel,
/datum/reagent/consumable/korta_nectar,
/datum/reagent/consumable/korta_milk,
/datum/reagent/consumable/astrotame,
/datum/reagent/consumable/salt,
/datum/reagent/consumable/blackpepper,
/datum/reagent/consumable/nutraslop,
/datum/reagent/consumable/enzyme,
)
/// Since we don't have a board to take from, we use this to give the dispenser a cell on spawning
var/cell_we_spawn_with = /obj/item/stock_parts/cell/crap/empty

/obj/machinery/chem_dispenser/frontier_appliance/Initialize(mapload)
. = ..()
AddElement(/datum/element/manufacturer_examine, COMPANY_FRONTIER)
cell = new cell_we_spawn_with(src)

/obj/machinery/chem_dispenser/frontier_appliance/display_beaker()
var/mutable_appearance/overlayed_beaker = beaker_overlay || mutable_appearance(icon, "disp_beaker")
return overlayed_beaker

/obj/machinery/chem_dispenser/frontier_appliance/RefreshParts()
. = ..()
powerefficiency = 0.5
recharge_amount = 50

/obj/machinery/chem_dispenser/frontier_appliance/default_deconstruction_crowbar()
return

// Deployable item for cargo for the sustenance machine

/obj/item/flatpacked_machine/sustenance_machine
name = "sustenance dispenser parts kit"
icon = 'modular_nova/modules/colony_fabricator/icons/chemistry_machines.dmi'
icon_state = "dispenser_parts"
w_class = WEIGHT_CLASS_NORMAL
type_to_deploy = /obj/machinery/chem_dispenser/frontier_appliance
deploy_time = 2 SECONDS
118 changes: 118 additions & 0 deletions modular_nova/modules/colony_fabricator/code/appliances/co2_cracker.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// We can't just use electrolyzer reactions, because that'd let electrolyzers do co2 cracking

GLOBAL_LIST_INIT(cracker_reactions, cracker_reactions_list())

/// Global proc to build up the list of co2 cracker reactions
/proc/cracker_reactions_list()
var/list/built_reaction_list = list()
for(var/reaction_path in subtypesof(/datum/cracker_reaction))
var/datum/cracker_reaction/reaction = new reaction_path()

built_reaction_list[reaction.id] = reaction

return built_reaction_list

/datum/cracker_reaction
var/list/requirements
var/name = "reaction"
var/id = "r"
var/desc = ""
var/list/factor

/// Called when the co2 cracker reaction is run, should be where the code for actually changing gasses around is run
/datum/cracker_reaction/proc/react(turf/location, datum/gas_mixture/air_mixture, working_power)
return

/// Checks if this reaction can actually be run
/datum/cracker_reaction/proc/reaction_check(datum/gas_mixture/air_mixture)
var/temp = air_mixture.temperature
var/list/cached_gases = air_mixture.gases
if((requirements["MIN_TEMP"] && temp < requirements["MIN_TEMP"]) || (requirements["MAX_TEMP"] && temp > requirements["MAX_TEMP"]))
return FALSE
for(var/id in requirements)
if(id == "MIN_TEMP" || id == "MAX_TEMP")
continue
if(!cached_gases[id] || cached_gases[id][MOLES] < requirements[id])
return FALSE
return TRUE

/datum/cracker_reaction/co2_cracking
name = "CO2 Cracking"
id = "co2_cracking"
desc = "Conversion of CO2 into equal amounts of O2"
requirements = list(
/datum/gas/carbon_dioxide = MINIMUM_MOLE_COUNT,
)
factor = list(
/datum/gas/carbon_dioxide = "1 mole of CO2 gets consumed",
/datum/gas/oxygen = "1 mole of O2 gets produced",
"Location" = "Can only happen on turfs with an active CO2 cracker.",
)

/datum/cracker_reaction/co2_cracking/react(turf/location, datum/gas_mixture/air_mixture, working_power)
var/old_heat_capacity = air_mixture.heat_capacity()
air_mixture.assert_gases(/datum/gas/water_vapor, /datum/gas/oxygen)
var/proportion = min(air_mixture.gases[/datum/gas/carbon_dioxide][MOLES] * INVERSE(2), (2.5 * (working_power ** 2)))
air_mixture.gases[/datum/gas/carbon_dioxide][MOLES] -= proportion
air_mixture.gases[/datum/gas/oxygen][MOLES] += proportion
var/new_heat_capacity = air_mixture.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
air_mixture.temperature = max(air_mixture.temperature * old_heat_capacity / new_heat_capacity, TCMB)

// CO2 cracker machine itself

/obj/machinery/electrolyzer/co2_cracker
name = "portable CO2 cracker"
desc = "A portable device that is the savior of many a colony on the frontier. Performing similarly to an electrolyzer, \
it takes in nearby gasses and breaks them into different gasses. The big draw of this one? It can crack carbon dioxide \
into breathable oxygen. Handy for places where CO2 is all too common, and oxygen is all too hard to find."
icon = 'modular_nova/modules/colony_fabricator/icons/portable_machines.dmi'
circuit = null
working_power = 1
/// Soundloop for while the thermomachine is turned on
var/datum/looping_sound/conditioner_running/soundloop

/obj/machinery/electrolyzer/co2_cracker/Initialize(mapload)
. = ..()
soundloop = new(src, FALSE)
AddElement(/datum/element/manufacturer_examine, COMPANY_FRONTIER)

/obj/machinery/electrolyzer/co2_cracker/process_atmos()
if(on && !soundloop.loop_started)
soundloop.start()
else if(soundloop.loop_started)
soundloop.stop()
return ..()

/obj/machinery/electrolyzer/co2_cracker/call_reactions(datum/gas_mixture/env)
for(var/reaction in GLOB.cracker_reactions)
var/datum/cracker_reaction/current_reaction = GLOB.cracker_reactions[reaction]

if(!current_reaction.reaction_check(env))
continue

current_reaction.react(loc, env, working_power)

env.garbage_collect()

/obj/machinery/electrolyzer/co2_cracker/RefreshParts()
. = ..()
working_power = 2
efficiency = 1

/obj/machinery/electrolyzer/co2_cracker/crowbar_act(mob/living/user, obj/item/tool)
return

// "parts kit" for buying these from cargo

/obj/item/flatpacked_machine/co2_cracker
name = "CO2 cracker parts kit"
icon = 'modular_nova/modules/colony_fabricator/icons/parts_kits.dmi'
icon_state = "co2_cracker"
type_to_deploy = /obj/machinery/electrolyzer/co2_cracker
deploy_time = 2 SECONDS
custom_materials = list(
/datum/material/iron = SHEET_MATERIAL_AMOUNT * 7.5,
/datum/material/glass = SHEET_MATERIAL_AMOUNT * 3,
/datum/material/plasma = HALF_SHEET_MATERIAL_AMOUNT, // We're gonna pretend plasma is the catalyst for co2 cracking
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/obj/machinery/biogenerator/foodricator
name = "organic rations printer"
desc = "An advanced machine seen in frontier outposts and colonies capable of turning organic plant matter into \
various foods or ingredients. The best friend of a chef where deliveries are inconsistent or simply don't exist. \
Some of those that consume the food from this complain that the foods it makes have poor taste, though they must \
not appreciate being able to eat steak and eggs for breakfast with a lack of any livestock at all in the colony."
icon = 'modular_nova/modules/colony_fabricator/icons/foodricator.dmi'
circuit = null
anchored = FALSE
pass_flags = PASSTABLE
efficiency = 1
productivity = 2.5
anchored_tabletop_offset = 8
show_categories = list(
RND_CATEGORY_AKHTER_FOODRICATOR_INGREDIENTS,
RND_CATEGORY_AKHTER_FOODRICATOR_BAGS,
RND_CATEGORY_AKHTER_FOODRICATOR_SNACKS,
RND_CATEGORY_AKHTER_FOODRICATOR_UTENSILS,
RND_CATEGORY_AKHTER_SEEDS,
)

/obj/machinery/biogenerator/foodricator/Initialize(mapload)
. = ..()
AddElement(/datum/element/manufacturer_examine, COMPANY_FRONTIER)

/obj/machinery/biogenerator/foodricator/RefreshParts()
. = ..()
efficiency = 1
productivity = 3

/obj/machinery/biogenerator/foodricator/default_deconstruction_crowbar()
return

// Deployable item for cargo for the rations printer

/obj/item/flatpacked_machine/organics_ration_printer
name = "organic rations printer parts kit"
icon = 'modular_nova/modules/colony_fabricator/icons/foodricator.dmi'
icon_state = "biogenerator_parts"
type_to_deploy = /obj/machinery/biogenerator/foodricator
custom_materials = list(
/datum/material/iron = SHEET_MATERIAL_AMOUNT * 5,
/datum/material/glass = SHEET_MATERIAL_AMOUNT * 2,
/datum/material/silver = SHEET_MATERIAL_AMOUNT,
/datum/material/gold = HALF_SHEET_MATERIAL_AMOUNT,
)
81 changes: 81 additions & 0 deletions modular_nova/modules/colony_fabricator/code/appliances/recycler.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/obj/machinery/colony_recycler
name = "materials recycler"
desc = "A large crushing machine used to recycle small items inefficiently. Items are inserted by hand, rather than by belt. \
Mind your fingers."
icon = 'modular_nova/modules/colony_fabricator/icons/portable_machines.dmi'
icon_state = "recycler"
anchored = FALSE
density = TRUE
circuit = null
/// The percentage of materials returned
var/amount_produced = 80
/// The sound made when an item is eaten
var/item_recycle_sound = 'modular_nova/modules/reagent_forging/sound/forge.ogg'
/// The recycler's internal materials storage, for when items recycled don't produce enough to make a full sheet of that material
var/datum/component/material_container/materials
/// The list of all the materials we can recycle
var/static/list/allowed_materials = list(
/datum/material/iron,
/datum/material/glass,
/datum/material/silver,
/datum/material/plasma,
/datum/material/gold,
/datum/material/diamond,
/datum/material/plastic,
/datum/material/uranium,
/datum/material/bananium,
/datum/material/titanium,
/datum/material/bluespace,
)
/// The item we turn into when repacked
var/repacked_type = /obj/item/flatpacked_machine/recycler

/obj/machinery/colony_recycler/Initialize(mapload)
. = ..()
AddElement(/datum/element/repackable, repacked_type, 5 SECONDS)
AddElement(/datum/element/manufacturer_examine, COMPANY_FRONTIER)
materials = AddComponent( \
/datum/component/material_container, \
allowed_materials, \
INFINITY, \
MATCONTAINER_EXAMINE, \
container_signals = list(COMSIG_MATCONTAINER_ITEM_CONSUMED = TYPE_PROC_REF(/obj/machinery/colony_recycler, has_eaten_materials)), \
)

/obj/machinery/colony_recycler/Destroy()
materials = null
return ..()

/obj/machinery/colony_recycler/examine(mob/user)
. = ..()
. += span_notice("Reclaiming <b>[amount_produced]%</b> of materials salvaged.")
. += span_notice("Can be <b>secured</b> with a <b>wrench</b> using <b>Right-Click</b>.")

/obj/machinery/colony_recycler/wrench_act_secondary(mob/living/user, obj/item/tool)
default_unfasten_wrench(user, tool)
return ITEM_INTERACT_SUCCESS

/// Proc called when the recycler eats new materials, checks if we should spit out new material sheets
/obj/machinery/colony_recycler/proc/has_eaten_materials(container, obj/item/item_inserted, last_inserted_id, mats_consumed, amount_inserted, atom/context)
SIGNAL_HANDLER

flick("recycler_grind", src)
playsound(src, item_recycle_sound, 50, TRUE)
use_power(min(active_power_usage * 0.25, amount_inserted / 100))

if(amount_inserted)
materials.retrieve_all(drop_location())

// "parts kit" for buying these from cargo

/obj/item/flatpacked_machine/recycler
name = "recycler parts kit"
icon = 'modular_nova/modules/colony_fabricator/icons/parts_kits.dmi'
icon_state = "recycler"
type_to_deploy = /obj/machinery/colony_recycler
deploy_time = 2 SECONDS
custom_materials = list(
/datum/material/iron = SHEET_MATERIAL_AMOUNT * 7.5,
/datum/material/glass = SHEET_MATERIAL_AMOUNT * 3,
/datum/material/titanium = HALF_SHEET_MATERIAL_AMOUNT, // Titan for the crushing element
)
Loading

0 comments on commit f77dfbe

Please sign in to comment.