Forgotten Flatpacks (#26414)

This commit is contained in:
Kurfursten
2020-05-12 09:23:32 -05:00
committed by GitHub
parent ffdc35c817
commit 66e831a19b
6 changed files with 192 additions and 34 deletions

View File

@@ -3086,6 +3086,8 @@ var/global/num_vending_terminals = 1
/obj/item/weapon/reagent_containers/food/drinks/flask/ancient = 1, /obj/item/weapon/reagent_containers/food/drinks/flask/ancient = 1,
/obj/item/device/crank_charger/generous = 1, /obj/item/device/crank_charger/generous = 1,
/obj/item/weapon/fakeposter_kit = 1, /obj/item/weapon/fakeposter_kit = 1,
/obj/structure/closet/crate/flatpack/ancient/condiment_dispenser = 1,
/obj/structure/closet/crate/flatpack/ancient/chemmaster_electrolyzer = 1,
) )
prices = list( prices = list(
/obj/item/clothing/suit/storage/trader = 100, /obj/item/clothing/suit/storage/trader = 100,
@@ -3127,6 +3129,8 @@ var/global/num_vending_terminals = 1
/obj/item/weapon/reagent_containers/food/drinks/flask/ancient = 175, /obj/item/weapon/reagent_containers/food/drinks/flask/ancient = 175,
/obj/item/device/crank_charger/generous = 50, /obj/item/device/crank_charger/generous = 50,
/obj/item/weapon/fakeposter_kit = 50, /obj/item/weapon/fakeposter_kit = 50,
/obj/structure/closet/crate/flatpack/ancient/condiment_dispenser = 100,
/obj/structure/closet/crate/flatpack/ancient/chemmaster_electrolyzer = 100,
) )
/obj/machinery/vending/trader/New() /obj/machinery/vending/trader/New()

View File

