mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
Allows ChemMasters to make multiple bottles at once (#21021)
* chem masters can make multiple bottles * replaces minmaxes with clamps * fills bottles * adds checks * adds flag * moves return
This commit is contained in:
@@ -220,17 +220,18 @@
|
||||
|
||||
if("createPill")
|
||||
var/many = params["many"]
|
||||
if(reagents.total_volume == 0) return
|
||||
if(reagents.total_volume == 0)
|
||||
return
|
||||
if(!condi)
|
||||
var/amount = 1
|
||||
var/vol_each = min(reagents.total_volume, 50)
|
||||
if(text2num(many))
|
||||
amount = min(max(round(input(usr, "Max 10. Buffer content will be split evenly.", "How many pills?", amount) as num|null), 0), 10)
|
||||
amount = Clamp(round(input(usr, "Max 10. Buffer content will be split evenly.", "How many pills?", amount) as num|null), 0, 10)
|
||||
if(!amount)
|
||||
return
|
||||
vol_each = min(reagents.total_volume / amount, 50)
|
||||
var/name = stripped_input(usr,"Name:","Name your pill!", "[reagents.get_master_reagent_name()] ([vol_each]u)", MAX_NAME_LEN)
|
||||
if(!name || !reagents.total_volume)
|
||||
if(!name || !reagents.total_volume || !src || qdeleted(src) || !usr.canUseTopic(src, be_close=TRUE))
|
||||
return
|
||||
var/obj/item/weapon/reagent_containers/pill/P
|
||||
|
||||
@@ -245,7 +246,7 @@
|
||||
reagents.trans_to(P,vol_each)
|
||||
else
|
||||
var/name = stripped_input(usr, "Name:", "Name your pack!", reagents.get_master_reagent_name(), MAX_NAME_LEN)
|
||||
if(!name || !reagents.total_volume)
|
||||
if(!name || !reagents.total_volume || !src || qdeleted(src) || !usr.canUseTopic(src, be_close=TRUE))
|
||||
return
|
||||
var/obj/item/weapon/reagent_containers/food/condiment/pack/P = new/obj/item/weapon/reagent_containers/food/condiment/pack(src.loc)
|
||||
|
||||
@@ -257,16 +258,17 @@
|
||||
|
||||
if("createPatch")
|
||||
var/many = params["many"]
|
||||
if(reagents.total_volume == 0) return
|
||||
if(reagents.total_volume == 0)
|
||||
return
|
||||
var/amount = 1
|
||||
var/vol_each = min(reagents.total_volume, 40)
|
||||
if(text2num(many))
|
||||
amount = min(max(round(input(usr, "Max 10. Buffer content will be split evenly.", "How many patches?", amount) as num|null), 0), 10)
|
||||
amount = Clamp(round(input(usr, "Max 10. Buffer content will be split evenly.", "How many patches?", amount) as num|null), 0, 10)
|
||||
if(!amount)
|
||||
return
|
||||
vol_each = min(reagents.total_volume / amount, 40)
|
||||
var/name = stripped_input(usr,"Name:","Name your patch!", "[reagents.get_master_reagent_name()] ([vol_each]u)", MAX_NAME_LEN)
|
||||
if(!name || !reagents.total_volume)
|
||||
if(!name || !reagents.total_volume || !src || qdeleted(src) || !usr.canUseTopic(src, be_close=TRUE))
|
||||
return
|
||||
var/obj/item/weapon/reagent_containers/pill/P
|
||||
|
||||
@@ -279,21 +281,40 @@
|
||||
. = TRUE
|
||||
|
||||
if("createBottle")
|
||||
var/name = stripped_input(usr, "Name:","Name your bottle!", (reagents.total_volume ? reagents.get_master_reagent_name() : " "), MAX_NAME_LEN)
|
||||
if(!name)
|
||||
var/many = params["many"]
|
||||
if(reagents.total_volume == 0)
|
||||
return
|
||||
var/obj/item/weapon/reagent_containers/P
|
||||
if(condi)
|
||||
var/obj/item/weapon/reagent_containers/food/condiment/C = new(src.loc)
|
||||
C.originalname = name
|
||||
P = C
|
||||
else
|
||||
P = new/obj/item/weapon/reagent_containers/glass/bottle(src.loc)
|
||||
|
||||
P.pixel_x = rand(-7, 7) //random position
|
||||
P.pixel_y = rand(-7, 7)
|
||||
P.name = trim("[name] bottle")
|
||||
reagents.trans_to(P, P.volume)
|
||||
if(condi)
|
||||
var/name = stripped_input(usr, "Name:","Name your bottle!", (reagents.total_volume ? reagents.get_master_reagent_name() : " "), MAX_NAME_LEN)
|
||||
if(!name || !reagents.total_volume || !src || qdeleted(src) || !usr.canUseTopic(src, be_close=TRUE))
|
||||
return
|
||||
var/obj/item/weapon/reagent_containers/food/condiment/P = new(src.loc)
|
||||
P.originalname = name
|
||||
P.name = trim("[name] bottle")
|
||||
reagents.trans_to(P, P.volume)
|
||||
else
|
||||
var/amount_full = 0
|
||||
var/vol_part = min(reagents.total_volume, 30)
|
||||
if(text2num(many))
|
||||
amount_full = round(reagents.total_volume / 30)
|
||||
vol_part = reagents.total_volume % 30
|
||||
var/name = stripped_input(usr, "Name:","Name your bottle!", (reagents.total_volume ? reagents.get_master_reagent_name() : " "), MAX_NAME_LEN)
|
||||
if(!name || !reagents.total_volume || !src || qdeleted(src) || !usr.canUseTopic(src, be_close=TRUE))
|
||||
return
|
||||
|
||||
var/obj/item/weapon/reagent_containers/glass/bottle/P
|
||||
for(var/i = 0; i < amount_full; i++)
|
||||
P = new/obj/item/weapon/reagent_containers/glass/bottle(src.loc)
|
||||
P.pixel_x = rand(-7, 7) //random position
|
||||
P.pixel_y = rand(-7, 7)
|
||||
P.name = trim("[name] bottle")
|
||||
reagents.trans_to(P, 30)
|
||||
|
||||
if(vol_part)
|
||||
P = new/obj/item/weapon/reagent_containers/glass/bottle(src.loc)
|
||||
P.name = trim("[name] bottle")
|
||||
reagents.trans_to(P, vol_part)
|
||||
. = TRUE
|
||||
|
||||
if("analyze")
|
||||
|
||||
+7
-7
File diff suppressed because one or more lines are too long
@@ -69,7 +69,10 @@
|
||||
<ui-button action='createPatch' params='{"many": 1}' state='{{data.bufferContents ? null : "disabled"}}' >Create Multiple Patches</ui-button>
|
||||
<br/>
|
||||
<br/>
|
||||
<ui-button action='createBottle' state='{{data.bufferContents ? null : "disabled"}}' >Create Bottle (max 30µ)</ui-button>
|
||||
<ui-button action='createBottle' params='{"many": 0}' state='{{data.bufferContents ? null : "disabled"}}' >Create Bottle (max 30µ)</ui-button>
|
||||
<br/>
|
||||
<ui-button action='createBottle' params='{"many": 1}' state='{{data.bufferContents ? null : "disabled"}}' >Dispense Buffer to Bottles</ui-button>
|
||||
|
||||
</ui-display>
|
||||
|
||||
{{else}}
|
||||
@@ -77,7 +80,7 @@
|
||||
<ui-button action='createPill' params='{"many": 0}' state='{{data.bufferContents ? null : "disabled"}}' >Create Pack (max 10µ)</ui-button>
|
||||
<br/>
|
||||
<br/>
|
||||
<ui-button action='createBottle' state='{{data.bufferContents ? null : "disabled"}}' >Create Bottle (max 50µ)</ui-button>
|
||||
<ui-button action='createBottle' params='{"many": 0}' state='{{data.bufferContents ? null : "disabled"}}' >Create Bottle (max 50µ)</ui-button>
|
||||
</ui-display>
|
||||
{{/if}}
|
||||
{{elseif data.screen == "analyze"}}
|
||||
|
||||
Reference in New Issue
Block a user