Merge pull request #11065 from Fox-McCloud/pill-bottles-and-patch-packs

[Goonchem] Pills, Bottles, Patches, and Pillbottles
This commit is contained in:
variableundefined
2019-03-24 17:51:00 +08:00
committed by GitHub
10 changed files with 144 additions and 94 deletions
-2
View File
@@ -49566,11 +49566,9 @@
pixel_y = 0;
step_size = 0
},
/obj/item/storage/box/pillbottles,
/obj/machinery/atmospherics/unary/vent_pump/on{
dir = 8
},
/obj/item/storage/box/iv_bags,
/turf/simulated/floor/plasteel{
tag = "icon-whitebluefull";
icon_state = "whitebluefull"
+1
View File
@@ -3,6 +3,7 @@
desc = "Contains all the luck you'll ever need."
icon = 'icons/obj/dice.dmi'
icon_state = "dicebag"
can_hold = list(/obj/item/dice)
/obj/item/storage/pill_bottle/dice/New()
..()
@@ -773,6 +773,20 @@
new /obj/item/storage/pill_bottle( src )
new /obj/item/storage/pill_bottle( src )
/obj/item/storage/box/patch_packs
name = "box of patch packs"
desc = "It has pictures of patch packs on its front."
/obj/item/storage/box/patch_packs/New()
..()
new /obj/item/storage/pill_bottle/patch_pack(src)
new /obj/item/storage/pill_bottle/patch_pack(src)
new /obj/item/storage/pill_bottle/patch_pack(src)
new /obj/item/storage/pill_bottle/patch_pack(src)
new /obj/item/storage/pill_bottle/patch_pack(src)
new /obj/item/storage/pill_bottle/patch_pack(src)
new /obj/item/storage/pill_bottle/patch_pack(src)
/obj/item/storage/box/bodybags
name = "body bags"
desc = "This box contains body bags."
@@ -234,6 +234,7 @@
/*
* Pill Bottles
*/
/obj/item/storage/pill_bottle
name = "pill bottle"
desc = "It's an airtight container for storing medication."
@@ -241,18 +242,38 @@
icon = 'icons/obj/chemical.dmi'
item_state = "contsolid"
w_class = WEIGHT_CLASS_SMALL
can_hold = list(/obj/item/reagent_containers/food/pill, /obj/item/dice, /obj/item/paper)
allow_quick_gather = 1
use_to_pickup = 1
storage_slots = 14
display_contents_with_number = 1
can_hold = list(/obj/item/reagent_containers/food/pill)
cant_hold = list(/obj/item/reagent_containers/food/pill/patch)
allow_quick_gather = TRUE
use_to_pickup = TRUE
storage_slots = 50
max_combined_w_class = 50
display_contents_with_number = TRUE
var/base_name = ""
var/label_text = ""
var/applying_meds = FALSE //To Prevent spam clicking and generating runtimes from apply a deleting pill multiple times.
var/rapid_intake_message = "unscrews the cap on the pill bottle and begins dumping the entire contents down their throat!"
var/rapid_post_instake_message = "downs the entire bottle of pills in one go!"
/obj/item/storage/pill_bottle/New()
..()
base_name = name
/obj/item/storage/pill_bottle/attack(mob/M, mob/user)
if(iscarbon(M) && contents.len)
if(applying_meds)
to_chat(user, "<span class='warning'>You are already applying meds.</span>")
return
applying_meds = TRUE
for(var/obj/item/reagent_containers/food/pill/P in contents)
if(P.attack(M, user))
applying_meds = FALSE
else
applying_meds = FALSE
break
else
return ..()
/obj/item/storage/pill_bottle/ert/New()
..()
new /obj/item/reagent_containers/food/pill/salicylic(src)
@@ -262,27 +283,21 @@
new /obj/item/reagent_containers/food/pill/charcoal(src)
new /obj/item/reagent_containers/food/pill/charcoal(src)
/obj/item/storage/pill_bottle/MouseDrop(obj/over_object as obj) //Quick pillbottle fix. -Agouri
if(ishuman(usr)) //Can monkeys even place items in the pocket slots? Leaving this in just in case~
var/mob/M = usr
if(!( istype(over_object, /obj/screen) ))
return ..()
if((!( M.restrained() ) && !( M.stat ) /*&& M.pocket == src*/))
switch(over_object.name)
if("r_hand")
M.unEquip(src)
M.put_in_r_hand(src)
if("l_hand")
M.unEquip(src)
M.put_in_l_hand(src)
src.add_fingerprint(usr)
return
if(over_object == usr && in_range(src, usr) || usr.contents.Find(src))
if(usr.s_active)
usr.s_active.close(usr)
src.show_to(usr)
return
return
/obj/item/storage/pill_bottle/MouseDrop(obj/over_object as obj) // Best utilized if you're a cantankerous doctor with a Vicodin habit.
if(iscarbon(over_object))
var/mob/living/carbon/C = over_object
if(loc == C && src == C.get_active_hand())
if(!contents.len)
to_chat(C, "<span class='notice'>There is nothing in [src]!</span>")
return
C.visible_message("<span class='danger'>[C] [rapid_intake_message]</span>")
if(do_mob(C, C, 100)) // 10 seconds
for(var/obj/item/reagent_containers/food/pill/P in contents)
P.attack(C, C)
C.visible_message("<span class='danger'>[C] [rapid_post_instake_message]</span>")
return
return ..()
/obj/item/storage/pill_bottle/attackby(var/obj/item/I, mob/user as mob, params)
if(istype(I, /obj/item/pen) || istype(I, /obj/item/flashlight/pen))
@@ -294,7 +309,7 @@
label_text = tmp_label
update_name_label()
else
..()
return ..()
/obj/item/storage/pill_bottle/proc/update_name_label()
if(label_text == "")
@@ -302,6 +317,14 @@
else
name = "[base_name] ([label_text])"
/obj/item/storage/pill_bottle/patch_pack
name = "Patch Pack"
icon_state = "patch_pack"
can_hold = list(/obj/item/reagent_containers/food/pill/patch)
cant_hold = list()
rapid_intake_message = "flips the lid of the Patch Pack open and begins rapidly stamping patches on themselves!"
rapid_post_instake_message = "stamps the entire contents of the Patch Pack all over their entire body!"
/obj/item/storage/pill_bottle/charcoal
name = "Pill bottle (Charcoal)"
desc = "Contains pills used to counter toxins."
@@ -13,6 +13,9 @@
..()
new /obj/item/storage/box/autoinjectors(src)
new /obj/item/storage/box/syringes(src)
new /obj/item/storage/box/pillbottles(src)
new /obj/item/storage/box/patch_packs(src)
new /obj/item/storage/box/iv_bags(src)
new /obj/item/reagent_containers/dropper(src)
new /obj/item/reagent_containers/dropper(src)
new /obj/item/reagent_containers/glass/beaker(src)
@@ -216,6 +219,8 @@
..()
new /obj/item/storage/box/pillbottles(src)
new /obj/item/storage/box/pillbottles(src)
new /obj/item/storage/box/patch_packs(src)
new /obj/item/storage/box/patch_packs(src)
/obj/structure/closet/secure_closet/medical_wall
+1 -1
View File
@@ -294,7 +294,7 @@ You can set verify to TRUE if you want send() to sleep until the client has the
/datum/asset/chem_master/register()
for(var/i = 1 to 20)
assets["pill[i].png"] = icon('icons/obj/chemical.dmi', "pill[i]")
for(var/i in list("bottle", "small_bottle", "wide_bottle", "round_bottle"))
for(var/i in list("bottle", "small_bottle", "wide_bottle", "round_bottle", "reagent_bottle"))
assets["[i].png"] = icon('icons/obj/chemical.dmi', "[i]")
for(var/asset_name in assets)
register_asset(asset_name, assets[asset_name])
@@ -1,7 +1,7 @@
/obj/machinery/chem_master
name = "\improper ChemMaster 3000"
density = 1
anchored = 1
density = TRUE
anchored = TRUE
icon = 'icons/obj/chemical.dmi'
icon_state = "mixer0"
use_power = IDLE_POWER_USE
@@ -9,28 +9,27 @@
var/obj/item/reagent_containers/beaker = null
var/obj/item/storage/pill_bottle/loaded_pill_bottle = null
var/mode = 0
var/condi = 0
var/condi = FALSE
var/useramount = 30 // Last used amount
var/pillamount = 10
var/patchamount = 10
var/bottlesprite = "bottle"
var/pillsprite = "1"
var/client/has_sprites = list()
var/printing = null
var/printing = FALSE
/obj/machinery/chem_master/New()
..()
create_reagents(100)
update_icon()
/obj/machinery/chem_master/ex_act(severity)
switch(severity)
if(1.0)
if(1)
qdel(src)
return
if(2.0)
if(2)
if(prob(50))
qdel(src)
return
/obj/machinery/chem_master/update_icon()
overlays.Cut()
@@ -50,43 +49,43 @@
stat |= NOPOWER
update_icon()
/obj/machinery/chem_master/attackby(obj/item/B, mob/user, params)
if(default_unfasten_wrench(user, B))
/obj/machinery/chem_master/attackby(obj/item/I, mob/user, params)
if(default_unfasten_wrench(user, I))
power_change()
return
if(istype(B, /obj/item/reagent_containers/glass) || istype(B, /obj/item/reagent_containers/food/drinks/drinkingglass))
if(istype(I, /obj/item/reagent_containers/glass) || istype(I, /obj/item/reagent_containers/food/drinks/drinkingglass))
if(beaker)
to_chat(user, "<span class='warning'>A beaker is already loaded into the machine.</span>")
return
if(!user.drop_item())
to_chat(user, "<span class='warning'>[B] is stuck to you!</span>")
to_chat(user, "<span class='warning'>[I] is stuck to you!</span>")
return
beaker = B
B.forceMove(src)
beaker = I
I.forceMove(src)
to_chat(user, "<span class='notice'>You add the beaker to the machine!</span>")
SSnanoui.update_uis(src)
update_icon()
else if(istype(B, /obj/item/storage/pill_bottle))
else if(istype(I, /obj/item/storage/pill_bottle))
if(loaded_pill_bottle)
to_chat(user, "<span class='warning'>A pill bottle is already loaded into the machine.</span>")
to_chat(user, "<span class='warning'>A [loaded_pill_bottle] is already loaded into the machine.</span>")
return
if(!user.drop_item())
to_chat(user, "<span class='warning'>[B] is stuck to you!</span>")
to_chat(user, "<span class='warning'>[I] is stuck to you!</span>")
return
loaded_pill_bottle = B
B.forceMove(src)
to_chat(user, "<span class='notice'>You add the pill bottle into the dispenser slot!</span>")
loaded_pill_bottle = I
I.forceMove(src)
to_chat(user, "<span class='notice'>You add [I] into the dispenser slot!</span>")
SSnanoui.update_uis(src)
return
else
return ..()
/obj/machinery/chem_master/Topic(href, href_list)
if(..())
return 1
return TRUE
add_fingerprint(usr)
usr.set_machine(src)
@@ -103,8 +102,8 @@
return
if(href_list["print_p"])
if(!(printing))
printing = 1
if(!printing)
printing = TRUE
visible_message("<span class='notice'>[src] rattles and prints out a sheet of paper.</span>")
playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, 1)
var/obj/item/paper/P = new /obj/item/paper(loc)
@@ -125,7 +124,7 @@
P.info += "<b>Description:</b> [href_list["desc"]]"
P.info += "<br><br><b>Notes:</b><br>"
P.name = "Chemical Analysis - [href_list["name"]]"
printing = null
printing = FALSE
if(beaker)
var/datum/reagents/R = beaker.reagents
@@ -203,10 +202,13 @@
if(count == null)
return
count = isgoodnumber(count)
if(count > 20) count = 20 //Pevent people from creating huge stacks of pills easily. Maybe move the number to defines?
if(count <= 0) return
var/amount_per_pill = reagents.total_volume/count
if(amount_per_pill > 50) amount_per_pill = 50
if(count > 20)
count = 20 //Pevent people from creating huge stacks of pills easily. Maybe move the number to defines?
if(count <= 0)
return
var/amount_per_pill = reagents.total_volume / count
if(amount_per_pill > 100)
amount_per_pill = 100
var/name = input(usr,"Name:","Name your pill!","[reagents.get_master_reagent_name()] ([amount_per_pill]u)") as text|null
if(!name)
return
@@ -216,18 +218,19 @@
to_chat(usr, "<span class='notice'>Not enough reagents to create these pills!</span>")
return
var/obj/item/reagent_containers/food/pill/P = new/obj/item/reagent_containers/food/pill(loc)
if(!name) name = reagents.get_master_reagent_name()
if(!name)
name = reagents.get_master_reagent_name()
P.name = "[name] pill"
P.pixel_x = rand(-7, 7) //random position
P.pixel_y = rand(-7, 7)
P.icon_state = "pill"+pillsprite
reagents.trans_to(P,amount_per_pill)
if(loaded_pill_bottle)
reagents.trans_to(P, amount_per_pill)
if(loaded_pill_bottle && loaded_pill_bottle.type == /obj/item/storage/pill_bottle)
if(loaded_pill_bottle.contents.len < loaded_pill_bottle.storage_slots)
P.forceMove(loaded_pill_bottle)
updateUsrDialog()
else
var/name = input(usr,"Name:","Name your bag!",reagents.get_master_reagent_name()) as text|null
var/name = input(usr, "Name:", "Name your bag!", reagents.get_master_reagent_name()) as text|null
if(!name)
return
name = reject_bad_text(name)
@@ -236,7 +239,7 @@
P.originalname = name
P.name = "[name] pack"
P.desc = "A small condiment pack. The label says it contains [name]."
reagents.trans_to(P,10)
reagents.trans_to(P, 10)
else if(href_list["createpatch"] || href_list["createpatch_multiple"])
if(!condi)
var/count = 1
@@ -247,10 +250,12 @@
count = isgoodnumber(count)
if(!count || count <= 0)
return
if(count > 20) count = 20 //Pevent people from creating huge stacks of patches easily. Maybe move the number to defines?
if(count > 20)
count = 20 //Pevent people from creating huge stacks of patches easily. Maybe move the number to defines?
var/amount_per_patch = reagents.total_volume/count
if(amount_per_patch > 40) amount_per_patch = 40
var/name = input(usr,"Name:","Name your patch!","[reagents.get_master_reagent_name()] ([amount_per_patch]u)") as text|null
if(amount_per_patch > 40)
amount_per_patch = 40
var/name = input(usr, "Name:", "Name your patch!", "[reagents.get_master_reagent_name()] ([amount_per_patch]u)") as text|null
if(!name)
return
name = reject_bad_text(name)
@@ -263,24 +268,30 @@
P.pixel_y = rand(-7, 7)
reagents.trans_to(P,amount_per_patch)
if(is_medical_patch)
P.instant_application = 1
P.instant_application = TRUE
P.icon_state = "bandaid_med"
if(loaded_pill_bottle && loaded_pill_bottle.type == /obj/item/storage/pill_bottle/patch_pack)
if(loaded_pill_bottle.contents.len < loaded_pill_bottle.storage_slots)
P.forceMove(loaded_pill_bottle)
updateUsrDialog()
else if(href_list["createbottle"])
if(!condi)
var/name = input(usr,"Name:","Name your bottle!",reagents.get_master_reagent_name()) as text|null
var/name = input(usr, "Name:", "Name your bottle!", reagents.get_master_reagent_name()) as text|null
if(!name)
return
name = reject_bad_text(name)
var/obj/item/reagent_containers/glass/bottle/P = new/obj/item/reagent_containers/glass/bottle(loc)
if(!name) name = reagents.get_master_reagent_name()
var/obj/item/reagent_containers/glass/bottle/reagent/P = new/obj/item/reagent_containers/glass/bottle/reagent(loc)
if(!name)
name = reagents.get_master_reagent_name()
P.name = "[name] bottle"
P.pixel_x = rand(-7, 7) //random position
P.pixel_y = rand(-7, 7)
P.icon_state = bottlesprite
reagents.trans_to(P,30)
reagents.trans_to(P, 50)
else
var/obj/item/reagent_containers/food/condiment/P = new/obj/item/reagent_containers/food/condiment(loc)
reagents.trans_to(P,50)
reagents.trans_to(P, 50)
else if(href_list["change_pill"])
#define MAX_PILL_SPRITE 20 //max icon state of the pill sprites
var/dat = "<table>"
@@ -299,7 +310,7 @@
else if(href_list["change_bottle"])
var/dat = "<table>"
var/j = 0
for(var/i in list("bottle", "small_bottle", "wide_bottle", "round_bottle"))
for(var/i in list("bottle", "small_bottle", "wide_bottle", "round_bottle", "reagent_bottle"))
j++
if(j == 1)
dat += "<tr>"
@@ -318,7 +329,6 @@
usr << browse(null, "window=chem_master_iconsel")
SSnanoui.update_uis(src)
return
/obj/machinery/chem_master/attack_ai(mob/user)
return attack_hand(user)
@@ -328,11 +338,10 @@
/obj/machinery/chem_master/attack_hand(mob/user)
if(..())
return 1
return TRUE
ui_interact(user)
return
/obj/machinery/chem_master/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
/obj/machinery/chem_master/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = TRUE)
var/datum/asset/chem_master/assets = get_asset_datum(/datum/asset/chem_master)
assets.send(user)
@@ -380,15 +389,15 @@
return 0
/obj/machinery/chem_master/proc/chemical_safety_check(datum/reagents/R)
var/all_safe = 1
var/all_safe = TRUE
for(var/datum/reagent/A in R.reagent_list)
if(!GLOB.safe_chem_list.Find(A.id))
all_safe = 0
all_safe = FALSE
return all_safe
/obj/machinery/chem_master/condimaster
name = "\improper CondiMaster 3000"
condi = 1
condi = TRUE
/obj/machinery/chem_master/constructable
name = "ChemMaster 2999"
@@ -403,9 +412,9 @@
component_parts += new /obj/item/reagent_containers/glass/beaker(null)
component_parts += new /obj/item/reagent_containers/glass/beaker(null)
/obj/machinery/chem_master/constructable/attackby(obj/item/B, mob/user, params)
/obj/machinery/chem_master/constructable/attackby(obj/item/I, mob/user, params)
if(default_deconstruction_screwdriver(user, "mixer0_nopower", "mixer0", B))
if(default_deconstruction_screwdriver(user, "mixer0_nopower", "mixer0", I))
if(beaker)
beaker.forceMove(get_turf(src))
beaker = null
@@ -415,15 +424,15 @@
loaded_pill_bottle = null
return
if(exchange_parts(user, B))
if(exchange_parts(user, I))
return
if(panel_open)
if(istype(B, /obj/item/crowbar))
default_deconstruction_crowbar(B)
return 1
if(iscrowbar(I))
default_deconstruction_crowbar(I)
return TRUE
else
to_chat(user, "<span class='warning'>You can't use the [name] while it's panel is opened!</span>")
return 1
return TRUE
else
..()
return ..()
@@ -8,7 +8,7 @@
icon_state = null
item_state = "pill"
possible_transfer_amounts = null
volume = 50
volume = 100
consume_sound = null
taste = FALSE
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

+2 -2
View File
@@ -42,7 +42,7 @@
<table>
<tr>
<td>
{{:helper.link('Create pill (50u max)', 'arrow-right', {'createpill': 1})}}
{{:helper.link('Create pill (100u max)', 'arrow-right', {'createpill': 1})}}
</td>
<td>
{{:helper.link('Multiple', 'arrow-right', {'createpill_multiple': 1})}}
@@ -64,7 +64,7 @@
</tr>
<tr>
<td>
{{:helper.link('Create bottle (30u max)', 'arrow-right', {'createbottle': 1})}}
{{:helper.link('Create bottle (50u max)', 'arrow-right', {'createbottle': 1})}}
</td>
<td>
{{:helper.link('Style', 'pencil', {'change_bottle': 1})}}