@@ -2,6 +2,7 @@
/obj/machinery/chem_dispenser /obj/machinery/chem_dispenser
name = "\improper Chem Dispenser" name = "\improper Chem Dispenser"
desc = "It dispenses chemicals."
density = TRUE density = TRUE
anchored = TRUE anchored = TRUE
icon = 'icons/obj/chemical.dmi' icon = 'icons/obj/chemical.dmi'
@@ -18,6 +19,7 @@
var/custom = 0 var/custom = 0
var/useramount = 30 // Last used amount var/useramount = 30 // Last used amount
var/required_quirk = MODULE_CAN_HANDLE_CHEMS var/required_quirk = MODULE_CAN_HANDLE_CHEMS
var/template_path = "chem_dispenser.tmpl"
var/list/dispensable_reagents = list( var/list/dispensable_reagents = list(
HYDROGEN, HYDROGEN,
LITHIUM, LITHIUM,
@@ -201,7 +203,7 @@ USE THIS CHEMISTRY DISPENSER FOR MAPS SO THEY START AT 100 ENERGY
if (!ui) if (!ui)
// the ui does not exist, so we'll create a new() one // the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\\modules\nano\nanoui.dm // for a list of parameters and their descriptions see the code docs in \code\\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "chem_dispenser.tmpl", "[src.name] 5000", 390, 630) ui = new(user, src, ui_key, template_path, "[src.name]", 390, 630)
// when the ui is first opened this is the data it will use // when the ui is first opened this is the data it will use
ui.set_initial_data(data) ui.set_initial_data(data)
// open the new ui window // open the new ui window
@@ -281,6 +283,9 @@ USE THIS CHEMISTRY DISPENSER FOR MAPS SO THEY START AT 100 ENERGY
return return
return ..() return ..()
/obj/machinery/chem_dispenser/proc/can_insert(var/obj/item/I)
return istype(I, /obj/item/weapon/reagent_containers/glass) || istype(I, /obj/item/weapon/reagent_containers/food/drinks)
/obj/machinery/chem_dispenser/attackby(var/obj/item/weapon/D as obj, var/mob/user as mob) //to be worked on /obj/machinery/chem_dispenser/attackby(var/obj/item/weapon/D as obj, var/mob/user as mob) //to be worked on
if(..()) if(..())
@@ -290,7 +295,7 @@ USE THIS CHEMISTRY DISPENSER FOR MAPS SO THEY START AT 100 ENERGY
if(!can_use(user)) if(!can_use(user))
return return
if(istype(D, /obj/item/weapon/reagent_containers/glass) || istype(D, /obj/item/weapon/reagent_containers/food/drinks)) if(can_insert(D))
if(src.container) if(src.container)
to_chat(user, "\A [src.container] is already loaded into the machine.") to_chat(user, "\A [src.container] is already loaded into the machine.")
return return
@@ -469,6 +474,34 @@ USE THIS CHEMISTRY DISPENSER FOR MAPS SO THEY START AT 100 ENERGY
max_energy = 100 max_energy = 100
energy = 100 energy = 100
/obj/machinery/chem_dispenser/condiment
name = "\improper Condiment Dispenser"
desc = "A dispenser designed to output condiments directly onto food, or into condiment bottles. These were banned for being 'unhygienic' after one too many licking incidents."
icon_state = "condi_dispenser"
pass_flags = PASSTABLE
max_energy = 30
required_quirk = MODULE_CAN_HANDLE_FOOD
template_path = "condi_dispenser.tmpl"
dispensable_reagents = list(
SODIUMCHLORIDE,
BLACKPEPPER,
KETCHUP,
MUSTARD,
RELISH,
CAPSAICIN,
FROSTOIL,
LIQUIDBUTTER,
SOYSAUCE,
SPRINKLES
)
machine_flags = SCREWTOGGLE | WRENCHMOVE | FIXED2WORK
/obj/machinery/chem_dispenser/condiment/can_insert(obj/item/I)
return istype(I,/obj/item/weapon/reagent_containers/food/snacks) || istype(I,/obj/item/weapon/reagent_containers/food/condiment)
/obj/machinery/chem_dispenser/condiment/update_icon()
return //no overlays for this one, it takes special inputs
#undef FORMAT_DISPENSER_NAME #undef FORMAT_DISPENSER_NAME
/obj/machinery/chem_dispenser/npc_tamper_act(mob/living/L) /obj/machinery/chem_dispenser/npc_tamper_act(mob/living/L)

View File

@@ -37,6 +37,8 @@ var/global/list/pillIcon2Name = list("oblong purple-pink", "oblong green-white",
var/max_pill_size = 50 var/max_pill_size = 50
var/pill_display_number = MAX_PILL_SPRITE/2 var/pill_display_number = MAX_PILL_SPRITE/2
var/electrolytic = FALSE
light_color = LIGHT_COLOR_BLUE light_color = LIGHT_COLOR_BLUE
light_range_on = 3 light_range_on = 3
light_power_on = 2 light_power_on = 2
@@ -200,6 +202,37 @@ var/global/list/pillIcon2Name = list("oblong purple-pink", "oblong green-white",
popup.open() popup.open()
return 1 return 1
else if(href_list["electrolyze"])
if(!electrolytic)
return
var/datum/reagent/target = locate(href_list["electrolyze"])
var/datum/chemical_reaction/unreaction
for(var/poss in typesof(/datum/chemical_reaction/))
var/datum/chemical_reaction/check = poss
if(initial(check.id) == target.id)
unreaction = new check
break
if(!unreaction)
to_chat(usr, "<span class='notice'>The chemical couldn't be broken down.</span>")
return
if(unreaction.result_amount > target.volume)
to_chat(usr, "<span class='notice'>There wasn't enough [target] to break down!</span>")
return
var/total_reactions = round(target.volume / unreaction.result_amount)
use_power(30*total_reactions)
var/amount_to_electrolyze = total_reactions*unreaction.result_amount
//The reason we have this new var is because the rounding may mean there are less reactions than total volume!
container.reagents.remove_reagent(unreaction.result,amount_to_electrolyze) //This moves over the reactive bulk, and leaves behind the amount too small to react
for(var/E in unreaction.required_reagents)
var/reagent_ID = E
if(islist(E))
var/list/L = E
reagent_ID = L[1] //the first element should be the synthetic version of the chemical
reagents.add_reagent(reagent_ID, unreaction.required_reagents[E]*total_reactions)
updateUsrDialog()
playsound(src, 'sound/effects/bubbles.ogg', 80, 1)
return 1
else if(href_list["add"]) else if(href_list["add"])
var/id = href_list["add"] var/id = href_list["add"]
var/amount var/amount
@@ -516,7 +549,7 @@ var/global/list/pillIcon2Name = list("oblong purple-pink", "oblong green-white",
reg_name = "[reg_name] ([vaccines])" reg_name = "[reg_name] ([vaccines])"
dat += {" dat += {"
<td class="column1"> <td class="column1">
[reg_name] , [round(G.volume, 0.01)] Units - <A href='?src=\ref[src];analyze=\ref[G]'>(?)</A> [reg_name], [round(G.volume, 0.01)] Units - <A href='?src=\ref[src];analyze=\ref[G]'>(?)</A> [electrolytic ? "<A href='?src=\ref[src];electrolyze=\ref[G]'>(Electrolyze)</A>" : ""]
</td> </td>
<td class="column2"> <td class="column2">
<A href='?src=\ref[src];add=[G.id];amount=1'>1u</A> <A href='?src=\ref[src];add=[G.id];amount=1'>1u</A>
@@ -591,7 +624,7 @@ var/global/list/pillIcon2Name = list("oblong purple-pink", "oblong green-white",
reg_name = "[reg_name] ([vaccines])" reg_name = "[reg_name] ([vaccines])"
dat += {" dat += {"
<td class="column1"> <td class="column1">
[reg_name] , [round(N.volume, 0.01)] Units - <A href='?src=\ref[src];analyze=\ref[N]'>(?)</A> [reg_name], [round(N.volume, 0.01)] Units - <A href='?src=\ref[src];analyze=\ref[N]'>(?)</A>
</td> </td>
<td class="column2"> <td class="column2">
<A href='?src=\ref[src];remove=[N.id];amount=1'>1u</A> <A href='?src=\ref[src];remove=[N.id];amount=1'>1u</A>
@@ -679,4 +712,10 @@ var/global/list/pillIcon2Name = list("oblong purple-pink", "oblong green-white",
chem_board = /obj/item/weapon/circuitboard/condimaster chem_board = /obj/item/weapon/circuitboard/condimaster
windowtype = "condi_master" windowtype = "condi_master"
/obj/machinery/chem_master/electrolytic
name = "\improper Electrolytic ChemMaster"
desc = "The ultimate industrial chemical cooker, its chemical reservoir is made from non-reactive stasis technology and it can electrolyze individual chemicals within. These were banned after the Junkie Wars of 2420, but you can still find them in shady places."
electrolytic = TRUE
flags = FPRINT | NOREACT
#undef MAX_PILL_SPRITE #undef MAX_PILL_SPRITE

View File

@@ -1,5 +1,7 @@
#define MAX_FLATPACK_STACKS 6 //how many flatpacks we can stack at once #define MAX_FLATPACK_STACKS 6 //how many flatpacks we can stack at once
#define FLATPACK_HEIGHT 4 //the height of the icon #define FLATPACK_HEIGHT 4 //the height of the icon
#define UNASSEMBLED 2 //2 = not opened, 1 = opened, assembling, 0 = ready to use
#define ASSEMBLING 1 //only ancient flatpacks use these, normal flatpacks start ready to use
/obj/structure/closet/crate/flatpack /obj/structure/closet/crate/flatpack
name = "\improper flatpack" name = "\improper flatpack"
@@ -11,10 +13,14 @@
anchored = 0 anchored = 0
pass_flags = PASSTABLE pass_flags = PASSTABLE
var/obj/machinery/machine = null var/obj/machinery/machine = null
// var/datum/construction/flatpack_unpack/unpacking var/datum/construction/flatpack_unpack/unpacking
var/assembling = 0 var/assembling = FALSE
var/list/image/stacked = list() //assoc ref list var/list/image/stacked = list() //assoc ref list
/obj/structure/closet/crate/flatpack/ancient
name = "ancient flatpack"
assembling = UNASSEMBLED
/obj/structure/closet/crate/flatpack/examine(mob/user) /obj/structure/closet/crate/flatpack/examine(mob/user)
..() ..()
if(stacked.len) if(stacked.len)
@@ -23,7 +29,8 @@
/obj/structure/closet/crate/flatpack/New() /obj/structure/closet/crate/flatpack/New()
..() ..()
// unpacking = new (src) if(assembling)
unpacking = new (src)
icon_state = "flatpack" //it gets changed in the crate code, so we reset it here icon_state = "flatpack" //it gets changed in the crate code, so we reset it here
/obj/structure/closet/crate/flatpack/update_icon() /obj/structure/closet/crate/flatpack/update_icon()
@@ -47,8 +54,8 @@
icon_state = "flatpackeng" icon_state = "flatpackeng"
break break
/* if(assembling) if(assembling == ASSEMBLING)
overlays += image(icon = icon, icon_state = "assembly") */ overlays += image(icon = icon, icon_state = "assembly")
else if(stacked.len) else if(stacked.len)
for(var/i = 1 to stacked.len) for(var/i = 1 to stacked.len)
var/image/stack_image = stacked[stacked[i]] //because it's an assoc list var/image/stack_image = stacked[stacked[i]] //because it's an assoc list
@@ -57,20 +64,20 @@
overlays += stack_image overlays += stack_image
/obj/structure/closet/crate/flatpack/attackby(var/atom/A, mob/user) /obj/structure/closet/crate/flatpack/attackby(var/atom/A, mob/user)
/* if(assembling) if(assembling == ASSEMBLING)
if(unpacking.action(A, user)) if(unpacking.action(A, user))
return 1 */ return 1
if(iscrowbar(A) && !assembling) if(iscrowbar(A))
if(stacked.len) if(stacked.len)
to_chat(user, "<span class='rose'>You can't open this flatpack while others are stacked on top of it!</span>") to_chat(user, "<span class='rose'>You can't open this flatpack while others are stacked on top of it!</span>")
return return
assembling = 1
user.visible_message("<span class='notice'>[user] begins to open the flatpack...</span>", "<span class='notice'>You begin to open the flatpack...</span>") user.visible_message("<span class='notice'>[user] begins to open the flatpack...</span>", "<span class='notice'>You begin to open the flatpack...</span>")
if(do_after(user, src, rand(10,40))) if(do_after(user, src, rand(10,40)))
if(machine) if(machine)
to_chat(user, "<span class='notice'>[bicon(src)]You successfully unpack \the [machine]!</span>") to_chat(user, "<span class='notice'>[bicon(src)] You successfully unpack \the [machine]!</span>")
// overlays += image(icon = icon, icon_state = "assembly") if(assembling == UNASSEMBLED)
/* var/obj/item/weapon/paper/instructions = new (get_turf(src)) overlays += image(icon = icon, icon_state = "assembly")
var/obj/item/weapon/paper/instructions = new (get_turf(src))
var/list/inst_list = unpacking.GenerateInstructions() var/list/inst_list = unpacking.GenerateInstructions()
instructions.name = "instructions ([machine.name])" instructions.name = "instructions ([machine.name])"
instructions.info = inst_list["instructions"] instructions.info = inst_list["instructions"]
@@ -78,15 +85,14 @@
instructions.overlays += image(icon = icon, icon_state = "paper_stamp-deny") instructions.overlays += image(icon = icon, icon_state = "paper_stamp-deny")
instructions.name = "misprinted " + instructions.name instructions.name = "misprinted " + instructions.name
instructions.update_icon() instructions.update_icon()
*/ assembling = ASSEMBLING
else
machine.forceMove(src.loc) machine.forceMove(src.loc)
machine = null machine = null
qdel(src) qdel(src)
else else
to_chat(user, "<span class='notice'>[bicon(src)]It seems this [src] was empty...</span>") to_chat(user, "<span class='notice'>[bicon(src)] It seems this [src] was empty...</span>")
qdel(src) qdel(src)
assembling = 0
return
/obj/structure/closet/crate/flatpack/proc/Finalize() /obj/structure/closet/crate/flatpack/proc/Finalize()
machine.forceMove(get_turf(src)) machine.forceMove(get_turf(src))
@@ -141,9 +147,9 @@
/obj/structure/closet/crate/flatpack/MouseDropTo(atom/dropping, mob/user) /obj/structure/closet/crate/flatpack/MouseDropTo(atom/dropping, mob/user)
if(istype(dropping, /obj/structure/closet/crate/flatpack) && dropping != src) if(istype(dropping, /obj/structure/closet/crate/flatpack) && dropping != src)
var/obj/structure/closet/crate/flatpack/stacking = dropping var/obj/structure/closet/crate/flatpack/stacking = dropping
/* if(assembling || stacking.assembling) if(assembling == ASSEMBLING || stacking.assembling == ASSEMBLING)
to_chat(user, "You can't stack opened flatpacks.") to_chat(user, "You can't stack opened flatpacks.")
return */ return
if((stacked.len + stacking.stacked.len + 2) >= MAX_FLATPACK_STACKS) //how many flatpacks we can in a stack (including the bases) if((stacked.len + stacking.stacked.len + 2) >= MAX_FLATPACK_STACKS) //how many flatpacks we can in a stack (including the bases)
to_chat(user, "You can't stack flatpacks that high.") to_chat(user, "You can't stack flatpacks that high.")
return return
@@ -198,7 +204,7 @@
machine = thing machine = thing
update_icon() update_icon()
/*
#define Fl_ACTION "action" #define Fl_ACTION "action"
/datum/construction/flatpack_unpack /datum/construction/flatpack_unpack
@@ -270,7 +276,6 @@
return 1 return 1
#undef Fl_ACTION #undef Fl_ACTION
*/
/obj/structure/closet/crate/flatpack/suit_modifier/New() /obj/structure/closet/crate/flatpack/suit_modifier/New()
@@ -302,3 +307,10 @@
..() ..()
machine = new /obj/machinery/shield_capacitor(src) machine = new /obj/machinery/shield_capacitor(src)
/obj/structure/closet/crate/flatpack/ancient/condiment_dispenser/New()
..()
machine = new /obj/machinery/chem_dispenser/condiment(src)
/obj/structure/closet/crate/flatpack/ancient/chemmaster_electrolyzer/New()
..()
machine = new /obj/machinery/chem_master/electrolytic(src)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -0,0 +1,70 @@
<!--
Based off Chem dispenser
-->
<div class="item">
<div class="itemLabel">
Energy:
</div>
<div class="itemContent">
{{:helper.displayBar(data.energy, 0, data.maxEnergy, 'good', data.energy + ' Units')}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Dispense:
</div>
<div class="itemContent">
{{:helper.link('5', 'gear', {'amount' : 5}, (data.amount == 5 && !data.custom) ? 'selected' : null)}}
{{:helper.link('10', 'gear', {'amount' : 10}, (data.amount == 10 && !data.custom) ? 'selected' : null)}}
{{:helper.link('15', 'gear', {'amount' : 15}, (data.amount == 15 && !data.custom) ? 'selected' : null)}}
{{:helper.link('20', 'gear', {'amount' : 20}, (data.amount == 20 && !data.custom) ? 'selected' : null)}}
{{:helper.link('25', 'gear', {'amount' : 25}, (data.amount == 25 && !data.custom) ? 'selected' : null)}}
{{:helper.link('30', 'gear', {'amount' : 30}, (data.amount == 30 && !data.custom) ? 'selected' : null)}}
{{:helper.link((data.custom) ? 'Custom: ' + data.amount : 'Custom', 'gear', {'amount' : 0}, (data.amount == 0), (data.custom) ? 'selected' : null)}}
</div>
</div>
<div class="item">&nbsp;</div>
<div class="item">
<div class="itemLabel" style="width: 100%;">
Condiment Dispenser
</div>
</div>
<div class="item">
<div class="itemContentWide" style="width: 100%;">
{{for data.chemicals}}
{{:helper.link(value.title, 'circle-arrow-s', value.commands, null, data.glass ? 'fixedLeftWide' : 'fixedLeft')}}
{{/for}}
</div>
</div>
<div class="item">&nbsp;</div>
<div class="item">
<div class="itemLabel">
Target Contents
</div>
<div class="itemContent">
{{:helper.link('Eject Target', 'eject', {'ejectBeaker' : 1}, data.isBeakerLoaded ? null : 'disabled', 'floatRight')}}
</div>
</div>
<div class="statusDisplay" style="min-height: 180px;">
<div class="item">
<div class="itemContent" style="width: 100%;">
{{if data.isBeakerLoaded}}
<b>Volume:&nbsp;{{:data.beakerCurrentVolume}}&nbsp;/&nbsp;{{:data.beakerMaxVolume}}</b><br>
{{for data.beakerContents}}
<span class="highlight">{{:value.volume}} units of {{:value.name}}</span><br>
{{empty}}
<span class="bad">
Target is empty
</span>
{{/for}}
{{else}}
<span class="average"><i>
No food/condiment bottle loaded
</i></span>
{{/if}}
</div>
</div>
</div>