This commit is contained in:
lolman360
2020-07-22 12:42:46 +10:00
parent f33487e972
commit 17d1fd0692
27 changed files with 222 additions and 203 deletions
@@ -26,11 +26,12 @@
. = ..()
anchored = bolt
create_reagents(buffer, reagent_flags)
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS )
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS, null, CALLBACK(src, .proc/can_be_rotated))
/obj/machinery/plumbing/proc/can_be_rotated(mob/user,rotation_type)
return TRUE
/obj/machinery/plumbing/examine(mob/user)
. = ..()
. += "<span class='notice'>The maximum volume display reads: <b>[reagents.maximum_volume] units</b>.</span>"
+2 -2
View File
@@ -25,8 +25,8 @@
and you get nasty leftovers
*/
var/emptying = FALSE
var/ui_x = 320
var/ui_y = 310
ui_x = 320
ui_y = 310
/obj/machinery/plumbing/acclimator/Initialize(mapload, bolt)
. = ..()
+1 -1
View File
@@ -56,7 +56,7 @@
to_chat(user, "<span class='notice'> The [src] will now fill for [wanted_amount]u.</span>")
/obj/machinery/plumbing/bottler/process()
if(machine_stat & NOPOWER)
if(stat & NOPOWER)
return
///see if machine has enough to fill
if(reagents.total_volume >= wanted_amount && anchored)
+16 -9
View File
@@ -14,17 +14,25 @@
. = ..()
AddComponent(/datum/component/plumbing/simple_supply, bolt)
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type)
/obj/machinery/plumbing/fermenter/can_be_rotated(mob/user,rotation_type)
if(anchored)
to_chat(user, "<span class='warning'>It is fastened to the floor!</span>")
return FALSE
return TRUE
switch(eat_dir)
if(WEST)
eat_dir = NORTH
return TRUE
if(EAST)
eat_dir = SOUTH
return TRUE
if(NORTH)
eat_dir = EAST
return TRUE
if(SOUTH)
eat_dir = WEST
return TRUE
/obj/machinery/plumbing/fermenter/setDir(newdir)
. = ..()
eat_dir = newdir
/obj/machinery/plumbing/fermenter/CanAllowThrough(atom/movable/AM)
/obj/machinery/plumbing/fermenter/CanPass(atom/movable/AM)
. = ..()
if(!anchored)
return
@@ -36,9 +44,8 @@
. = ..()
ferment(AM)
/// uses fermentation proc similar to fermentation barrels
/obj/machinery/plumbing/fermenter/proc/ferment(atom/AM)
if(machine_stat & NOPOWER)
if(stat & NOPOWER)
return
if(reagents.holder_full())
return
+2 -2
View File
@@ -12,8 +12,8 @@
var/list/english_left = list()
///whitelist of chems but their name instead of path
var/list/english_right = list()
var/ui_x = 320
var/ui_y = 310
ui_x = 320
ui_y = 310
/obj/machinery/plumbing/filter/Initialize(mapload, bolt)
@@ -7,23 +7,31 @@
rcd_cost = 30
rcd_delay = 30
buffer = 400
var/eat_dir = SOUTH
var/eat_dir = NORTH
/obj/machinery/plumbing/grinder_chemical/Initialize(mapload, bolt)
. = ..()
AddComponent(/datum/component/plumbing/simple_supply, bolt)
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type)
/obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user,rotation_type)
if(anchored)
to_chat(user, "<span class='warning'>It is fastened to the floor!</span>")
return FALSE
return TRUE
switch(eat_dir)
if(WEST)
eat_dir = NORTH
return TRUE
if(EAST)
eat_dir = SOUTH
return TRUE
if(NORTH)
eat_dir = EAST
return TRUE
if(SOUTH)
eat_dir = WEST
return TRUE
/obj/machinery/plumbing/grinder_chemical/setDir(newdir)
. = ..()
eat_dir = newdir
/obj/machinery/plumbing/grinder_chemical/CanAllowThrough(atom/movable/AM)
/obj/machinery/plumbing/grinder_chemical/CanPass(atom/movable/AM)
. = ..()
if(!anchored)
return
@@ -36,7 +44,7 @@
grind(AM)
/obj/machinery/plumbing/grinder_chemical/proc/grind(atom/AM)
if(machine_stat & NOPOWER)
if(stat & NOPOWER)
return
if(reagents.holder_full())
return
@@ -53,6 +61,4 @@
return
I.on_grind()
reagents.add_reagent_list(I.grind_results)
if(I.reagents)
I.reagents.trans_to(src, I.reagents.total_volume, transfered_by = src)
qdel(I)
+50 -30
View File
@@ -1,28 +1,36 @@
///We take a constant input of reagents, and produce a pill once a set volume is reached
/obj/machinery/plumbing/pill_press
name = "pill press"
desc = "A press that presses pills."
name = "chemical press"
desc = "A press that makes pills, patches and bottles."
icon_state = "pill_press"
///the minimum size a pill can be
var/minimum_pill = 5
///the maximum size a pill can be
var/maximum_pill = 50
///the size of the pill
var/pill_size = 10
///pill name
var/pill_name = "factory pill"
///maximum size of a pill
var/max_pill_volume = 50
///maximum size of a patch
var/max_patch_volume = 40
///maximum size of a bottle
var/max_bottle_volume = 30
///current operating product (pills or patches)
var/product = "pill"
///the minimum size a pill or patch can be
var/min_volume = 5
///the maximum size a pill or patch can be
var/max_volume = 50
///selected size of the product
var/current_volume = 10
///prefix for the product name
var/product_name = "factory"
///the icon_state number for the pill.
var/pill_number = RANDOM_PILL_STYLE
///list of id's and icons for the pill selection of the ui
var/list/pill_styles
///list of pills stored in the machine, so we dont have 610 pills on one tile
var/list/stored_pills = list()
///list of products stored in the machine, so we dont have 610 pills on one tile
var/list/stored_products = list()
///max amount of pills allowed on our tile before we start storing them instead
var/max_floor_pills = 10
var/max_floor_products = 50 //haha massive pill piles
/obj/machinery/plumbing/pill_press/examine(mob/user)
. = ..()
. += "<span class='notice'>The [name] currently has [stored_pills.len] stored. There needs to be less than [max_floor_pills] on the floor to continue dispensing.</span>"
. += "<span class='notice'>The [name] currently has [stored_products.len] stored. There needs to be less than [max_floor_products ] on the floor to continue dispensing.</span>"
/obj/machinery/plumbing/pill_press/Initialize(mapload, bolt)
. = ..()
@@ -37,29 +45,41 @@
SL["htmltag"] = assets.icon_tag("pill[x]")
pill_styles += list(SL)
/obj/machinery/plumbing/pill_press/process()
if(stat & NOPOWER)
return
if(reagents.total_volume >= pill_size)
var/obj/item/reagent_containers/pill/P = new(src)
reagents.trans_to(P, pill_size)
P.name = pill_name
stored_pills += P
if(pill_number == RANDOM_PILL_STYLE)
P.icon_state = "pill[rand(1,21)]"
else
P.icon_state = "pill[pill_number]"
if(P.icon_state == "pill4") //mirrored from chem masters
P.desc = "A tablet or capsule, but not just any, a red one, one taken by the ones not scared of knowledge, freedom, uncertainty and the brutal truths of reality."
if(stored_pills.len)
if(reagents.total_volume >= current_volume)
if (product == "pill")
var/obj/item/reagent_containers/pill/P = new(src)
reagents.trans_to(P, current_volume)
P.name = trim("[product_name] pill")
stored_products += P
if(pill_number == RANDOM_PILL_STYLE)
P.icon_state = "pill[rand(1,21)]"
else
P.icon_state = "pill[pill_number]"
if(P.icon_state == "pill4") //mirrored from chem masters
P.desc = "A tablet or capsule, but not just any, a red one, one taken by the ones not scared of knowledge, freedom, uncertainty and the brutal truths of reality."
else if (product == "patch")
var/obj/item/reagent_containers/pill/patch/P = new(src)
reagents.trans_to(P, current_volume)
P.name = trim("[product_name] patch")
stored_products += P
else if (product == "bottle")
var/obj/item/reagent_containers/glass/bottle/P = new(src)
reagents.trans_to(P, current_volume)
P.name = trim("[product_name] bottle")
stored_products += P
if(stored_products.len)
var/pill_amount = 0
for(var/obj/item/reagent_containers/pill/P in loc)
pill_amount++
if(pill_amount >= max_floor_pills) //too much so just stop
if(pill_amount >= max_floor_products) //too much so just stop
break
if(pill_amount < max_floor_pills)
var/atom/movable/AM = stored_pills[1] //AM because forceMove is all we need
stored_pills -= AM
if(pill_amount < max_floor_products)
var/atom/movable/AM = stored_products[1] //AM because forceMove is all we need
stored_products -= AM
AM.forceMove(drop_location())
+20 -39
View File
@@ -1,15 +1,17 @@
///We pump liquids from activated(plungerated) geysers to a plumbing outlet. We need to be wired.
/obj/machinery/power/liquid_pump
///We pump liquids from activated(plungerated) geysers to a plumbing outlet. We don't need to be wired.
/obj/machinery/plumbing/liquid_pump
name = "liquid pump"
desc = "Pump up those sweet liquids from under the surface."
desc = "Pump up those sweet liquids from under the surface. Uses thermal energy from geysers to power itself." //better than placing 200 cables, because it wasnt fun
icon = 'icons/obj/plumbing/plumbers.dmi'
icon_state = "pump"
anchored = FALSE
density = TRUE
idle_power_usage = 10
active_power_usage = 1000
///Are we powered?
var/powered = FALSE
rcd_cost = 30
rcd_delay = 40
///units we pump per process (2 seconds)
var/pump_power = 2
///set to true if the loop couldnt find a geyser in process, so it remembers and stops checking every loop until moved. more accurate name would be absolutely_no_geyser_under_me_so_dont_try
@@ -19,63 +21,42 @@
///volume of our internal buffer
var/volume = 200
/obj/machinery/power/liquid_pump/Initialize()
/obj/machinery/plumbing/liquid_pump/Initialize(mapload, bolt)
. = ..()
create_reagents(volume)
AddComponent(/datum/component/plumbing/simple_supply, TRUE)
AddComponent(/datum/component/plumbing/simple_supply, bolt)
/obj/machinery/power/liquid_pump/attackby(obj/item/W, mob/user, params)
if(!powered)
if(!anchored)
if(default_deconstruction_screwdriver(user, "[initial(icon_state)]_open", "[initial(icon_state)]",W))
return
if(default_deconstruction_crowbar(W))
return
return ..()
/obj/machinery/power/liquid_pump/wrench_act(mob/living/user, obj/item/I)
..()
default_unfasten_wrench(user, I)
return TRUE
///please note that the component has a hook in the parent call, wich handles activating and deactivating
/obj/machinery/power/liquid_pump/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
/obj/machinery/plumbing/liquid_pump/default_unfasten_wrench(mob/user, obj/item/I, time = 20)
. = ..()
if(. == SUCCESSFUL_UNFASTEN)
geyser = null
update_icon()
powered = FALSE
geyserless = FALSE //we switched state, so lets just set this back aswell
/obj/machinery/power/liquid_pump/process()
if(!anchored || panel_open)
/obj/machinery/plumbing/liquid_pump/process()
if(!anchored || panel_open || geyserless)
return
if(!geyser && !geyserless)
if(!geyser)
for(var/obj/structure/geyser/G in loc.contents)
geyser = G
update_icon()
if(!geyser) //we didnt find one, abort
anchored = FALSE
geyserless = TRUE
visible_message("<span class='warning'>The [name] makes a sad beep!</span>")
playsound(src, 'sound/machines/buzz-sigh.ogg', 50)
return
if(avail(active_power_usage))
if(!powered) //we werent powered before this tick so update our sprite
powered = TRUE
update_icon()
add_load(active_power_usage)
pump()
else if(powered) //we were powered, but now we arent
powered = FALSE
update_icon()
pump()
///pump up that sweet geyser nectar
/obj/machinery/power/liquid_pump/proc/pump()
/obj/machinery/plumbing/liquid_pump/proc/pump()
if(!geyser || !geyser.reagents)
return
geyser.reagents.trans_to(src, pump_power)
/obj/machinery/power/liquid_pump/update_icon()
if(powered)
/obj/machinery/plumbing/liquid_pump/update_icon_state()
if(geyser)
icon_state = initial(icon_state) + "-on"
else if(panel_open)
icon_state = initial(icon_state) + "-open"
@@ -34,7 +34,7 @@
/datum/reagent/oxygen,
/datum/reagent/phosphorus,
/datum/reagent/potassium,
/datum/reagent/uranium/radium,
/datum/reagent/radium,
/datum/reagent/silicon,
/datum/reagent/silver,
/datum/reagent/sodium,
@@ -51,7 +51,7 @@
AddComponent(/datum/component/plumbing/simple_supply, bolt)
/obj/machinery/plumbing/synthesizer/process()
if(machine_stat & NOPOWER || !reagent_id || !amount)
if(stat & NOPOWER || !reagent_id || !amount)
return
if(reagents.total_volume >= amount) //otherwise we get leftovers, and we need this to be precise
return