Adds canned bread (#29654)

* Adds canned bread

* Critical immulsions error

* Readds icon

* put in hands

Co-authored-by: Kurfursten <scouttac@gmail.com>
This commit is contained in:
help-maint
2021-06-29 21:19:14 -03:00
committed by GitHub
parent 55d94b96bd
commit 198d810984
5 changed files with 60 additions and 25 deletions

View File

@@ -14,6 +14,7 @@
/datum/storeitem/menu1, /datum/storeitem/menu1,
/datum/storeitem/menu2, /datum/storeitem/menu2,
/datum/storeitem/diy_soda, /datum/storeitem/diy_soda,
/datum/storeitem/canned_bread,
), ),
"ZAM!" = list( "ZAM!" = list(
/datum/storeitem/zambiscuits, /datum/storeitem/zambiscuits,
@@ -82,7 +83,7 @@
refresh_ui() refresh_ui()
/obj/machinery/computer/merch/proc/refresh_ui() /obj/machinery/computer/merch/proc/refresh_ui(var/mob/user)
var/dat = {"<tbody id="StoreTable">"} var/dat = {"<tbody id="StoreTable">"}
@@ -93,7 +94,7 @@
<th><h2>[category_name]</h2></th> <th><h2>[category_name]</h2></th>
"} "}
for(var/store_item in category_items) for(var/store_item in category_items)
dat += make_div(store_item) dat += make_div(store_item, user)
dat += "</table>" dat += "</table>"
@@ -121,10 +122,12 @@
src.add_hiddenprint(user) src.add_hiddenprint(user)
return attack_hand(user) return attack_hand(user)
/obj/machinery/computer/merch/proc/make_div(var/store_ID) /obj/machinery/computer/merch/proc/make_div(var/store_ID, var/mob/user)
var/datum/storeitem/SI = centcomm_store.items["[store_ID]"] var/datum/storeitem/SI = centcomm_store.items["[store_ID]"]
if(SI.stock == 0) if(SI.stock == 0)
return "<tr><td><i>[SI.name] (SOLD OUT)</i></td></tr>" return "<tr><td><i>[SI.name] (SOLD OUT)</i></td></tr>"
else if(user && !SI.available_to_user(user))
return
else else
. = "<tr><td><A href='?src=\ref[src];choice=buy;chosen_item=[store_ID]'>[SI.name] ([!(SI.cost) ? "free" : "[SI.cost]$"])" . = "<tr><td><A href='?src=\ref[src];choice=buy;chosen_item=[store_ID]'>[SI.name] ([!(SI.cost) ? "free" : "[SI.cost]$"])"
if(SI.stock != -1) if(SI.stock != -1)
@@ -139,7 +142,7 @@
interface.hide(user) interface.hide(user)
return return
refresh_ui() refresh_ui(user)
interact(user) interact(user)
/obj/machinery/computer/merch/interact(mob/user) /obj/machinery/computer/merch/interact(mob/user)
@@ -164,7 +167,7 @@
else else
to_chat(usr, "[bicon(src)]<span class='notice'>Transaction complete! Enjoy your product.</span>") to_chat(usr, "[bicon(src)]<span class='notice'>Transaction complete! Enjoy your product.</span>")
src.refresh_ui() src.refresh_ui(usr)
return return
/obj/machinery/computer/merch/update_icon() /obj/machinery/computer/merch/update_icon()

View File

@@ -218,16 +218,17 @@
/obj/item/weapon/reagent_containers/food/drinks/examine(mob/user) /obj/item/weapon/reagent_containers/food/drinks/examine(mob/user)
..() ..()
if(!reagents || reagents.total_volume == 0) if(is_open_container())
to_chat(user, "<span class='info'>\The [src] is empty!</span>") if(!reagents || reagents.total_volume == 0)
else if (reagents.total_volume <= src.volume/4) to_chat(user, "<span class='info'>\The [src] is empty!</span>")
to_chat(user, "<span class='info'>\The [src] is almost empty!</span>") else if (reagents.total_volume <= src.volume/4)
else if (reagents.total_volume <= src.volume*0.66) to_chat(user, "<span class='info'>\The [src] is almost empty!</span>")
to_chat(user, "<span class='info'>\The [src] is about half full, or about half empty!</span>") else if (reagents.total_volume <= src.volume*0.66)
else if (reagents.total_volume <= src.volume*0.90) to_chat(user, "<span class='info'>\The [src] is about half full, or about half empty!</span>")
to_chat(user, "<span class='info'>\The [src] is almost full!</span>") else if (reagents.total_volume <= src.volume*0.90)
else to_chat(user, "<span class='info'>\The [src] is almost full!</span>")
to_chat(user, "<span class='info'>\The [src] is full!</span>") else
to_chat(user, "<span class='info'>\The [src] is full!</span>")
/obj/item/weapon/reagent_containers/food/drinks/imbibe(mob/user) //Drink the liquid within /obj/item/weapon/reagent_containers/food/drinks/imbibe(mob/user) //Drink the liquid within
if(lit) if(lit)
@@ -673,14 +674,11 @@
//because playsound(user, 'sound/effects/can_open[rand(1,3)].ogg', 50, 1) just wouldn't work. also so badmins can varedit these //because playsound(user, 'sound/effects/can_open[rand(1,3)].ogg', 50, 1) just wouldn't work. also so badmins can varedit these
var/list/open_sounds = list('sound/effects/can_open1.ogg', 'sound/effects/can_open2.ogg', 'sound/effects/can_open3.ogg') var/list/open_sounds = list('sound/effects/can_open1.ogg', 'sound/effects/can_open2.ogg', 'sound/effects/can_open3.ogg')
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/attack_self(var/mob/user) /obj/item/weapon/reagent_containers/food/drinks/soda_cans/attack_self(var/mob/user)
if(!is_open_container()) if(!is_open_container())
to_chat(user, "You pull back the tab of \the [src] with a satisfying pop.") return pop_open(user)
flags |= OPENCONTAINER
src.verbs |= /obj/item/weapon/reagent_containers/verb/empty_contents
playsound(user, pick(open_sounds), 50, 1)
overlays += image(icon = icon, icon_state = "soda_open")
return
if (reagents.total_volume > 0) if (reagents.total_volume > 0)
return ..() return ..()
else if (user.a_intent == I_HURT) else if (user.a_intent == I_HURT)
@@ -692,6 +690,13 @@
playsound(user, 'sound/items/can_crushed.ogg', 75, 1) playsound(user, 'sound/items/can_crushed.ogg', 75, 1)
qdel(src) qdel(src)
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/proc/pop_open(var/mob/user)
to_chat(user, "You pull back the tab of \the [src] with a satisfying pop.")
flags |= OPENCONTAINER
src.verbs |= /obj/item/weapon/reagent_containers/verb/empty_contents
playsound(user, pick(open_sounds), 50, 1)
overlays += image(icon = icon, icon_state = "soda_open")
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/cola /obj/item/weapon/reagent_containers/food/drinks/soda_cans/cola
name = "Space Cola" name = "Space Cola"
desc = "Cola. in space." desc = "Cola. in space."
@@ -839,6 +844,19 @@
reagents.add_reagent(URANIUM, 3.6) reagents.add_reagent(URANIUM, 3.6)
reagents.add_reagent(SPORTDRINK, 20) reagents.add_reagent(SPORTDRINK, 20)
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/canned_bread
name = "\improper canned bread"
desc = "Wow, they have it!"
icon_state = "cannedbread"
//no actual chemicals in the can
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/canned_bread/pop_open(var/mob/user)
. = ..()
spawn(0.5 SECONDS)
playsound(src, pick('sound/effects/splat_pie1.ogg','sound/effects/splat_pie2.ogg'), 50)
var/obj/B = new /obj/item/weapon/reagent_containers/food/snacks/sliceable/bread(get_turf(src))
user.put_in_hands(B)
/obj/item/weapon/reagent_containers/food/drinks/coloring /obj/item/weapon/reagent_containers/food/drinks/coloring
name = "\improper vial of food coloring" name = "\improper vial of food coloring"
icon = 'icons/obj/chemical.dmi' icon = 'icons/obj/chemical.dmi'

View File

@@ -22,6 +22,9 @@
else else
new typepath(merchcomp.loc) new typepath(merchcomp.loc)
//If this returns FALSE, then the button simply will not appear for the user in question.
/datum/storeitem/proc/available_to_user(var/mob/user,var/obj/machinery/computer/merch/merchcomp)
return TRUE
///////////////////////////// /////////////////////////////
// Food // Food
@@ -44,6 +47,14 @@
typepath = /obj/item/weapon/storage/box/diy_soda typepath = /obj/item/weapon/storage/box/diy_soda
cost = 45 cost = 45
/datum/storeitem/canned_bread
name = "Canned Bread"
desc = "Best thing since sliced."
typepath = /obj/item/weapon/reagent_containers/food/drinks/soda_cans/canned_bread
cost = 15
/datum/storeitem/canned_bread/available_to_user(var/mob/user,var/obj/machinery/computer/merch/merchcomp)
return(isskrell(user) || Holiday == APRIL_FOOLS_DAY)
///////////////////////////// /////////////////////////////
// Tools // Tools
///////////////////////////// /////////////////////////////

View File

@@ -50,17 +50,20 @@ var/global/datum/store/centcomm_store=new
linked_db = DB linked_db = DB
break break
/datum/store/proc/PlaceOrder(var/mob/living/usr, var/itemID, var/obj/machinery/computer/merch/merchcomp) /datum/store/proc/PlaceOrder(var/mob/living/user, var/itemID, var/obj/machinery/computer/merch/merchcomp)
// Get our item, first. // Get our item, first.
var/datum/storeitem/item = items["[itemID]"] var/datum/storeitem/item = items["[itemID]"]
if(item.stock == 0) if(item.stock == 0)
to_chat(usr, "<span class='warning'>That item is sold out.</span>") to_chat(user, "<span class='warning'>That item is sold out.</span>")
return
if(!item.available_to_user(user, merchcomp))
to_chat(user, "<span class='warning'>That item is not available to you.</span>")
return return
// Try to deduct funds. // Try to deduct funds.
if(!charge(usr,item.cost,item,merchcomp)) if(!charge(user,item.cost,item,merchcomp))
return 0 return 0
// Give them the item. // Give them the item.
item.deliver(usr,merchcomp) item.deliver(user,merchcomp)
if(item.stock != -1) if(item.stock != -1)
item.stock-- item.stock--
return 1 return 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 109 KiB